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.
@@ -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@github.com:')
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 = push.find_repository.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
- jruby = File.join( RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] )
133
- if ( File.exist?( path_to('Gemfile') ) )
134
- exec_cmd( "cd #{root} && #{jruby} -S bundle package" )
135
- exec_cmd( "cd #{root} && #{jruby} -S bundle install --local --path vendor/bundle" )
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 exec_cmd(cmd)
146
- Open3.popen3( cmd ) do |stdin, stdout, stderr|
145
+ def exec_command(cmd)
146
+ IO.popen4( cmd ) do |pid, stdin, stdout, stderr|
147
147
  stdin.close
148
- stdout_thr = Thread.new(stdout) {|stdout_io|
149
- stdout_io.each_line do |l|
150
- STDOUT.puts l
151
- STDOUT.flush
152
- end
153
- stdout_io.close
154
- }
155
- stderr_thr = Thread.new(stderr) {|stderr_io|
156
- stderr_io.each_line do |l|
157
- STDERR.puts l
158
- STDERR.flush
159
- end
160
- }
161
- stdout_thr.join
162
- stderr_thr.join
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
 
@@ -94,7 +94,7 @@ class Push
94
94
  end
95
95
 
96
96
  def find_repository
97
- Repository.get(:name=>repo_name, :branch=>branch)
97
+ Repository.first(:name=>repo_name, :branch=>branch)
98
98
  end
99
99
 
100
100
  protected
@@ -14,6 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ $: << File.join(File.dirname(__FILE__), '..')
18
+
17
19
  require 'torquebox-messaging'
18
20
  require 'deployer'
19
21
  require 'models'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: torquebox-stompbox
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.2
5
+ version: 0.3.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Lance Ball