coldshoulder 0.0.7 → 1.0.0
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 +4 -12
- data/lib/coldshoulder/generator.rb +1 -1
- data/lib/coldshoulder/version.rb +1 -1
- data/spec/commander_spec.rb +3 -3
- metadata +1 -1
data/bin/coldshoulder
CHANGED
@@ -4,23 +4,15 @@ module Coldshoulder
|
|
4
4
|
|
5
5
|
attr_accessor :command, :language
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
self.command =
|
9
|
-
self.language =
|
10
|
-
generate!
|
7
|
+
def initialize(arg_hash)
|
8
|
+
self.command = arg_hash[:command]
|
9
|
+
self.language = arg_hash[:language]
|
11
10
|
end
|
12
11
|
|
13
12
|
def generate!
|
14
|
-
|
13
|
+
Coldshoulder::Generator.new.build(self.language)
|
15
14
|
end
|
16
15
|
|
17
|
-
protected
|
18
|
-
|
19
|
-
def process
|
20
|
-
if self.command == "generate"
|
21
|
-
Coldshoulder::Generator.new.build(self.language)
|
22
|
-
end
|
23
|
-
end
|
24
16
|
end
|
25
17
|
|
26
18
|
end
|
@@ -16,7 +16,7 @@ module Coldshoulder
|
|
16
16
|
end
|
17
17
|
puts "Ignore file generated for language #{language}"
|
18
18
|
else
|
19
|
-
puts "The gitignore file could not be generated.
|
19
|
+
puts "The gitignore file could not be generated. Language #{language} not found"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/lib/coldshoulder/version.rb
CHANGED
data/spec/commander_spec.rb
CHANGED
@@ -3,18 +3,18 @@ require 'spec_helper'
|
|
3
3
|
describe Coldshoulder::Commander do
|
4
4
|
|
5
5
|
it 'takes in a command' do
|
6
|
-
Coldshoulder::Commander.new("generate"
|
6
|
+
Coldshoulder::Commander.new({:command => "generate",:language => "Python"}).command.should == "generate"
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'takes in a language' do
|
10
|
-
Coldshoulder::Commander.new("generate"
|
10
|
+
Coldshoulder::Commander.new({:command => "generate",:language => "Ruby"}).language.should == "Ruby"
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'drives the generation of a gitignore file' do
|
14
14
|
file = mock('file')
|
15
15
|
File.should_receive(:open).with(".gitignore", "w").and_yield(file)
|
16
16
|
file.should_receive(:write)
|
17
|
-
Coldshoulder::Commander.new("generate",
|
17
|
+
Coldshoulder::Commander.new({:command => "generate", :language => "Ruby"}).generate!
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|