Sha256: 1d397f43c5fe87f12c5e2140cb67682a17f36520400efa7cb64a71c1f548579e

Contents?: true

Size: 977 Bytes

Versions: 42

Compression:

Stored size: 977 Bytes

Contents

# coding: UTF-8

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

42 entries across 42 versions & 1 rubygems

Version Path
daddy-0.3.7 lib/tasks/unicorn.rake
daddy-0.3.6 lib/tasks/unicorn.rake
daddy-0.3.4 lib/tasks/unicorn.rake
daddy-0.3.3 lib/tasks/unicorn.rake
daddy-0.3.2 lib/tasks/unicorn.rake
daddy-0.3.1 lib/tasks/unicorn.rake
daddy-0.3.0 lib/tasks/unicorn.rake
daddy-0.2.23 lib/tasks/unicorn.rake
daddy-0.2.22 lib/tasks/unicorn.rake
daddy-0.2.21 lib/tasks/unicorn.rake
daddy-0.2.20 lib/tasks/unicorn.rake
daddy-0.2.19 lib/tasks/unicorn.rake
daddy-0.2.18 lib/tasks/unicorn.rake
daddy-0.2.17 lib/tasks/unicorn.rake
daddy-0.2.16 lib/tasks/unicorn.rake
daddy-0.2.15 lib/tasks/unicorn.rake
daddy-0.2.14 lib/tasks/unicorn.rake
daddy-0.2.13 lib/tasks/unicorn.rake
daddy-0.2.12 lib/tasks/unicorn.rake
daddy-0.2.11 lib/tasks/unicorn.rake