taco_it 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/taco +23 -76
  2. data/lib/taco/commander.rb +31 -0
  3. metadata +3 -2
data/bin/taco CHANGED
@@ -9,10 +9,10 @@ rescue TacoRc::ParseError => e
9
9
  exit 1
10
10
  end
11
11
 
12
- require 'commander/import'
12
+ require 'taco/commander/import'
13
13
 
14
14
  program :name, 'taco'
15
- program :version, '1.5.0'
15
+ program :version, '1.5.1'
16
16
  program :description, 'simple command line issue tracking'
17
17
 
18
18
  command :init do |c|
@@ -20,14 +20,7 @@ command :init do |c|
20
20
  c.summary = 'initialize a taco repo in the current directory'
21
21
  c.description = 'Initialize a taco Issue repository in the current working directory'
22
22
  c.action do |args, options|
23
- begin
24
- # FIXME: merge this kind of thing into commander: tell it how many arguments we expect.
25
- raise ArgumentError.new("Unexpected arguments: #{args.join(', ')}") unless args.size == 0
26
- puts cli.init!
27
- rescue Exception => e
28
- puts "Error: #{e}"
29
- exit 1
30
- end
23
+ puts cli.init!
31
24
  end
32
25
  end
33
26
 
@@ -40,17 +33,10 @@ command :list do |c|
40
33
 
41
34
  c.example 'Sort Issues by Priority, Owner, and Kind', 'taco list --sort priority,owner,kind'
42
35
 
36
+ c.arguments lambda { |args| args.all? { |arg| arg =~ /\w+:\w+/ } }
37
+
43
38
  c.action do |args, options|
44
- begin
45
- # FIXME: merge this kind of thing into commander: tell it how many arguments we expect.
46
- unless args.all? { |arg| arg =~ /\w+:\w+/ }
47
- raise ArgumentError.new("Unexpected arguments: #{args.join(', ')}")
48
- end
49
- puts cli.list args, :sort => options.sort
50
- rescue Exception => e
51
- puts "Error: #{e}"
52
- exit 1
53
- end
39
+ puts cli.list args, :sort => options.sort
54
40
  end
55
41
  end
56
42
 
@@ -63,19 +49,13 @@ command :new do |c|
63
49
 
64
50
  c.option '--retry', nil, 'retry a failed Issue creation'
65
51
 
52
+ c.arguments lambda { |args| args.size <= 1 }
53
+
66
54
  c.action do |args, options|
67
55
  begin
68
- # FIXME: merge this kind of thing into commander: tell it how many arguments we expect.
69
- raise ArgumentError.new("Unexpected arguments: #{args.join(', ')}") if args.size > 1
70
-
71
- begin
72
- puts cli.new! args, { :retry => options.retry }
73
- rescue Issue::Invalid => e
74
- raise Issue::Invalid.new("#{e.to_s}.\nYou can use the --retry option to correct this error.")
75
- end
76
- rescue Exception => e
77
- puts "Error: #{e}"
78
- exit 1
56
+ puts cli.new! args, { :retry => options.retry }
57
+ rescue Issue::Invalid => e
58
+ raise Issue::Invalid.new("#{e.to_s}.\nYou can use the --retry option to correct this error.")
79
59
  end
80
60
  end
81
61
  end
@@ -94,13 +74,10 @@ command :show do |c|
94
74
  c.option '--changelog', nil, 'shows the changelog'
95
75
  c.option '--all', nil, 'show all Issues'
96
76
 
77
+ c.arguments lambda { |args| true } # argument validation (matching arguments to issues) will be done inside cli.show
78
+
97
79
  c.action do |args, options|
98
- begin
99
- puts cli.show args, { :changelog => options.changelog, :all => options.all }
100
- rescue Exception => e
101
- puts "Error: #{e}"
102
- exit 1
103
- end
80
+ puts cli.show args, { :changelog => options.changelog, :all => options.all }
104
81
  end
105
82
  end
106
83
 
