bashly 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/bashly/commands/generate.rb +12 -2
- data/lib/bashly/models/command.rb +6 -3
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/command_filter.erb +1 -0
- data/lib/bashly/views/command/default_initialize_script.erb +6 -0
- data/lib/bashly/views/command/initialize.erb +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adc0195f1560e5851741b7b17ce2a4b6d825aa77a7f5f9cc6a808e6864b605b1
|
4
|
+
data.tar.gz: 7c06088461ad5e62a3c5523aaebb49ade7fed0ae3cd111159390e50985913ae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7863f3863eaaf697aa26a7dfacbacc695f6eac61123fb85efa752c623a9cf3a853cff32dec314e347d5fb469d2b5168e4ddb7efc796db994b0ce2f713f0d7ca
|
7
|
+
data.tar.gz: 79b400c668d45b6429c7945bb44402311b06f184d57547f55a6e983b91390b2feb79c6ebf7e7fe5be14454ad3d019e4f526710ca6d103f8f6746f9473558b16f
|
data/README.md
CHANGED
@@ -22,10 +22,20 @@ module Bashly
|
|
22
22
|
def create_user_files
|
23
23
|
say "creating user files in !txtgrn!#{Settings.source_dir}"
|
24
24
|
|
25
|
+
create_file "#{Settings.source_dir}/initialize.sh", command.render(:default_initialize_script)
|
26
|
+
|
25
27
|
if command.commands.empty?
|
26
|
-
|
28
|
+
create_root_command_file
|
29
|
+
else
|
30
|
+
create_all_command_files
|
27
31
|
end
|
28
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_root_command_file
|
35
|
+
create_file "#{Settings.source_dir}/root_command.sh", command.render(:default_root_script)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_all_command_files
|
29
39
|
command.commands.each do |subcommand|
|
30
40
|
file = "#{Settings.source_dir}/#{subcommand.full_name.to_underscore}_command.sh"
|
31
41
|
content = subcommand.render :default_script
|
@@ -50,13 +50,16 @@ module Bashly
|
|
50
50
|
# Reads a file from the userspace (Settings.source_dir) and returns
|
51
51
|
# its contents.
|
52
52
|
# If the file is not found, returns a string with a hint.
|
53
|
-
def load_user_file(file)
|
53
|
+
def load_user_file(file, placeholder: true)
|
54
54
|
path = "#{Settings.source_dir}/#{file}"
|
55
|
+
default_content = placeholder ? "# error: cannot load file" : ''
|
56
|
+
|
55
57
|
content = if File.exist? path
|
56
58
|
File.read path
|
57
|
-
else
|
58
|
-
|
59
|
+
else
|
60
|
+
default_content
|
59
61
|
end
|
62
|
+
|
60
63
|
"# :#{path}\n#{content}"
|
61
64
|
end
|
62
65
|
|
data/lib/bashly/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bashly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- lib/bashly/views/argument/usage.erb
|
92
92
|
- lib/bashly/views/command/command_filter.erb
|
93
93
|
- lib/bashly/views/command/command_functions.erb
|
94
|
+
- lib/bashly/views/command/default_initialize_script.erb
|
94
95
|
- lib/bashly/views/command/default_root_script.erb
|
95
96
|
- lib/bashly/views/command/default_script.erb
|
96
97
|
- lib/bashly/views/command/fixed_flags_filter.erb
|