torquebox-rake-support 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -160,6 +160,10 @@ module TorqueBox
160
160
  # If called from rake within a rails app, bundler will try
161
161
  # to init itself via RUBYOPT, which we don't want
162
162
  ENV.delete('RUBYOPT')
163
+ # Match load-path of booted TorqueBox to the load-path of
164
+ # this process so that we know we can find bundler and our
165
+ # own gems if used with bundle install --deployment
166
+ ENV['RUBYLIB'] = "#{ENV['RUBYLIB']}:#{$:.join(':')}"
163
167
 
164
168
  set_java_opts("#{options[:jvm_options]} #{jruby_opts_properties}")
165
169
  print_server_config(options[:clustered])
@@ -240,7 +244,7 @@ module TorqueBox
240
244
  File.open( deployment, 'w' ) do |file|
241
245
  YAML.dump( deployment_descriptor, file )
242
246
  end
243
- FileUtils.touch( dodeploy_file( name ) )
247
+ FileUtils.touch( dodeploy_file( name, dest_dir ) )
244
248
  [name, dest_dir]
245
249
  end
246
250
 
@@ -250,16 +254,16 @@ module TorqueBox
250
254
  dest_dir = find_option( opts, 'dest_dir' ) || deploy_dir
251
255
  FileUtils.cp( archive_path, dest_dir )
252
256
  archive = File.basename( archive_path )
253
- FileUtils.touch( dodeploy_file( archive ) )
257
+ FileUtils.touch( dodeploy_file( archive, dest_dir ) )
254
258
  [archive, dest_dir]
255
259
  end
256
260
 
257
- def dodeploy_file(name)
258
- File.join( DeployUtils.deploy_dir, "#{name}" ) + ".dodeploy"
261
+ def dodeploy_file(name, deploy_dir = DeployUtils.deploy_dir)
262
+ File.join( deploy_dir, "#{name}" ) + ".dodeploy"
259
263
  end
260
264
 
261
- def deployed_file(name)
262
- File.join( DeployUtils.deploy_dir, "#{name}" ) + ".deployed"
265
+ def deployed_file(name, deploy_dir = DeployUtils.deploy_dir)
266
+ File.join( deploy_dir, "#{name}" ) + ".deployed"
263
267
  end
264
268
 
265
269
  def undeploy_archive(opts = {})
@@ -402,6 +406,14 @@ module TorqueBox
402
406
  applications
403
407
  end
404
408
 
409
+ def jruby_opts_properties
410
+ jruby_opts = ENV['JRUBY_OPTS']
411
+ return "" if jruby_opts.nil?
412
+ # Only convert -Xa.b, -Xa.b.c, -Xa.b.c.d style options to properties
413
+ properties = jruby_opts.scan(/-X(\w+\..+?)\s/)
414
+ properties.map { |matches| "-Djruby.#{matches.first}" }.join(' ')
415
+ end
416
+
405
417
  private
406
418
 
407
419
  def undeploy(name, opts = {})
@@ -429,14 +441,6 @@ module TorqueBox
429
441
  end
430
442
  end
431
443
 
432
- def jruby_opts_properties
433
- jruby_opts = ENV['JRUBY_OPTS']
434
- return "" if jruby_opts.nil?
435
- # Only convert -Xa.b, -Xa.b.c, -Xa.b.c.d style options to properties
436
- properties = jruby_opts.scan(/-X(\w+\..+?)\s/)
437
- properties.map { |matches| "-Djruby.#{matches.first}" }.join(' ')
438
- end
439
-
440
444
  def print_server_config(clustered)
441
445
  config_file = clustered ? cluster_config_file : standalone_config_file
442
446
  config_path = File.join(config_dir, config_file)
@@ -17,6 +17,7 @@
17
17
 
18
18
 
19
19
  begin
20
+ gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
20
21
  require 'rails/version'
21
22
  rescue LoadError
22
23
  end
@@ -24,10 +25,11 @@ end
24
25
  module TorqueBox
25
26
  class Rails
26
27
 
27
- def self.new_app
28
+ def self.new_app( root )
28
29
  print_rails_not_installed_and_exit unless rails_installed?
29
30
  require_generators
30
- # Assumes ARGV[0] already has the application name
31
+ # Ensure ARGV[0] has the application path
32
+ ARGV.unshift( root ) if ARGV.empty?
31
33
  ARGV << [ "-m", TorqueBox::Rails.template ]
