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



29
30
31
# File 'lib/bashly/settings.rb', line 29

def commands_dir
  @commands_dir ||= get :commands_dir
end

.compact_short_flagsObject



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

def compact_short_flags
  @compact_short_flags ||= get :compact_short_flags
end

.config_pathObject



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

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

.conjoined_flag_argsObject



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

def conjoined_flag_args
  @conjoined_flag_args ||= get :conjoined_flag_args
end

.enable_bash3_bouncerObject



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

def enable_bash3_bouncer
  @enable_bash3_bouncer ||= get :enable_bash3_bouncer
end

.enable_deps_arrayObject



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

def enable_deps_array
  @enable_deps_array ||= get :enable_deps_array
end

.enable_env_var_names_arrayObject



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

def enable_env_var_names_array
  @enable_env_var_names_array ||= get :enable_env_var_names_array
end

.enable_header_commentObject



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

def enable_header_comment
  @enable_header_comment ||= get :enable_header_comment
end

.enable_inspect_argsObject



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

def enable_inspect_args
  @enable_inspect_args ||= get :enable_inspect_args
end

.enable_view_markersObject



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

def enable_view_markers
  @enable_view_markers ||= get :enable_view_markers
end

.lib_dirObject



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

def lib_dir
  @lib_dir ||= get :lib_dir
end

.partials_extensionObject



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

def partials_extension
  @partials_extension ||= get :partials_extension
end

.private_reveal_keyObject



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

def private_reveal_key
  @private_reveal_key ||= get :private_reveal_key
end

.show_examples_on_errorObject



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

def show_examples_on_error
  @show_examples_on_error ||= get :show_examples_on_error
end

.source_dirObject



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

def source_dir
  @source_dir ||= get :source_dir
end

.strictObject



111
112
113
# File 'lib/bashly/settings.rb', line 111

def strict
  @strict ||= get :strict
end

.tab_indentObject



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

def tab_indent
  @tab_indent ||= get :tab_indent
end

.target_dirObject



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

def target_dir
  @target_dir ||= get :target_dir
end

.usage_colorsObject



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

def usage_colors
  @usage_colors ||= get :usage_colors
end

.var_aliasesObject



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

def var_aliases
  @var_aliases ||= get :var_aliases
end

Class Method Details

.enabled?(feature) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.envObject



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

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

.env=(value) ⇒ Object



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

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

.full_lib_dirObject



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

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

.production?Boolean

Returns:

  • (Boolean)


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

def production?
  env == :production
end

.strict_stringObject



115
116
117
118
119
120
121
122
123
# File 'lib/bashly/settings.rb', line 115

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