torquebox-rake-support 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/torquebox/deploy_utils.rb +20 -8
 - data/lib/torquebox/server.rb +1 -2
 - data/spec/deploy_utils_spec.rb +10 -15
 - metadata +14 -14
 
| 
         @@ -70,8 +70,17 @@ module TorqueBox 
     | 
|
| 
       70 
70 
     | 
    
         
             
                    File.join("#{server_dir}","configuration")
         
     | 
| 
       71 
71 
     | 
    
         
             
                  end
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
      
 73 
     | 
    
         
            +
                  def standalone_config_file
         
     | 
| 
      
 74 
     | 
    
         
            +
                    eap? ? "standalone-full.xml" : "standalone.xml"
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       73 
77 
     | 
    
         
             
                  def cluster_config_file
         
     | 
| 
       74 
     | 
    
         
            -
                    "standalone-ha.xml"
         
     | 
| 
      
 78 
     | 
    
         
            +
                    eap? ? "standalone-full-ha.xml" : "standalone-ha.xml"
         
     | 
| 
      
 79 
     | 
    
         
            +
                  end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  def eap?
         
     | 
| 
      
 82 
     | 
    
         
            +
                    index_html = File.join( jboss_home, 'welcome-content', 'index.html' )
         
     | 
| 
      
 83 
     | 
    
         
            +
                    File.exists?( index_html ) && File.read( index_html ) =~ /EAP 6/
         
     | 
| 
       75 
84 
     | 
    
         
             
                  end
         
     | 
| 
       76 
85 
     | 
    
         | 
| 
       77 
86 
     | 
    
         
             
                  def properties_dir
         
     | 
| 
         @@ -79,11 +88,6 @@ module TorqueBox 
     | 
|
| 
       79 
88 
     | 
    
         
             
                  end
         
     | 
| 
       80 
89 
     | 
    
         | 
| 
       81 
90 
     | 
    
         
             
                  def deploy_dir
         
     | 
| 
       82 
     | 
    
         
            -
                    d = File.join( torquebox_home, 'apps' )
         
     | 
| 
       83 
     | 
    
         
            -
                    if ( File.exists?( d ) && File.directory?( d ) )
         
     | 
| 
       84 
     | 
    
         
            -
                      return d
         
     | 
| 
       85 
     | 
    
         
            -
                    end
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
91 
     | 
    
         
             
                    File.join( "#{server_dir}", "deployments" )
         
     | 
| 
       88 
92 
     | 
    
         
             
                  end
         
     | 
| 
       89 
93 
     | 
    
         | 
| 
         @@ -123,7 +127,8 @@ module TorqueBox 
     | 
|
| 
       123 
127 
     | 
    
         | 
| 
       124 
128 
     | 
    
         
             
                  def run_command_line(opts={})
         
     | 
| 
       125 
129 
     | 
    
         
             
                    options = ENV['JBOSS_OPTS'] || ''
         
     | 
| 
       126 
     | 
    
         
            -
                     
     | 
| 
      
 130 
     | 
    
         
            +
                    config_file = opts[:clustered] ? cluster_config_file : standalone_config_file
         
     | 
| 
      
 131 
     | 
    
         
            +
                    options = "#{options} --server-config=#{config_file}"
         
     | 
| 
       127 
132 
     | 
    
         
             
                    options = "#{options} -Dorg.torquebox.web.http.maxThreads=#{opts[:max_threads]}" if opts[:max_threads]
         
     | 
| 
       128 
133 
     | 
    
         
             
                    options = "#{options} -b #{opts[:bind_address]}" if opts[:bind_address]
         
     | 
| 
       129 
134 
     | 
    
         
             
                    options = "#{options} -Djboss.socket.binding.port-offset=#{opts[:port_offset]}" if opts[:port_offset]
         
     | 
| 
         @@ -157,6 +162,7 @@ module TorqueBox 
     | 
|
| 
       157 
162 
     | 
    
         
             
                      ENV.delete('RUBYOPT') 
         
     | 
| 
       158 
163 
     | 
    
         | 
| 
       159 
164 
     | 
    
         
             
                      set_java_opts("#{options[:jvm_options]} #{jruby_opts_properties}")
         
     | 
| 
      
 165 
     | 
    
         
            +
                      print_server_config(options[:clustered])
         
     | 
| 
       160 
166 
     | 
    
         
             
                      exec_command(run_command_line(options).join(' '))
         
     | 
| 
       161 
167 
     | 
    
         
             
                    end
         
     | 
| 
       162 
168 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -179,7 +185,7 @@ module TorqueBox 
     | 
|
| 
       179 
185 
     | 
    
         
             
                      include_files = []
         
     | 
| 
       180 
