Class: Runner::Rails

Inherits:
Base
  • Object
show all
Defined in:
lib/shared_infrastructure/runner/rails.rb

Instance Attribute Summary

Attributes inherited from Base

#builder_class

Instance Method Summary collapse

Methods inherited from Base

#options_for_config, #process_args

Instance Method Details

#mainObject



3
4
5
6
7
# File 'lib/shared_infrastructure/runner/rails.rb', line 3

def main
  builder = super
  FileUtils.mkdir_p(File.dirname(Systemd.unit_file("example.com"))) if Nginx.root?
  builder
end

#process_optionsObject



9
10
11
# File 'lib/shared_infrastructure/runner/rails.rb', line 9

def process_options
  super(Nginx::Builder::RailsHttp, Nginx::Builder::RailsHttps)
end

#protocol_factory(options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/shared_infrastructure/runner/rails.rb', line 13

def protocol_factory(options)
  protocol_class = super(
    options,
    Nginx::Builder::RailsHttp,
    Nginx::Builder::RailsHttps
  )

  # puts "Runner::Rails protocol_class: #{protocol_class}"
  # TODO: Each class has a subtly different group of lines here.
  # There's almost certainly a refactoring that would make this less
  # convoluted.
  domain_name = options.delete(:domain_name)
  user = options.delete(:user)
  certificate_domain = options.delete(:certificate_domain)
  accel_location = options.delete(:accel_location)
  # FIXME: This is the wrong way to do this.
  rails_env = options.delete(:rails_env) { "production" }
  domain = SharedInfrastructure::Domain.new(domain_name)
  protocol_class.new(user, certificate_domain, accel_location: accel_location, domain: domain, rails_env: rails_env)
end