baboon 1.0.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -0
- data/lib/baboon/cli.rb +38 -23
- data/lib/baboon/version.rb +1 -1
- data/spec/lib/baboon/cli.rb +0 -0
- data/spec/lib/baboon/configuration_spec.rb +6 -0
- metadata +4 -3
data/README.md
CHANGED
data/lib/baboon/cli.rb
CHANGED
@@ -51,6 +51,8 @@ module Baboon
|
|
51
51
|
if File.exists?("config/initializers/baboon.rb")
|
52
52
|
@configuration = Util.read_configuration("config/initializers/baboon.rb")
|
53
53
|
|
54
|
+
# configure the servers
|
55
|
+
|
54
56
|
Baboon.configure do |config|
|
55
57
|
config.application = @configuration[:application]
|
56
58
|
config.repository = @configuration[:repository]
|
@@ -58,7 +60,7 @@ module Baboon
|
|
58
60
|
config.deploy_user = @configuration[:deploy_user]
|
59
61
|
config.branch = @configuration[:branch]
|
60
62
|
config.rails_env = @configuration[:rails_env]
|
61
|
-
config.servers = @configuration[:servers]
|
63
|
+
config.servers = @configuration[:servers].gsub('[', '').gsub(']', '').split(',').collect(&:strip)
|
62
64
|
end
|
63
65
|
else
|
64
66
|
#Error.stop("Baboon says there is no configuration file at: config/initializers/baboon.rb. Please run `rails g baboon:install`")
|
@@ -69,33 +71,41 @@ module Baboon
|
|
69
71
|
|
70
72
|
desc "deploy", "Starts a real deploy to a server"
|
71
73
|
def deploy
|
72
|
-
printf @logger.format("
|
74
|
+
printf @logger.format("== Baboon starting deploy", "32", 1)
|
73
75
|
|
74
|
-
#
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
"
|
79
|
-
|
80
|
-
|
81
|
-
|
76
|
+
# Loop through each server and do deploy, we will add threading later to do simultaneous deploys
|
77
|
+
Baboon.configuration.servers.each do |server|
|
78
|
+
current = server.to_s.strip
|
79
|
+
|
80
|
+
printf @logger.format("== [#{current}]", "35", 1)
|
81
|
+
|
82
|
+
# Essentially these are the instructions we need run for the Ubuntu 11.04 for rails
|
83
|
+
# TODO: add lib of different instruction sets for Play framework, nodejs, etc
|
84
|
+
instructions = [
|
85
|
+
"cd '#{Baboon.configuration.deploy_path}' && bundle install --deployment",
|
86
|
+
"cd '#{Baboon.configuration.deploy_path}' && git fetch",
|
87
|
+
"cd '#{Baboon.configuration.deploy_path}' && git checkout #{Baboon.configuration.branch.to_s}",
|
88
|
+
"cd '#{Baboon.configuration.deploy_path}' && git merge origin/#{Baboon.configuration.branch.to_s}",
|
89
|
+
"cd '#{Baboon.configuration.deploy_path}' && touch tmp/restart.txt"
|
90
|
+
]
|
82
91
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
92
|
+
# Vars for connecting via ssh to the server
|
93
|
+
credentials = {
|
94
|
+
user: Baboon.configuration.deploy_user.to_s,
|
95
|
+
host: current
|
96
|
+
}
|
88
97
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
98
|
+
Net::SSH.start(credentials[:host], credentials[:user]) do |session|
|
99
|
+
instructions.each do |instruction|
|
100
|
+
puts "[#{current}]: #{instruction}"
|
101
|
+
puts ""
|
102
|
+
session.exec instruction
|
103
|
+
session.loop
|
104
|
+
end
|
95
105
|
end
|
96
|
-
end
|
106
|
+
end # Looping servers
|
97
107
|
|
98
|
-
printf @logger.format("
|
108
|
+
printf @logger.format("== Baboon deploy Complete", "31", 1)
|
99
109
|
end
|
100
110
|
|
101
111
|
desc "configuration", "Shows the current configuration for baboon"
|
@@ -108,6 +118,11 @@ module Baboon
|
|
108
118
|
printf @logger.format("Baboon[Rails_env]: #{Baboon.configuration.rails_env}", "37", 1)
|
109
119
|
printf @logger.format("Baboon[Servers]: #{Baboon.configuration.servers}", "37", 1)
|
110
120
|
end
|
121
|
+
|
122
|
+
desc "servers", "Shows the current servers that will get deployed to"
|
123
|
+
def servers
|
124
|
+
printf @logger.format(Baboon.configuration.servers.inspect, "31", 1)
|
125
|
+
end
|
111
126
|
|
112
127
|
# desc "init", "Generates deployment customization scripts for your app"
|
113
128
|
# def init
|
data/lib/baboon/version.rb
CHANGED
File without changes
|
@@ -103,5 +103,11 @@ describe Baboon::Configuration do
|
|
103
103
|
Baboon.configuration.servers.should eq(['server_1', 'server_2'])
|
104
104
|
end
|
105
105
|
end
|
106
|
+
|
107
|
+
context 'when multiple servers are assigned' do
|
108
|
+
it 'should return accordingly' do
|
109
|
+
# puts Baboon.configuration.servers.inspect
|
110
|
+
end
|
111
|
+
end
|
106
112
|
end
|
107
113
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baboon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -256,6 +256,7 @@ files:
|
|
256
256
|
- lib/generators/baboon/config/templates/baboon.yml
|
257
257
|
- lib/generators/baboon/install/install_generator.rb
|
258
258
|
- lib/generators/baboon/install/templates/baboon.rb
|
259
|
+
- spec/lib/baboon/cli.rb
|
259
260
|
- spec/lib/baboon/configuration_spec.rb
|
260
261
|
- spec/lib/baboon_spec.rb
|
261
262
|
- spec/lib/generators/baboon/install/install_generator_spec.rb
|
@@ -276,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
276
277
|
version: '0'
|
277
278
|
segments:
|
278
279
|
- 0
|
279
|
-
hash:
|
280
|
+
hash: 1283147833976404377
|
280
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
281
282
|
none: false
|
282
283
|
requirements:
|
@@ -285,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
286
|
version: '0'
|
286
287
|
segments:
|
287
288
|
- 0
|
288
|
-
hash:
|
289
|
+
hash: 1283147833976404377
|
289
290
|
requirements: []
|
290
291
|
rubyforge_project: baboon
|
291
292
|
rubygems_version: 1.8.24
|