186 
     | 
    
         
             
                      Dir[ "**/**", ".bundle/**/**" ].each do |entry|
         
     | 
| 
       181 
187 
     | 
    
         
             
                        unless File.directory?(entry) || skip_files.any? {|regex| entry.match(regex)}
         
     | 
| 
       182 
     | 
    
         
            -
                          include_files << entry 
         
     | 
| 
      
 188 
     | 
    
         
            +
                          include_files << '"' + entry.to_s + '"'
         
     | 
| 
       183 
189 
     | 
    
         
             
                        end
         
     | 
| 
       184 
190 
     | 
    
         
             
                      end
         
     | 
| 
       185 
191 
     | 
    
         | 
| 
         @@ -431,6 +437,12 @@ module TorqueBox 
     | 
|
| 
       431 
437 
     | 
    
         
             
                    properties.map { |matches| "-Djruby.#{matches.first}" }.join(' ')
         
     | 
| 
       432 
438 
     | 
    
         
             
                  end
         
     | 
| 
       433 
439 
     | 
    
         | 
| 
      
 440 
     | 
    
         
            +
                  def print_server_config(clustered)
         
     | 
| 
      
 441 
     | 
    
         
            +
                    config_file = clustered ? cluster_config_file : standalone_config_file
         
     | 
| 
      
 442 
     | 
    
         
            +
                    config_path = File.join(config_dir, config_file)
         
     | 
| 
      
 443 
     | 
    
         
            +
                    puts "Booting AS7 from configuration #{config_path}"
         
     | 
| 
      
 444 
     | 
    
         
            +
                  end
         
     | 
| 
      
 445 
     | 
    
         
            +
             
     | 
| 
       434 
446 
     | 
    
         
             
                end
         
     | 
| 
       435 
447 
     | 
    
         
             
              end
         
     | 
| 
       436 
448 
     | 
    
         
             
            end
         
     | 
    
        data/lib/torquebox/server.rb
    CHANGED
    
    | 
         @@ -29,7 +29,6 @@ module TorqueBox 
     | 
|
| 
       29 
29 
     | 
    
         
             
                  end
         
     | 
| 
       30 
30 
     | 
    
         
             
                  home.full_gem_path if home
         
     | 
| 
       31 
31 
     | 
    
         
             
                rescue Exception => e
         
     | 
| 
       32 
     | 
    
         
            -
                  puts "Cannot find torquebox-server: #{e}"
         
     | 
| 
       33 
32 
     | 
    
         
             
                  nil
         
     | 
| 
       34 
33 
     | 
    
         
             
                end
         
     | 
| 
       35 
34 
     | 
    
         | 
| 
         @@ -50,7 +49,7 @@ module TorqueBox 
     | 
|
| 
       50 
49 
     | 
    
         
             
                  ENV['JBOSS_HOME'] ||= "#{ENV['TORQUEBOX_HOME']}/jboss"
         
     | 
| 
       51 
50 
     | 
    
         
             
                  ENV['JRUBY_HOME'] ||= jruby_home
         
     | 
| 
       52 
51 
     | 
    
         
             
                  ENV['JBOSS_OPTS'] ||= "-Djruby.home=#{jruby_home}"
         
     | 