32
34
  ARGV.flatten!
33
35
  if using_rails3?
data/spec/rails_spec.rb CHANGED
@@ -11,7 +11,7 @@ describe TorqueBox::Rails do
11
11
  it "should print a warning" do
12
12
  $stderr.should_receive(:puts)
13
13
  lambda {
14
- TorqueBox::Rails.new_app
14
+ TorqueBox::Rails.new_app('root')
15
15
  }.should raise_error SystemExit
16
16
  end
17
17
  end
@@ -38,7 +38,7 @@ describe TorqueBox::Rails do
38
38
  describe "new_app" do
39
39
  it "should generate" do
40
40
  ::Rails::Generators::AppGenerator.should_receive(:start)
41
- TorqueBox::Rails.new_app
41
+ TorqueBox::Rails.new_app('root')
42
42
  end
43
43
  end
44
44
 
@@ -67,7 +67,7 @@ describe TorqueBox::Rails do
67
67
  describe "new_app" do
68
68
  it "should generate" do
69
69
  ::Rails::Generator::Scripts::Generate.any_instance.should_receive(:run)
70
- TorqueBox::Rails.new_app
70
+ TorqueBox::Rails.new_app('root')
71
71
  end
72
72
  end
73
73
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: torquebox-rake-support
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.1.1
5
+ version: 2.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - The TorqueBox Team
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-08-27 00:00:00 Z
13
+ date: 2012-09-24 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -48,33 +48,33 @@ extra_rdoc_files: []
48
48
 
49
49
  files:
50
50
  - licenses/lgpl-2.1.txt
51
- - lib/torquebox-rake-support.rb
52
51
  - lib/org.torquebox.rake-support.rb
53
- - lib/torquebox/launchd.rb
52
+ - lib/torquebox-rake-support.rb
54
53
  - lib/torquebox/server.rb
54
+ - lib/torquebox/upstart.rb
55
55
  - lib/torquebox/deploy_utils.rb
56
56
  - lib/torquebox/rails.rb
57
- - lib/torquebox/upstart.rb
57
+ - lib/torquebox/launchd.rb
58
58
  - lib/torquebox/rake/tasks.rb
59
+ - lib/torquebox/rake/tasks/deployment.rb
59
60
  - lib/torquebox/rake/tasks/server.rb
60
61
  - lib/torquebox/rake/tasks/archive.rb
61
- - lib/torquebox/rake/tasks/deployment.rb
62
- - generators/torquebox_queue_generator.rb
63
62
  - generators/USAGE
63
+ - generators/torquebox_queue_generator.rb
64
64
  - generators/templates/queue.rb
65
+ - spec/spec_helper.rb
66
+ - spec/server_spec.rb
65
67
  - spec/deploy_utils_spec.rb
66
68
  - spec/upstart_spec.rb
67
69
  - spec/rails_spec.rb
68
- - spec/server_spec.rb
69
- - spec/spec_helper.rb
70
- - spec/fixtures/simpleapp/config.ru
71
70
  - spec/fixtures/simpleapp/simpleapp.box
72
- - spec/fixtures/simpleapp/app/puppet-master.rb
73
- - spec/fixtures/simpleapp/app/a-non-cached.gem
71
+ - spec/fixtures/simpleapp/config.ru
72
+ - spec/fixtures/simpleapp/puppet/puppet.rb
74
73
  - spec/fixtures/simpleapp/app/app.rb
74
+ - spec/fixtures/simpleapp/app/a-non-cached.gem
75
+ - spec/fixtures/simpleapp/app/puppet-master.rb
75
76
  - spec/fixtures/simpleapp/app/app.box
76
77
  - spec/fixtures/simpleapp/vendor/vendor.rb
77
- - spec/fixtures/simpleapp/puppet/puppet.rb
78
78
  homepage: http://torquebox.org/
79
79
  licenses:
80
80
  - lgpl
@@ -103,7 +103,7 @@ signing_key:
103
103
  specification_version: 3
104
104
  summary: TorqueBox Rake Support
105
105
  test_files:
106
+ - spec/server_spec.rb
106
107
  - spec/deploy_utils_spec.rb
107
108
  - spec/upstart_spec.rb
108
109
  - spec/rails_spec.rb
109
- - spec/server_spec.rb