Class: Rsm::Base

Inherits:
Thor::Group
  • Object
show all
Includes:
Actions, Thor::Actions
Defined in:
lib/rsm/base.rb

Constant Summary

SERVERS =
[:unicorn, :thin]

Constants included from Actions

Actions::TAR_OPTS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Actions

#application_root, #downloaded_file, #fetch_temporary_archive, #run_ruby_binary, #unpack_compressed_archive

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server



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

def server
  @server
end

#socket_per_workerObject (readonly)

Returns the value of attribute socket_per_worker



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

def socket_per_worker
  @socket_per_worker
end

#worker_processesObject (readonly)

Returns the value of attribute worker_processes



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

def worker_processes
  @worker_processes
end

Class Method Details

.source_rootObject



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

def self.source_root
  File.expand_path("../../../templates/#{template_path}", __FILE__)
end

.template_pathObject



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

def self.template_path
  Thor::Util.snake_case(name.to_s).squeeze(":").gsub(":", "/")
end

Instance Method Details

#set_destination_rootObject



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

def set_destination_root
  self.destination_root = application_root.to_s
end

#set_serverObject



35
36
37
38
39
# File 'lib/rsm/base.rb', line 35

def set_server
  @server = options[:server].to_sym
  raise "Unknown server #{options[:server].inspect}. Available is #{SERVERS}" unless SERVERS.include?(server)
  @socket_per_worker = (server == :thin)
end

#set_worker_processesObject



41
42
43
# File 'lib/rsm/base.rb', line 41

def set_worker_processes
  @worker_processes = options[:worker_processes]
end