Class: Rsm::Install::Rails

Inherits:
Base
  • Object
show all
Defined in:
lib/tasks/install/rails.rb

Constant Summary

Constants inherited from Base

Base::SERVERS

Constants included from Actions

Actions::TAR_OPTS

Instance Attribute Summary

Attributes inherited from Base

#server, #socket_per_worker, #worker_processes

Instance Method Summary collapse

Methods inherited from Base

#set_destination_root, #set_server, #set_worker_processes, source_root, template_path

Methods included from Actions

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

Instance Method Details

#downloadObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tasks/install/rails.rb', line 12

def download
  empty_directory "."
  inside application_root do
    if options[:git]
      run "git clone #{options[:git]} ."
    elsif options[:tgz]
      fetch_temporary_archive(name, options[:tgz], :gz)
      unpack_compressed_archive(name, :gz)
    elsif options[:tbz2]
      fetch_temporary_archive(name, options[:tbz2], :bz2)
      unpack_compessed_archive(name, :bz2)
    else
      say "No source URI specified - skip download"
    end
  end
end

#permissionsObject



45
46
47
48
49
50
51
52
# File 'lib/tasks/install/rails.rb', line 45

def permissions
  inside "." do
    empty_directory "log"
    empty_directory "tmp"
    run "chown #{options[:user]}:#{options[:group]} -R ."
    run "chmod 755 log tmp"
  end
end

#server_configObject



41
42
43
# File 'lib/tasks/install/rails.rb', line 41

def server_config
  send("#{server}_config")
end

#thin_configObject



34
35
36
37
38
# File 'lib/tasks/install/rails.rb', line 34

def thin_config
  inside "." do
    run_ruby_binary "thin config -C config/thin.yml -S tmp/sockets/thin.sock -s #{options[:worker_processes]} -e #{options[:environment]}"
  end
end

#unicorn_configObject



29
30
31
# File 'lib/tasks/install/rails.rb', line 29

def unicorn_config
  template "unicorn.rb.erb", "config/unicorn.rb"
end