torquebox 2.0.0.beta1 → 2.0.0.beta2

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.
Files changed (3) hide show
  1. data/bin/torquebox +46 -18
  2. data/lib/torquebox.rb +1 -1
  3. metadata +19 -30
data/bin/torquebox CHANGED
@@ -20,10 +20,11 @@
20
20
  require 'thor'
21
21
  require 'torquebox-rake-support'
22
22
  require 'torquebox/server'
23
+ require 'torquebox/rails'
23
24
 
24
25
  class TorqueBoxCommand < Thor
25
26
 
26
- TASK_ORDER = %w(deploy undeploy start cli env help)
27
+ TASK_ORDER = %w(deploy undeploy start rails archive cli env help)
27
28
 
28
29
  map "run" => "start"
29
30
  desc "run", "Run TorqueBox"
@@ -31,12 +32,43 @@ class TorqueBoxCommand < Thor
31
32
  method_option 'max-threads', :type => :numeric, :desc => "Maximum number of HTTP threads"
32
33
  method_option 'bind-address', :aliases => '-b', :type => :string, :desc => "IP address to bind to"
33
34
  def start
34
- setup_environment
35
+ TorqueBox::Server.setup_environment
35
36
  TorqueBox::DeployUtils.run_server(:clustered => options.clustered,
36
37
  :max_threads => options['max-threads'],
37
38
  :bind_address => options['bind-address'])
38
39
  end
39
40
 
41
+ desc "rails ROOT", "Create a Rails application at ROOT using the TorqueBox Rails template, or apply the TorqueBox template to an existing application at ROOT."
42
+ def rails(root = ".")
43
+ ARGV.shift
44
+ TorqueBox::Server.setup_environment
45
+ if File.exist?( root )
46
+ TorqueBox::Rails.apply_template( root )
47
+ else
48
+ TorqueBox::Rails.new_app
49
+ end
50
+ end
51
+
52
+ desc "archive ROOT", "Create a nice self-contained application archive"
53
+ method_option :deploy, :type => :boolean, :desc => "Deploy the archive to TORQUEBOX_HOME."
54
+ long_desc <<-EOS
55
+ Creates an application archive containing all of your application dependencies.
56
+ The archive can be deployed to TorqueBox with the --deploy option or by
57
+ hand after the archive file, known as a .knob, has been created by using
58
+ `torquebox deploy myapp.knob`.
59
+ EOS
60
+ def archive(root = Dir.pwd)
61
+ root = Dir.pwd if (root == '.')
62
+ TorqueBox::Server.setup_environment
63
+ archive_name = TorqueBox::DeployUtils.archive_name( root )
64
+ path = TorqueBox::DeployUtils.create_archive(:name => archive_name, :app_dir => root)
65
+ puts "Created archive: #{path}"
66
+ if options.deploy
67
+ puts "Deploying #{archive_name} to #{ENV['TORQUEBOX_HOME']}"
68
+ TorqueBox::DeployUtils.deploy_archive( :archive_path => path )
69
+ end
70
+ end
71
+
40
72
  desc "deploy ROOT", "Deploy an application to TorqueBox"
41
73
  long_desc <<-EOS
42
74
  Deploy an application to TorqueBox. The ROOT argument should point to either
@@ -45,23 +77,27 @@ class TorqueBoxCommand < Thor
45
77
  EOS
46
78
  method_option :context_path, :type => :string, :desc => "Context Path (ex: /, /my_app)"
47
79
  method_option :env, :type => :string, :desc => "Application Environment (ex: development, test, production)"
80
+ method_option :name, :type => :string, :desc => "The desired name of the deployment artifact (ex: foo)"
48
81
  def deploy(root = ".")
49
- setup_environment
82
+ TorqueBox::Server.setup_environment
50
83
  root = File.expand_path(root)
51
84
  opts = {:root => root}.merge(options)
52
85
  descriptor = TorqueBox::DeployUtils.basic_deployment_descriptor(opts)
53
- deployment_name = TorqueBox::DeployUtils.deployment_name(root)
54
- deployed_name, deploy_dir = TorqueBox::DeployUtils.deploy_yaml(descriptor, deployment_name)
86
+ deployed_name, deploy_dir = TorqueBox::DeployUtils.deploy_yaml(descriptor, opts)
55
87
  puts "Deployed: #{deployed_name}"
