sickle 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/README.md +4 -0
- data/Rakefile +1 -0
- data/circle.yml +3 -0
- data/lib/sickle.rb +7 -3
- data/lib/sickle/version.rb +1 -1
- data/sickle.gemspec +0 -1
- data/spec/main_spec.rb +5 -6
- data/spec/test_app.rb +2 -1
- metadata +4 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05f685b42a45b06451fd11b7942e8fdf01d9cb44
|
4
|
+
data.tar.gz: 03a7527ee840f4f63c557acb29f312beca1fefa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f17497ea2b1218b6546076232e3f68802c39c49e326b6e9f3a8757bd84baa45c638ed1a1fc0d3906173e33708591173efd8a7d934e70ae59835540833caeb86f
|
7
|
+
data.tar.gz: 8d4f3e33fd6a27a1552c01d451393fed9f0d64ce026871fa4ac4f42cf8613f0421942cb9751e008b462e17c5b939de6670c3765139d9428dfb8f41a1458fa227
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -18,6 +18,10 @@ Sickle is dead simple library for building complex command line tools. A lot of
|
|
18
18
|
* Usage and help for free
|
19
19
|
* No external dependencies (only stdlib optparse)
|
20
20
|
|
21
|
+
#### Requirements
|
22
|
+
|
23
|
+
* Ruby: 1.9.x, 2.0.x, jruby (1.9), rbx (1.9)
|
24
|
+
|
21
25
|
|
22
26
|
## Installation
|
23
27
|
|
data/Rakefile
CHANGED
data/circle.yml
ADDED
data/lib/sickle.rb
CHANGED
@@ -77,16 +77,20 @@ module Sickle
|
|
77
77
|
|
78
78
|
def register(parser, results)
|
79
79
|
if @type == :boolean
|
80
|
-
parser.on("--#{
|
80
|
+
parser.on("--#{cli_name}", opts[:desc]) do
|
81
81
|
results[@name] = true
|
82
82
|
end
|
83
83
|
else
|
84
|
-
parser.on("--#{
|
84
|
+
parser.on("--#{cli_name} #{@name.upcase}") do |v|
|
85
85
|
results[@name] = coerce(v)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
def cli_name
|
91
|
+
@name.to_s.tr("_", "-")
|
92
|
+
end
|
93
|
+
|
90
94
|
def coerce(value)
|
91
95
|
case @default
|
92
96
|
when Fixnum
|
@@ -174,7 +178,7 @@ module Sickle
|
|
174
178
|
end
|
175
179
|
|
176
180
|
def __display_option(opt)
|
177
|
-
" --#{opt.
|
181
|
+
" --#{opt.cli_name} (default: #{opt.default})"
|
178
182
|
end
|
179
183
|
end
|
180
184
|
|
data/lib/sickle/version.rb
CHANGED
data/sickle.gemspec
CHANGED
data/spec/main_spec.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
require "minitest/spec"
|
2
1
|
require "minitest/autorun"
|
3
|
-
require "
|
2
|
+
require "minitest/pride"
|
4
3
|
|
5
4
|
require File.join(File.dirname(__FILE__), "test_app")
|
6
5
|
|
@@ -24,7 +23,7 @@ describe Sickle do
|
|
24
23
|
end
|
25
24
|
|
26
25
|
it "correct commands options" do
|
27
|
-
App.__commands["task1"].options.keys.must_equal [:quiet]
|
26
|
+
App.__commands["task1"].options.keys.must_equal [:quiet, :with_prefix]
|
28
27
|
App.__commands["task2"].options.keys.must_equal [:fast, :slow, :number]
|
29
28
|
end
|
30
29
|
end
|
@@ -32,9 +31,9 @@ describe Sickle do
|
|
32
31
|
describe "Runner" do
|
33
32
|
it "task1" do
|
34
33
|
App.run(["task1", "x", "y"]).must_equal(
|
35
|
-
["task1", "x", "y", "def", false, false, false])
|
36
|
-
App.run(["task1", "x", "y", "z", "--verbose"]).must_equal(
|
37
|
-
["task1", "x", "y", "z", false, true, false])
|
34
|
+
["task1", "x", "y", "def", false, false, false, false])
|
35
|
+
App.run(["task1", "x", "y", "z", "--verbose", "--with-prefix"]).must_equal(
|
36
|
+
["task1", "x", "y", "z", false, true, false, true])
|
38
37
|
end
|
39
38
|
|
40
39
|
it "task2" do
|
data/spec/test_app.rb
CHANGED
@@ -50,8 +50,9 @@ class App
|
|
50
50
|
|
51
51
|
desc "Run task 1"
|
52
52
|
option :quiet
|
53
|
+
option :with_prefix
|
53
54
|
def task1(a, b, c = "def")
|
54
|
-
p ["task1", a, b, c, options[:quiet], options[:verbose], options[:debug]]
|
55
|
+
p ["task1", a, b, c, options[:quiet], options[:verbose], options[:debug], options[:with_prefix]]
|
55
56
|
end
|
56
57
|
|
57
58
|
desc "Run task 2"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sickle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tymon Tobolski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: turn
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
description: Sickle is dead simple library for building complex command line tools.
|
70
56
|
email:
|
71
57
|
- i@teamon.eu
|
@@ -79,6 +65,7 @@ files:
|
|
79
65
|
- LICENSE.txt
|
80
66
|
- README.md
|
81
67
|
- Rakefile
|
68
|
+
- circle.yml
|
82
69
|
- lib/sickle.rb
|
83
70
|
- lib/sickle/version.rb
|
84
71
|
- sickle.gemspec
|
@@ -113,3 +100,4 @@ test_files:
|
|
113
100
|
- spec/main_spec.rb
|
114
101
|
- spec/test_app.rb
|
115
102
|
- spec/test_run.rb
|
103
|
+
has_rdoc:
|