bashly 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -6
- data/lib/bashly/config.rb +6 -2
- data/lib/bashly/extensions/string.rb +4 -0
- data/lib/bashly/extensions/yaml.rb +9 -7
- data/lib/bashly/libraries/settings/settings.yml +7 -1
- data/lib/bashly/library_source.rb +1 -1
- data/lib/bashly/message_strings.rb +2 -2
- data/lib/bashly/refinements/compose_refinements.rb +1 -1
- data/lib/bashly/script/command.rb +15 -3
- data/lib/bashly/settings.rb +5 -0
- data/lib/bashly/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a333ce419f5ba64e38000497f245fc5baf822243cd2765c1805ebdf6de2e3b46
|
4
|
+
data.tar.gz: 0c9ab24cc2cecd88cbd20a06ab11028740ce3000aec75080ca9a12c6769110c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff95fd919a29a16d610d8f3c069f2de17b9984a41251de56e484a5dc49e86dd4114934c47ccb2274521f7f8bd5078287a54ef10478c5e18b6c8a93f462f1c503
|
7
|
+
data.tar.gz: 65a1be57601cc7a560a19ef48dc75b09647244fe477327f23ae52a37f8114afca4ee3871a1f72e1b046589e252a57701956a93e9015907bf76fd24455da341ff
|
data/README.md
CHANGED
@@ -32,7 +32,6 @@ a [docker image](https://hub.docker.com/r/dannyben/bashly).
|
|
32
32
|
<table>
|
33
33
|
<tr>
|
34
34
|
<td><a href="https://rhodecode.com/"><img src='support/img/RhodeCode-logo.png' width=240></a></td>
|
35
|
-
<td><a href="https://decisiohealth.com/"><img src='support/img/decisio-logo.png' width=240></a></td>
|
36
35
|
</tr>
|
37
36
|
</table>
|
38
37
|
|
@@ -82,11 +81,6 @@ to contribute, feel free to [open an issue][issues] or
|
|
82
81
|
|
83
82
|
Visit the *[How to contribute][contributing]* page for more information.
|
84
83
|
|
85
|
-
## Stargazers and Forkers
|
86
|
-
|
87
|
-
[](https://github.com/DannyBen/bashly/stargazers)
|
88
|
-
|
89
|
-
[](https://github.com/DannyBen/bashly/network/members)
|
90
84
|
|
91
85
|
[issues]: https://github.com/DannyBen/bashly/issues
|
92
86
|
[discussions]: https://github.com/DannyBen/bashly/discussions
|
data/lib/bashly/config.rb
CHANGED
@@ -2,7 +2,11 @@ require 'yaml'
|
|
2
2
|
|
3
3
|
module Bashly
|
4
4
|
# A convenience class to use either a hash or a filename as a configuration
|
5
|
-
# source
|
5
|
+
# source.
|
6
|
+
#
|
7
|
+
# When a filename is provided, it is loaded with these extra features:
|
8
|
+
# - Support for `import` keyword to merge additional YAML files
|
9
|
+
# - Preprocessing with ERB
|
6
10
|
class Config
|
7
11
|
using ComposeRefinements
|
8
12
|
|
@@ -10,7 +14,7 @@ module Bashly
|
|
10
14
|
|
11
15
|
def self.new(config)
|
12
16
|
if config.is_a? String
|
13
|
-
YAML.
|
17
|
+
YAML.load_erb_file(config).compose
|
14
18
|
else
|
15
19
|
config
|
16
20
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module YAML
|
2
|
-
#
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
# We trust our loaded YAMLs
|
3
|
+
# This patch is due to https://bugs.ruby-lang.org/issues/17866
|
4
|
+
# StackOverflow: https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias/71192990#71192990
|
5
|
+
class << self
|
6
|
+
alias load unsafe_load
|
7
|
+
|
8
|
+
def load_erb_file(path)
|
9
|
+
YAML.load ERB.new(File.read(path)).result
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
@@ -18,9 +18,15 @@ config_path: "%{source_dir}/bashly.yml"
|
|
18
18
|
# The path to use for creating the bash script
|
19
19
|
target_dir: .
|
20
20
|
|
21
|
-
# The path to use for common library files, relative to
|
21
|
+
# The path to use for common library files, relative to source_dir
|
22
22
|
lib_dir: lib
|
23
23
|
|
24
|
+
# The path to use for command files, relative to source_dir
|
25
|
+
# When set to nil (~), command files will be placed directly under source_dir
|
26
|
+
# When set to any other string, command files will be placed under this
|
27
|
+
# directory, and each command will get its own subdirectory
|
28
|
+
commands_dir: ~
|
29
|
+
|
24
30
|
# Configure the bash options that will be added to the initialize function:
|
25
31
|
# strict: true Bash strict mode (set -euo pipefail)
|
26
32
|
# strict: false Only exit on errors (set -e)
|
@@ -13,7 +13,7 @@ module Bashly
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def values!
|
16
|
-
defaults = YAML.
|
16
|
+
defaults = YAML.load_file asset('libraries/strings/strings.yml')
|
17
17
|
defaults.merge project_strings
|
18
18
|
end
|
19
19
|
|
@@ -23,7 +23,7 @@ module Bashly
|
|
23
23
|
|
24
24
|
def project_strings!
|
25
25
|
if File.exist? project_strings_path
|
26
|
-
YAML.
|
26
|
+
YAML.load_file project_strings_path
|
27
27
|
else
|
28
28
|
{}
|
29
29
|
end
|
@@ -22,7 +22,7 @@ module ComposeRefinements
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def safe_load_yaml(path)
|
25
|
-
loaded = YAML.
|
25
|
+
loaded = YAML.load_erb_file path
|
26
26
|
return loaded if loaded.is_a?(Array) || loaded.is_a?(Hash)
|
27
27
|
|
28
28
|
raise Bashly::ConfigurationError, "Cannot find a valid YAML in g`#{path}`"
|
@@ -159,10 +159,10 @@ module Bashly
|
|
159
159
|
options['examples'].is_a?(Array) ? options['examples'] : [options['examples']]
|
160
160
|
end
|
161
161
|
|
162
|
-
# Returns the
|
163
|
-
#
|
162
|
+
# Returns the filename that is expected to hold the user code for this
|
163
|
+
# command
|
164
164
|
def filename
|
165
|
-
options['filename'] ||
|
165
|
+
options['filename'] || implicit_filename
|
166
166
|
end
|
167
167
|
|
168
168
|
# Returns an array of Flags
|
@@ -314,6 +314,18 @@ module Bashly
|
|
314
314
|
def whitelisted_flags
|
315
315
|
flags.select(&:allowed)
|
316
316
|
end
|
317
|
+
|
318
|
+
private
|
319
|
+
|
320
|
+
# Returns either a flat filename (docker_status_command.sh) or a nested
|
321
|
+
# path (commands/docker/status.sh)
|
322
|
+
def implicit_filename
|
323
|
+
if Settings.commands_dir
|
324
|
+
"#{Settings.commands_dir}/#{action_name.to_path}.#{Settings.partials_extension}"
|
325
|
+
else
|
326
|
+
"#{action_name.to_underscore}_command.#{Settings.partials_extension}"
|
327
|
+
end
|
328
|
+
end
|
317
329
|
end
|
318
330
|
end
|
319
331
|
end
|
data/lib/bashly/settings.rb
CHANGED
@@ -4,6 +4,7 @@ module Bashly
|
|
4
4
|
include AssetHelper
|
5
5
|
|
6
6
|
attr_writer(
|
7
|
+
:commands_dir,
|
7
8
|
:compact_short_flags,
|
8
9
|
:config_path,
|
9
10
|
:lib_dir,
|
@@ -15,6 +16,10 @@ module Bashly
|
|
15
16
|
:usage_colors
|
16
17
|
)
|
17
18
|
|
19
|
+
def commands_dir
|
20
|
+
@commands_dir ||= get :commands_dir
|
21
|
+
end
|
22
|
+
|
18
23
|
def compact_short_flags
|
19
24
|
@compact_short_flags ||= get :compact_short_flags
|
20
25
|
end
|
data/lib/bashly/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.7
|
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: 2023-
|
11
|
+
date: 2023-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
268
|
- !ruby/object:Gem::Version
|
269
269
|
version: '0'
|
270
270
|
requirements: []
|
271
|
-
rubygems_version: 3.4.
|
271
|
+
rubygems_version: 3.4.10
|
272
272
|
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: Bash Command Line Tool Generator
|