56
88
  puts " into: #{deploy_dir}"
57
89
  end
58
90
 
59
91
  desc "undeploy ROOT", "Undeploy an application from TorqueBox"
92
+ method_option :name, :type => :string, :desc => "The name of the artifact to undeploy (ex: foo)"
60
93
  def undeploy(root = ".")
61
- setup_environment
94
+ TorqueBox::Server.setup_environment
62
95
  root = File.expand_path(root)
63
- deployment_name = TorqueBox::DeployUtils.deployment_name(root)
64
- deploy_name, deploy_dir = TorqueBox::DeployUtils.undeploy(deployment_name)
96
+ opts = {:root => root}.merge(options)
97
+ deploy_name, deploy_dir = TorqueBox::DeployUtils.undeploy_yaml(opts)
98
+ unless deploy_name
99
+ deploy_name, deploy_dir = TorqueBox::DeployUtils.undeploy_archive(opts)
100
+ end
65
101
 
66
102
  if deploy_name
67
103
  puts "Undeployed: #{deploy_name}"
@@ -73,7 +109,7 @@ class TorqueBoxCommand < Thor
73
109
 
74
110
  desc "cli", "Run the JBoss AS7 CLI"
75
111
  def cli
76
- setup_environment
112
+ TorqueBox::Server.setup_environment
77
113
  options = "--connect"
78
114
  if Config::CONFIG['host_os'] =~ /mswin/
79
115
  path = File.join(TorqueBox::Server.jboss_home, "bin\\jboss-admin")
@@ -86,7 +122,7 @@ class TorqueBoxCommand < Thor
86
122
 
87
123
  desc "env [VARIABLE]", "Display TorqueBox environment variables"
88
124
  def env(variable=nil)
89
- setup_environment
125
+ TorqueBox::Server.setup_environment
90
126
  env_keys = %w(TORQUEBOX_HOME JBOSS_HOME JRUBY_HOME)
91
127
  if variable.nil?
92
128
  env_keys.each { |key| shell.say "#{key}=#{ENV[key]}" }
@@ -97,14 +133,6 @@ class TorqueBoxCommand < Thor
97
133
  end
98
134
 
