tg_cli 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tg_cli/version.rb +1 -1
- data/spec/lib/tg_cli/base_spec.rb +10 -8
- data/spec/lib/tg_cli/group_base_spec.rb +4 -2
- data/spec/lib/tg_cli/main_spec.rb +26 -24
- data/spec/spec_helper.rb +0 -1
- metadata +19 -26
data/lib/tg_cli/version.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
module TgCli
|
4
|
+
describe Base do
|
4
5
|
|
5
|
-
|
6
|
+
subject { Base }
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
context "extracting a name from a usage string" do
|
9
|
+
it "should extract properly" do
|
10
|
+
subject.send(:extract_name_from_usage, "init").should == "init"
|
11
|
+
subject.send(:extract_name_from_usage, "init [foo] [bar]").should == "init"
|
12
|
+
subject.send(:extract_name_from_usage, "init <foo> [bar]").should == "init"
|
13
|
+
subject.send(:extract_name_from_usage, "ssh-config").should == "ssh-config"
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,35 +1,37 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
module TgCli
|
4
|
+
describe Main do
|
5
|
+
subject { Main }
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
context "#registering" do
|
8
|
+
it {should respond_to :register }
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
it "should register a base command as a single invokable" do
|
11
|
+
base = Class.new(Base)
|
12
|
+
name = "__test_registering_single_subcommand"
|
13
|
+
subject.register(base, name, name, "A description")
|
14
|
+
expect { subject.tasks[name] }.should_not raise_error
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
it "should register a group base as a subcommand" do
|
18
|
+
base = Class.new(GroupBase)
|
19
|
+
name = "_test_registering_single_group"
|
20
|
+
subject.register(base, name, name, "A description")
|
21
|
+
subject.subcommands.should include(name)
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
it "should alias methods if the alias option is given" do
|
25
|
+
base = Class.new(Base) do
|
26
|
+
def execute
|
27
|
+
true
|
28
|
+
end
|
27
29
|
end
|
28
|
-
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
name = "__test_registering_with_alias"
|
32
|
+
subject.register(base, name, name, "A description", :alias => "--ALIAS")
|
33
|
+
subject.start(["--ALIAS"]).should be_true
|
34
|
+
end
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tg_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &6153820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *6153820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &6153100 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.14.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *6153100
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: guard
|
38
|
-
requirement: &
|
38
|
+
requirement: &6151320 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.8.4
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *6151320
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard-bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &6150840 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.1.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *6150840
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard-rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &6150340 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.4.5
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *6150340
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yard
|
71
|
-
requirement: &
|
71
|
+
requirement: &6149500 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.7.2
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *6149500
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &6129500 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 2.6.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *6129500
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: mocha
|
93
|
-
requirement: &
|
93
|
+
requirement: &6109560 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 0.10.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *6109560
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: pry
|
104
|
-
requirement: &
|
104
|
+
requirement: &6108700 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: 0.9.6.2
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *6108700
|
113
113
|
description: Helpers around Thor extracted from the Vagrant gem.
|
114
114
|
email:
|
115
115
|
- wael.nasreddine@gmail.com
|
@@ -146,18 +146,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- - ! '>='
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
|
-
segments:
|
150
|
-
- 0
|
151
|
-
hash: 4598389211369895346
|
152
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
150
|
none: false
|
154
151
|
requirements:
|
155
152
|
- - ! '>='
|
156
153
|
- !ruby/object:Gem::Version
|
157
154
|
version: '0'
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
hash: 4598389211369895346
|
161
155
|
requirements: []
|
162
156
|
rubyforge_project:
|
163
157
|
rubygems_version: 1.8.11
|
@@ -169,4 +163,3 @@ test_files:
|
|
169
163
|
- spec/lib/tg_cli/group_base_spec.rb
|
170
164
|
- spec/lib/tg_cli/main_spec.rb
|
171
165
|
- spec/spec_helper.rb
|
172
|
-
has_rdoc:
|