Class: Circus::Profiles::PureRb

Inherits:
RubyBase show all
Defined in:
lib/circus/profiles/pure_rb.rb

Constant Summary collapse

PURERB_APP_PROPERTY =
'purerb-app'

Constants inherited from RubyBase

RubyBase::BUNDLER_TOOL

Class Method Summary collapse

Instance Method Summary collapse

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, #requirements, #supported_for_development?

Constructor Details

#initialize(name, dir, props) ⇒ PureRb

Returns a new instance of PureRb.



15
16
17
18
19
# File 'lib/circus/profiles/pure_rb.rb', line 15

def initialize(name, dir, props)
  super(name, dir, props)
  
  @rb_script = props[PURERB_APP_PROPERTY] || "#{name}.rb"
end

Class Method Details

.accepts?(name, dir, props) ⇒ Boolean

Checks if this is a pure ruby application. Will accept the application if it has a file named <name>.rb, or has a ‘purerb-app’ property describing the entry point.

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/circus/profiles/pure_rb.rb', line 10

def self.accepts?(name, dir, props)
  return true if props.include? PURERB_APP_PROPERTY
  return File.exists?(File.join(dir, "#{name}.rb"))
end

Instance Method Details

#deploy_run_script_contentObject

Install our gems and then run in deployment



37
38
39
40
41
42
43
# File 'lib/circus/profiles/pure_rb.rb', line 37

def deploy_run_script_content
  shell_run_script do
    <<-EOT
    exec ruby #{@rb_script}
    EOT
  end
end

#dev_run_script_contentObject

Just run the script in development



27
28
29
30
31
32
33
34
# File 'lib/circus/profiles/pure_rb.rb', line 27

def dev_run_script_content
  shell_run_script do
    <<-EOT
    cd #{@dir}
    exec ruby #{@rb_script}
    EOT
  end
end

#nameObject

The name of this profile



22
23
24
# File 'lib/circus/profiles/pure_rb.rb', line 22

def name
  "pure-rb"
end