Sha256: 9bf1e499153aee26f5b3ece1bc8b47c1af5851d8c7813e150665fc4705e8c0d0

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

# encoding: utf-8
module MagicRecipes
  module Sqlite
    def self.load_into(configuration)
      configuration.load do

        set_default :sqlite_path,         "#{ deploy_to }/shared/db/"
        set_default :sqlite_db,           "#{ rails_env.downcase.strip }"

        namespace :sqlite do
          
          desc "setup shared sqlite-folder"
          task :setup_db do
            run "mkdir #{ sqlite_path }"
          end

          desc "save current db"
          task :save_db do
            if use_rvm
              run <<-CMD
                #{rvm_cmd} && 
                cd #{deploy_to}/current/db && 
                cp -f #{ sqlite_db }.sqlite3 #{ sqlite_path }/
              CMD
            else
              run "cd #{deploy_to}/current/db && cp #{ sqlite_db }.sqlite3 #{sqlite_path}/"
            end
          end

          desc "copy the database"
          task :copy_db do
            if use_rvm
              run <<-CMD
                #{rvm_cmd} && 
                cd #{sqlite_path} && 
                cp -f #{ sqlite_db }.sqlite3 #{deploy_to}/current/db/
              CMD
            else
              run "cd #{sqlite_path} && cp -f #{ sqlite_db }.sqlite3 #{deploy_to}/current/db/"
            end
          end

        end

        after "deploy:setup", "sqlite:setup_db"

        # eof
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
magic_recipes-0.0.19 lib/magic_recipes/sqlite.rb