Class: Circus::Profiles::PurePy

Inherits:
PythonBase show all
Defined in:
lib/circus/profiles/pure_py.rb

Constant Summary collapse

PUREPY_APP_PROPERTY =
'purepy-app'

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PythonBase

#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) ⇒ PurePy

Returns a new instance of PurePy.



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

def initialize(name, dir, props)
  super(name, dir, props)
  
  @py_script = props[PUREPY_APP_PROPERTY] || "#{name}.py"
end

Class Method Details

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

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

Returns:

  • (Boolean)


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

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

Instance Method Details

#deploy_run_script_contentObject



35
36
37
38
39
40
41
# File 'lib/circus/profiles/pure_py.rb', line 35

def deploy_run_script_content
  shell_run_script do
    <<-EOT
    exec vendor/bin/python #{@py_script}
    EOT
  end
end

#dev_run_script_contentObject



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

def dev_run_script_content
  shell_run_script do
    <<-EOT
    cd #{@dir}
    exec vendor/bin/python #{@py_script}
    EOT
  end
end

#nameObject

The name of this profile



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

def name
  "pure-py"
end