Sha256: 7426b2223295c2c333af14c71717be9f5170d9e29fd1fcb8c147ee565ff485eb
Contents?: true
Size: 1.94 KB
Versions: 1
Compression:
Stored size: 1.94 KB
Contents
require 'capistrano' module GaleraClusterMigrations class Capistrano TASKS = [ 'galera:migrate' ] def self.load_into(capistrano_config) capistrano_config.load do before(Capistrano::TASKS) do Config.load(self) end namespace :galera do desc <<-DESC Run the migrate rake task. By default, it runs this in most recently \ deployed version of the app. However, you can specify a different release \ via the migrate_target variable, which must be one of :latest (for the \ default behavior), or :current (for the release indicated by the \ `current' symlink). Strings will work for those values instead of symbols, \ too. You can also specify additional environment variables to pass to rake \ via the migrate_env variable. Finally, you can specify the full path to the \ rake executable by setting the rake variable. The defaults are: set :rake, "rake" set :rails_env, "production" set :migrate_env, "" set :migrate_target, :latest DESC task :migrate, :roles => :db do rake = fetch(:rake, "rake") rails_env = fetch(:rails_env, "production") migrate_env = fetch(:migrate_env, "") migrate_target = fetch(:migrate_target, :latest) directory = case migrate_target.to_sym when :current then current_path when :latest then latest_release else raise ArgumentError, "unknown migration target #{migrate_target.inspect}" end run "cd #{directory} && #{rake} RAILS_ENV=#{rails_env} #{migrate_env} galera:db:alter[db:migrate]" end end end end end end if Capistrano::Configuration.instance GaleraClusterMigrations::Capistrano.load_into(Capistrano::Configuration.instance) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
galera_cluster_migrations-0.0.1.alpha1 | lib/galera_cluster_migrations/capistrano.rb |