coldshoulder 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/coldshoulder +1 -1
- data/lib/coldshoulder/commander.rb +19 -23
- data/lib/coldshoulder/version.rb +1 -1
- data/spec/commander_spec.rb +1 -2
- metadata +1 -1
data/bin/coldshoulder
CHANGED
@@ -2,41 +2,37 @@ module Coldshoulder
|
|
2
2
|
|
3
3
|
class Commander
|
4
4
|
|
5
|
-
attr_accessor :command, :language
|
5
|
+
attr_accessor :command, :language, :optional
|
6
6
|
|
7
7
|
def initialize(arg_hash)
|
8
8
|
self.language = arg_hash[:language]
|
9
9
|
self.command = arg_hash[:command]
|
10
|
-
|
11
|
-
|
12
|
-
else
|
13
|
-
parse!([self.command])
|
14
|
-
end
|
10
|
+
self.optional = arg_hash[:optional]
|
11
|
+
parse!([self.command, self.optional])
|
15
12
|
end
|
16
13
|
|
17
14
|
def parse!(commands)
|
18
15
|
options = {}
|
19
16
|
if self.command == "generate"
|
20
17
|
generate!
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
18
|
+
end
|
19
|
+
begin
|
20
|
+
opts = OptionParser.new do |opts|
|
21
|
+
opts.banner = "Usage: coldshoulder [options] [template name]"
|
22
|
+
opts.separator ""
|
23
|
+
opts.separator "Commands: "
|
24
|
+
|
25
|
+
opts.on_tail("-v", "--version", "Display the version") do
|
26
|
+
puts "Current version: #{Coldshoulder::VERSION}"
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on_tail("-h", "--help", "Displays this message") do
|
30
|
+
puts opts
|
35
31
|
end
|
36
|
-
opts.parse!(commands)
|
37
|
-
rescue OptionParser::ParseError => e
|
38
|
-
puts "Error: #{e.message}"
|
39
32
|
end
|
33
|
+
opts.parse!(commands)
|
34
|
+
rescue OptionParser::ParseError => e
|
35
|
+
puts "Error: #{e.message}"
|
40
36
|
end
|
41
37
|
end
|
42
38
|
|
data/lib/coldshoulder/version.rb
CHANGED
data/spec/commander_spec.rb
CHANGED
@@ -17,10 +17,9 @@ describe Coldshoulder::Commander do
|
|
17
17
|
Coldshoulder::Commander.new({:command => "generate", :language => "Ruby"})
|
18
18
|
end
|
19
19
|
|
20
|
-
it '
|
20
|
+
it 'will not generate a gitingore file if generate is not specified' do
|
21
21
|
Coldshoulder::Generator.should_not_receive(:build)
|
22
22
|
Coldshoulder::Commander.new({:command => "-v", :language => "Ruby"})
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
25
|
end
|