coldshoulder 1.1.4 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,13 +1,13 @@
1
+ #
2
+ # Generated using coldshoulder v1.1.2 - github.com/bryanmikaelian/coldshoulder
3
+ #
4
+
1
5
  *.gem
2
6
  *.rbc
3
7
  .bundle
4
8
  .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
9
  coverage
10
- doc/
10
+ InstalledFiles
11
11
  lib/bundler/man
12
12
  pkg
13
13
  rdoc
@@ -15,4 +15,12 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ Gemfile.lock
19
+
20
+ # YARD artifacts
21
+ .yardoc
22
+ _yardoc
23
+ doc/
24
+
25
+ # Rspec
18
26
  .rspec
data/bin/coldshoulder CHANGED
@@ -2,4 +2,5 @@
2
2
 
3
3
  require 'coldshoulder'
4
4
 
5
- Coldshoulder::Commander.new({:command => ARGV[0], :language => ARGV[1], :optional => ARGV[2]})
5
+ # Coldshoulder::Commander.new({:command => ARGV[0], :language => ARGV[1], :optional => ARGV[2]})
6
+ Coldshoulder::Director.new(ARGV).direct!
@@ -0,0 +1,55 @@
1
+ module Coldshoulder
2
+
3
+ class Director
4
+
5
+ attr_accessor :args
6
+
7
+ def initialize(args)
8
+ self.args = args
9
+ end
10
+
11
+ def direct!
12
+ run!
13
+ end
14
+
15
+ def opts
16
+ opts = OptionParser.new do |opts|
17
+ opts.banner = "Usage: coldshoulder [options] [template name]"
18
+ opts.separator ""
19
+ opts.separator "Commands: "
20
+
21
+ opts.on_tail("-v", "--version", "Display the version") do
22
+ Coldshoulder::Display.message "Current version: #{Coldshoulder::VERSION}"
23
+ end
24
+
25
+ opts.on_tail("-h", "--help", "Displays this message") do
26
+ Coldshoulder::Display.message opts
27
+ end
28
+ end
29
+ end
30
+
31
+ def parse!
32
+ opts.parse!(arguements)
33
+ end
34
+
35
+ protected
36
+
37
+ def run!
38
+ command = args.shift
39
+ case command
40
+ when "generate"
41
+ language = args.shift
42
+ Coldshoulder::Generator.new.build(language)
43
+ when nil
44
+ command = "--help"
45
+ end
46
+ begin
47
+ opts.parse!([command])
48
+ rescue OptionParser::ParseError => e
49
+ puts "Error: #{e.message}"
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ end
@@ -0,0 +1,9 @@
1
+ module Coldshoulder
2
+ module Display
3
+
4
+ def self.message(message)
5
+ puts message
6
+ end
7
+
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Coldshoulder
2
- VERSION = "1.1.4"
2
+ VERSION = "1.2.1"
3
3
  end
data/lib/coldshoulder.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "coldshoulder/version"
2
2
  require 'coldshoulder/generator'
3
- require 'coldshoulder/commander'
3
+ require 'coldshoulder/director'
4
+ require 'coldshoulder/display'
4
5
  require 'optparse'
5
6
 
6
7
  module Coldshoulder
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coldshoulder::Director do
4
+ before :each do
5
+ @arguements = ["-v", "generate"]
6
+ end
7
+
8
+ it 'takes in the ARGV values' do
9
+ Coldshoulder::Director.new(@arguements).args.should == @arguements
10
+ end
11
+
12
+ it 'can display the version' do
13
+ Coldshoulder::Display.should_receive(:message).with("Current version: #{Coldshoulder::VERSION}")
14
+ Coldshoulder::Director.new(["-v", "--version"]).direct!
15
+ end
16
+
17
+ it 'can display the help' do
18
+ Coldshoulder::Display.should_receive(:message)
19
+ Coldshoulder::Director.new(["-h", "--help"]).direct!
20
+ end
21
+
22
+ it 'drives the generation of a gitignore file' do
23
+ file = mock('file')
24
+ File.should_receive(:open).with(".gitignore", "w").and_yield(file)
25
+ file.should_receive(:write)
26
+ Coldshoulder::Director.new(["generate", "Ruby"]).direct!
27
+ end
28
+
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coldshoulder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.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: 2012-08-15 00:00:00.000000000 Z
12
+ date: 2012-08-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Generate gitignore files with ease.
15
15
  email:
@@ -27,10 +27,11 @@ files:
27
27
  - bin/coldshoulder
28
28
  - coldshoulder.gemspec
29
29
  - lib/coldshoulder.rb
30
- - lib/coldshoulder/commander.rb
30
+ - lib/coldshoulder/director.rb
31
+ - lib/coldshoulder/display.rb
31
32
  - lib/coldshoulder/generator.rb
32
33
  - lib/coldshoulder/version.rb
33
- - spec/commander_spec.rb
34
+ - spec/director_spec.rb
34
35
  - spec/generator_spec.rb
35
36
  - spec/spec_helper.rb
36
37
  homepage: http://bryanmikaelian.github.com/coldshoulder/
@@ -53,12 +54,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  version: '0'
54
55
  requirements: []
55
56
  rubyforge_project:
56
- rubygems_version: 1.8.24
57
+ rubygems_version: 1.8.23
57
58
  signing_key:
58
59
  specification_version: 3
59
60
  summary: Written in Ruby, coldshoulder is a command line tool that will let you easily
60
61
  generate a gitignore file.
61
62
  test_files:
62
- - spec/commander_spec.rb
63
+ - spec/director_spec.rb
63
64
  - spec/generator_spec.rb
64
65
  - spec/spec_helper.rb
@@ -1,48 +0,0 @@
1
- module Coldshoulder
2
-
3
- class Commander
4
-
5
- attr_accessor :command, :language, :optional
6
-
7
- def initialize(arg_hash)
8
- self.language = arg_hash[:language]
9
- self.command = arg_hash[:command]
10
- self.optional = arg_hash[:optional]
11
- parse!([self.command, self.optional])
12
- end
13
-
14
- def parse!(commands)
15
- options = {}
16
- if self.command == "generate"
17
- generate!
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
31
- end
32
- end
33
- opts.parse!(commands)
34
- rescue OptionParser::ParseError => e
35
- puts "Error: #{e.message}"
36
- end
37
- end
38
-
39
-
40
- protected
41
-
42
- def generate!
43
- Coldshoulder::Generator.new.build(self.language)
44
- end
45
-
46
- end
47
-
48
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Coldshoulder::Commander do
4
-
5
- it 'takes in a command' do
6
- Coldshoulder::Commander.new({:command => "generate",:language => "Python"}).command.should == "generate"
7
- end
8
-
9
- it 'takes in a language' do
10
- Coldshoulder::Commander.new({:command => "generate",:language => "Ruby"}).language.should == "Ruby"
11
- end
12
-
13
- it 'drives the generation of a gitignore file' do
14
- file = mock('file')
15
- File.should_receive(:open).with(".gitignore", "w").and_yield(file)
16
- file.should_receive(:write)
17
- Coldshoulder::Commander.new({:command => "generate", :language => "Ruby"})
18
- end
19
-
20
- it 'will not generate a gitingore file if generate is not specified' do
21
- Coldshoulder::Generator.should_not_receive(:build)
22
- Coldshoulder::Commander.new({:command => "-v", :language => "Ruby"})
23
- end
24
-
25
- end