| 
       53 
     | 
    
         
            -
                  %w( 
     | 
| 
      
 52 
     | 
    
         
            +
                  %w(JBOSS_HOME JRUBY_HOME).each { |key| puts "[ERROR] #{key} is not set. Install torquebox-server gem or manually set #{key}" unless ENV[key] }
         
     | 
| 
       54 
53 
     | 
    
         
             
                end
         
     | 
| 
       55 
54 
     | 
    
         | 
| 
       56 
55 
     | 
    
         
             
              end
         
     | 
    
        data/spec/deploy_utils_spec.rb
    CHANGED
    
    | 
         @@ -293,11 +293,6 @@ describe TorqueBox::DeployUtils do 
     | 
|
| 
       293 
293 
     | 
    
         
             
              end
         
     | 
| 
       294 
294 
     | 
    
         | 
| 
       295 
295 
     | 
    
         
             
              describe '.run_command_line' do
         
     | 
| 
       296 
     | 
    
         
            -
                it 'should not add --server-config when not clustered' do
         
     | 
| 
       297 
     | 
    
         
            -
                  command, options = @util.run_command_line(:clustered => false)
         
     | 
| 
       298 
     | 
    
         
            -
                  options.should_not include('--server-config=')
         
     | 
| 
       299 
     | 
    
         
            -
                end
         
     | 
| 
       300 
     | 
    
         
            -
             
     | 
| 
       301 
296 
     | 
    
         
             
                it 'should add --server-config when clustered' do
         
     | 
| 
       302 
297 
     | 
    
         
             
                  command, options = @util.run_command_line(:clustered => true)
         
     | 
| 
       303 
298 
     | 
    
         
             
                  options.should include('--server-config=')
         
     | 
| 
         @@ -362,14 +357,14 @@ describe TorqueBox::DeployUtils do 
     | 
|
| 
       362 
357 
     | 
    
         | 
| 
       363 
358 
     | 
    
         
             
              describe '.create_archive' do
         
     | 
| 
       364 
359 
     | 
    
         | 
| 
       365 
     | 
    
         
            -
                ALL_EXPECTED_FILES = %w{config.ru
         
     | 
| 
       366 
     | 
    
         
            -
                                        app/app.rb
         
     | 
| 
       367 
     | 
    
         
            -
                                        app/puppet-master.rb
         
     | 
| 
       368 
     | 
    
         
            -
                                        app/app.box
         
     | 
| 
       369 
     | 
    
         
            -
                                        app/a-non-cached.gem
         
     | 
| 
       370 
     | 
    
         
            -
                                        vendor/vendor.rb
         
     | 
| 
       371 
     | 
    
         
            -
                                        puppet/puppet.rb
         
     | 
| 
       372 
     | 
    
         
            -
                                        simpleapp.box}
         
     | 
| 
      
 360 
     | 
    
         
            +
                ALL_EXPECTED_FILES = %w{"config.ru"
         
     | 
| 
      
 361 
     | 
    
         
            +
                                        "app/app.rb"
         
     | 
| 
      
 362 
     | 
    
         
            +
                                        "app/puppet-master.rb"
         
     | 
| 
      
 363 
     | 
    
         
            +
                                        "app/app.box"
         
     | 
| 
      
 364 
     | 
    
         
            +
                                        "app/a-non-cached.gem"
         
     | 
| 
      
 365 
     | 
    
         
            +
                                        "vendor/vendor.rb"
         
     | 
| 
      
 366 
     | 
    
         
            +
                                        "puppet/puppet.rb"
         
     | 
| 
      
 367 
     | 
    
         
            +
                                        "simpleapp.box"}
         
     | 
| 
       373 
368 
     | 
    
         | 
| 
       374 
369 
     | 
    
         
             
                def mock_run_command(expected_includes)
         
     | 
| 
       375 
370 
     | 
    
         
             
                  @util.should_receive(:run_command) do |arg|
         
     | 
| 
         @@ -379,7 +374,7 @@ describe TorqueBox::DeployUtils do 
     | 
|
| 
       379 
374 
     | 
    
         
             
                end
         
     | 
| 
       380 
375 
     | 
    
         | 
| 
       381 
376 
     | 
    
         
             
                it 'should not include excluded dirs and files' do
         
     | 
| 
       382 
     | 
    
         
            -
                  mock_run_command(ALL_EXPECTED_FILES - %w{puppet/puppet.rb simpleapp.box})
         
     | 
| 
      
 377 
     | 
    
         
            +
                  mock_run_command(ALL_EXPECTED_FILES - %w{"puppet/puppet.rb" "simpleapp.box"})
         
     | 
| 
       383 
378 
     | 
    
         | 
| 
       384 
379 
     | 
    
         
             
                  path = @util.create_archive(
         
     | 
| 
       385 
380 
     | 
    
         
             
                      :name => "simpleapp",
         
     | 
| 
         @@ -391,7 +386,7 @@ describe TorqueBox::DeployUtils do 
     | 
|
| 
       391 
386 
     | 
    
         
             
                end
         
     | 
| 
       392 
387 
     | 
    
         | 
| 
       393 
388 
     | 
    
         
             
                it 'should exclude based on patterns' do
         
     | 
| 
       394 
     | 
    
         
            -
                  mock_run_command(ALL_EXPECTED_FILES - %w{simpleapp.box})
         
     | 
| 
      
 389 
     | 
    
         
            +
                  mock_run_command(ALL_EXPECTED_FILES - %w{"simpleapp.box"})
         
     | 
| 
       395 
390 
     | 
    
         | 
| 
       396 
391 
     | 
    
         
             
                  path = @util.create_archive(
         
     | 
| 
       397 
392 
     | 
    
         
             
                      :name => "simpleapp",
         
     | 
    
        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. 
     | 
| 
      
 5 
     | 
    
         
            +
              version: 2.1.1
         
     | 
| 
       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- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2012-08-27 00:00:00 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
              - !ruby/object:Gem::Dependency 
         
     | 
| 
       16 
16 
     | 
    
         
             
                name: rake
         
     | 
| 
         @@ -51,29 +51,29 @@ files: 
     | 
|
| 
       51 
51 
     | 
    
         
             
              - lib/torquebox-rake-support.rb
         
     | 
| 
       52 
52 
     | 
    
         
             
              - lib/org.torquebox.rake-support.rb
         
     | 
| 
       53 
53 
     | 
    
         
             
              - lib/torquebox/launchd.rb
         
     | 
| 
       54 
     | 
    
         
            -
              - lib/torquebox/upstart.rb
         
     | 
| 
       55 
     | 
    
         
            -
              - lib/torquebox/rails.rb
         
     | 
| 
       56 
     | 
    
         
            -
              - lib/torquebox/deploy_utils.rb
         
     | 
| 
       57 
54 
     | 
    
         
             
              - lib/torquebox/server.rb
         
     | 
| 
      
 55 
     | 
    
         
            +
              - lib/torquebox/deploy_utils.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
              - lib/torquebox/rails.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
              - lib/torquebox/upstart.rb
         
     | 
| 
       58 
58 
     | 
    
         
             
              - lib/torquebox/rake/tasks.rb
         
     | 
| 
       59 
     | 
    
         
            -
              - lib/torquebox/rake/tasks/deployment.rb
         
     | 
| 
       60 
     | 
    
         
            -
              - lib/torquebox/rake/tasks/archive.rb
         
     | 
| 
       61 
59 
     | 
    
         
             
              - lib/torquebox/rake/tasks/server.rb
         
     | 
| 
       62 
     | 
    
         
            -
              -  
     | 
| 
      
 60 
     | 
    
         
            +
              - lib/torquebox/rake/tasks/archive.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
              - lib/torquebox/rake/tasks/deployment.rb
         
     | 
| 
       63 
62 
     | 
    
         
             
              - generators/torquebox_queue_generator.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
              - generators/USAGE
         
     | 
| 
       64 
64 
     | 
    
         
             
              - generators/templates/queue.rb
         
     | 
| 
      
 65 
     | 
    
         
            +
              - spec/deploy_utils_spec.rb
         
     | 
| 
      
 66 
     | 
    
         
            +
              - spec/upstart_spec.rb
         
     | 
| 
       65 
67 
     | 
    
         
             
              - spec/rails_spec.rb
         
     | 
| 
       66 
68 
     | 
    
         
             
              - spec/server_spec.rb
         
     | 
| 
       67 
69 
     | 
    
         
             
              - spec/spec_helper.rb
         
     | 
| 
       68 
     | 
    
         
            -
              - spec/upstart_spec.rb
         
     | 
| 
       69 
     | 
    
         
            -
              - spec/deploy_utils_spec.rb
         
     | 
| 
       70 
70 
     | 
    
         
             
              - spec/fixtures/simpleapp/config.ru
         
     | 
| 
       71 
71 
     | 
    
         
             
              - spec/fixtures/simpleapp/simpleapp.box
         
     | 
| 
       72 
     | 
    
         
            -
              - spec/fixtures/simpleapp/vendor/vendor.rb
         
     | 
| 
       73 
72 
     | 
    
         
             
              - spec/fixtures/simpleapp/app/puppet-master.rb
         
     | 
| 
       74 
     | 
    
         
            -
              - spec/fixtures/simpleapp/app/app.rb
         
     | 
| 
       75 
73 
     | 
    
         
             
              - spec/fixtures/simpleapp/app/a-non-cached.gem
         
     | 
| 
      
 74 
     | 
    
         
            +
              - spec/fixtures/simpleapp/app/app.rb
         
     | 
| 
       76 
75 
     | 
    
         
             
              - spec/fixtures/simpleapp/app/app.box
         
     | 
| 
      
 76 
     | 
    
         
            +
              - spec/fixtures/simpleapp/vendor/vendor.rb
         
     | 
| 
       77 
77 
     | 
    
         
             
              - spec/fixtures/simpleapp/puppet/puppet.rb
         
     | 
| 
       78 
78 
     | 
    
         
             
            homepage: http://torquebox.org/
         
     | 
| 
       79 
79 
     | 
    
         
             
            licenses: 
         
     | 
| 
         @@ -103,7 +103,7 @@ signing_key: 
     | 
|
| 
       103 
103 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       104 
104 
     | 
    
         
             
            summary: TorqueBox Rake Support
         
     | 
| 
       105 
105 
     | 
    
         
             
            test_files: 
         
     | 
| 
      
 106 
     | 
    
         
            +
              - spec/deploy_utils_spec.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
              - spec/upstart_spec.rb
         
     | 
| 
       106 
108 
     | 
    
         
             
              - spec/rails_spec.rb
         
     | 
| 
       107 
109 
     | 
    
         
             
              - spec/server_spec.rb
         
     | 
| 
       108 
     | 
    
         
            -
              - spec/upstart_spec.rb
         
     | 
| 
       109 
     | 
    
         
            -
              - spec/deploy_utils_spec.rb
         
     |