Skip to content

Commit 978da0d

Browse files
authored
Merge pull request #337 from DannyBen/add/configurable-config-path
Allow configuring the path to bashly.yml
2 parents 4f9c9c6 + facd6ce commit 978da0d

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

lib/bashly/commands/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Base < MisterBin::Command
77
include AssetHelper
88

99
def config
10-
@config ||= Config.new "#{Settings.source_dir}/bashly.yml"
10+
@config ||= Config.new Settings.config_path
1111
end
1212

1313
def config_validator

lib/bashly/libraries/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def command
2222
end
2323

2424
def config
25-
@config ||= Config.new "#{Settings.source_dir}/bashly.yml"
25+
@config ||= Config.new Settings.config_path
2626
end
2727
end
2828
end

lib/bashly/settings.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,26 @@ class Settings
33
class << self
44
include AssetHelper
55

6-
attr_writer :compact_short_flags, :lib_dir, :partials_extension,
7-
:source_dir, :strict, :tab_indent, :target_dir, :usage_colors
6+
attr_writer(
7+
:compact_short_flags,
8+
:config_path,
9+
:lib_dir,
10+
:partials_extension,
11+
:source_dir,
12+
:strict,
13+
:tab_indent,
14+
:target_dir,
15+
:usage_colors,
16+
)
817

918
def compact_short_flags
1019
@compact_short_flags ||= get :compact_short_flags
1120
end
1221

22+
def config_path
23+
@config_path ||= get(:config_path) % { source_dir: source_dir }
24+
end
25+
1326
def env
1427
@env ||= get(:env)&.to_sym
1528
end

lib/bashly/templates/settings.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
# - "0", "false" or "no" to represent false
77
# - "1", "true" or "yes" to represent true
88

9-
# The path containing the bashly configuration and source files
9+
# The path containing the bashly source files
1010
source_dir: src
1111

12+
# Tha path to bashly.yml
13+
config_path: "%{source_dir}/bashly.yml"
14+
1215
# The path to use for creating the bash script
1316
target_dir: .
1417

0 commit comments

Comments
 (0)