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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 728137708fa1cabea46440dcc99eaded654fbf3f522d86f4bea6b47cb10ce823
4
- data.tar.gz: eccdb7dc7bb05af0780a16f2f15f8fff7748127946c7243df720cd8d347bfe68
3
+ metadata.gz: adc0195f1560e5851741b7b17ce2a4b6d825aa77a7f5f9cc6a808e6864b605b1
4
+ data.tar.gz: 7c06088461ad5e62a3c5523aaebb49ade7fed0ae3cd111159390e50985913ae3
5
5
  SHA512:
6
- metadata.gz: 261c3c410b87b9b0693d60dddad9f88aeeaa55160c8ef624366783a76771227c0076fc0aad4f9357220f50a53ab0902323e78287eb3222b40ebe5cafe871a088
7
- data.tar.gz: 7164422d5e1027abc69b77b57380ffefb574575f5eaf6362ba8bc5fcad8894135cd7a382b444b3c54cabc6f05ba519d8fa06bcfa503a714feb85bcac031f12f7
6
+ metadata.gz: e7863f3863eaaf697aa26a7dfacbacc695f6eac61123fb85efa752c623a9cf3a853cff32dec314e347d5fb469d2b5168e4ddb7efc796db994b0ce2f713f0d7ca
7
+ data.tar.gz: 79b400c668d45b6429c7945bb44402311b06f184d57547f55a6e983b91390b2feb79c6ebf7e7fe5be14454ad3d019e4f526710ca6d103f8f6746f9473558b16f
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align='center'>
2
- <img src='bashly-logo.svg' width=300>
2
+ <img src='logo.svg' width=280>
3
3
 
4
4
  Bashly - Bash CLI Framework and Generator
5
5
  ==================================================
@@ -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
- create_file "#{Settings.source_dir}/root_command.sh", command.render(:default_root_script)
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
- "# error: cannot load file"
59
+ else
60
+ default_content
59
61
  end
62
+
60
63
  "# :#{path}\n#{content}"
61
64
  end
62
65
 
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -8,6 +8,7 @@ case $action in
8
8
 
9
9
  <%- commands.each do |command| -%>
10
10
  <%= command.aliases.join " | " %> )
11
+ action=<%= command.name %>
11
12
  shift
12
13
  <%= command.name %>_parse_args "$@"
13
14
  shift $#
@@ -0,0 +1,6 @@
1
+ # Code here runs inside the initialize() function
2
+ # Use it for anything that you need to run before any other function, like
3
+ # setting environment vairables:
4
+ # CONFIG_FILE=settings.ini
5
+ #
6
+ # Feel free to empty (but not delete) this file.
@@ -3,4 +3,6 @@ initialize() {
3
3
  version="<%= version %>"
4
4
  long_usage=''
5
5
  set -e
6
+
7
+ <%= load_user_file("initialize.sh", placeholder: false).indent 2 %>
6
8
  }
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.0
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