Class: Foreman::Export::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman/export/base.rb

Direct Known Subclasses

Bluepill, Daemon, Inittab, Launchd, Runit, Supervisord, Systemd, Upstart

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location, engine, options = {}) ⇒ Base

Returns a new instance of Base.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/foreman/export/base.rb', line 15

def initialize(location, engine, options={})
  @location  = location
  @engine    = engine
  @options   = options.dup
  @formation = engine.formation

  # deprecated
  def port
    Foreman::Export::Base.warn_deprecation!
    engine.base_port
  end

  # deprecated
  def template
    Foreman::Export::Base.warn_deprecation!
    options[:template]
  end

  # deprecated
  def @engine.procfile
    Foreman::Export::Base.warn_deprecation!
    @processes.map do |process|
      Struct.new(
        :name => @names[process],
        :process => process
      )
    end
  end
end

Instance Attribute Details

#engineObject (readonly)

Returns the value of attribute engine.



8
9
10
# File 'lib/foreman/export/base.rb', line 8

def engine
  @engine
end

#formationObject (readonly)

Returns the value of attribute formation.



10
11
12
# File 'lib/foreman/export/base.rb', line 10

def formation
  @formation
end

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/foreman/export/base.rb', line 7

def location
  @location
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/foreman/export/base.rb', line 9

def options
  @options
end

#portObject (readonly)

deprecated



13
14
15
# File 'lib/foreman/export/base.rb', line 13

def port
  @port
end

Class Method Details

.procfileObject

deprecated



34
35
36
37
38
39
40
41
42
# File 'lib/foreman/export/base.rb', line 34

def @engine.procfile
  Foreman::Export::Base.warn_deprecation!
  @processes.map do |process|
    Struct.new(
      :name => @names[process],
      :process => process
    )
  end
end

Instance Method Details

#appObject



52
53
54
# File 'lib/foreman/export/base.rb', line 52

def app
  options[:app] || "app"
end

#exportObject



45
46
47
48
49
50
# File 'lib/foreman/export/base.rb', line 45

def export
  error("Must specify a location") unless location
  FileUtils.mkdir_p(location) rescue error("Could not create: #{location}")
  chown user, log
  chown user, run
end

#logObject



56
57
58
# File 'lib/foreman/export/base.rb', line 56

def log
  options[:log] || "/var/log/#{app}"
end

#runObject



60
61
62
# File 'lib/foreman/export/base.rb', line 60

def run
  options[:run] || "/var/run/#{app}"
end

#templateObject

deprecated



28
29
30
31
# File 'lib/foreman/export/base.rb', line 28

def template
  Foreman::Export::Base.warn_deprecation!
  options[:template]
end

#userObject



64
65
66
# File 'lib/foreman/export/base.rb', line 64

def user
  options[:user] || app
end