Sha256: 82e8918045f96e5acf5988d2e77402f13d3203afd467f275bb8ad41a4bc314de

Contents?: true

Size: 960 Bytes

Versions: 13

Compression:

Stored size: 960 Bytes

Contents

require 'rake'

namespace :dad do
  namespace :unicorn do

    desc 'Unicornをインストールします。'
    task :install => :environment do
      rails_env = ENV['RAILS_ENV'] || Rails.env
      rails_root = ENV['RAILS_ROOT'] || Rails.root
      init_script = 'unicorn_' + YAML.load_file("config/database.yml")[Rails.env]['database']

      commands = [
        "RAILS_ENV=#{rails_env} RAILS_ROOT=#{rails_root} erb -T - #{File.dirname(__FILE__)}/unicorn.erb > tmp/#{init_script}",
        "RAILS_ENV=#{rails_env} RAILS_ROOT=#{rails_root} erb -T - #{File.dirname(__FILE__)}/unicorn.rb.erb > config/unicorn.rb",

        "sudo cp -f tmp/#{init_script} /etc/init.d/#{init_script}",
        "sudo chown root:root /etc/init.d/#{init_script}",
        "sudo chmod 755 /etc/init.d/#{init_script}",
        "sudo /sbin/chkconfig #{init_script} on",
      ]

      commands.each do |c|
        puts c
        fail unless system(c)
      end
    end  

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
daddy-0.3.20 lib/tasks/unicorn.rake
daddy-0.3.19 lib/tasks/unicorn.rake
daddy-0.3.18 lib/tasks/unicorn.rake
daddy-0.3.17 lib/tasks/unicorn.rake
daddy-0.3.16 lib/tasks/unicorn.rake
daddy-0.3.15 lib/tasks/unicorn.rake
daddy-0.3.14 lib/tasks/unicorn.rake
daddy-0.3.13 lib/tasks/unicorn.rake
daddy-0.3.12 lib/tasks/unicorn.rake
daddy-0.3.11 lib/tasks/unicorn.rake
daddy-0.3.10 lib/tasks/unicorn.rake
daddy-0.3.9 lib/tasks/unicorn.rake
daddy-0.3.8 lib/tasks/unicorn.rake