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



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

def commands_dir
  @commands_dir ||= get :commands_dir
end

.compact_short_flagsObject



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

def compact_short_flags
  @compact_short_flags ||= get :compact_short_flags
end

.config_pathObject



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

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

.conjoined_flag_argsObject



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

def conjoined_flag_args
  @conjoined_flag_args ||= get :conjoined_flag_args
end

.enable_bash3_bouncerObject



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

def enable_bash3_bouncer
  @enable_bash3_bouncer ||= get :enable_bash3_bouncer
end

.enable_deps_arrayObject



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

def enable_deps_array
  @enable_deps_array ||= get :enable_deps_array
end

.enable_env_var_names_arrayObject



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

def enable_env_var_names_array
  @enable_env_var_names_array ||= get :enable_env_var_names_array
end

.enable_header_commentObject



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

def enable_header_comment
  @enable_header_comment ||= get :enable_header_comment
end

.enable_inspect_argsObject



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

def enable_inspect_args
  @enable_inspect_args ||= get :enable_inspect_args
end

.enable_sourcingObject



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

def enable_sourcing
  @enable_sourcing ||= get :enable_sourcing
end

.enable_view_markersObject



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

def enable_view_markers
  @enable_view_markers ||= get :enable_view_markers
end

.lib_dirObject



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

def lib_dir
  @lib_dir ||= get :lib_dir
end

.partials_extensionObject



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

def partials_extension
  @partials_extension ||= get :partials_extension
end

.private_reveal_keyObject



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

def private_reveal_key
  @private_reveal_key ||= get :private_reveal_key
end

.show_examples_on_errorObject



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

def show_examples_on_error
  @show_examples_on_error ||= get :show_examples_on_error
end

.source_dirObject



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

def source_dir
  @source_dir ||= get :source_dir
end

.strictObject



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

def strict
  @strict ||= get :strict
end

.tab_indentObject



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

def tab_indent
  @tab_indent ||= get :tab_indent
end

.target_dirObject



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

def target_dir
  @target_dir ||= get :target_dir
end

.usage_colorsObject



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

def usage_colors
  @usage_colors ||= get :usage_colors
end

.var_aliasesObject



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

def var_aliases
  @var_aliases ||= get :var_aliases
end

Class Method Details

.enabled?(feature) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.envObject



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

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

.env=(value) ⇒ Object



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

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

.full_lib_dirObject



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

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

.production?Boolean

Returns:

  • (Boolean)


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

def production?
  env == :production
end

.strict_stringObject



120
121
122
123
124
125
126
127
128
# File 'lib/bashly/settings.rb', line 120

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