runfile 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +88 -0
- data/lib/runfile.rb +1 -0
- data/lib/runfile/runner.rb +7 -3
- data/lib/runfile/version.rb +3 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4214f82d6684139a8037647c5ccbc573faf47ab4
|
4
|
+
data.tar.gz: d38adc9cad47620f82812bbe0fe1881e9e2efff8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf2f7fafb7d05a4ad9888ca22d4f3a507811749fe383b1c579ab0057c26e931331a88c1a88809c4ad3cadf07d658e1ca74006e2cdd9f24ff1ea9113f619f0183
|
7
|
+
data.tar.gz: bda2f4546fd50cd8550dacf75acf184be4bb580fccc95ca26f8bb778d5fb55c83a17148776059a6dc3a99771b05afc4b55d48f01146366775f1567ce5bd644fc
|
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
Runfile - If Rake and Docopt had a baby
|
2
|
+
=======================================
|
3
|
+
|
4
|
+
An easy way to create project specific command line utilities
|
5
|
+
|
6
|
+
|
7
|
+
## Wait, What?
|
8
|
+
|
9
|
+
**Runfile** lets you create command line applications in a way similar
|
10
|
+
to [Rake](https://github.com/ruby/rake), but with the full power of
|
11
|
+
[Docopt](http://docopt.org/) command line options.
|
12
|
+
|
13
|
+
You create a `Runfile`, and execute commands with
|
14
|
+
`run command arguments -and --flags`.
|
15
|
+
|
16
|
+
|
17
|
+
## Install
|
18
|
+
|
19
|
+
$ gem install runfile
|
20
|
+
|
21
|
+
|
22
|
+
## Example
|
23
|
+
|
24
|
+
The most minimal `Runfile` looks like this:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
usage "greet <name>"
|
28
|
+
action :greet do |args|
|
29
|
+
puts "Hello #{args['<name>']}"
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
You can then run it by executing this command:
|
34
|
+
|
35
|
+
```
|
36
|
+
$ run greet Luke
|
37
|
+
Hello Luke
|
38
|
+
```
|
39
|
+
|
40
|
+
Executing `run` without parameters, will show the usage patterns:
|
41
|
+
|
42
|
+
```
|
43
|
+
$ run
|
44
|
+
Usage:
|
45
|
+
run greet <name>
|
46
|
+
run (-h | --help | --version)
|
47
|
+
```
|
48
|
+
|
49
|
+
Executing `run --help` will show the full help document (docopt)
|
50
|
+
|
51
|
+
```
|
52
|
+
$ run --help
|
53
|
+
Runfile 0.0.0
|
54
|
+
|
55
|
+
Usage:
|
56
|
+
run greet <name>
|
57
|
+
run (-h | --help | --version)
|
58
|
+
|
59
|
+
Options:
|
60
|
+
-h --help
|
61
|
+
Show this screen
|
62
|
+
|
63
|
+
--version
|
64
|
+
Show version
|
65
|
+
```
|
66
|
+
|
67
|
+
## Documentation
|
68
|
+
|
69
|
+
- [Learn by Example](https://github.com/DannyBen/runfile/tree/master/examples)
|
70
|
+
- [Runfile Command Reference](https://github.com/DannyBen/runfile/wiki/Runfile-Command-Reference)
|
71
|
+
- [More about Runfile](https://github.com/DannyBen/runfile/wiki)
|
72
|
+
|
73
|
+
## Test
|
74
|
+
|
75
|
+
$ rake test
|
76
|
+
|
77
|
+
|
78
|
+
## Todo
|
79
|
+
|
80
|
+
- Add documentation for `*.runfile` form files
|
81
|
+
- (Colsole) Add newline detection in wordwrap (i.e. add indentation spaces
|
82
|
+
after newline)
|
83
|
+
- Consider supporting user and system level `*.runfiles`
|
84
|
+
- Wiki (in progress)
|
85
|
+
- GitHub pages
|
86
|
+
- Can we have a colored docopt? Would be nice...
|
87
|
+
(working, but causing some issues, will probably abandon)
|
88
|
+
|
data/lib/runfile.rb
CHANGED
data/lib/runfile/runner.rb
CHANGED
@@ -30,8 +30,12 @@ module Runfile
|
|
30
30
|
|
31
31
|
# Load and execute a Runfile call.
|
32
32
|
def execute(argv, filename='Runfile')
|
33
|
-
File.
|
34
|
-
|
33
|
+
File.file? filename or handle_no_runfile argv
|
34
|
+
begin
|
35
|
+
load filename
|
36
|
+
rescue
|
37
|
+
abort "Failed loading file '#{filename}'.\nIs it a valid Runfile?"
|
38
|
+
end
|
35
39
|
@@instance.run *argv
|
36
40
|
end
|
37
41
|
|
@@ -131,7 +135,7 @@ module Runfile
|
|
131
135
|
execute argv, "#{argv[0]}.runfile"
|
132
136
|
else
|
133
137
|
runfiles = Dir['*.runfile']
|
134
|
-
runfiles.empty? and abort "Runfile not found.\nUse 'run make' to create one."
|
138
|
+
runfiles.empty? and abort "Runfile engine v#{Runfile::VERSION}\n\nRunfile not found.\nUse 'run make' to create one."
|
135
139
|
runfiles.each do |f|
|
136
140
|
f.slice! '.runfile'
|
137
141
|
puts "Did you mean 'run #{f}'"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
@@ -45,12 +45,14 @@ executables:
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- README.md
|
48
49
|
- bin/run
|
49
50
|
- lib/runfile.rb
|
50
51
|
- lib/runfile/action.rb
|
51
52
|
- lib/runfile/docopt_maker.rb
|
52
53
|
- lib/runfile/dsl.rb
|
53
54
|
- lib/runfile/runner.rb
|
55
|
+
- lib/runfile/version.rb
|
54
56
|
homepage: https://github.com/DannyBen/runfile
|
55
57
|
licenses:
|
56
58
|
- MIT
|