wojtekmach-cli 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/README.md +19 -6
  2. data/bin/rb-cli +10 -0
  3. data/lib/cli/app.rb +5 -0
  4. data/lib/cli/version.rb +1 -1
  5. metadata +11 -9
data/README.md CHANGED
@@ -4,9 +4,7 @@ A CLI app framework
4
4
 
5
5
  ## Setup
6
6
 
7
- git clone /path/to/cli.git
8
- cd cli
9
- rake install
7
+ gem install wojtekmach-cli
10
8
 
11
9
  ## Example
12
10
 
@@ -36,9 +34,24 @@ Let's say you have a file `hello.rb`:
36
34
 
37
35
  You can now use it like this:
38
36
 
39
- ruby hello.rb # => Hello, World!
40
- ruby hello.rb hi # => Hi, World!
41
- ruby hello.rb -m Bye # => Bye, World!
37
+ % ruby hello.rb # => Hello, World!
38
+ % ruby hello.rb hi # => Hi, World!
39
+ % ruby hello.rb -m Bye # => Bye, World!
40
+
41
+ Alternatively, you can use the `rb-cli` binary like that:
42
+
43
+ #!/usr/bin/env rb-cli
44
+
45
+ name "hello"
46
+ version "0.0.1"
47
+
48
+ default do
49
+ ...
50
+ end
51
+
52
+ And run it:
53
+
54
+ % ./hello.rb
42
55
 
43
56
  ## Licence
44
57
 
data/bin/rb-cli ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "cli"
4
+
5
+ _name = ARGV.shift
6
+
7
+ CLI.app do
8
+ binary _name
9
+ instance_eval File.read(_name), _name, 1
10
+ end
data/lib/cli/app.rb CHANGED
@@ -64,6 +64,11 @@ module CLI
64
64
  @app = app
65
65
  end
66
66
 
67
+ # Sets the App binary_name
68
+ def binary(val)
69
+ app.binary = val
70
+ end
71
+
67
72
  # Sets the App name
68
73
  def name(val)
69
74
  app.name = val
data/lib/cli/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module CLI
2
2
  # Current CLI version
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.3"
4
4
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wojtekmach-cli
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Wojciech Mach
@@ -10,7 +10,8 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-11 00:00:00 Z
13
+ date: 2011-06-11 00:00:00 +02:00
14
+ default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: rspec
@@ -37,8 +38,8 @@ dependencies:
37
38
  description: CLI apps framework.
38
39
  email:
39
40
  - wojtekmach1@gmail.com
40
- executables: []
41
-
41
+ executables:
42
+ - rb-cli
42
43
  extensions: []
43
44
 
44
45
  extra_rdoc_files: []
@@ -52,12 +53,14 @@ files:
52
53
  - LICENSE
53
54
  - README.md
54
55
  - Rakefile
56
+ - bin/rb-cli
55
57
  - cli.gemspec
56
58
  - lib/cli.rb
57
59
  - lib/cli/app.rb
58
60
  - lib/cli/version.rb
59
61
  - spec/cli/app_spec.rb
60
62
  - spec/spec_helper.rb
63
+ has_rdoc: true
61
64
  homepage: ""
62
65
  licenses: []
63
66
 
@@ -81,10 +84,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
84
  requirements: []
82
85
 
83
86
  rubyforge_project: cli
84
- rubygems_version: 1.8.5
87
+ rubygems_version: 1.3.9.1
85
88
  signing_key:
86
89
  specification_version: 3
87
- summary: cli-0.1.0
88
- test_files:
89
- - spec/cli/app_spec.rb
90
- - spec/spec_helper.rb
90
+ summary: cli-0.1.3
91
+ test_files: []
92
+