Sha256: 6e11c4a033a2fef7e20a352cf661379b7d9a0b7a95cb790d83bd4e8ae328bb0c

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

namespace :active_record do
  
  desc <<-DESC
  Create (ActiveRecord) database yaml in shared path. 
  Note: If both @:db_host@ and @:db_socket@ are used, @db_socket@ wins.
  
  "Source":#{link_to_source(__FILE__)}
  DESC
  task_arg(:db_name, "Database name")
  task_arg(:db_user, "Database user")
  task_arg(:db_pass, "Database password")
  task_arg(:db_host, "Database host", :default => nil)
  task_arg(:db_socket, "Database socket", :default => nil)
  task_arg(:database_yml_template, "Database yml template", :default => "rails/database.yml.erb")
  task :setup, :roles => :app do    
    
    unless db_host.blank?
      set :db_connect_type, "host"
      set :db_connect, db_host
    end
    
    unless db_socket.blank?
      set :db_connect_type, "socket"
      set :db_connect, db_socket
    end
    
    run "mkdir -p #{shared_path}/config"
    put template.load(database_yml_template), "#{shared_path}/config/database.yml"
  end

  desc "Make symlink for database yaml"
  task :update_code do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" 
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
calas-capitate-0.3.6 lib/recipes/active_record.rb
capitate-0.3.6 lib/recipes/active_record.rb