blazing 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  #
8
8
  # TODO: Remove Config.repository in 0.3
9
9
  #
10
- s.version = '0.2.12'
10
+ s.version = '0.2.13'
11
11
 
12
12
  s.authors = ["Felipe Kaufmann"]
13
13
  s.email = ["felipekaufmann@gmail.com"]
@@ -1,3 +1,5 @@
1
+ require 'erb'
2
+
1
3
  module Blazing
2
4
  class Commands
3
5
 
@@ -5,7 +7,7 @@ module Blazing
5
7
 
6
8
  class << self
7
9
  def run(command, options = {})
8
- self.new(options).send(command)
10
+ self.new(options.merge({ :command => command })).send(command)
9
11
  end
10
12
  end
11
13
 
@@ -14,14 +16,14 @@ module Blazing
14
16
 
15
17
  @target_name = options[:target_name]
16
18
  @config_file = options[:file]
19
+ @command = options[:command]
20
+ @targets = []
17
21
 
18
- @config ||= Config.parse(@config_file)
19
- @targets = determine_targets
20
-
21
- error 'no target given or found' if @targets.empty?
22
-
23
- # TODO: better exception handling, like this?
24
- #raise RuntimeError if @targets.empty?
22
+ if command_requires_config?
23
+ @config ||= Config.parse(@config_file)
24
+ @targets = determine_targets
25
+ error 'no target given or found' if @targets.empty?
26
+ end
25
27
  end
26
28
 
27
29
  def init
@@ -68,5 +70,10 @@ module Blazing
68
70
  targets.compact
69
71
  end
70
72
  end
73
+
74
+ def command_requires_config?
75
+ [:setup, :update, :recipes].include? @command
76
+ end
71
77
  end
72
78
  end
79
+
@@ -31,22 +31,27 @@ module Blazing
31
31
  end
32
32
 
33
33
  describe '.new' do
34
- it 'reads to config file' do
34
+ it 'reads the config file when the command requires it' do
35
35
  Config.should_receive(:parse).and_return(config)
36
- commands.new
36
+ commands.new(:command => :setup)
37
+ end
38
+
39
+ it 'does not read the config file when the command does not need it' do
40
+ Config.should_not_receive(:parse)
41
+ commands.new(:command => :init)
37
42
  end
38
43
  end
39
44
 
40
45
  describe '#run' do
41
46
  it 'creates an instance of itself' do
42
47
  commands_instance.stub!(:dummy_command)
43
- commands.should_receive(:new).with({}).and_return(commands_instance)
48
+ commands.should_receive(:new).with({ :command => :dummy_command }).and_return(commands_instance)
44
49
  commands.run(:dummy_command)
45
50
  end
46
51
 
47
52
  it 'runs the specified command' do
48
53
  commands_instance.should_receive(:dummy_command)
49
- commands.stub(:new).with({}).and_return(commands_instance)
54
+ commands.stub(:new).with({ :command => :dummy_command }).and_return(commands_instance)
50
55
  commands.run(:dummy_command)
51
56
  end
52
57
 
@@ -91,7 +96,7 @@ module Blazing
91
96
 
92
97
  it 'runs the update command' do
93
98
  commands_instance.should_receive(:update)
94
- commands.stub(:new).with({}).and_return(commands_instance)
99
+ commands.stub(:new).and_return(commands_instance)
95
100
  commands.run(:setup)
96
101
  end
97
102
  end
@@ -1,11 +1,12 @@
1
1
  require 'spec_helper'
2
2
  require 'blazing/config'
3
+ require 'blazing/commands'
3
4
 
4
5
  describe '$ blazing init' do
5
6
 
6
7
  before :each do
7
8
  setup_sandbox
8
- Blazing::Commands.new(:file => File.join(File.dirname(__FILE__), '../../support/empty_config.rb')).init
9
+ Blazing::Commands.new.init
9
10
  end
10
11
 
11
12
  after :each do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blazing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-11 00:00:00.000000000 Z
12
+ date: 2012-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
16
- requirement: &70361051961640 !ruby/object:Gem::Requirement
16
+ requirement: &70334195772180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70361051961640
24
+ version_requirements: *70334195772180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70361051959700 !ruby/object:Gem::Requirement
27
+ requirement: &70334195770720 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70361051959700
35
+ version_requirements: *70334195770720
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70361051985760 !ruby/object:Gem::Requirement
38
+ requirement: &70334195769240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70361051985760
46
+ version_requirements: *70334195769240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &70361051982840 !ruby/object:Gem::Requirement
49
+ requirement: &70334195767520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70361051982840
57
+ version_requirements: *70334195767520
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-rspec
60
- requirement: &70361051981860 !ruby/object:Gem::Requirement
60
+ requirement: &70334200036880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70361051981860
68
+ version_requirements: *70334200036880
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ruby_gntp
71
- requirement: &70361051979820 !ruby/object:Gem::Requirement
71
+ requirement: &70334200034600 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70361051979820
79
+ version_requirements: *70334200034600
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rb-fsevent
82
- requirement: &70361051994320 !ruby/object:Gem::Requirement
82
+ requirement: &70334200032160 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70361051994320
90
+ version_requirements: *70334200032160
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: pry
93
- requirement: &70361051993500 !ruby/object:Gem::Requirement
93
+ requirement: &70334200058200 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70361051993500
101
+ version_requirements: *70334200058200
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: pimpmychangelog
104
- requirement: &70361051988240 !ruby/object:Gem::Requirement
104
+ requirement: &70334200056220 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70361051988240
112
+ version_requirements: *70334200056220
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: grit
115
- requirement: &70361052002100 !ruby/object:Gem::Requirement
115
+ requirement: &70334200055360 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70361052002100
123
+ version_requirements: *70334200055360
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: logging
126
- requirement: &70361051997480 !ruby/object:Gem::Requirement
126
+ requirement: &70334200053920 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *70361051997480
134
+ version_requirements: *70334200053920
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: thor
137
- requirement: &70361051995020 !ruby/object:Gem::Requirement
137
+ requirement: &70334200051800 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *70361051995020
145
+ version_requirements: *70334200051800
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: activesupport
148
- requirement: &70361052010500 !ruby/object:Gem::Requirement
148
+ requirement: &70334200066260 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :runtime
155
155
  prerelease: false
156
- version_requirements: *70361052010500
156
+ version_requirements: *70334200066260
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: i18n
159
- requirement: &70361052009800 !ruby/object:Gem::Requirement
159
+ requirement: &70334200064180 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: '0'
165
165
  type: :runtime
166
166
  prerelease: false
167
- version_requirements: *70361052009800
167
+ version_requirements: *70334200064180
168
168
  description: painless git push deployments for everyone
169
169
  email:
170
170
  - felipekaufmann@gmail.com