blazing 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/blazing.gemspec +2 -1
- data/lib/blazing.rb +0 -2
- data/lib/blazing/base.rb +8 -1
- data/lib/blazing/bootstrap.rb +27 -0
- data/lib/blazing/cli/base.rb +14 -16
- data/lib/blazing/config.rb +11 -9
- data/lib/blazing/{object.rb → core_ext/object.rb} +0 -0
- data/lib/blazing/recipe.rb +20 -4
- data/lib/blazing/target.rb +97 -31
- data/lib/blazing/version.rb +1 -1
- data/spec/blazing/cli/base_spec.rb +22 -68
- data/spec/blazing/config_spec.rb +1 -1
- data/spec/blazing/integration/init_spec.rb +53 -0
- data/spec/blazing/logger_spec.rb +1 -1
- data/spec/blazing/remote_spec.rb +136 -136
- data/spec/blazing/target_spec.rb +23 -23
- metadata +13 -12
- data/lib/blazing/cli/templates/pre-hook.tt +0 -9
- data/lib/blazing/remote.rb +0 -73
data/Gemfile.lock
CHANGED
data/blazing.gemspec
CHANGED
@@ -19,9 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
# TODO: better to use ~ ?
|
21
21
|
s.add_dependency "thor", ">= 0.14.6"
|
22
|
+
s.add_dependency "grit"
|
22
23
|
|
23
24
|
# TODO: Get rid of those, just used for guessing recipe names etc in lib/recipes.rb
|
24
25
|
s.add_dependency "activesupport", ">= 3.0.5"
|
25
26
|
s.add_dependency "i18n"
|
26
|
-
|
27
|
+
|
27
28
|
end
|
data/lib/blazing.rb
CHANGED
@@ -5,9 +5,7 @@ require 'blazing/config'
|
|
5
5
|
require 'blazing/runner'
|
6
6
|
require 'blazing/logger'
|
7
7
|
require 'blazing/target'
|
8
|
-
require 'blazing/remote'
|
9
8
|
require 'blazing/recipe'
|
10
|
-
require 'blazing/object'
|
11
9
|
require 'blazing/cli/base'
|
12
10
|
require 'blazing/cli/create'
|
13
11
|
require 'blazing/cli/hook'
|
data/lib/blazing/base.rb
CHANGED
@@ -4,7 +4,7 @@ module Blazing
|
|
4
4
|
module Base
|
5
5
|
|
6
6
|
def config
|
7
|
-
@config ||= Blazing::Config.
|
7
|
+
@config ||= Blazing::Config.parse
|
8
8
|
end
|
9
9
|
|
10
10
|
def log(type, message)
|
@@ -30,5 +30,12 @@ module Blazing
|
|
30
30
|
Grit::Repo.new(Dir.pwd).config['remote.origin.url'] || 'user@host:/some/path'
|
31
31
|
end
|
32
32
|
|
33
|
+
#
|
34
|
+
# Return true if a Gemfile exists in pwd
|
35
|
+
#
|
36
|
+
def gemfile_present?
|
37
|
+
File.exists? 'Gemfile'
|
38
|
+
end
|
39
|
+
|
33
40
|
end
|
34
41
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Blazing
|
2
|
+
class Target
|
3
|
+
module Bootstrap
|
4
|
+
|
5
|
+
def clone_command
|
6
|
+
"if [ -e #{@path} ]; then \
|
7
|
+
echo 'directory exists already'; else \
|
8
|
+
git clone #{@repository} #{"--branch #{@branch}" if @branch} #{@path} && cd #{@path} && git config receive.denyCurrentBranch ignore; fi"
|
9
|
+
end
|
10
|
+
|
11
|
+
def clone_repository
|
12
|
+
@runner.run "ssh #{@user}@#{@host} '#{clone_command}'"
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_target_as_remote
|
16
|
+
@runner.run "git remote add #{@name} #{@user}@#{@host}:#{@path}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def setup_post_receive_hook
|
20
|
+
@hook.new([use_rvm?]).generate
|
21
|
+
@runner.run "scp /tmp/post-receive #{@user}@#{@host}:#{@path}/.git/hooks/post-receive"
|
22
|
+
@runner.run "ssh #{@user}@#{@host} 'chmod +x #{@path}/.git/hooks/post-receive'"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/blazing/cli/base.rb
CHANGED
@@ -18,31 +18,32 @@ module Blazing
|
|
18
18
|
@task.invoke_all
|
19
19
|
end
|
20
20
|
|
21
|
-
desc '
|
22
|
-
def
|
23
|
-
|
24
|
-
log :info, "setting up target #{target.name}"
|
25
|
-
target.setup
|
21
|
+
desc 'bootstrap TARGET_NAME', 'setup or update blazing on specified target and deploy'
|
22
|
+
def bootstrap(target_name = nil)
|
23
|
+
Blazing::Target.bootstrap(target_name)
|
26
24
|
|
27
25
|
# TODO: Abstract this into module and load it where we need it. Methods / actions should have
|
28
26
|
# a success and failure message
|
29
27
|
if exit_status == 0
|
30
|
-
log :success, "successfully
|
28
|
+
log :success, "successfully bootstrapped target #{target_name}"
|
31
29
|
else
|
32
|
-
log :error, "failed
|
30
|
+
log :error, "failed bootstrapping target #{target_name}"
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
34
|
+
desc 'setup TARGET_NAME', 'setup git remote for one or all targets'
|
35
|
+
def setup(target_name = nil)
|
36
|
+
Blazing::Target.setup(target_name)
|
37
|
+
end
|
38
|
+
|
36
39
|
desc 'deploy TARGET', 'deploy to TARGET'
|
37
40
|
def deploy(target_name = nil)
|
38
|
-
|
39
|
-
log :info, "deploying target #{target.name}"
|
40
|
-
target.deploy
|
41
|
+
Blazing::Target.deploy(target_name)
|
41
42
|
|
42
43
|
if exit_status == 0
|
43
|
-
log :success, "successfully deployed target #{
|
44
|
+
log :success, "successfully deployed target #{target_name}"
|
44
45
|
else
|
45
|
-
log :error, "failed deploying on target #{
|
46
|
+
log :error, "failed deploying on target #{target_name}"
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
@@ -54,12 +55,9 @@ module Blazing
|
|
54
55
|
report
|
55
56
|
end
|
56
57
|
|
57
|
-
#TODO: move post_recevie and rvm somewhere else, they must only be called by the post-receive hook and not visible to user
|
58
|
-
|
59
58
|
desc 'post_receive', 'trigger the post-receive actions'
|
60
59
|
def post_receive(target_name = nil)
|
61
|
-
|
62
|
-
Blazing::Remote.new(target.name).post_receive
|
60
|
+
Blazing::Target.post_receive(target_name)
|
63
61
|
end
|
64
62
|
end
|
65
63
|
end
|
data/lib/blazing/config.rb
CHANGED
@@ -19,7 +19,7 @@ module Blazing
|
|
19
19
|
#
|
20
20
|
# Load configuration file and parse it
|
21
21
|
#
|
22
|
-
def
|
22
|
+
def parse
|
23
23
|
read do
|
24
24
|
instance_eval(File.read(Blazing::CONFIGURATION_FILE))
|
25
25
|
end
|
@@ -53,7 +53,7 @@ module Blazing
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def target(name, options = {})
|
56
|
-
@targets << Blazing::Target.new(name, options)
|
56
|
+
@targets << Blazing::Target.new(name, options.merge(:config => self))
|
57
57
|
end
|
58
58
|
|
59
59
|
def use(name, options = {})
|
@@ -65,23 +65,25 @@ module Blazing
|
|
65
65
|
# If only one target is defined, it is the default one
|
66
66
|
#
|
67
67
|
def find_target(target_name = nil)
|
68
|
+
active_target = nil
|
69
|
+
|
68
70
|
if target_name
|
69
|
-
|
71
|
+
active_target = targets.find {|target| target.name == target_name }
|
70
72
|
end
|
71
73
|
|
72
|
-
if
|
73
|
-
|
74
|
+
if active_target.nil? && targets.size == 1
|
75
|
+
active_target = targets.first
|
74
76
|
end
|
75
77
|
|
76
|
-
if
|
77
|
-
|
78
|
+
if active_target.nil?
|
79
|
+
active_target = targets.find {|target| target.default }
|
78
80
|
end
|
79
81
|
|
80
|
-
if
|
82
|
+
if active_target.nil?
|
81
83
|
raise 'no target specified and no default targets found'
|
82
84
|
end
|
83
85
|
|
84
|
-
|
86
|
+
active_target
|
85
87
|
end
|
86
88
|
|
87
89
|
end
|
File without changes
|
data/lib/blazing/recipe.rb
CHANGED
@@ -18,10 +18,17 @@ module Blazing
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def recipe_class
|
21
|
-
|
21
|
+
# TODO: Unify naming conventions
|
22
|
+
# Gem Recipe Naming Convention
|
23
|
+
('Blazing::' + @name.to_s.gsub('_','/').camelize).constantize
|
22
24
|
rescue NameError
|
23
|
-
|
24
|
-
|
25
|
+
begin
|
26
|
+
# Builtin Recipe Naming Convention
|
27
|
+
('Blazing::' + (@name.to_s + '_recipe').camelize).constantize
|
28
|
+
rescue NameError
|
29
|
+
@logger.log :error, "unable to load #{@name} recipe"
|
30
|
+
return nil
|
31
|
+
end
|
25
32
|
end
|
26
33
|
|
27
34
|
def run
|
@@ -42,7 +49,15 @@ module Blazing
|
|
42
49
|
end
|
43
50
|
|
44
51
|
def load_gem_recipes
|
45
|
-
#TODO:
|
52
|
+
# TODO: I'm sure there is a better way to do this...
|
53
|
+
gems = open('Gemfile').grep(/blazing-/).map { |l| l.match(/(blazing-.*)\'\,/)[1] }
|
54
|
+
gems.each do |gem|
|
55
|
+
gem_lib_path = $:.find { |p| p.include? gem }
|
56
|
+
recipes_path = File.join(gem_lib_path, gem, 'recipes')
|
57
|
+
recipes = Dir.entries(recipes_path).delete_if { |r| r == '.' || r == '..' }
|
58
|
+
debugger
|
59
|
+
recipes.each { |recipe| require File.join(gem, 'recipes', recipe) }
|
60
|
+
end
|
46
61
|
end
|
47
62
|
|
48
63
|
def load_local_recipes
|
@@ -57,6 +72,7 @@ module Blazing
|
|
57
72
|
descendants = []
|
58
73
|
|
59
74
|
load_builtin_recipes
|
75
|
+
load_gem_recipes
|
60
76
|
|
61
77
|
ObjectSpace.each_object(Class) do |k|
|
62
78
|
descendants.unshift k if k < self
|
data/lib/blazing/target.rb
CHANGED
@@ -1,40 +1,80 @@
|
|
1
1
|
require 'blazing'
|
2
|
-
require 'blazing/object'
|
2
|
+
require 'blazing/core_ext/object'
|
3
|
+
require 'blazing/config'
|
4
|
+
require 'blazing/bootstrap'
|
3
5
|
|
4
6
|
module Blazing
|
5
7
|
class Target
|
6
8
|
|
9
|
+
include Blazing::Target::Bootstrap
|
10
|
+
|
7
11
|
attr_accessor :name, :recipes
|
8
12
|
|
9
13
|
AVAILABLE_SETTINGS = [:deploy_to, :host, :user, :path, :default, :branch]
|
10
14
|
|
15
|
+
class << self
|
16
|
+
|
17
|
+
def bootstrap(name)
|
18
|
+
target = config.find_target(name)
|
19
|
+
runner = Blazing::Runner.new
|
20
|
+
# TODO: Use a Wrapper to Net::SSH
|
21
|
+
target.clone_repository
|
22
|
+
target.setup_post_receive_hook
|
23
|
+
setup target.name
|
24
|
+
end
|
25
|
+
|
26
|
+
def deploy(name)
|
27
|
+
target = config.find_target(name)
|
28
|
+
runner = Blazing::Runner.new
|
29
|
+
deploy_command = "git push #{name}"
|
30
|
+
deploy_command += " #{target.branch}:#{target.branch}" if target.branch
|
31
|
+
|
32
|
+
# TODO: checkout branch if we pushed to a branch which is not checked out
|
33
|
+
runner.run deploy_command
|
34
|
+
end
|
35
|
+
|
36
|
+
def setup(name)
|
37
|
+
if name
|
38
|
+
config.find_target(name).add_target_as_remote
|
39
|
+
else
|
40
|
+
config.targets.each do |target|
|
41
|
+
target.add_target_as_remote
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def post_receive(name)
|
47
|
+
target = config.find_target(name)
|
48
|
+
target.set_git_dir
|
49
|
+
target.reset_head!
|
50
|
+
@recipes.delete_if { |recipe| recipe.name == 'rvm' }
|
51
|
+
target.run_recipes
|
52
|
+
end
|
53
|
+
|
54
|
+
def config
|
55
|
+
Blazing::Config.parse
|
56
|
+
end
|
57
|
+
|
58
|
+
def runner
|
59
|
+
Blazing::Runner.new
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
11
64
|
def initialize(name, options = {})
|
12
65
|
@name = name.to_s
|
13
66
|
@logger = options[:_logger] ||= Blazing::Logger.new
|
14
67
|
@runner = options[:_runner] ||= Blazing::Runner.new
|
15
68
|
@hook = options[:_hook] ||= Blazing::CLI::Hook
|
16
|
-
create_accessors(options)
|
17
|
-
end
|
18
69
|
|
19
|
-
|
20
|
-
# TODO: Use a Wrapper to Net::SSH
|
21
|
-
clone_repository
|
22
|
-
add_target_as_remote
|
23
|
-
setup_post_receive_hook
|
24
|
-
end
|
70
|
+
@config = options[:config] || Blazing::Config.parse
|
25
71
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
@runner.run deploy_command
|
72
|
+
@repository = @config.repository
|
73
|
+
create_accessors_from_config(options)
|
74
|
+
load_recipes
|
30
75
|
end
|
31
76
|
|
32
|
-
def
|
33
|
-
@_config ||= Blazing::Config
|
34
|
-
@_config.load
|
35
|
-
end
|
36
|
-
|
37
|
-
def create_accessors(options)
|
77
|
+
def create_accessors_from_config(options)
|
38
78
|
assign_settings(options)
|
39
79
|
parse_deploy_to_string unless @deploy_to.blank?
|
40
80
|
ensure_mandatory_settings
|
@@ -61,25 +101,51 @@ module Blazing
|
|
61
101
|
end
|
62
102
|
end
|
63
103
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
|
104
|
+
def set_git_dir
|
105
|
+
ENV['GIT_DIR'] = '.git'
|
106
|
+
end
|
107
|
+
|
108
|
+
def reset_head!
|
109
|
+
@runner ||= Blazing::Runner.new
|
110
|
+
@runner.run 'git reset --hard HEAD'
|
68
111
|
end
|
69
112
|
|
70
|
-
|
71
|
-
|
113
|
+
#
|
114
|
+
# Called by post-receive hook to determine rvm usage
|
115
|
+
#
|
116
|
+
def use_rvm?
|
117
|
+
@rvm_recipe = @recipes.find { |recipe| recipe.name == 'rvm' }
|
118
|
+
@recipes.delete_if { |recipe| recipe.name == 'rvm' }
|
119
|
+
if @rvm_recipe
|
120
|
+
@rvm_recipe.options[:rvm_string]
|
121
|
+
else
|
122
|
+
'none'
|
123
|
+
end
|
72
124
|
end
|
73
125
|
|
74
|
-
def
|
75
|
-
|
126
|
+
def load_recipes
|
127
|
+
|
128
|
+
# TODO: For now, recipes can be assigned only in the global
|
129
|
+
# namespace of the config. Make it possible for targets to
|
130
|
+
# define recipes individually
|
131
|
+
|
132
|
+
@recipes = @config.recipes if @recipes.blank?
|
133
|
+
Blazing::Recipe.load_builtin_recipes
|
76
134
|
end
|
77
135
|
|
78
|
-
def
|
79
|
-
|
80
|
-
@
|
81
|
-
|
136
|
+
def run_recipes
|
137
|
+
run_bootstrap_recipes
|
138
|
+
@recipes.each do |recipe|
|
139
|
+
recipe.run
|
140
|
+
end
|
82
141
|
end
|
83
142
|
|
143
|
+
def run_bootstrap_recipes
|
144
|
+
bundler = @recipes.find { |r| r.name == 'bundler' }
|
145
|
+
if bundler
|
146
|
+
bundler.run
|
147
|
+
@recipes.delete_if { |r| r.name == 'bundler' }
|
148
|
+
end
|
149
|
+
end
|
84
150
|
end
|
85
151
|
end
|
data/lib/blazing/version.rb
CHANGED
@@ -14,6 +14,7 @@ describe Blazing::CLI::Base do
|
|
14
14
|
@hook = double('hook', :new => double('template', :generate => nil))
|
15
15
|
@base = Blazing::CLI::Base.new
|
16
16
|
@base.instance_variable_set('@logger', @logger)
|
17
|
+
@some_target_name = 'test_target'
|
17
18
|
end
|
18
19
|
|
19
20
|
describe '#init' do
|
@@ -25,68 +26,51 @@ describe Blazing::CLI::Base do
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
|
-
describe '#
|
29
|
-
|
30
|
-
before :each do
|
31
|
-
@some_target_name = 'test_target'
|
32
|
-
hook = double('hook', :new => double('template', :generate => nil))
|
33
|
-
config = Blazing::Config.new
|
34
|
-
config.target(@some_target_name, :deploy_to => 'smoeone@somewhere:/asdasdasd', :_logger => @logger, :_runner => @runner, :_hook => hook)
|
35
|
-
@base.instance_variable_set('@config', config)
|
36
|
-
end
|
29
|
+
describe '#bootstrap' do
|
37
30
|
|
38
|
-
it '
|
39
|
-
|
40
|
-
@base.
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'runs setup on selected target' do
|
44
|
-
@target = @base.instance_variable_get('@config').instance_variable_get('@targets').first
|
45
|
-
@target.should_receive(:setup)
|
46
|
-
@base.setup(@some_target_name)
|
31
|
+
it 'runs bootstrap on selected target' do
|
32
|
+
Blazing::Target.should_receive(:bootstrap).with(@some_target_name)
|
33
|
+
@base.bootstrap(@some_target_name)
|
47
34
|
end
|
48
35
|
|
49
36
|
it 'logs a success message if exitstatus of setup was 0' do
|
37
|
+
Blazing::Target.stub!(:bootstrap)
|
50
38
|
@base.instance_variable_set('@exit_status', 0)
|
51
|
-
@logger.should_receive(:log).with(:success, "successfully
|
52
|
-
@base.
|
39
|
+
@logger.should_receive(:log).with(:success, "successfully bootstrapped target test_target")
|
40
|
+
@base.bootstrap(@some_target_name)
|
53
41
|
end
|
54
42
|
|
55
43
|
it 'logs an error if exitstatus of setup was not 0' do
|
44
|
+
Blazing::Target.stub!(:bootstrap)
|
56
45
|
@base.instance_variable_set('@exit_status', 1)
|
57
|
-
@logger.should_receive(:log).with(:error, "failed
|
58
|
-
@base.
|
46
|
+
@logger.should_receive(:log).with(:error, "failed bootstrapping target test_target")
|
47
|
+
@base.bootstrap(@some_target_name)
|
59
48
|
end
|
60
49
|
end
|
61
50
|
|
62
|
-
describe '#
|
63
|
-
|
64
|
-
|
65
|
-
@some_target_name
|
66
|
-
hook = double('hook', :new => double('template', :generate => nil))
|
67
|
-
config = Blazing::Config.new
|
68
|
-
config.target(@some_target_name, :deploy_to => 'smoeone@somewhere:/asdasdasd', :_logger => @logger, :_runner => @runner, :_hook => hook)
|
69
|
-
@base.instance_variable_set('@config', config)
|
51
|
+
describe '#setup' do
|
52
|
+
it 'runs setup on given target' do
|
53
|
+
Blazing::Target.should_receive(:setup).with(@some_target_name)
|
54
|
+
@base.setup(@some_target_name)
|
70
55
|
end
|
56
|
+
end
|
71
57
|
|
72
|
-
|
73
|
-
@logger.should_receive(:log).with(:info, "deploying target test_target")
|
74
|
-
@base.deploy(@some_target_name)
|
75
|
-
end
|
58
|
+
describe '#deploy' do
|
76
59
|
|
77
60
|
it 'runs setup on selected target' do
|
78
|
-
|
79
|
-
@target.should_receive(:deploy)
|
61
|
+
Blazing::Target.should_receive(:deploy).with(@some_target_name)
|
80
62
|
@base.deploy(@some_target_name)
|
81
63
|
end
|
82
64
|
|
83
65
|
it 'logs a success message if exitstatus of setup was 0' do
|
66
|
+
Blazing::Target.stub!(:deploy)
|
84
67
|
@base.instance_variable_set('@exit_status', 0)
|
85
68
|
@logger.should_receive(:log).with(:success, "successfully deployed target test_target")
|
86
69
|
@base.deploy(@some_target_name)
|
87
70
|
end
|
88
71
|
|
89
72
|
it 'logs an error if exitstatus of setup was not 0' do
|
73
|
+
Blazing::Target.stub!(:deploy)
|
90
74
|
@base.instance_variable_set('@exit_status', 1)
|
91
75
|
@logger.should_receive(:log).with(:error, "failed deploying on target test_target")
|
92
76
|
@base.deploy(@some_target_name)
|
@@ -102,39 +86,9 @@ describe Blazing::CLI::Base do
|
|
102
86
|
|
103
87
|
describe '#post_receive' do
|
104
88
|
|
105
|
-
before :each do
|
106
|
-
@some_target_name = 'test_target'
|
107
|
-
config = Blazing::Config.new
|
108
|
-
config.target(@some_target_name, :deploy_to => 'smoeone@somewhere:/asdasdasd')
|
109
|
-
@base.instance_variable_set('@config', config)
|
110
|
-
end
|
111
|
-
|
112
89
|
it 'instantiates a new remote and calls its post_receive method' do
|
113
|
-
Blazing::
|
114
|
-
@base.post_receive
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe '#rvm' do
|
119
|
-
|
120
|
-
before :each do
|
121
|
-
@some_target_name = 'test_target'
|
122
|
-
hook = double('hook', :new => double('template', :generate => nil))
|
123
|
-
@config = Blazing::Config.new
|
124
|
-
@config.target(@some_target_name, :deploy_to => 'smoeone@somewhere:/asdasdasd', :_logger => @logger, :_runner => @runner, :_hook => hook)
|
125
|
-
@base.instance_variable_set('@config', @config)
|
126
|
-
end
|
127
|
-
|
128
|
-
it 'writes a log with the rvm string if the target has rvm enabled' do
|
129
|
-
@logger.should_receive(:log).with(:info, 'someruby@somegemset')
|
130
|
-
Blazing::Remote.stub!(:new).and_return(double('remote', :use_rvm? => 'someruby@somegemset'))
|
131
|
-
@base.rvm(@some_target_name)
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'writes a log saying false if the target has no rvm enabled' do
|
135
|
-
@logger.should_receive(:log).with(:info, false)
|
136
|
-
Blazing::Remote.stub!(:new).and_return(double('remote', :use_rvm? => false))
|
137
|
-
@base.rvm(@some_target_name)
|
90
|
+
Blazing::Target.should_receive(:post_receive).with(@some_target_name)
|
91
|
+
@base.post_receive(@some_target_name)
|
138
92
|
end
|
139
93
|
end
|
140
94
|
end
|
data/spec/blazing/config_spec.rb
CHANGED
@@ -69,7 +69,7 @@ describe Blazing::Config do
|
|
69
69
|
it 'reads and parses the config file and returns a config object' do
|
70
70
|
Blazing.send(:remove_const, 'CONFIGURATION_FILE')
|
71
71
|
Blazing::CONFIGURATION_FILE = 'spec/support/config.rb'
|
72
|
-
Blazing::Config.
|
72
|
+
Blazing::Config.parse.should be_a Blazing::Config
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'blazing'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
describe 'blazing init' do
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
@blazing_root = Dir.pwd
|
9
|
+
@sandbox_directory = File.join(@blazing_root, 'spec/support/sandbox')
|
10
|
+
@blazing = Blazing::CLI::Base.new
|
11
|
+
|
12
|
+
# Sometimes, when specs failed, the sandbox would stick around
|
13
|
+
FileUtils.rm_rf(@sandbox_directory) if Dir.exists?(@sandbox_directory)
|
14
|
+
|
15
|
+
# Setup Sandbox
|
16
|
+
Dir.mkdir(@sandbox_directory)
|
17
|
+
Dir.chdir(@sandbox_directory)
|
18
|
+
|
19
|
+
# Setup empty repository
|
20
|
+
@repository_dir = 'repo_without_config'
|
21
|
+
Dir.mkdir(@repository_dir)
|
22
|
+
Dir.chdir(@repository_dir)
|
23
|
+
`git init`
|
24
|
+
end
|
25
|
+
|
26
|
+
after :each do
|
27
|
+
# Teardown Sandbox
|
28
|
+
Dir.chdir(@blazing_root)
|
29
|
+
FileUtils.rm_rf(@sandbox_directory)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'creates the config directory if it does not exist' do
|
33
|
+
silence(:stdout) { @blazing.init }
|
34
|
+
Dir.exists?('config').should be true
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'does not fail when config directory exists already' do
|
38
|
+
silence(:stdout) { lambda { @blazing.init }.should_not raise_error }
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'attempts to use the origin remote to setup the repository in the config' do
|
42
|
+
@origin = 'git@github.com:someone/somerepo.git'
|
43
|
+
`git remote add origin #{@origin}`
|
44
|
+
silence(:stdout) { @blazing.init }
|
45
|
+
Blazing::Config.parse.repository.should == @origin
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'sets a dummy repository config when no remote was found' do
|
49
|
+
silence(:stdout) { @blazing.init }
|
50
|
+
Blazing::Config.parse.repository.should == 'user@host:/some/path'
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/spec/blazing/logger_spec.rb
CHANGED
data/spec/blazing/remote_spec.rb
CHANGED
@@ -1,136 +1,136 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'blazing/remote'
|
3
|
-
|
4
|
-
describe Blazing::Remote do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
end
|
1
|
+
# require 'spec_helper'
|
2
|
+
# require 'blazing/remote'
|
3
|
+
|
4
|
+
# describe Blazing::Remote do
|
5
|
+
|
6
|
+
# before :each do
|
7
|
+
# # recipes = []
|
8
|
+
# # @config = double('config', :load => double('actual_config', :recipes => recipes, :find_target => double('target', :recipes => recipes)))
|
9
|
+
# @config = Blazing::Config.new
|
10
|
+
# @config.target :some_name, :deploy_to => 'user@hostname:/path'
|
11
|
+
# @remote = Blazing::Remote.new('some_name', :config => @config)
|
12
|
+
# @remote.instance_variable_set('@_dir', double('Dir', :chdir => nil))
|
13
|
+
# end
|
14
|
+
|
15
|
+
# describe '#post_receive' do
|
16
|
+
# before :each do
|
17
|
+
# @remote.instance_variable_set('@runner', double('runner', :run => true))
|
18
|
+
# Dir.stub!(:chdir)
|
19
|
+
# end
|
20
|
+
|
21
|
+
# it 'sets up the git dir' do
|
22
|
+
# @remote.should_receive(:set_git_dir)
|
23
|
+
# @remote.post_receive
|
24
|
+
# end
|
25
|
+
|
26
|
+
# it 'runs the recipes' do
|
27
|
+
# @remote.should_receive(:run_recipes)
|
28
|
+
# @remote.post_receive
|
29
|
+
# end
|
30
|
+
|
31
|
+
# it 'resets the git repository' do
|
32
|
+
# @remote.should_receive(:reset_head!)
|
33
|
+
# @remote.post_receive
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
|
37
|
+
# describe '#gemfile_present?' do
|
38
|
+
# it 'checks if a Gemfile is in the cwd' do
|
39
|
+
# File.should_receive(:exists?).with('Gemfile')
|
40
|
+
# @remote.gemfile_present?
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
|
44
|
+
# describe '#set_git_dir' do
|
45
|
+
# it 'sets .git as gitdir if git dir is "."' do
|
46
|
+
# # Dir.should_receive(:chdir).with('.git')
|
47
|
+
# # @remote.set_git_dir
|
48
|
+
# end
|
49
|
+
# end
|
50
|
+
|
51
|
+
# describe '#reset_head!' do
|
52
|
+
# it 'does a git reset --hard HEAD' do
|
53
|
+
# runner = double('runner', :run => nil)
|
54
|
+
# @remote.instance_variable_set('@runner', runner)
|
55
|
+
# runner.should_receive(:run).with('git reset --hard HEAD')
|
56
|
+
# @remote.reset_head!
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
|
60
|
+
# describe '#use_rvm?' do
|
61
|
+
# context 'with rvm recipe enabled' do
|
62
|
+
# it 'returns the rvm string' do
|
63
|
+
# @remote.instance_variable_set('@recipes', double('recipes', :find => double('recipe', :options => { :rvm_string => 'someruby@somegemset'}), :delete_if => nil))
|
64
|
+
# @remote.use_rvm?.should == 'someruby@somegemset'
|
65
|
+
# end
|
66
|
+
|
67
|
+
# it 'deletes the rvm recipes from the recipes array' do
|
68
|
+
# @remote.instance_variable_set('@recipes', [double('rvm_recipe', :name => 'rvm', :options => {})])
|
69
|
+
# @remote.use_rvm?
|
70
|
+
# @remote.instance_variable_get('@recipes').should be_blank
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
|
74
|
+
# context 'without rvm_recipe' do
|
75
|
+
# it 'returns false' do
|
76
|
+
# @remote.instance_variable_set('@recipes', double('rvm_recipe', :find => false, :delete_if => nil))
|
77
|
+
# @remote.use_rvm?.should be false
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
# end
|
81
|
+
|
82
|
+
# describe '#setup_recipes' do
|
83
|
+
# context 'when the target has no recipes' do
|
84
|
+
# it 'assigns the global recipes settings from the config' do
|
85
|
+
# recipe_probe = double('recipe_probe', :name => 'noname', :run => nil)
|
86
|
+
# config = double('config', :recipes => [recipe_probe])
|
87
|
+
# @remote.instance_variable_set('@config', config)
|
88
|
+
# @remote.setup_recipes
|
89
|
+
# @remote.instance_variable_get('@recipes').first.should be recipe_probe
|
90
|
+
# end
|
91
|
+
# end
|
92
|
+
|
93
|
+
# context 'when the target has recipes' do
|
94
|
+
# it 'does not touch the target recipes' do
|
95
|
+
# target_recipe_probe = double('target_recipe_probe', :name => 'target', :run => nil)
|
96
|
+
# global_recipe_probe = double('global_recipe_probe', :name => 'global', :run => nil)
|
97
|
+
# global_config = double('config', :recipes => [global_recipe_probe])
|
98
|
+
# blazing_config_class = double('blazing_config', :parse => global_config)
|
99
|
+
# @remote.instance_variable_set('@_config', blazing_config_class)
|
100
|
+
# @remote.instance_variable_set('@recipes', [target_recipe_probe])
|
101
|
+
# @remote.setup_recipes
|
102
|
+
# @remote.instance_variable_get('@recipes').first.name.should == 'target'
|
103
|
+
# end
|
104
|
+
# end
|
105
|
+
# end
|
106
|
+
|
107
|
+
# describe '#run_recipes' do
|
108
|
+
# it 'runs all recipes' do
|
109
|
+
# recipes = [double('one', :name => nil), double('two', :name => nil), double('three', :name => nil)]
|
110
|
+
# @remote.instance_variable_set('@recipes', recipes)
|
111
|
+
# recipes.each do |recipe|
|
112
|
+
# recipe.should_receive(:run)
|
113
|
+
# end
|
114
|
+
# @remote.run_recipes
|
115
|
+
# end
|
116
|
+
# end
|
117
|
+
|
118
|
+
# describe '#run_bootstrap_recipes' do
|
119
|
+
|
120
|
+
# before :each do
|
121
|
+
# @bundler = double('bundler', :name => 'bundler', :run => nil)
|
122
|
+
# @recipes = [@bundler, double('two', :name => nil), double('three', :name => nil)]
|
123
|
+
# @remote.instance_variable_set('@recipes', @recipes)
|
124
|
+
# end
|
125
|
+
|
126
|
+
# it 'runs bundler recipe if it is enabled' do
|
127
|
+
# @bundler.should_receive(:run)
|
128
|
+
# @remote.run_bootstrap_recipes
|
129
|
+
# end
|
130
|
+
|
131
|
+
# it 'deletes the bundler recipe from the array after running it' do
|
132
|
+
# @remote.run_bootstrap_recipes
|
133
|
+
# @recipes.find { |r| r.name == 'bundler' }.should be nil
|
134
|
+
# end
|
135
|
+
# end
|
136
|
+
# end
|
data/spec/blazing/target_spec.rb
CHANGED
@@ -8,6 +8,7 @@ describe Blazing::Target do
|
|
8
8
|
@runner = double('runner', :run => nil)
|
9
9
|
@hook = double('hook', :new => double('template', :generate => nil))
|
10
10
|
@options = { :deploy_to => 'someone@somehost:/some/path', :_hook => @hook, :_runner => @runner, :_logger => @logger }
|
11
|
+
Blazing::Config.stub!(:parse).and_return(Blazing::Config.new)
|
11
12
|
end
|
12
13
|
|
13
14
|
describe '#initialize' do
|
@@ -66,57 +67,56 @@ describe Blazing::Target do
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
describe '
|
70
|
+
describe '.bootstrap' do
|
70
71
|
before :each do
|
71
|
-
blazing_config = double('config', :load => Blazing::Config.new)
|
72
72
|
@target = Blazing::Target.new('somename', @options)
|
73
|
-
@
|
73
|
+
@config = Blazing::Config.new
|
74
|
+
@config.targets << @target
|
75
|
+
Blazing::Config.stub!(:parse).and_return(@config)
|
74
76
|
end
|
75
77
|
|
76
78
|
it 'clones the repository on the target location' do
|
77
79
|
@target.should_receive(:clone_repository)
|
78
|
-
|
80
|
+
Blazing::Target.bootstrap('somename')
|
79
81
|
end
|
80
82
|
|
81
83
|
it 'adds the target as a git remote' do
|
82
84
|
@target.should_receive(:add_target_as_remote)
|
83
|
-
|
85
|
+
Blazing::Target.bootstrap('somename')
|
84
86
|
end
|
85
87
|
|
86
88
|
it 'sets up the post-receive hook' do
|
87
89
|
@target.should_receive(:setup_post_receive_hook)
|
88
|
-
|
90
|
+
Blazing::Target.bootstrap('somename')
|
89
91
|
end
|
92
|
+
end
|
90
93
|
|
91
|
-
|
92
|
-
|
93
|
-
@target.
|
94
|
-
@
|
94
|
+
describe '.deploy' do
|
95
|
+
before :each do
|
96
|
+
@target = Blazing::Target.new('somename', @options)
|
97
|
+
@config = Blazing::Config.new
|
98
|
+
@config.targets << @target
|
99
|
+
Blazing::Config.stub!(:parse).and_return(@config)
|
100
|
+
@runner = double('runner', :run => nil)
|
101
|
+
Blazing::Runner.stub!(:new).and_return(@runner)
|
95
102
|
end
|
96
|
-
end
|
97
103
|
|
98
|
-
describe '#deploy' do
|
99
104
|
it 'uses git push to deploy to the target' do
|
100
|
-
target = Blazing::Target.new('somename', @options)
|
101
105
|
@runner.should_receive(:run).with(/git push somename/)
|
102
|
-
|
106
|
+
Blazing::Target.deploy('somename')
|
103
107
|
end
|
104
108
|
|
105
109
|
it 'pushes the correct branch when one is configured' do
|
106
|
-
target =
|
107
|
-
target.branch = 'somebranch'
|
110
|
+
@target.branch = 'somebranch'
|
108
111
|
@runner.should_receive(:run).with(/git push somename somebranch:somebranch/)
|
109
|
-
|
112
|
+
Blazing::Target.deploy('somename')
|
110
113
|
end
|
111
114
|
end
|
112
115
|
|
113
|
-
describe '
|
116
|
+
describe 'config' do
|
114
117
|
it 'delegates to Blazing::Config.load' do
|
115
|
-
|
116
|
-
|
117
|
-
target.instance_variable_set("@_config", blazing_config)
|
118
|
-
blazing_config.should_receive(:load)
|
119
|
-
target.config
|
118
|
+
Blazing::Config.should_receive(:parse)
|
119
|
+
Blazing::Target.config
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: blazing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.15
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Felipe Kaufmann
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-20 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -24,29 +24,29 @@ dependencies:
|
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
27
|
+
name: grit
|
28
28
|
requirement: &id002 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: "0"
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: activesupport
|
39
39
|
requirement: &id003 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
44
|
+
version: 3.0.5
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: *id003
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: i18n
|
50
50
|
requirement: &id004 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
@@ -79,19 +79,18 @@ files:
|
|
79
79
|
- blazing.gemspec
|
80
80
|
- lib/blazing.rb
|
81
81
|
- lib/blazing/base.rb
|
82
|
+
- lib/blazing/bootstrap.rb
|
82
83
|
- lib/blazing/cli/base.rb
|
83
84
|
- lib/blazing/cli/create.rb
|
84
85
|
- lib/blazing/cli/hook.rb
|
85
86
|
- lib/blazing/cli/templates/blazing.tt
|
86
87
|
- lib/blazing/cli/templates/post-hook.tt
|
87
|
-
- lib/blazing/cli/templates/pre-hook.tt
|
88
88
|
- lib/blazing/config.rb
|
89
|
+
- lib/blazing/core_ext/object.rb
|
89
90
|
- lib/blazing/logger.rb
|
90
|
-
- lib/blazing/object.rb
|
91
91
|
- lib/blazing/recipe.rb
|
92
92
|
- lib/blazing/recipes/bundler_recipe.rb
|
93
93
|
- lib/blazing/recipes/rvm_recipe.rb
|
94
|
-
- lib/blazing/remote.rb
|
95
94
|
- lib/blazing/runner.rb
|
96
95
|
- lib/blazing/target.rb
|
97
96
|
- lib/blazing/version.rb
|
@@ -100,6 +99,7 @@ files:
|
|
100
99
|
- spec/blazing/cli/create_spec.rb
|
101
100
|
- spec/blazing/cli/hook_spec.rb
|
102
101
|
- spec/blazing/config_spec.rb
|
102
|
+
- spec/blazing/integration/init_spec.rb
|
103
103
|
- spec/blazing/logger_spec.rb
|
104
104
|
- spec/blazing/recipe_spec.rb
|
105
105
|
- spec/blazing/recipes/bundler_recipe_spec.rb
|
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
hash:
|
126
|
+
hash: 3198654558293204946
|
127
127
|
segments:
|
128
128
|
- 0
|
129
129
|
version: "0"
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
requirements:
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
hash:
|
135
|
+
hash: 3198654558293204946
|
136
136
|
segments:
|
137
137
|
- 0
|
138
138
|
version: "0"
|
@@ -149,6 +149,7 @@ test_files:
|
|
149
149
|
- spec/blazing/cli/create_spec.rb
|
150
150
|
- spec/blazing/cli/hook_spec.rb
|
151
151
|
- spec/blazing/config_spec.rb
|
152
|
+
- spec/blazing/integration/init_spec.rb
|
152
153
|
- spec/blazing/logger_spec.rb
|
153
154
|
- spec/blazing/recipe_spec.rb
|
154
155
|
- spec/blazing/recipes/bundler_recipe_spec.rb
|
data/lib/blazing/remote.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'blazing'
|
2
|
-
require 'blazing/config'
|
3
|
-
|
4
|
-
module Blazing
|
5
|
-
class Remote
|
6
|
-
|
7
|
-
def initialize(target_name, options = {})
|
8
|
-
@config = options[:config] || Blazing::Config.load
|
9
|
-
@target = @config.find_target(target_name)
|
10
|
-
@recipes = @target.recipes
|
11
|
-
setup_recipes
|
12
|
-
end
|
13
|
-
|
14
|
-
def post_receive
|
15
|
-
set_git_dir
|
16
|
-
reset_head!
|
17
|
-
@recipes.delete_if { |recipe| recipe.name == 'rvm' }
|
18
|
-
run_recipes
|
19
|
-
end
|
20
|
-
|
21
|
-
def gemfile_present?
|
22
|
-
File.exists? 'Gemfile'
|
23
|
-
end
|
24
|
-
|
25
|
-
def set_git_dir
|
26
|
-
ENV['GIT_DIR'] = '.git'
|
27
|
-
end
|
28
|
-
|
29
|
-
def reset_head!
|
30
|
-
@runner ||= Blazing::Runner.new
|
31
|
-
@runner.run 'git reset --hard HEAD'
|
32
|
-
end
|
33
|
-
|
34
|
-
#
|
35
|
-
# Called by post-receive hook to determine rvm usage
|
36
|
-
#
|
37
|
-
def use_rvm?
|
38
|
-
@rvm_recipe = @recipes.find { |recipe| recipe.name == 'rvm' }
|
39
|
-
@recipes.delete_if { |recipe| recipe.name == 'rvm' }
|
40
|
-
if @rvm_recipe
|
41
|
-
@rvm_recipe.options[:rvm_string]
|
42
|
-
else
|
43
|
-
'none'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def setup_recipes
|
48
|
-
|
49
|
-
# TODO: For now, recipes can be assigned only in the global
|
50
|
-
# namespace of the config. Make it possible for targets to
|
51
|
-
# define recipes individually
|
52
|
-
|
53
|
-
@recipes = @config.recipes if @recipes.blank?
|
54
|
-
Blazing::Recipe.load_builtin_recipes
|
55
|
-
end
|
56
|
-
|
57
|
-
def run_recipes
|
58
|
-
run_bootstrap_recipes
|
59
|
-
@recipes.each do |recipe|
|
60
|
-
recipe.run
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def run_bootstrap_recipes
|
65
|
-
bundler = @recipes.find { |r| r.name == 'bundler' }
|
66
|
-
if bundler
|
67
|
-
bundler.run
|
68
|
-
@recipes.delete_if { |r| r.name == 'bundler' }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|