Sha256: f804b6c1d12ed4d885445f79114d931d4e876a566766e260e637af8c51ac25d6
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
namespace :unicorn do desc 'start server' task :start, [:env, :config] do |task, args| args = { :env => 'development', :config => 'unicorn.rb' }.merge args.to_hash cmd = 'unicorn_rails' cmd << ' -c ' << args[:config] if File.exists?(File.join(Rails.root, args[:config])) cmd << ' -E ' << args[:env] sys cmd << ' -D' end desc 'stop server' task :stop do sys 'kill -QUIT `cat tmp/unicorn.pid`' if File.exists? File.join(Rails.root, 'tmp', 'unicorn.pid') end desc 'restart server' task :restart, [:env, :config] => [:stop, :start] desc 'copy unicorn.rb to root path' task :copy, [:processes, :port] do |task, args| path = File.join(Rails.root, 'unicorn.rb') if File.exists? path err 'unicorn.rb is exists! Please remove it and run again.' else args = { :processes => 1, :port => 8080 }.merge args.to_hash p file = "# Added by zfben_rails_rake\nworker_processes #{args[:processes]}\nlisten #{args[:port]}, :tcp_nopush => true, :tcp_nodelay => true\npid 'tmp/unicorn.pid'\n# End zfben_rails_rake" File.open(path, 'w'){ |f| f.write file } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zfben_rails_rake-0.0.10 | lib/zfben_rails_rake/tasks/unicorn.rb |