Class: Bashly::Settings

Inherits:
Object
  • Object
show all
Extended by:
AssetHelper
Defined in:
lib/bashly/settings.rb

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from AssetHelper

asset, asset_content

Class Attribute Details

.argfile_varObject



41
42
43
# File 'lib/bashly/settings.rb', line 41

def argfile_var
  @argfile_var ||= get :argfile_var
end

.commands_dirObject



45
46
47
# File 'lib/bashly/settings.rb', line 45

def commands_dir
  @commands_dir ||= get :commands_dir
end

.compact_short_flagsObject



49
50
51
# File 'lib/bashly/settings.rb', line 49

def compact_short_flags
  @compact_short_flags ||= get :compact_short_flags
end

.config_pathObject



57
58
59
# File 'lib/bashly/settings.rb', line 57

def config_path
  @config_path ||= get(:config_path) % { source_dir: source_dir }
end

.conjoined_flag_argsObject



53
54
55
# File 'lib/bashly/settings.rb', line 53

def conjoined_flag_args
  @conjoined_flag_args ||= get :conjoined_flag_args
end

.enable_bash3_bouncerObject



67
68
69
# File 'lib/bashly/settings.rb', line 67

def enable_bash3_bouncer
  @enable_bash3_bouncer ||= get :enable_bash3_bouncer
end

.enable_deps_arrayObject



71
72
73
# File 'lib/bashly/settings.rb', line 71

def enable_deps_array
  @enable_deps_array ||= get :enable_deps_array
end

.enable_env_var_names_arrayObject



75
76
77
# File 'lib/bashly/settings.rb', line 75

def enable_env_var_names_array
  @enable_env_var_names_array ||= get :enable_env_var_names_array
end

.enable_header_commentObject



79
80
81
# File 'lib/bashly/settings.rb', line 79

def enable_header_comment
  @enable_header_comment ||= get :enable_header_comment
end

.enable_inspect_argsObject



83
84
85
# File 'lib/bashly/settings.rb', line 83

def enable_inspect_args
  @enable_inspect_args ||= get :enable_inspect_args
end

.enable_sourcingObject



87
88
89
# File 'lib/bashly/settings.rb', line 87

def enable_sourcing
  @enable_sourcing ||= get :enable_sourcing
end

.enable_view_markersObject



91
92
93
# File 'lib/bashly/settings.rb', line 91

def enable_view_markers
  @enable_view_markers ||= get :enable_view_markers
end

.extra_lib_dirsObject



103
104
105
106
107
108
109
110
111
112
# File 'lib/bashly/settings.rb', line 103

def extra_lib_dirs
  @extra_lib_dirs ||= begin
    dirs = get :extra_lib_dirs
    case dirs
    when Array then dirs
    when String then dirs.split(',').map(&:strip)
    else []
    end
  end
end

.formatterObject



114
115
116
# File 'lib/bashly/settings.rb', line 114

def formatter
  @formatter ||= get :formatter
end

.function_namesObject



126
127
128
# File 'lib/bashly/settings.rb', line 126

def function_names
  @function_names ||= get :function_names
end

.lib_dirObject



130
131
132
# File 'lib/bashly/settings.rb', line 130

def lib_dir
  @lib_dir ||= get :lib_dir
end

.partials_extensionObject



134
135
136
# File 'lib/bashly/settings.rb', line 134

def partials_extension
  @partials_extension ||= get :partials_extension
end

.private_reveal_keyObject



138
139
140
# File 'lib/bashly/settings.rb', line 138

def private_reveal_key
  @private_reveal_key ||= get :private_reveal_key
end

.show_examples_on_errorObject



146
147
148
# File 'lib/bashly/settings.rb', line 146

def show_examples_on_error
  @show_examples_on_error ||= get :show_examples_on_error
end

.source_dirObject



150
151
152
# File 'lib/bashly/settings.rb', line 150

def source_dir
  @source_dir ||= get :source_dir
end

.strictObject



154
155
156
# File 'lib/bashly/settings.rb', line 154

def strict
  @strict ||= get :strict
end

.tab_indentObject



168
169
170
# File 'lib/bashly/settings.rb', line 168

def tab_indent
  @tab_indent ||= get :tab_indent
end

.target_dirObject



172
173
174
# File 'lib/bashly/settings.rb', line 172

def target_dir
  @target_dir ||= get :target_dir
end

.usage_colorsObject



176
177
178
# File 'lib/bashly/settings.rb', line 176

def usage_colors
  @usage_colors ||= get :usage_colors
end

.var_aliasesObject



180
181
182
# File 'lib/bashly/settings.rb', line 180

def var_aliases
  @var_aliases ||= get :var_aliases
end

.watch_eventedObject



184
185
186
# File 'lib/bashly/settings.rb', line 184

def watch_evented
  @watch_evented ||= get :watch_evented
end

.watch_latencyObject



188
189
190
# File 'lib/bashly/settings.rb', line 188

def watch_latency
  @watch_latency ||= get :watch_latency
end

.word_wrapObject



192
193
194
# File 'lib/bashly/settings.rb', line 192

def word_wrap
  @word_wrap ||= get :word_wrap
end

Class Method Details

.all_lib_dirsObject



37
38
39
# File 'lib/bashly/settings.rb', line 37

def all_lib_dirs
  @all_lib_dirs = [full_lib_dir] + extra_lib_dirs
end

.enabled?(feature) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
64
65
# File 'lib/bashly/settings.rb', line 61

def enabled?(feature)
  send(:"enable_#{feature}") == 'always' ||
    (send(:"enable_#{feature}") == 'production' && production?) ||
    (send(:"enable_#{feature}") == 'development' && !production?)
end

.envObject



95
96
97
# File 'lib/bashly/settings.rb', line 95

def env
  @env ||= get(:env)&.to_sym
end

.env=(value) ⇒ Object



99
100
101
# File 'lib/bashly/settings.rb', line 99

def env=(value)
  @env = value&.to_sym
end

.full_lib_dirObject



118
119
120
# File 'lib/bashly/settings.rb', line 118

def full_lib_dir
  "#{source_dir}/#{lib_dir}"
end

.function_name(key) ⇒ Object



122
123
124
# File 'lib/bashly/settings.rb', line 122

def function_name(key)
  function_names[key.to_s] || key.to_s
end

.production?Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/bashly/settings.rb', line 142

def production?
  env == :production
end

.strict_stringObject



158
159
160
161
162
163
164
165
166
# File 'lib/bashly/settings.rb', line 158

def strict_string
  if strict.is_a? String
    strict
  elsif strict
    'set -euo pipefail'
  else
    'set -e'
  end
end