@@ -111,20 +88,14 @@ command :edit do |c|
111
88
 
112
89
  c.option '--retry', nil, 'retry a failed Issue edit'
113
90
 
91
+ c.arguments lambda { |args| args.size == 1 }
92
+
114
93
  c.action do |args, options|
115
94
  begin
116
- # FIXME: merge this kind of thing into commander: tell it how many arguments we expect.
117
- raise ArgumentError.new("Unexpected arguments: #{args.join(', ')}") unless args.size == 1
118
-
119
- begin
120
- puts cli.edit! args, { :retry => options.retry }
121
- rescue Issue::Invalid => e
122
- raise Issue::Invalid.new("#{e.to_s}.\nYou can use the --retry option to correct this error.")
123
- end
124
- rescue Exception => e
125
- puts "Error: #{e}"
126
- exit 1
127
- end
95
+ puts cli.edit! args, { :retry => options.retry }
96
+ rescue Issue::Invalid => e
97
+ raise Issue::Invalid.new("#{e.to_s}.\nYou can use the --retry option to correct this error.")
98
+ end
128
99
  end
129
100
  end
130
101
 
@@ -136,15 +107,7 @@ command :template do |c|
136
107
  c.option '--defaults', nil, 'Print the Issue template with default values'
137
108
 
138
109
  c.action do |args, options|
139
- begin
140
- # FIXME: merge this kind of thing into commander: tell it how many arguments we expect.
141
- raise ArgumentError.new("Unexpected arguments: #{args.join(', ')}") unless args.size == 0
142
-
143
- puts cli.template({ :defaults => options.defaults })
144
- rescue Exception => e
145
- puts "Error: #{e}"
146
- exit 1
147
- end
110
+ puts cli.template({ :defaults => options.defaults })
148
111
  end
149
112
  end
150
113
 
@@ -154,15 +117,7 @@ command :html do |c|
154
117
  c.description = 'Generate an HTML buglist from index.html.erb'
155
118
 
156
119
  c.action do |args, options|
157
- begin
158
- # FIXME: merge this kind of thing into commander: tell it how many arguments we expect.
159
- raise ArgumentError.new("Unexpected arguments: #{args.join(', ')}") unless args.size == 0
160
-
161
- puts cli.html
162
- rescue Exception => e
163
- puts "Error: #{e}"
164
- exit 1
165
- end
120
+ puts cli.html
166
121
  end
167
122
  end
168
123
 
@@ -174,14 +129,6 @@ command :push do |c|
174
129
  c.option '--message STRING', String, 'Override the default commit message.'
175
130
 
176
131
  c.action do |args, options|
177
- begin
178
- # FIXME: merge this kind of thing into commander: tell it how many arguments we expect.
179
- raise ArgumentError.new("Unexpected arguments: #{args.join(', ')}") unless args.size == 0
180
-
181
- puts cli.push({ :message => options.message })
182
- rescue Exception => e
183
- puts "Error: #{e}"
184
- exit 1
185
- end
132
+ puts cli.push({ :message => options.message })
186
133
  end
187
134
  end
@@ -0,0 +1,31 @@
1
+ #--
2
+ # Copyright (c) 2008-2009 TJ Holowaychuk <tj@vision-media.ca>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following 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 OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ require 'highline/import'
25
+ require 'taco/commander/version'
26
+ require 'taco/commander/blank'
27
+ require 'taco/commander/core_ext'
28
+ require 'taco/commander/runner'
29
+ require 'taco/commander/command'
30
+ require 'taco/commander/help_formatters'
31
+ require 'taco/commander/platform'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taco_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-01 00:00:00.000000000 Z
12
+ date: 2013-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
@@ -38,6 +38,7 @@ files:
38
38
  - lib/taco.rb
39
39
  - lib/taco/change.rb
40
40
  - lib/taco/cli.rb
41
+ - lib/taco/commander.rb
41
42
  - lib/taco/issue.rb
42
43
  - lib/taco/schema.rb
43
44
  - lib/taco/taco.rb