runfile 1.0.0.rc4 → 1.0.0

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: ab0dde51597dac5b5f75e8c7fe4fd627d94b70251a9f7ada897fad07f32573fc
4
- data.tar.gz: aa612294f0247bcfed789fa7a9704798f611ec83dbb80a55fe9c18eb85ad6d07
3
+ metadata.gz: 97b62f3eec29bfcf7295e6d6da2f08b8461e9957f1d85296ab1831666d841f9e
4
+ data.tar.gz: 5f2b029e59be9181f05abf5b45448bd1bf57527df33e8a5431c445b106c633e1
5
5
  SHA512:
6
- metadata.gz: cc5ed99c7b6cd47d7f3a64418ac62698f46c5e5ee1e55edb3bdf18ef157e4764efadd874ab2767a0be50ee98e0592195546d63c6f988607cb25cc6ce9de03cd8
7
- data.tar.gz: b6d0ff5c3e8fd53b048c2e5b35ebf180ef2a4f44e05b2a271e7defb572ad654258f140bcb40fa3048b84a999201e7ff5a3067d3db4ab4835c5f8f8f3aff1b990
6
+ metadata.gz: 7ea4e40d8cca826236c906dd6d8430f6a5ba1d2f317babce072f6034cefa7e9bb439f6582dc4e4fffec017cbaf78e93ef5785c5578a6d13743d9910a8f62bc3f
7
+ data.tar.gz: 42f2904c17a98672d2291808b7adde081207f083ab200a8a6ff01990a87aaf9b62554a4b914807363481d9ba59faadfdc57d0cdcf00820df8a3f9eff457be61b
data/README.md CHANGED
@@ -9,15 +9,16 @@
9
9
 
10
10
  ---
11
11
 
