Class: Circus::Profiles::Rack
- Defined in:
- lib/circus/profiles/rack.rb
Constant Summary collapse
- RACKFILE_NAME =
'ruby-rackfile'
Constants inherited from RubyBase
Circus::Profiles::RubyBase::BUNDLER_TOOL
Class Method Summary collapse
-
.accepts?(name, dir, props) ⇒ Boolean
Checks if this is a rack applcation.
Instance Method Summary collapse
- #deploy_run_script_content ⇒ Object
- #dev_run_script_content ⇒ Object
-
#initialize(name, dir, props) ⇒ Rack
constructor
A new instance of Rack.
-
#name ⇒ Object
The name of this profile.
-
#requirements ⇒ Object
Describes the requirements of the deployed application.
Methods inherited from RubyBase
#cleanup_after_deploy, #extra_dirs, #prepare_for_deploy, #prepare_for_dev
Methods inherited from Base
#cleanup_after_deploy, #extra_dirs, #mark_for_persistent_run?, #package_base_dir?, #package_for_deploy, #package_for_dev, #supported_for_development?
Constructor Details
#initialize(name, dir, props) ⇒ Rack
Returns a new instance of Rack.
15 16 17 18 19 |
# File 'lib/circus/profiles/rack.rb', line 15 def initialize(name, dir, props) super(name, dir, props) @rackup_name = props[RACKFILE_NAME] || 'config.ru' end |
Class Method Details
.accepts?(name, dir, props) ⇒ Boolean
Checks if this is a rack applcation. Will accept the application if it has a config.ru, or if the properties describe the location of an alternative rack entry point.
10 11 12 13 |
# File 'lib/circus/profiles/rack.rb', line 10 def self.accepts?(name, dir, props) return true if props.include? RACKFILE_NAME return File.exists?(File.join(dir, 'config.ru')) end |
Instance Method Details
#deploy_run_script_content ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/circus/profiles/rack.rb', line 35 def deploy_run_script_content shell_run_script do <<-EOT exec bundle exec thin -R #{@rackup_name} -p #{listen_port} start EOT end end |
#dev_run_script_content ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/circus/profiles/rack.rb', line 26 def dev_run_script_content shell_run_script do <<-EOT cd #{@dir} exec bundle exec thin -R #{@rackup_name} -p #{listen_port} start EOT end end |
#name ⇒ Object
The name of this profile
22 23 24 |
# File 'lib/circus/profiles/rack.rb', line 22 def name "rack" end |
#requirements ⇒ Object
Describes the requirements of the deployed application. Rack applications automatically have an environment system property applied for RACK_ENV and RAILS_ENV
45 46 47 48 49 50 51 52 53 |
# File 'lib/circus/profiles/rack.rb', line 45 def requirements res = super res['system-properties'] ||= {} res['system-properties']['RACK_ENV'] = 'production' res['system-properties']['RAILS_ENV'] = 'production' res end |