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



31
32
33
# File 'lib/bashly/settings.rb', line 31

def commands_dir
  @commands_dir ||= get :commands_dir
end

.compact_short_flagsObject



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

def compact_short_flags
  @compact_short_flags ||= get :compact_short_flags
end

.config_pathObject



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

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

.conjoined_flag_argsObject



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

def conjoined_flag_args
  @conjoined_flag_args ||= get :conjoined_flag_args
end

.enable_bash3_bouncerObject



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

def enable_bash3_bouncer
  @enable_bash3_bouncer ||= get :enable_bash3_bouncer
end

.enable_deps_arrayObject



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

def enable_deps_array
  @enable_deps_array ||= get :enable_deps_array
end

.enable_env_var_names_arrayObject



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

def enable_env_var_names_array
  @enable_env_var_names_array ||= get :enable_env_var_names_array
end

.enable_header_commentObject



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

def enable_header_comment
  @enable_header_comment ||= get :enable_header_comment
end

.enable_inspect_argsObject



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

def enable_inspect_args
  @enable_inspect_args ||= get :enable_inspect_args
end

.enable_sourcingObject



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

def enable_sourcing
  @enable_sourcing ||= get :enable_sourcing
end

.enable_view_markersObject



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

def enable_view_markers
  @enable_view_markers ||= get :enable_view_markers
end

.function_namesObject



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

def function_names
  @function_names ||= get :function_names
end

.lib_dirObject



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

def lib_dir
  @lib_dir ||= get :lib_dir
end

.partials_extensionObject



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

def partials_extension
  @partials_extension ||= get :partials_extension
end

.private_reveal_keyObject



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

def private_reveal_key
  @private_reveal_key ||= get :private_reveal_key
end

.show_examples_on_errorObject



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

def show_examples_on_error
  @show_examples_on_error ||= get :show_examples_on_error
end

.source_dirObject



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

def source_dir
  @source_dir ||= get :source_dir
end

.strictObject



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

def strict
  @strict ||= get :strict
end

.tab_indentObject



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

def tab_indent
  @tab_indent ||= get :tab_indent
end

.target_dirObject



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

def target_dir
  @target_dir ||= get :target_dir
end

.usage_colorsObject



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

def usage_colors
  @usage_colors ||= get :usage_colors
end

.var_aliasesObject



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

def var_aliases
  @var_aliases ||= get :var_aliases
end

Class Method Details

.enabled?(feature) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.envObject



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

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

.env=(value) ⇒ Object



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

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

.full_lib_dirObject



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

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

.function_name(key) ⇒ Object



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

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

.production?Boolean

Returns:

  • (Boolean)


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

def production?
  env == :production
end

.strict_stringObject



129
130
131
132
133
134
135
136
137
# File 'lib/bashly/settings.rb', line 129

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