simplecli 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- metadata +5 -11
- data/LICENSE +0 -22
- data/README.rdoc +0 -169
- data/Rakefile +0 -57
- data/VERSION.yml +0 -4
- data/examples/hello-cli +0 -44
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplecli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- remi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -22,20 +22,14 @@ extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
23
23
|
|
24
24
|
files:
|
25
|
-
- Rakefile
|
26
|
-
- VERSION.yml
|
27
|
-
- README.rdoc
|
28
|
-
- LICENSE
|
29
25
|
- lib/simplecli.rb
|
30
|
-
- examples/hello-cli
|
31
26
|
has_rdoc: true
|
32
27
|
homepage: http://github.com/remi/simplecli
|
33
28
|
licenses: []
|
34
29
|
|
35
30
|
post_install_message:
|
36
|
-
rdoc_options:
|
37
|
-
|
38
|
-
- --charset=UTF-8
|
31
|
+
rdoc_options: []
|
32
|
+
|
39
33
|
require_paths:
|
40
34
|
- lib
|
41
35
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -55,7 +49,7 @@ requirements: []
|
|
55
49
|
rubyforge_project:
|
56
50
|
rubygems_version: 1.3.5
|
57
51
|
signing_key:
|
58
|
-
specification_version:
|
52
|
+
specification_version: 3
|
59
53
|
summary: For making simple RubyGem-like command-line interfaces
|
60
54
|
test_files: []
|
61
55
|
|
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2009 ryan "remi" Taylor
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person
|
4
|
-
obtaining a copy of this software and associated documentation
|
5
|
-
files (the "Software"), to deal in the Software without
|
6
|
-
restriction, including without limitation the rights to use,
|
7
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the
|
9
|
-
Software is furnished to do so, subject to the following
|
10
|
-
conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
included in all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
= SimpleCLI
|
2
|
-
|
3
|
-
== DEPRECATED
|
4
|
-
|
5
|
-
I used to use this for all of my CLI's. Then I found Thor.
|
6
|
-
|
7
|
-
I still think it would be fun to complete a new SimpleCLI DSL
|
8
|
-
that I was working on ... but Thor is becoming pretty standard
|
9
|
-
so I would much rather use something that's widely known and used.
|
10
|
-
|
11
|
-
I personally recommend using Thor and, when you want to run
|
12
|
-
your script, call ClassThatInheritsFromThor.start
|
13
|
-
|
14
|
-
Thor:: http://github.com/wycats/thor
|
15
|
-
|
16
|
-
== Old Documentation ...
|
17
|
-
|
18
|
-
SimpleCLI is Undergoing Renovations
|
19
|
-
|
20
|
-
After over a year of use, this library needs some love!
|
21
|
-
|
22
|
-
I'm going to ...
|
23
|
-
|
24
|
-
- get a spec suite working again (I had specs for SimpleCLI once ... they're gone now)
|
25
|
-
- create a DSL (or 2) for making it easier for people to make SimpleCLI apps if
|
26
|
-
they don't want to just include the SimpleCLI module in one of their classes
|
27
|
-
- make (atleast some of) the DSL work in pre-defined classes (kindof like what we do now)
|
28
|
-
- create a screencast showing how easy it is to use SimpleCLI (and how to test-drive
|
29
|
-
SimpleCLI applications)
|
30
|
-
- document #command_missing and #default_comment usage with good examples
|
31
|
-
- create abunchof examples and throw them in the examples directory
|
32
|
-
- add #before and #after blocks for handling global options or something to do before
|
33
|
-
exiting type stuff
|
34
|
-
- make sure errors return the right response code
|
35
|
-
|
36
|
-
== About
|
37
|
-
|
38
|
-
Super Simple RubyGems-like CLI
|
39
|
-
|
40
|
-
SimpleCLI gives you a stupidly simple way to implement command-line
|
41
|
-
interfaces like that of RubyGems with a basic interface like:
|
42
|
-
|
43
|
-
gem command [options]
|
44
|
-
|
45
|
-
SimpleCLI gives you a way of defining your commands (or actions) so
|
46
|
-
they'll automatically show up when you run `yourapp commands`
|
47
|
-
|
48
|
-
SimpleCLI also makes it really easy to add documentation to each of
|
49
|
-
your commands (or actions)
|
50
|
-
|
51
|
-
== Real Examples
|
52
|
-
|
53
|
-
I use SimpleCLI in most of my apps for quick and dirty command-line interfaces.
|
54
|
-
|
55
|
-
Here are a few real examples:
|
56
|
-
|
57
|
-
* {Syntax On}[http://github.com/remi/syntax-on/tree/master/lib/syntax-on/bin.rb]
|
58
|
-
* {Domain Finder}[http://github.com/remi/domain-finder/tree/master/lib/domain-finder/bin.rb]
|
59
|
-
* ADF[http://github.com/remi/adf/tree/master/lib/adf/bin.rb]
|
60
|
-
|
61
|
-
== Example
|
62
|
-
|
63
|
-
Here's a super simple SimpleCLI example:
|
64
|
-
|
65
|
-
#! /usr/bin/env ruby
|
66
|
-
|
67
|
-
require File.dirname(__FILE__) + '/../lib/simplecli'
|
68
|
-
|
69
|
-
class Hello
|
70
|
-
include SimpleCLI
|
71
|
-
|
72
|
-
def usage
|
73
|
-
puts <<doco
|
74
|
-
|
75
|
-
Hello CLI
|
76
|
-
|
77
|
-
Usage:
|
78
|
-
#{ script_name } command [options]
|
79
|
-
|
80
|
-
Futher help:
|
81
|
-
#{ script_name } commands # list all available commands
|
82
|
-
#{ script_name } help <COMMAND> # show help for COMMAND
|
83
|
-
#{ script_name } help # show this help message
|
84
|
-
|
85
|
-
doco
|
86
|
-
end
|
87
|
-
|
88
|
-
def sayhello_help
|
89
|
-
<<doco
|
90
|
-
Usage: #{ script_name } sayhello [SAY]
|
91
|
-
|
92
|
-
Arguments:
|
93
|
-
SAY: Something to say (default 'Hello World!')
|
94
|
-
|
95
|
-
Summary:
|
96
|
-
Says hello!
|
97
|
-
doco
|
98
|
-
end
|
99
|
-
def sayhello *args
|
100
|
-
puts args.empty? ? "Hello World!" : args.join(' ')
|
101
|
-
end
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
# POSTAMBLE
|
106
|
-
if __FILE__ == $0
|
107
|
-
Hello.new( ARGV, :default => 'sayhello' ).run
|
108
|
-
end
|
109
|
-
|
110
|
-
Example usage:
|
111
|
-
|
112
|
-
<em><tt>$ ./hello-cli</tt></em>
|
113
|
-
|
114
|
-
Hello CLI
|
115
|
-
|
116
|
-
Usage:
|
117
|
-
hello-cli command [options]
|
118
|
-
|
119
|
-
Futher help:
|
120
|
-
hello-cli commands # list all available commands
|
121
|
-
hello-cli help <COMMAND> # show help for COMMAND
|
122
|
-
hello-cli help # show this help message
|
123
|
-
|
124
|
-
<em><tt>$ ./hello-cli commands</tt></em>
|
125
|
-
|
126
|
-
hello-cli commands are:
|
127
|
-
|
128
|
-
DEFAULT COMMAND sayhello
|
129
|
-
|
130
|
-
commands List all 'hello-cli' commands
|
131
|
-
help Provide help documentation for a command
|
132
|
-
sayhello Says hello!
|
133
|
-
|
134
|
-
For help on a particular command, use 'hello-cli help COMMAND'.
|
135
|
-
|
136
|
-
<em><tt>$ ./hello-cli help</tt></em>
|
137
|
-
|
138
|
-
Usage: hello-cli help COMMAND
|
139
|
-
|
140
|
-
Summary:
|
141
|
-
Provide help documentation for a command
|
142
|
-
|
143
|
-
<em><tt>$ ./hello-cli help sayhello</tt></em>
|
144
|
-
|
145
|
-
Usage: hello-cli sayhello [SAY]
|
146
|
-
|
147
|
-
Arguments:
|
148
|
-
SAY: Something to say (default 'Hello World!')
|
149
|
-
|
150
|
-
Summary:
|
151
|
-
Says hello!
|
152
|
-
|
153
|
-
<em><tt>$ ./hello-cli sayhello</tt></em>
|
154
|
-
|
155
|
-
Hello World!
|
156
|
-
|
157
|
-
<em><tt>$ ./hello-cli sayhello Hi There</tt></em>
|
158
|
-
|
159
|
-
Hi There
|
160
|
-
|
161
|
-
<em><tt>$ ./hello-cli Hi There</tt></em> `# this works because sayhello is configured as the default command`
|
162
|
-
|
163
|
-
Hi There
|
164
|
-
|
165
|
-
TODO
|
166
|
-
----
|
167
|
-
|
168
|
-
* implement a `before` block for handling global options
|
169
|
-
* there was once a spec suite ... where'd it go? find or recreate it!
|
data/Rakefile
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rubygems'
|
3
|
-
require 'rake/rdoctask'
|
4
|
-
require 'spec/rake/spectask'
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'jeweler'
|
8
|
-
Jeweler::Tasks.new do |s|
|
9
|
-
s.name = "simplecli"
|
10
|
-
s.summary = "For making simple RubyGem-like command-line interfaces"
|
11
|
-
s.email = "remi@remitaylor.com"
|
12
|
-
s.homepage = "http://github.com/remi/simplecli"
|
13
|
-
s.description = "SimpleCLI gives you a stupidly simple way to implement command-line interfaces like that of RubyGems"
|
14
|
-
s.authors = %w( remi )
|
15
|
-
s.files = FileList["[A-Z]*", "{lib,spec,examples}/**/*"]
|
16
|
-
# s.add_dependency 'person-project'
|
17
|
-
# s.executables = "neato"
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
21
|
-
end
|
22
|
-
|
23
|
-
Spec::Rake::SpecTask.new do |t|
|
24
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "Run all examples with RCov"
|
28
|
-
Spec::Rake::SpecTask.new('rcov') do |t|
|
29
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
30
|
-
t.rcov = true
|
31
|
-
end
|
32
|
-
|
33
|
-
Rake::RDocTask.new do |rdoc|
|
34
|
-
rdoc.rdoc_dir = 'rdoc'
|
35
|
-
rdoc.title = 'simplecli'
|
36
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
37
|
-
rdoc.rdoc_files.include('README.rdoc')
|
38
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
39
|
-
end
|
40
|
-
|
41
|
-
desc 'Confirm that gemspec is $SAFE'
|
42
|
-
task :safe do
|
43
|
-
require 'yaml'
|
44
|
-
require 'rubygems/specification'
|
45
|
-
data = File.read('simplecli.gemspec')
|
46
|
-
spec = nil
|
47
|
-
if data !~ %r{!ruby/object:Gem::Specification}
|
48
|
-
Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
|
49
|
-
else
|
50
|
-
spec = YAML.load(data)
|
51
|
-
end
|
52
|
-
spec.validate
|
53
|
-
puts spec
|
54
|
-
puts "OK"
|
55
|
-
end
|
56
|
-
|
57
|
-
task :default => :spec
|
data/VERSION.yml
DELETED
data/examples/hello-cli
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../lib/simplecli'
|
4
|
-
|
5
|
-
class Hello
|
6
|
-
include SimpleCLI
|
7
|
-
|
8
|
-
def usage
|
9
|
-
puts <<doco
|
10
|
-
|
11
|
-
Hello CLI
|
12
|
-
|
13
|
-
Usage:
|
14
|
-
#{ script_name } command [options]
|
15
|
-
|
16
|
-
Futher help:
|
17
|
-
#{ script_name } commands # list all available commands
|
18
|
-
#{ script_name } help <COMMAND> # show help for COMMAND
|
19
|
-
#{ script_name } help # show this help message
|
20
|
-
|
21
|
-
doco
|
22
|
-
end
|
23
|
-
|
24
|
-
def sayhello_help
|
25
|
-
<<doco
|
26
|
-
Usage: #{ script_name } sayhello [SAY]
|
27
|
-
|
28
|
-
Arguments:
|
29
|
-
SAY: Something to say (default 'Hello World!')
|
30
|
-
|
31
|
-
Summary:
|
32
|
-
Says hello!
|
33
|
-
doco
|
34
|
-
end
|
35
|
-
def sayhello *args
|
36
|
-
puts args.empty? ? "Hello World!" : args.join(' ')
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
# POSTAMBLE
|
42
|
-
if __FILE__ == $0
|
43
|
-
Hello.new( ARGV, :default => 'sayhello' ).run
|
44
|
-
end
|