martin 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +54 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/martin/base.rb +0 -2
- data/martin.gemspec +6 -3
- metadata +17 -6
- data/README.rdoc +0 -45
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Martin
|
2
|
+
|
3
|
+
An ode to the Rat Pack (Dean Martin) with a Sinatra style DSL for creating command line interfaces to your applications
|
4
|
+
|
5
|
+
## Example
|
6
|
+
|
7
|
+
### `calc.rb`
|
8
|
+
|
9
|
+
class Calculator
|
10
|
+
def add(*nums)
|
11
|
+
nums.reduce(:+)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
### `app.rb`
|
16
|
+
|
17
|
+
require File.dirname(__FILE__) + '/calc'
|
18
|
+
require 'martin'
|
19
|
+
|
20
|
+
configure do
|
21
|
+
@calc = Calculator.new
|
22
|
+
end
|
23
|
+
|
24
|
+
command /add (\d+) to (\d+)/ do |a, b|
|
25
|
+
puts @calc.add(a.to_i, b.to_i)
|
26
|
+
end
|
27
|
+
|
28
|
+
error do |input|
|
29
|
+
puts 'Error: command ' + input.split.first + ' not found.'
|
30
|
+
end
|
31
|
+
|
32
|
+
And that's it! Now run `ruby app add 15 to 25` and the application
|
33
|
+
should return `40`
|
34
|
+
|
35
|
+
This works great coupled with [highline][1]
|
36
|
+
[Rubular][2] is a great place to test your regular expressions
|
37
|
+
|
38
|
+
## Note on Patches/Pull Requests
|
39
|
+
|
40
|
+
* Fork the project.
|
41
|
+
* Make your feature addition or bug fix.
|
42
|
+
* Add tests for it. This is important so I don't break it in a
|
43
|
+
future version unintentionally.
|
44
|
+
* Commit, do not mess with rakefile, version, or history.
|
45
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
46
|
+
* Send me a pull request. Bonus points for topic branches.
|
47
|
+
|
48
|
+
## Copyright
|
49
|
+
|
50
|
+
Copyright (c) 2010 Ryan Lewis. See LICENSE for details.
|
51
|
+
|
52
|
+
|
53
|
+
[1]: http://github.com/JEG2/highline "highline"
|
54
|
+
[2]: http://rubular.com/ "rubular"
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
gem.email = "c00lryguy@gmail.com"
|
13
13
|
gem.homepage = "http://github.com/c00lryguy/martin"
|
14
14
|
gem.authors = ["Ryan Lewis"]
|
15
|
-
|
15
|
+
gem.add_development_dependency "shoulda", ">= 0"
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
17
|
end
|
18
18
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/martin/base.rb
CHANGED
data/martin.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{martin}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ryan Lewis"]
|
@@ -14,13 +14,13 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.email = %q{c00lryguy@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
"README.
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
22
|
"LICENSE",
|
23
|
-
"README.
|
23
|
+
"README.md",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
26
|
"lib/martin.rb",
|
@@ -46,9 +46,12 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.specification_version = 3
|
47
47
|
|
48
48
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
49
50
|
else
|
51
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
50
52
|
end
|
51
53
|
else
|
54
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
52
55
|
end
|
53
56
|
end
|
54
57
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ryan Lewis
|
@@ -16,8 +16,19 @@ cert_chain: []
|
|
16
16
|
|
17
17
|
date: 2010-04-17 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: shoulda
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :development
|
31
|
+
version_requirements: *id001
|
21
32
|
description: An ode to the Rat Pack (Dean Martin) with a Sinatra style DSL for creating command line interfaces to your applications
|
22
33
|
email: c00lryguy@gmail.com
|
23
34
|
executables: []
|
@@ -26,12 +37,12 @@ extensions: []
|
|
26
37
|
|
27
38
|
extra_rdoc_files:
|
28
39
|
- LICENSE
|
29
|
-
- README.
|
40
|
+
- README.md
|
30
41
|
files:
|
31
42
|
- .document
|
32
43
|
- .gitignore
|
33
44
|
- LICENSE
|
34
|
-
- README.
|
45
|
+
- README.md
|
35
46
|
- Rakefile
|
36
47
|
- VERSION
|
37
48
|
- lib/martin.rb
|
data/README.rdoc
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
= Martin
|
2
|
-
|
3
|
-
An ode to the Rat Pack (Dean Martin) with a Sinatra style DSL for creating command line interfaces to your applications
|
4
|
-
|
5
|
-
== Example
|
6
|
-
|
7
|
-
calc.rb
|
8
|
-
class Calculator
|
9
|
-
def add(*nums)
|
10
|
-
nums.reduce(:+)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
app.rb
|
15
|
-
require File.dirname(__FILE__) + 'calc'
|
16
|
-
require 'martin'
|
17
|
-
|
18
|
-
configure do
|
19
|
-
@calc = Calculator.new
|
20
|
-
end
|
21
|
-
|
22
|
-
command /add (\d+) to (\d+)/ do |a, b|
|
23
|
-
puts @calc.add(a.to_i, b.to_i)
|
24
|
-
end
|
25
|
-
|
26
|
-
error do |input|
|
27
|
-
puts 'Error: command ' + input.split.first + ' not found.'
|
28
|
-
end
|
29
|
-
|
30
|
-
And that's it! Now run `ruby app add 15 to 25` and the application
|
31
|
-
should return `40`
|
32
|
-
|
33
|
-
== Note on Patches/Pull Requests
|
34
|
-
|
35
|
-
* Fork the project.
|
36
|
-
* Make your feature addition or bug fix.
|
37
|
-
* Add tests for it. This is important so I don't break it in a
|
38
|
-
future version unintentionally.
|
39
|
-
* Commit, do not mess with rakefile, version, or history.
|
40
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
41
|
-
* Send me a pull request. Bonus points for topic branches.
|
42
|
-
|
43
|
-
== Copyright
|
44
|
-
|
45
|
-
Copyright (c) 2010 Ryan Lewis. See LICENSE for details.
|