bashly 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bashly/settings.rb +36 -10
- data/lib/bashly/templates/settings.yml +8 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/normalize_input.gtx +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d91ebd35f74173621d545d29ff7ea404341638c7b06aa0610cb1ab10dfba93a
|
4
|
+
data.tar.gz: 81b1516fd118e2f985d5fd6b88cfa07db8f3b01eb91895d069587de26586bb1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f366a6add6ae9c750f07c219393f613dc381e7ade0f18e94fef716364fbcecdbcac7cb8f5cdaf2101ea2c2f0040dab72303e740d87508750f627b71e4dbca39f
|
7
|
+
data.tar.gz: 3327229305d123a6ea878846035fb4fbb0e33a6d7f6fd81ee3e203b1c89cd29d36cc36822908c31faa5fa97edba98a69db941fece386849aeafbdfef4cdea978
|
data/lib/bashly/settings.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
module Bashly
|
2
2
|
class Settings
|
3
3
|
class << self
|
4
|
-
|
4
|
+
include AssetHelper
|
5
|
+
|
6
|
+
attr_writer :compact_short_flags, :source_dir, :target_dir,
|
7
|
+
:lib_dir, :strict, :tab_indent
|
5
8
|
|
6
9
|
def source_dir
|
7
|
-
@source_dir ||= get :source_dir
|
10
|
+
@source_dir ||= get :source_dir
|
8
11
|
end
|
9
12
|
|
10
13
|
def target_dir
|
11
|
-
@target_dir ||= get :target_dir
|
14
|
+
@target_dir ||= get :target_dir
|
12
15
|
end
|
13
16
|
|
14
17
|
def lib_dir
|
15
|
-
@lib_dir ||= get :lib_dir
|
18
|
+
@lib_dir ||= get :lib_dir
|
16
19
|
end
|
17
20
|
|
18
21
|
def strict
|
@@ -23,8 +26,12 @@ module Bashly
|
|
23
26
|
@tab_indent ||= get :tab_indent
|
24
27
|
end
|
25
28
|
|
29
|
+
def compact_short_flags
|
30
|
+
@compact_short_flags ||= get :compact_short_flags
|
31
|
+
end
|
32
|
+
|
26
33
|
def env
|
27
|
-
@env ||= get(:env
|
34
|
+
@env ||= get(:env)&.to_sym
|
28
35
|
end
|
29
36
|
|
30
37
|
def env=(value)
|
@@ -41,14 +48,33 @@ module Bashly
|
|
41
48
|
|
42
49
|
private
|
43
50
|
|
44
|
-
def get(key
|
45
|
-
|
51
|
+
def get(key)
|
52
|
+
case env_value key
|
53
|
+
when nil then config[key.to_s]
|
54
|
+
when "0", "false", "no" then false
|
55
|
+
when "1", "true", "yes" then true
|
56
|
+
else env_value key
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def env_value(key)
|
61
|
+
ENV["BASHLY_#{key.upcase}"]
|
62
|
+
end
|
63
|
+
|
64
|
+
def config
|
65
|
+
@config ||= defsult_settings.merge user_settings
|
46
66
|
end
|
47
67
|
|
48
68
|
def user_settings
|
49
|
-
@user_settings ||=
|
50
|
-
|
51
|
-
|
69
|
+
@user_settings ||= File.exist?('settings.yml') ? Config.new('settings.yml') : {}
|
70
|
+
end
|
71
|
+
|
72
|
+
def defsult_settings
|
73
|
+
@defsult_settings ||= Config.new(default_settings_path)
|
74
|
+
end
|
75
|
+
|
76
|
+
def default_settings_path
|
77
|
+
asset "templates/settings.yml"
|
52
78
|
end
|
53
79
|
|
54
80
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
# All settings are optional (with their default values provided below), and
|
2
2
|
# can also be set with an environment variable with the same name, capitalized
|
3
3
|
# and prefixed by `BASHLY_` - for example: BASHLY_SOURCE_DIR
|
4
|
+
#
|
5
|
+
# When setting environment variables, you can use:
|
6
|
+
# - "0", "false" or "no" to represent false
|
7
|
+
# - "1", "true" or "yes" to represent true
|
4
8
|
|
5
9
|
# The path containing the bashly configuration and source files
|
6
10
|
source_dir: src
|
@@ -18,6 +22,10 @@ strict: false
|
|
18
22
|
# (every 2 leading spaces will be converted to a tab character)
|
19
23
|
tab_indent: false
|
20
24
|
|
25
|
+
# When true, the generated script will consider any argument in the form of
|
26
|
+
# `-abc` as if it is `-a -b -c`.
|
27
|
+
compact_short_flags: true
|
28
|
+
|
21
29
|
# Set to 'production' or 'development':
|
22
30
|
# - production generate a smaller script, without file markers
|
23
31
|
# - development generate with file markers
|
data/lib/bashly/version.rb
CHANGED
@@ -11,11 +11,15 @@
|
|
11
11
|
> elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
|
12
12
|
> input+=("${BASH_REMATCH[1]}")
|
13
13
|
> input+=("${BASH_REMATCH[2]}")
|
14
|
+
|
15
|
+
if Settings.compact_short_flags
|
14
16
|
> elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
15
17
|
> flags="${BASH_REMATCH[1]}"
|
16
18
|
> for (( i=0 ; i < ${#flags} ; i++ )); do
|
17
19
|
> input+=("-${flags:i:1}")
|
18
20
|
> done
|
21
|
+
end
|
22
|
+
|
19
23
|
> else
|
20
24
|
> input+=("$arg")
|
21
25
|
> fi
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bashly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: completely
|