Class: Rsm::Install::Rails
- Defined in:
- lib/tasks/install/rails.rb
Constant Summary
Constants inherited from Base
Constants included from Actions
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
Attributes inherited from Base
#server, #socket_per_worker, #worker_processes
Instance Method Summary collapse
- #define_vars ⇒ Object
- #download ⇒ Object
- #permissions ⇒ Object
- #server_config ⇒ Object
- #thin_config ⇒ Object
- #unicorn_config ⇒ Object
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, #ruby_binary, #run_ruby_binary, #run_with_bundler, #unpack_compressed_archive
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/tasks/install/rails.rb', line 5 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/tasks/install/rails.rb', line 5 def port @port end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
5 6 7 |
# File 'lib/tasks/install/rails.rb', line 5 def socket @socket end |
Instance Method Details
#define_vars ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tasks/install/rails.rb', line 35 def define_vars @socket = [:socket] @host = [:host] @port = [:port] @config_dir = if [:capistrano] "../shared" else "config" end end |
#download ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tasks/install/rails.rb', line 18 def download empty_directory "." inside application_root do if [:git] run "git clone #{[:git]} ." elsif [:tgz] fetch_temporary_archive(name, [:tgz], :gz) unpack_compressed_archive(name, :gz) elsif [:tbz2] fetch_temporary_archive(name, [:tbz2], :bz2) unpack_compessed_archive(name, :bz2) else say "No source URI specified - skip download" end end end |
#permissions ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/tasks/install/rails.rb', line 74 def inside "." do empty_directory "log" empty_directory "tmp" run "chown #{[:user]}:#{[:group]} -R ." run "chmod 755 log tmp" end end |
#server_config ⇒ Object
70 71 72 |
# File 'lib/tasks/install/rails.rb', line 70 def server_config send("#{server}_config") end |
#thin_config ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/tasks/install/rails.rb', line 51 def thin_config env = [:environment] inside "." do cmd = "thin config -C #@config_dir/thin.#{env}.yml -s #{[:worker_processes]} -e #{env} -l log/thin.#{env}.log -P tmp/pids/thin.#{env}.pid" if socket cmd << " -S tmp/sockets/thin.#{env}.sock" else if host cmd << " -a #{host}" end if port cmd << " -p #{port}" end end run_with_bundler cmd end end |
#unicorn_config ⇒ Object
46 47 48 |
# File 'lib/tasks/install/rails.rb', line 46 def unicorn_config template "unicorn.rb.erb", "#@config_dir/unicorn.rb" end |