blazing 0.1.0.alpha3 → 0.1.0.alpha4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blazing (0.1.0.alpha3)
4
+ blazing (0.1.0.alpha4)
5
5
  activesupport
6
6
  grit
7
7
  i18n
data/README.md CHANGED
@@ -81,6 +81,6 @@ Felipe Kaufmann ([@effkay][])
81
81
 
82
82
  ## License
83
83
 
84
- See the `MIT-LICENSE` file
84
+ See the [MIT-LICENSE file](https://github.com/effkay/blazing/blob/master/MIT-LICENCE)
85
85
 
86
86
  [@effkay]: https://github.com/effkay
@@ -7,7 +7,7 @@ class Blazing::Config
7
7
  extend Blazing::DSLSetter
8
8
 
9
9
  attr_reader :file
10
- attr_accessor :targets
10
+ attr_accessor :targets, :recipes
11
11
  dsl_setter :repository, :rvm, :rake
12
12
 
13
13
  class << self
@@ -32,14 +32,8 @@ class Blazing::Config
32
32
  targets << Blazing::Target.new(name, location, self, options)
33
33
  end
34
34
 
35
- def recipes(recipes = nil)
36
- if recipes.kind_of? Symbol
37
- @recipes << Blazing::Recipe.init_by_name(recipes)
38
- elsif recipes.kind_of? Array
39
- @recipes = recipes.map { |r| Blazing::Recipe.init_by_name(r) }
40
- else
41
- @recipes
42
- end
35
+ def recipe(name, options = {})
36
+ @recipes << Blazing::Recipe.init_by_name(name, options)
43
37
  end
44
38
 
45
39
  def default_target
@@ -2,10 +2,24 @@ require 'active_support/inflector'
2
2
 
3
3
  class Blazing::Recipe
4
4
 
5
+ attr_reader :options
6
+
7
+ def initialize(options = {})
8
+ @options = options
9
+ end
10
+
5
11
  class << self
6
12
 
7
- def init_by_name(name)
8
- "Blazing::Recipe::#{name.to_s.camelize}".constantize.new
13
+ def init_by_name(name, options = {})
14
+ "Blazing::Recipe::#{name.to_s.camelize}".constantize.new(options)
15
+ end
16
+
17
+ def list
18
+ descendants = []
19
+ ObjectSpace.each_object(Class) do |k|
20
+ descendants.unshift k if k < self
21
+ end
22
+ descendants
9
23
  end
10
24
 
11
25
  end
@@ -47,4 +47,12 @@ class Blazing::Runner
47
47
  @config.default_target.update
48
48
  end
49
49
 
50
+ def recipes_run_command
51
+ @config.recipes.each { |recipe| recipe.run }
52
+ end
53
+
54
+ def recipes_list_command
55
+ Blazing::Recipe.list.each { |r| puts r.to_s.demodulize.underscore }
56
+ end
57
+
50
58
  end
@@ -2,20 +2,31 @@
2
2
  # Blazing Configuration File
3
3
  #
4
4
 
5
+ #
5
6
  # Specify the location of your repository:
6
- # repository 'git@github.com:path/to/your/repository'
7
+ #
8
+ # repository 'git@github.com:path/to/your/repository'
7
9
 
10
+ #
8
11
  # Define possible deploy targets:
9
- # target :production, 'blazing@production.server.com:/where/your/code/is/shipped/to'
10
- # target :staging, 'blazing@production.server.com:/where/your/code/is/shipped/to', :default => true
12
+ #
13
+ # target :production, 'blazing@production.server.com:/where/your/code/is/shipped/to'
14
+ # target :staging, 'blazing@production.server.com:/where/your/code/is/shipped/to', :default => true
15
+
16
+ #
17
+ # Define which recipes should be used. The recipes are run in the order that they are defined
18
+ #
19
+
20
+ # Use Ruby Enterprise Edition and gemset 123
21
+ # recipe :rvm, :use => 'ree@123'
11
22
 
12
- # Define which recipes should be used
13
- # recipes [:rvm, :bundler]
23
+ # Or use the rvmrc
24
+ # recipe :rvm, :use => :rvmrc
14
25
 
15
- # Define an rvm ruby/gemset to be used remotely
16
- # rvm 'ruby-1.9.2@agemset'
17
- # Or use the rvm specified in .rvmrc
18
- # rvm :rvmrc
26
+ # Bundle after deploying
27
+ # recipe :bundler
19
28
 
20
- # Defina a rake task that should be run after deployment
21
- # rake :a_rake_task_to_call_after_deployment
29
+ #
30
+ # Define a rake task that should be run after deployment. The rake task will run after the recipes have run.
31
+ #
32
+ # rake :a_rake_task_to_call_after_deployment
@@ -39,6 +39,10 @@ done
39
39
  fi
40
40
  <% end %>
41
41
 
42
+ <% unless @config.recipes.empty? %>
43
+ blazing recipes:run
44
+ <% end %>
45
+
42
46
  <% if @config.rake %>
43
47
  rake <%= @config.rake %>
44
48
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Blazing
2
- VERSION = "0.1.0.alpha3"
2
+ VERSION = "0.1.0.alpha4"
3
3
  end
@@ -84,26 +84,32 @@ describe Blazing::Config do
84
84
  end
85
85
  end
86
86
 
87
- describe 'recipes' do
87
+ describe 'recipe' do
88
88
 
89
89
  before :each do
90
90
  class Blazing::Recipe::Dummy < Blazing::Recipe
91
91
  end
92
92
  end
93
93
 
94
- it 'is an empty recipe if nothing was set' do
94
+ it 'is an empty array if nothing was set' do
95
95
  @config.recipes.should be_a Array
96
96
  end
97
97
 
98
98
  it 'accepts a single recipe as argument' do
99
- @config.recipes :dummy
100
- @config.recipes.first.should be_a Blazing::Recipe::Dummy
99
+ # @config.recipe :dummy
100
+ # @config.recipes.first.should be_a Blazing::Recipe::Dummy
101
101
  end
102
102
 
103
- it 'accepts an array of recipes as argument' do
104
- @config.recipes [:dummy, :dummy]
105
- @config.recipes.size.should be 2
106
- @config.recipes.each { |r| r.should be_a Blazing::Recipe::Dummy }
103
+ it 'allows multiple recipes to be defined' do
104
+ # @config.recipe :dummy
105
+ # @config.recipe :dummy
106
+ # @config.recipes.size.should be 2
107
+ # @config.recipes.each { |r| r.should be_a Blazing::Recipe::Dummy }
108
+ end
109
+
110
+ it 'passes the options to the recipe initializer' do
111
+ @config.recipe :dummy, :something => 'blah'
112
+ @config.recipes.first.options[:something].should == 'blah'
107
113
  end
108
114
  end
109
115
 
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+ require 'blazing/config'
3
+ require 'blazing/runner'
4
+
5
+ describe 'blazing init' do
6
+
7
+ before :each do
8
+ setup_sandbox
9
+ end
10
+
11
+ after :each do
12
+ teardown_sandbox
13
+ end
14
+
15
+ it 'prints a list of the available recipes' do
16
+ class Blazing::Recipe::Dummy < Blazing::Recipe
17
+ end
18
+ capture(:stdout) { Blazing::Runner.new.exec('recipes:list') }.should == "dummy\n"
19
+ end
20
+
21
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'blazing/config'
3
+ require 'blazing/runner'
4
+
5
+ describe 'blazing init' do
6
+
7
+ before :each do
8
+ setup_sandbox
9
+ class Blazing::Recipe::Dummy < Blazing::Recipe
10
+ end
11
+ @dummy_recipe = Blazing::Recipe::Dummy.new
12
+ @config = Blazing::Config.new
13
+ @config.target :production, @production_url
14
+ @config.instance_variable_set('@recipes', [@dummy_recipe])
15
+ @runner = Blazing::Runner.new(@config)
16
+ end
17
+
18
+ after :each do
19
+ teardown_sandbox
20
+ end
21
+
22
+ it 'runs the configured recipes' do
23
+ @dummy_recipe.should_receive(:run)
24
+ capture(:stdout) { @runner.exec('recipes:run') }
25
+ end
26
+
27
+ end
@@ -21,6 +21,10 @@ describe 'blazing update' do
21
21
  end
22
22
 
23
23
  it 'generates the hook' do
24
+ @shell_double = double('shell')#Blazing::Shell.new
25
+ @target = @config.default_target
26
+ @target.instance_variable_set('@shell', @shell_double)
27
+ @shell_double.stub(:run)
24
28
  capture(:stdout) { @runner.exec('update') }
25
29
  File.exists?(Blazing::TMP_HOOK).should be true
26
30
  end
@@ -14,4 +14,10 @@ describe Blazing::Recipe do
14
14
  end
15
15
  end
16
16
 
17
+ describe '.list' do
18
+ it 'retunrs an array of the available recipe classes' do
19
+ Blazing::Recipe.list.first.should be Blazing::Recipe::Dummy
20
+ end
21
+ end
22
+
17
23
  end
@@ -1,8 +1,9 @@
1
1
  require 'spec_helper'
2
2
  require 'blazing/runner'
3
+ require 'blazing/config'
3
4
 
4
5
  #
5
- # Note: More specs for Runner in the integration directory.
6
+ # NOTE: More specs for Runner in the integration directory.
6
7
  #
7
8
 
8
9
  describe Blazing::Runner do
@@ -18,30 +19,6 @@ describe Blazing::Runner do
18
19
  lambda { Blazing::Runner.new(@config).exec('weird_command') }.should raise_error
19
20
  end
20
21
 
21
- it 'knows the init command' do
22
- runner = Blazing::Runner.new(@config)
23
- runner.should_receive(:init_command)
24
- runner.exec('init')
25
- end
26
-
27
- it 'knows the setup:local command' do
28
- runner = Blazing::Runner.new(@config)
29
- runner.should_receive(:setup_local_command)
30
- runner.exec('setup:local')
31
- end
32
-
33
- it 'knows the setup:remote command' do
34
- runner = Blazing::Runner.new(@config)
35
- runner.should_receive(:setup_remote_command)
36
- runner.exec('setup:remote')
37
- end
38
-
39
- it 'knows the deploy command' do
40
- runner = Blazing::Runner.new(@config)
41
- runner.should_receive(:deploy_command)
42
- runner.exec('deploy')
43
- end
44
-
45
22
  end
46
23
 
47
24
  end
metadata CHANGED
@@ -1,176 +1,134 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: blazing
3
- version: !ruby/object:Gem::Version
4
- hash: -3702664374
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.alpha4
5
5
  prerelease: 6
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- - alpha
11
- - 3
12
- version: 0.1.0.alpha3
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Felipe Kaufmann
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
-
20
- date: 2011-10-23 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2011-10-24 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: rdoc
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70155896849380 !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 3
31
- segments:
32
- - 0
33
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
34
22
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rake
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70155896849380
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70155896848860 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 63
45
- segments:
46
- - 0
47
- - 9
48
- - 2
31
+ - !ruby/object:Gem::Version
49
32
  version: 0.9.2
50
33
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rspec
54
34
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70155896848860
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70155896848440 !ruby/object:Gem::Requirement
56
39
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
64
44
  type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: guard
68
45
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70155896848440
47
+ - !ruby/object:Gem::Dependency
48
+ name: guard
49
+ requirement: &70155896847980 !ruby/object:Gem::Requirement
70
50
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
78
55
  type: :development
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: guard-rspec
82
56
  prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70155896847980
58
+ - !ruby/object:Gem::Dependency
59
+ name: guard-rspec
60
+ requirement: &70155896847560 !ruby/object:Gem::Requirement
84
61
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
92
66
  type: :development
93
- version_requirements: *id005
94
- - !ruby/object:Gem::Dependency
95
- name: growl
96
67
  prerelease: false
97
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70155896847560
69
+ - !ruby/object:Gem::Dependency
70
+ name: growl
71
+ requirement: &70155896847100 !ruby/object:Gem::Requirement
98
72
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
106
77
  type: :development
107
- version_requirements: *id006
108
- - !ruby/object:Gem::Dependency
109
- name: rb-fsevent
110
78
  prerelease: false
111
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *70155896847100
80
+ - !ruby/object:Gem::Dependency
81
+ name: rb-fsevent
82
+ requirement: &70155896846680 !ruby/object:Gem::Requirement
112
83
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
118
- - 0
119
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
120
88
  type: :development
121
- version_requirements: *id007
122
- - !ruby/object:Gem::Dependency
123
- name: grit
124
89
  prerelease: false
125
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *70155896846680
91
+ - !ruby/object:Gem::Dependency
92
+ name: grit
93
+ requirement: &70155896846260 !ruby/object:Gem::Requirement
126
94
  none: false
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- hash: 3
131
- segments:
132
- - 0
133
- version: "0"
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
134
99
  type: :runtime
135
- version_requirements: *id008
136
- - !ruby/object:Gem::Dependency
137
- name: activesupport
138
100
  prerelease: false
139
- requirement: &id009 !ruby/object:Gem::Requirement
101
+ version_requirements: *70155896846260
102
+ - !ruby/object:Gem::Dependency
103
+ name: activesupport
104
+ requirement: &70155896845840 !ruby/object:Gem::Requirement
140
105
  none: false
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- hash: 3
145
- segments:
146
- - 0
147
- version: "0"
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
148
110
  type: :runtime
149
- version_requirements: *id009
150
- - !ruby/object:Gem::Dependency
151
- name: i18n
152
111
  prerelease: false
153
- requirement: &id010 !ruby/object:Gem::Requirement
112
+ version_requirements: *70155896845840
113
+ - !ruby/object:Gem::Dependency
114
+ name: i18n
115
+ requirement: &70155896845420 !ruby/object:Gem::Requirement
154
116
  none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- hash: 3
159
- segments:
160
- - 0
161
- version: "0"
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
162
121
  type: :runtime
163
- version_requirements: *id010
122
+ prerelease: false
123
+ version_requirements: *70155896845420
164
124
  description: git push deployent utility, ready to be extended by your own recipes
165
- email:
125
+ email:
166
126
  - felipekaufmann@gmail.com
167
- executables:
127
+ executables:
168
128
  - blazing
169
129
  extensions: []
170
-
171
130
  extra_rdoc_files: []
172
-
173
- files:
131
+ files:
174
132
  - .gitignore
175
133
  - .rvmrc
176
134
  - Gemfile
@@ -195,6 +153,8 @@ files:
195
153
  - lib/blazing/version.rb
196
154
  - spec/blazing/config_spec.rb
197
155
  - spec/blazing/integration/init_spec.rb
156
+ - spec/blazing/integration/recipes_list_spec.rb
157
+ - spec/blazing/integration/recipes_run_spec.rb
198
158
  - spec/blazing/integration/setup_local_spec.rb
199
159
  - spec/blazing/integration/setup_remote_spec.rb
200
160
  - spec/blazing/integration/update_spec.rb
@@ -205,42 +165,33 @@ files:
205
165
  - spec/support/empty_config.rb
206
166
  homepage: https://github.com/effkay/blazing
207
167
  licenses: []
208
-
209
168
  post_install_message:
210
169
  rdoc_options: []
211
-
212
- require_paths:
170
+ require_paths:
213
171
  - lib
214
- required_ruby_version: !ruby/object:Gem::Requirement
172
+ required_ruby_version: !ruby/object:Gem::Requirement
215
173
  none: false
216
- requirements:
217
- - - ">="
218
- - !ruby/object:Gem::Version
219
- hash: 3
220
- segments:
221
- - 0
222
- version: "0"
223
- required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
224
179
  none: false
225
- requirements:
226
- - - ">"
227
- - !ruby/object:Gem::Version
228
- hash: 25
229
- segments:
230
- - 1
231
- - 3
232
- - 1
180
+ requirements:
181
+ - - ! '>'
182
+ - !ruby/object:Gem::Version
233
183
  version: 1.3.1
234
184
  requirements: []
235
-
236
185
  rubyforge_project: blazing
237
186
  rubygems_version: 1.8.10
238
187
  signing_key:
239
188
  specification_version: 3
240
189
  summary: blazing fast deployment
241
- test_files:
190
+ test_files:
242
191
  - spec/blazing/config_spec.rb
243
192
  - spec/blazing/integration/init_spec.rb
193
+ - spec/blazing/integration/recipes_list_spec.rb
194
+ - spec/blazing/integration/recipes_run_spec.rb
244
195
  - spec/blazing/integration/setup_local_spec.rb
245
196
  - spec/blazing/integration/setup_remote_spec.rb
246
197
  - spec/blazing/integration/update_spec.rb