torquebox-stompbox 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/deployer.rb +28 -26
- data/app/models.rb +1 -1
- data/app/tasks/deployer_task.rb +2 -0
- metadata +1 -1
data/app/deployer.rb
CHANGED
@@ -37,6 +37,7 @@ class Deployer
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def self.undeploy(push, async = true)
|
40
|
+
puts "Undeploying #{push.repo_name}/#{push.branch}"
|
40
41
|
push.undeploy
|
41
42
|
if async
|
42
43
|
DeployerTask.async(:undeploy, :id=>push.id)
|
@@ -79,7 +80,7 @@ class Deployer
|
|
79
80
|
|
80
81
|
# Hack to avoid problems with github responses using git gem over https
|
81
82
|
def git_url
|
82
|
-
push.repo_url.sub('https://github.com/', 'git
|
83
|
+
push.repo_url.sub('https://github.com/', 'git://github.com/')
|
83
84
|
end
|
84
85
|
|
85
86
|
def deployment_path
|
@@ -101,14 +102,15 @@ class Deployer
|
|
101
102
|
def write_descriptor
|
102
103
|
repo = push.find_repository
|
103
104
|
if repo
|
104
|
-
config =
|
105
|
-
config ||= {}
|
105
|
+
config = repo.config.nil? ? {} : YAML.load(repo.config)
|
106
106
|
config['application'] ||= {}
|
107
107
|
config['application']['root'] = root
|
108
108
|
config['application']['env'] ||= 'production'
|
109
109
|
descriptor = TorqueBox::DeployUtils.basic_deployment_descriptor(config)
|
110
110
|
descriptor.merge! config
|
111
111
|
TorqueBox::DeployUtils.deploy_yaml( descriptor, deployment_file )
|
112
|
+
else
|
113
|
+
puts "Unable to find repository #{push.repo_name}/#{push.branch}"
|
112
114
|
end
|
113
115
|
end
|
114
116
|
|
@@ -129,12 +131,10 @@ class Deployer
|
|
129
131
|
|
130
132
|
def freeze_gems
|
131
133
|
puts "Freezing gems"
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
else
|
137
|
-
exec_cmd( "cd #{root} && #{jruby} -S rake rails:freeze:gems" )
|
134
|
+
Dir.chdir( root ) do
|
135
|
+
jruby = File.join( RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] )
|
136
|
+
jruby << " --1.9" if RUBY_VERSION =~ /^1\.9\./
|
137
|
+
exec_command( "#{jruby} -S bundle install --deployment" )
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
@@ -142,26 +142,28 @@ class Deployer
|
|
142
142
|
"#{root}/#{file}"
|
143
143
|
end
|
144
144
|
|
145
|
-
def
|
146
|
-
|
145
|
+
def exec_command(cmd)
|
146
|
+
IO.popen4( cmd ) do |pid, stdin, stdout, stderr|
|
147
147
|
stdin.close
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
148
|
+
[
|
149
|
+
Thread.new(stdout) {|stdout_io|
|
150
|
+
stdout_io.each_line do |l|
|
151
|
+
STDOUT.puts l
|
152
|
+
STDOUT.flush
|
153
|
+
end
|
154
|
+
stdout_io.close
|
155
|
+
},
|
156
|
+
|
157
|
+
Thread.new(stderr) {|stderr_io|
|
158
|
+
stderr_io.each_line do |l|
|
159
|
+
STDERR.puts l
|
160
|
+
STDERR.flush
|
161
|
+
end
|
162
|
+
}
|
163
|
+
].each( &:join )
|
163
164
|
end
|
164
165
|
end
|
166
|
+
|
165
167
|
end
|
166
168
|
|
167
169
|
|
data/app/models.rb
CHANGED
data/app/tasks/deployer_task.rb
CHANGED