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 1
1
module Bashly
2
2
module Commands
3
3
class Generate < Base
4
- using ComposeRefinements
5
-
6
4
help "Generate the bash script and required files"
7
5
8
6
usage "bashly generate [--force --quiet --upgrade --wrap FUNCTION]"
@@ -118,7 +116,7 @@ def master_script_path
118
116
end
119
117
120
118
def config
121
- @config ||= Config . new ( "#{ Settings . source_dir } /bashly.yml" ) . compose
119
+ @config ||= Config . new "#{ Settings . source_dir } /bashly.yml"
122
120
end
123
121
124
122
def command
Original file line number Diff line number Diff line change @@ -4,11 +4,13 @@ module Bashly
4
4
# A convenience class to use either a hash or a filename as a configuration
5
5
# source
6
6
class Config
7
+ using ComposeRefinements
8
+
7
9
attr_reader :config
8
10
9
11
def self . new ( config )
10
12
if config . is_a? String
11
- YAML . load_file config
13
+ YAML . load_file ( config ) . compose
12
14
else
13
15
config
14
16
end
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ def command
7
7
end
8
8
9
9
def config
10
- @config ||= Bashly :: Config . new "#{ Settings . source_dir } /bashly.yml"
10
+ @config ||= Config . new "#{ Settings . source_dir } /bashly.yml"
11
11
end
12
12
end
13
13
end
Original file line number Diff line number Diff line change 18
18
19
19
context "with a string argument" do
20
20
let ( :config ) { "spec/fixtures/config.yml" }
21
+
21
22
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
23
32
end
24
33
end
25
34
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