bashly 0.6.7 → 0.6.8
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/lib/bashly/commands/generate.rb +11 -6
- data/lib/bashly/extensions/string.rb +1 -1
- data/lib/bashly/models/script.rb +19 -1
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/initialize.erb +0 -5
- data/lib/bashly/views/script/bash3_bouncer.erb +5 -0
- data/lib/bashly/views/script/header.erb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f0b22d0ac9bf41f91fed37e60996fa5175346a9e2e5e56158b760ededfef2a0
|
4
|
+
data.tar.gz: 39ffcd5e199b6b79fd04a4bd38e93d4703ad7aebce0ec4970b8250280112c5db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd57501ae8a6fc8b3072320dc7358b2097ef9b280b5e8b80efa52155c91a9fe56abbb73821ffc2b8a8a8e55caf7a61dd46ef29d8c88f49b2232cddfccff77a32
|
7
|
+
data.tar.gz: 83f7293f9b543d6330daedf6421678b3c321166751708dba0985d7aa18a9191510a3832bd2ac8d2a3510b09f9eb2064403798b38894c7227a63f8c86f52f04dc
|
@@ -3,11 +3,12 @@ module Bashly
|
|
3
3
|
class Generate < Base
|
4
4
|
help "Generate the bash script and required files"
|
5
5
|
|
6
|
-
usage "bashly generate [--force --wrap FUNCTION]"
|
6
|
+
usage "bashly generate [--force --quiet --wrap FUNCTION]"
|
7
7
|
usage "bashly generate (-h|--help)"
|
8
8
|
|
9
9
|
option "-f --force", "Overwrite existing files"
|
10
10
|
option "-w --wrap FUNCTION", "Wrap the entire script in a function so it can also be sourced"
|
11
|
+
option "-q --quiet", "Disable on-screen progress report"
|
11
12
|
|
12
13
|
environment "BASHLY_SOURCE_DIR", "The path containing the bashly configuration and source files [default: src]"
|
13
14
|
environment "BASHLY_TARGET_DIR", "The path to use for creating the bash script [default: .]"
|
@@ -18,13 +19,17 @@ module Bashly
|
|
18
19
|
def run
|
19
20
|
create_user_files
|
20
21
|
create_master_script
|
21
|
-
|
22
|
+
quiet_say "run !txtpur!#{master_script_path} --help!txtrst! to test your bash script"
|
22
23
|
end
|
23
24
|
|
24
25
|
private
|
25
26
|
|
27
|
+
def quiet_say(message)
|
28
|
+
say message unless args['--quiet']
|
29
|
+
end
|
30
|
+
|
26
31
|
def create_user_files
|
27
|
-
|
32
|
+
quiet_say "creating user files in !txtgrn!#{Settings.source_dir}"
|
28
33
|
|
29
34
|
create_file "#{Settings.source_dir}/initialize.sh", command.render(:default_initialize_script)
|
30
35
|
|
@@ -50,17 +55,17 @@ module Bashly
|
|
50
55
|
|
51
56
|
def create_file(file, content)
|
52
57
|
if File.exist? file and !args['--force']
|
53
|
-
|
58
|
+
quiet_say "skipped !txtgrn!#{file}!txtrst! (exists)"
|
54
59
|
else
|
55
60
|
File.write file, content
|
56
|
-
|
61
|
+
quiet_say "created !txtgrn!#{file}"
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
60
65
|
def create_master_script
|
61
66
|
File.write master_script_path, script.code
|
62
67
|
FileUtils.chmod "+x", master_script_path
|
63
|
-
|
68
|
+
quiet_say "created !txtgrn!#{master_script_path}"
|
64
69
|
end
|
65
70
|
|
66
71
|
def script
|
data/lib/bashly/models/script.rb
CHANGED
@@ -22,12 +22,30 @@ module Bashly
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def header
|
25
|
-
@header ||=
|
25
|
+
@header ||= header!
|
26
|
+
end
|
27
|
+
|
28
|
+
def header!
|
29
|
+
if File.exist? custom_header_path
|
30
|
+
File.read custom_header_path
|
31
|
+
else
|
32
|
+
default_header
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def default_header
|
37
|
+
result = render('header')
|
38
|
+
result += render('bash3_bouncer') unless function_name
|
39
|
+
result
|
26
40
|
end
|
27
41
|
|
28
42
|
def body
|
29
43
|
@body ||= command.render('master_script')
|
30
44
|
end
|
45
|
+
|
46
|
+
def custom_header_path
|
47
|
+
@custom_header_path ||= "#{Settings.source_dir}/header.sh"
|
48
|
+
end
|
31
49
|
end
|
32
50
|
end
|
33
51
|
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: 0.6.
|
4
|
+
version: 0.6.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: 2021-
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/bashly/views/environment_variable/usage.erb
|
144
144
|
- lib/bashly/views/flag/case.erb
|
145
145
|
- lib/bashly/views/flag/usage.erb
|
146
|
+
- lib/bashly/views/script/bash3_bouncer.erb
|
146
147
|
- lib/bashly/views/script/header.erb
|
147
148
|
- lib/bashly/views/script/wrapper.erb
|
148
149
|
homepage: https://github.com/dannyben/bashly
|