99
135
  no_tasks {
100
- def setup_environment
101
- ENV['TORQUEBOX_HOME'] ||= TorqueBox::Server.torquebox_home
102
- ENV['JBOSS_HOME'] ||= TorqueBox::Server.jboss_home
103
- ENV['JRUBY_HOME'] ||= TorqueBox::Server.jruby_home
104
- ENV['JBOSS_OPTS'] ||= "-Djruby.home=#{TorqueBox::Server.jruby_home}"
105
- %w(TORQUEBOX_HOME JBOSS_HOME JRUBY_HOME).each { |key| puts "[ERROR] #{key} is not set. Install torquebox-server gem or manually set #{key}" unless ENV[key] }
106
- end
107
-
108
136
  class << self
109
137
  # Override all_tasks and help methods in Thor to print options
110
138
  # out in the order we prefer
data/lib/torquebox.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2008-2011 Red Hat, Inc, and individual contributors.
1
+ # Copyright 2008-2012 Red Hat, Inc, and individual contributors.
2
2
  #
3
3
  # This is free software; you can redistribute it and/or modify it
4
4
  # under the terms of the GNU Lesser General Public License as
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: torquebox
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 2.0.0.beta1
5
+ version: 2.0.0.beta2
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: 2011-12-02 00:00:00 Z
13
+ date: 2012-01-05 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: torquebox-core
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.0.0.beta1
23
+ version: 2.0.0.beta2
24
24
  type: :runtime
25
25
  version_requirements: *id001
26
26
  - !ruby/object:Gem::Dependency
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - "="
33
33
  - !ruby/object:Gem::Version
34
- version: 2.0.0.beta1
34
+ version: 2.0.0.beta2
35
35
  type: :runtime
36
36
  version_requirements: *id002
37
37
  - !ruby/object:Gem::Dependency
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - "="
44
44
  - !ruby/object:Gem::Version
45
- version: 2.0.0.beta1
45
+ version: 2.0.0.beta2
46
46
  type: :runtime
47
47
  version_requirements: *id003
48
48
  - !ruby/object:Gem::Dependency
@@ -53,7 +53,7 @@ dependencies:
53
53
  requirements:
54
54
  - - "="
55
55
  - !ruby/object:Gem::Version
56
- version: 2.0.0.beta1
56
+ version: 2.0.0.beta2
57
57
  type: :runtime
58
58
  version_requirements: *id004
59
59
  - !ruby/object:Gem::Dependency
@@ -64,7 +64,7 @@ dependencies:
64
64
  requirements:
65
65
  - - "="
66
66
  - !ruby/object:Gem::Version
67
- version: 2.0.0.beta1
67
+ version: 2.0.0.beta2
68
68
  type: :runtime
69
69
  version_requirements: *id005
70
70
  - !ruby/object:Gem::Dependency
@@ -75,7 +75,7 @@ dependencies:
75
75
  requirements:
76
76
  - - "="
77
77
  - !ruby/object:Gem::Version
78
- version: 2.0.0.beta1
78
+ version: 2.0.0.beta2
79
79
  type: :runtime
80
80
  version_requirements: *id006
81
81
  - !ruby/object:Gem::Dependency
@@ -86,57 +86,46 @@ dependencies:
86
86
  requirements:
87
87
  - - "="
88
88
  - !ruby/object:Gem::Version
89
- version: 2.0.0.beta1
89
+ version: 2.0.0.beta2
90
90
  type: :runtime
91
91
  version_requirements: *id007
92
92
  - !ruby/object:Gem::Dependency
93
- name: torquebox-vfs
93
+ name: torquebox-web
94
94
  prerelease: false
95
95
  requirement: &id008 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - "="
99
99
  - !ruby/object:Gem::Version
100
- version: 2.0.0.beta1
100
+ version: 2.0.0.beta2
101
101
  type: :runtime
102
102
  version_requirements: *id008
103
103
  - !ruby/object:Gem::Dependency
104
- name: torquebox-web
104
+ name: torquebox-cache
105
105
  prerelease: false
106
106
  requirement: &id009 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - "="
110
110
  - !ruby/object:Gem::Version
111
- version: 2.0.0.beta1
111
+ version: 2.0.0.beta2
112
112
  type: :runtime
113
113
  version_requirements: *id009
114
114
  - !ruby/object:Gem::Dependency
115
- name: torquebox-cache
115
+ name: torquebox-stomp
116
116
  prerelease: false
117
117
  requirement: &id010 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - "="
121
121
  - !ruby/object:Gem::Version
122
- version: 2.0.0.beta1
122
+ version: 2.0.0.beta2
123
123
  type: :runtime
124
124
  version_requirements: *id010
125
- - !ruby/object:Gem::Dependency
126
- name: torquebox-stomp
127
- prerelease: false
128
- requirement: &id011 !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - "="
132
- - !ruby/object:Gem::Version
133
- version: 2.0.0.beta1
134
- type: :runtime
135
- version_requirements: *id011
136
125
  - !ruby/object:Gem::Dependency
137
126
  name: thor
138
127
  prerelease: false
139
- requirement: &id012 !ruby/object:Gem::Requirement
128
+ requirement: &id011 !ruby/object:Gem::Requirement
140
129
  none: false
141
130
  requirements:
142
131
  - - ">="
@@ -146,18 +135,18 @@ dependencies:
146
135
  - !ruby/object:Gem::Version
147
136
  version: 1.0.0
148
137
  type: :runtime
149
- version_requirements: *id012
138
+ version_requirements: *id011
150
139
  - !ruby/object:Gem::Dependency
151
140
  name: rspec
152
141
  prerelease: false
153
- requirement: &id013 !ruby/object:Gem::Requirement
142
+ requirement: &id012 !ruby/object:Gem::Requirement
154
143
  none: false
155
144
  requirements:
156
145
  - - "="
157
146
  - !ruby/object:Gem::Version
158
147
  version: 2.7.0
159
148
  type: :development
160
- version_requirements: *id013
149
+ version_requirements: *id012
161
150
  description: ""
162
151
  email:
163
152
  - torquebox-dev@torquebox.org