Class: Circus::Profiles::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/circus/profiles/base.rb

Overview

Base functionality for an Profile

Direct Known Subclasses

ChefStack, Jekyll, MakeBase, MavenWebApp, PythonBase, RubyBase

Instance Method Summary collapse

Constructor Details

#initialize(name, dir, props) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
# File 'lib/circus/profiles/base.rb', line 11

def initialize(name, dir, props)
  @name = name
  @dir = dir
  @props = props
end

Instance Method Details

#cleanup_after_deploy(logger, overlay_dir) ⇒ Object



54
55
# File 'lib/circus/profiles/base.rb', line 54

def cleanup_after_deploy(logger, overlay_dir)
end

#extra_dirsObject



31
32
33
# File 'lib/circus/profiles/base.rb', line 31

def extra_dirs
  []
end

#mark_for_persistent_run?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/circus/profiles/base.rb', line 17

def mark_for_persistent_run?
  true
end

#package_base_dir?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/circus/profiles/base.rb', line 27

def package_base_dir?
  true
end

#package_for_deploy(logger, run_dir) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/circus/profiles/base.rb', line 42

def package_for_deploy(logger, run_dir)
  return false unless prepare_for_deploy(logger, run_dir)
  write_run_script(run_dir) do |f|
    f.write(deploy_run_script_content.strip)
  end
  
  reqs = build_default_requirements.merge(requirements)
  File.open(File.join(run_dir, 'requirements.yaml'), 'w') do |f|
    f.write(reqs.to_yaml)
  end
end

#package_for_dev(logger, run_dir) ⇒ Object



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

def package_for_dev(logger, run_dir)
  return false unless prepare_for_dev(logger, run_dir)
  write_run_script(run_dir) do |f|
    f.write(dev_run_script_content.strip)
  end
end

#requirementsObject

Overriden by subclasses to specify the resources that they require. Defaults to a resource hash provided in the act definition



59
60
61
# File 'lib/circus/profiles/base.rb', line 59

def requirements
  (@props['requirements'] || {}).dup
end

#supported_for_development?Boolean

Whether acts using the given profile can be run during development. If this returns false, then local only commands (such as go) will ignore these items.

Returns:

  • (Boolean)


23
24
25
# File 'lib/circus/profiles/base.rb', line 23

def supported_for_development?
  true
end