File tree Expand file tree Collapse file tree 5 files changed +18
-6
lines changed Expand file tree Collapse file tree 5 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 11module Bashly
22 module Commands
33 class Generate < Base
4- using ComposeRefinements
5-
64 help "Generate the bash script and required files"
75
86 usage "bashly generate [--force --quiet --upgrade --wrap FUNCTION]"
@@ -118,7 +116,7 @@ def master_script_path
118116 end
119117
120118 def config
121- @config ||= Config . new ( "#{ Settings . source_dir } /bashly.yml" ) . compose
119+ @config ||= Config . new "#{ Settings . source_dir } /bashly.yml"
122120 end
123121
124122 def command
Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ module Bashly
44 # A convenience class to use either a hash or a filename as a configuration
55 # source
66 class Config
7+ using ComposeRefinements
8+
79 attr_reader :config
810
911 def self . new ( config )
1012 if config . is_a? String
11- YAML . load_file config
13+ YAML . load_file ( config ) . compose
1214 else
1315 config
1416 end
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ def command
77 end
88
99 def config
10- @config ||= Bashly :: Config . new "#{ Settings . source_dir } /bashly.yml"
10+ @config ||= Config . new "#{ Settings . source_dir } /bashly.yml"
1111 end
1212 end
1313 end
Original file line number Diff line number Diff line change 1818
1919 context "with a string argument" do
2020 let ( :config ) { "spec/fixtures/config.yml" }
21+
2122 it "treats the string as a path to YAML and loads it" do
22- expect ( subject [ "loaded" ] ) . to eq "yes indeed"
23+ expect ( subject [ "loaded" ] ) . to eq "yes indeed"
24+ end
25+
26+ context "when the loaded YAML contains import directives" do
27+ let ( :config ) { "spec/fixtures/import.yml" }
28+
29+ it "evaluates them" do
30+ expect ( subject [ "commands" ] . first [ 'loaded' ] ) . to eq "yes indeed"
31+ end
2332 end
2433 end
2534
Original file line number Diff line number Diff line change 1+ commands :
2+ - import : spec/fixtures/config.yml
3+
You can’t perform that action at this time.
0 commit comments