Skip to content

Commit 102f8af

Browse files
committed
add Settings.strict to match BASHLY_STRICT
1 parent 4da5054 commit 102f8af

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lib/bashly/settings.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Bashly
22
class Settings
33
class << self
4-
attr_writer :source_dir, :target_dir
4+
attr_writer :source_dir, :target_dir, :strict
55

66
def source_dir
77
@source_dir ||= ENV['BASHLY_SOURCE_DIR'] || 'src'
@@ -10,6 +10,10 @@ def source_dir
1010
def target_dir
1111
@target_dir ||= ENV['BASHLY_TARGET_DIR'] || '.'
1212
end
13+
14+
def strict
15+
@strict ||= ENV['BASHLY_STRICT'] || '.'
16+
end
1317
end
1418
end
1519
end

lib/bashly/views/command/initialize.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
initialize() {
33
version="<%= version %>"
44
long_usage=''
5-
<%= ENV['BASHLY_STRICT'] ? "set -euo pipefail" : "set -e" %>
5+
<%= Settings.strict ? "set -euo pipefail" : "set -e" %>
66

77
<%= load_user_file("initialize.sh", placeholder: false).indent 2 %>
88
}

spec/spec_helper.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
# Set up working directory for the specs
1515
Settings.source_dir = 'spec/tmp/src'
1616
Settings.target_dir = 'spec/tmp'
17+
Settings.strict = '1' # generate scripts with `set -euo pipefile`
1718
reset_tmp_dir
1819

1920
# Consistent Colsole output (for rspec_fixtures)
2021
ENV['TTY'] = 'off'
2122
ENV['COLUMNS'] = '80'
2223
ENV['LINES'] = '30'
2324

24-
# Force generated scripts to strict mode (set -euo pipefile)
25-
ENV['BASHLY_STRICT'] = '1'
2625

2726
RSpec.configure do |c|
2827
c.include SpecMixin

0 commit comments

Comments
 (0)