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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 558258a98c5a64125802ab9612acd60906bfd069
4
- data.tar.gz: d787f718632c0e16df8d176938a30a54e668d5c7
3
+ metadata.gz: 4214f82d6684139a8037647c5ccbc573faf47ab4
4
+ data.tar.gz: d38adc9cad47620f82812bbe0fe1881e9e2efff8
5
5
  SHA512:
6
- metadata.gz: 01ff19b161a0ab6492e87a5c432b2ca76de79802fa5356fb2103879e4ed67d11494d926f8343260414a3c51b56ae0c665ff7c423ea93377bc93e1519e68d0b84
7
- data.tar.gz: 46ed488ad6b113c67223240d751a83409a7edb70950845cd1a34dd27133d5145ab74bf032b7a92da9e122658d51f7e8675d01af2e66a9c914713c22f80ab4445
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
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'runfile/version'
2
3
  require 'runfile/docopt_maker'
3
4
  require 'runfile/action'
4
5
  require 'runfile/runner'
@@ -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.exist? filename or handle_no_runfile argv
34
- load filename
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}'"
@@ -0,0 +1,3 @@
1
+ module Runfile
2
+ VERSION = "0.2.2"
3
+ end
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.1
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