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

.commands_dirObject



34
35
36
# File 'lib/bashly/settings.rb', line 34

def commands_dir
  @commands_dir ||= get :commands_dir
end

.compact_short_flagsObject



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

def compact_short_flags
  @compact_short_flags ||= get :compact_short_flags
end

.config_pathObject



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

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

.conjoined_flag_argsObject



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

def conjoined_flag_args
  @conjoined_flag_args ||= get :conjoined_flag_args
end

.enable_bash3_bouncerObject



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

def enable_bash3_bouncer
  @enable_bash3_bouncer ||= get :enable_bash3_bouncer
end

.enable_deps_arrayObject



60
61
62
# File 'lib/bashly/settings.rb', line 60

def enable_deps_array
  @enable_deps_array ||= get :enable_deps_array
end

.enable_env_var_names_arrayObject



64
65
66
# File 'lib/bashly/settings.rb', line 64

def enable_env_var_names_array
  @enable_env_var_names_array ||= get :enable_env_var_names_array
end

.enable_header_commentObject



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

def enable_header_comment
  @enable_header_comment ||= get :enable_header_comment
end

.enable_inspect_argsObject



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

def enable_inspect_args
  @enable_inspect_args ||= get :enable_inspect_args
end

.enable_sourcingObject



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

def enable_sourcing
  @enable_sourcing ||= get :enable_sourcing
end

.enable_view_markersObject



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

def enable_view_markers
  @enable_view_markers ||= get :enable_view_markers
end

.extra_lib_dirsObject



112
113
114
115
116
117
118
119
120
121
# File 'lib/bashly/settings.rb', line 112

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



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

def formatter
  @formatter ||= get :formatter
end

.function_namesObject



104
105
106
# File 'lib/bashly/settings.rb', line 104

def function_names
  @function_names ||= get :function_names
end

.lib_dirObject



108
109
110
# File 'lib/bashly/settings.rb', line 108

def lib_dir
  @lib_dir ||= get :lib_dir
end

.partials_extensionObject



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

def partials_extension
  @partials_extension ||= get :partials_extension
end

.private_reveal_keyObject



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

def private_reveal_key
  @private_reveal_key ||= get :private_reveal_key
end

.show_examples_on_errorObject



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

def show_examples_on_error
  @show_examples_on_error ||= get :show_examples_on_error
end

.source_dirObject



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

def source_dir
  @source_dir ||= get :source_dir
end

.strictObject



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

def strict
  @strict ||= get :strict
end

.tab_indentObject



161
162
163
# File 'lib/bashly/settings.rb', line 161

def tab_indent
  @tab_indent ||= get :tab_indent
end

.target_dirObject



165
166
167
# File 'lib/bashly/settings.rb', line 165

def target_dir
  @target_dir ||= get :target_dir
end

.usage_colorsObject



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

def usage_colors
  @usage_colors ||= get :usage_colors
end

.var_aliasesObject



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

def var_aliases
  @var_aliases ||= get :var_aliases
end

.word_wrapObject



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

def word_wrap
  @word_wrap ||= get :word_wrap
end

Class Method Details

.all_lib_dirsObject



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

def all_lib_dirs
  @all_lib_dirs = [full_lib_dir] + extra_lib_dirs
end

.enabled?(feature) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
54
# File 'lib/bashly/settings.rb', line 50

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

.envObject



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

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

.env=(value) ⇒ Object



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

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

.full_lib_dirObject



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

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

.function_name(key) ⇒ Object



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

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

.production?Boolean

Returns:

  • (Boolean)


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

def production?
  env == :production
end

.strict_stringObject



151
152
153
154
155
156
157
158
159
# File 'lib/bashly/settings.rb', line 151

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