-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If the `.tomo/config.rb` file declares a setup or deploy task with `privileged: true` and the file starts with the special `# frozen_string_literal: true` comment, tomo crashes with the following error message: ``` TypeError: can't define singleton lib/tomo/configuration/dsl/tasks_block.rb:17:in `extend_object' lib/tomo/configuration/dsl/tasks_block.rb:17:in `extend' lib/tomo/configuration/dsl/tasks_block.rb:17:in `run' ``` This is because tomo is trying to call `.extend` on a frozen string. Fix by creating a mutable copy of task names before extending them.
- Loading branch information
1 parent
dfb0ebb
commit 129dfad
Showing
5 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require "test_helper" | ||
|
||
class Tomo::ConfigurationTest < Minitest::Test | ||
include Tomo::Testing::Local | ||
|
||
def test_parses_a_config_file_that_contains_frozen_string_literals | ||
in_temp_dir do | ||
FileUtils.mkdir ".tomo" | ||
File.write(".tomo/config.rb", <<~CONFIG) | ||
# frozen_string_literal: true | ||
setup do | ||
run "nginx:setup", privileged: true | ||
end | ||
CONFIG | ||
|
||
parsed = Tomo::Configuration.from_config_rb | ||
|
||
assert_instance_of(Tomo::Configuration, parsed) | ||
end | ||
end | ||
end |