12
- A beautiful command line application framework
13
- Rake-inspired - Docopt inside
12
+ A beautiful command line utility builder
13
+ Rake-inspired Docopt inside
14
+ **[runfile.dannyb.co](https://runfile.dannyb.co)**
14
15
 
15
16
  ---
16
17
 
17
18
  </div>
18
19
 
19
- **Runfile** lets you create command line applications in a way similar
20
- to [Rake](https://github.com/ruby/rake), but with the full power of
20
+ **Runfile** lets you create command line tools in a way similar to
21
+ [Rake](https://github.com/ruby/rake), but with the full power of
21
22
  [Docopt](http://docopt.org/) command line options.
22
23
 
23
24
  You create a `runfile`, and execute commands with
@@ -26,15 +27,9 @@ You create a `runfile`, and execute commands with
26
27
  Runfile is designed primarily for Ruby developers, but if you need to add a
27
28
  command line "toolbelt" for your projects, you can use it regardless.
28
29
 
29
- ## Pre-release Notice
30
-
31
- Note that this README describes the not yet released 1.0.0 version.
32
- See [runfile.dannyb.co](https://runfile.dannyb.co/) for the stable release
33
- documentation.
34
-
35
30
  ## Demo
36
31
 
37
- ![Runfile Demo](demo.svg "Runfile Demo")
32
+ ![Runfile Demo](support/cast.gif "Runfile Demo")
38
33
 
39
34
  ## Install
40
35
 
@@ -110,7 +105,7 @@ Options:
110
105
  Show this message
111
106
  ```
112
107
 
113
- ## Examples
108
+ ### More Examples
114
109
 
115
110
  You can learn almost everything there is to know about runfile from the
116
111
  [examples](https://github.com/DannyBen/runfile/tree/master/examples#readme).
@@ -129,56 +124,67 @@ Note that the current user guide is for the stable version 0.12.0.
129
124
 
130
125
  ## Breaking Changes in 1.0.0
131
126
 
132
- If you are using a version earlier than 1.0, note that the upcoming release
133
- 1.0.0 includes some breaking changes. You can read more about them in[this Pull
134
- Request](https://github.com/DannyBen/runfile/pull/50).
127
+ If you are using a version earlier than 1.0, note that version 1.0.0 includes
128
+ some breaking changes. You can read more about them in [this Pull Request]
129
+ (https://github.com/DannyBen/runfile/pull/50).
135
130
 
136
131
  ### Upgrading to 1.0.0
137
132
 
138
- ### No more `.runfile` config
133
+ <details>
134
+ <summary>Show section</summary>
135
+
136
+ ### No more `.runfile` config
137
+
138
+ If you have used the multi-runfile config file, this no longer exists.
139
+ Use a standard `runfile` instead, along with the `import` directive.
140
+
141
+ ### No more `action :global`
142
+
143
+ If you have used the `action :global do` notation, this is replaced with the
144
+ simpler use `action do` instead. Also, there is no more need for
145
+ empty `usage ''`, just delete it if you have it in your runfiles.
146
+
147
+ ### No more `execute` directive
139
148
 
140
- If you have used the multi-runfile config file, this no longer exists.
141
- Use a standard `runfile` instead, along with the `import` directive.
149
+ If you have used it to cross-call other actions, it is no longer available. As
150
+ an alternative, you can define common code in separate classes and `require`
151
+ them, or use the new `helpers` directive to define functions that will be
152
+ available to all actions.
142
153
 
143
- ### No more `action :global`
154
+ ### Code outside of actions should be inside `helpers`
144
155
 
145
- If you have used the `action :global do` notation, this is replaced with the
146
- simpler use `action do` instead. Also, there is no more need for
147
- empty `usage ''`, just delete it if you have it in your runfiles.
156
+ If your runfiles include other ruby code, especially `def method`, you should
157
+ now use the new `helpers` block and tuck this code inside it.
148
158
 
149
- ### No more `execute` directive
159
+ ### No more need for `trap(:INT)`
150
160
 
151
- If you have used it to cross-call other actions, it is no longer available. As
152
- an alternative, you can define common code in separate classes and `require`
153
- them, or use the new `helpers` directive to define functions that will be
154
- available to all actions.
161
+ If your old runfiles trap the `Interrupt` signal, there is no longer a need to
162
+ do so, as it is trapped by default.
155
163
 
156
- ### No more need for `trap(:INT)`
164
+ ### Colsole is included
157
165
 
158
- If your old runfiles trap the `Interrupt` signal, there i no longer a need to
159
- do so, as it is trapped by default.
166
+ If your runfiles `required` and `include` Colsole, there is no longer a need to
167
+ do it. Colsole is bundled and available in actions.
160
168
 
161
- ### Colsole is included
169
+ ### Long flags before short flags
162
170
 
163
- If your runfiles `required` and `include` Colsole, there is no longer a need to
164
- do it. Colsole is bundled and available in actions.
171
+ This is a cosmetic change for consistency. All generated output shows long flags
172
+ before short flags `--force, -f` instead of `-f, --force`. Update your custom
173
+ `usage` directives accordingly.
165
174
 
166
- ### Long flags before short flags
175
+ ### Examples no longer add implicit 'run'
167
176
 
168
- This is a cosmetic change for consistency. All generated output shows long flags
169
- before short flags `--force, -f` instead of `-f, --force`. Update your custom
170
- `usage` directives accordingly.
177
+ If you were using the `example` directive, it will no longer add the initial
178
+ `run` in front of your examples. Add it yourself. This is intended to allow
179
+ providing more elaborate examples.
171
180
 
172
- ### Examples no longer add implicit 'run'
181
+ ### RunfileTasks
173
182
 
174
- If you were using the `example` directive, it will no longer add the initial
175
- `run` in front of your examples. Add it yourself. This is intended to allow
176
- providing more elaborate examples.
183
+ The `RunfileTasks` gem is also released as a pre-release, if you are using it
184
+ make sure to install the latest release candidate.
177
185
 
178
- ### RunfileTasks
186
+ </details>
179
187
 
180
- The `RunfileTasks` gem is also released as a pre-release, if you are using it
181
- make sure to install the latest release candidate.
182
188
 
183
189
  ## Contributing / Support
184
190
 
@@ -1,7 +1,7 @@
1
1
  module Runfile
2
2
  # Represents a single action inside a {Userfile} and executes its block
3
3
  # on demand. Properties of this class are populated by the {DSL} module when
4
- # running a {Userfile}.
4
+ # the runfile is executed.
5
5
  class Action
6
6
  include Inspectable
7
7
 
@@ -26,7 +26,7 @@ module Runfile
26
26
 
27
27
  instance_eval do
28
28
  host.helpers.each { |b| b.call args }
29
- block.call args
29
+ block.call args if block
30
30
  end
31
31
  end
32
32
 
@@ -34,10 +34,6 @@ module Runfile
34
34
  @name = value&.to_s
35
35
  end
36
36
 
37
- def names
38
- name ? [name, shortcut].compact : ['(default)']
39
- end
40
-
41
37
  def prefix
42
38
  host&.full_name
43
39
  end
@@ -58,6 +54,12 @@ module Runfile
58
54
  @usages ||= []
59
55
  end
60
56
 
57
+ private
58
+
59
+ def names
60
+ name.empty? ? [] : [name, shortcut].compact
61
+ end
62
+
61
63
  def validate_context
62
64
  host.required_contexts.each do |varname, default|
63
65
  next if host.context[varname]
@@ -2,8 +2,6 @@ module Runfile
2
2
  module DSL
3
3
  # Commands
4
4
 
5
- attr_reader :default_action
6
-
7
5
  def action(name = nil, shortcut = nil, &block)
8
6
  current_action.block = block
9
7
  current_action.name = name.to_s
@@ -123,7 +121,6 @@ module Runfile
123
121
  def finalize_current_action(name)
124
122
  key = name.empty? ? :default : name
125
123
  actions[key] = current_action
126
- @default_action = current_action unless name
127
124
  @current_action = nil
128
125
  end
129
126
 
@@ -10,4 +10,5 @@ module Runfile
10
10
  class ActionNotFound < UserError; end
11
11
  class GemNotFound < UserError; end
12
12
  class SyntaxError < UserError; end
13
+ class DocoptError < SyntaxError; end
13
14
  end
@@ -1,6 +1,6 @@
1
1
  module Runfile
2
2
  # Finds the path of an installed or bundled gem
3
- # Adapted from Rubocop <https://github.com/rubocop/rubocop/blob/master/lib/rubocop/config_loader_resolver.rb#L268>
3
+ # Adapted from [Rubocop](https://github.com/rubocop/rubocop/blob/master/lib/rubocop/config_loader_resolver.rb#L268)
4
4
  class GemFinder
5
5
  class << self
6
6
  def find(gem_name, file = nil)
@@ -14,6 +14,8 @@ module Runfile
14
14
  Docopt.docopt docopt, argv: argv, version: version
15
15
  rescue Docopt::Exit => e
16
16
  raise ExitWithUsage, e.message
17
+ rescue Docopt::DocoptLanguageError => e
18
+ raise DocoptError, "There is an error in your runfile:\nnb`#{e.message}`"
17
19
  end
18
20
  end
19
21
  end
@@ -1,3 +1,3 @@
1
1
  module Runfile
2
- VERSION = '1.0.0.rc4'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc4
4
+ version: 1.0.0
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-01-28 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole
@@ -144,9 +144,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
144
  version: '2.7'
145
145
  required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - ">"
147
+ - - ">="
148
148
  - !ruby/object:Gem::Version
149
- version: 1.3.1
149
+ version: '0'
150
150
  requirements: []
151
151
  rubygems_version: 3.4.5
152
152
  signing_key: