Sha256: f97df0b29f380163c1023f5ee9d24afd57a35f5f5ba18cd5f5a4217a27cd7528
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
Capistrano::Configuration.instance(:must_exist).load do namespace :shards do namespace :setup do desc "Upload configs" task :default, :roles => :app do if exists?(:shards_setup_settings) set(:recipe_settings) do { 'main' => database_template_settings, 'shards' => shards_template_settings } end put template.render(_shards_template), _shards_remote_path else puts "[FATAL] - Shards template settings were not found" abort end end desc "Download configs" task :get, :roles => :db do download _shards_remote_path, _shards_local_path end end end def shards_setup_defaults HashWithIndifferentAccess.new({ 'environments' => %w(production), 'databases' => {} }) end def shards_template_settings DeepToHash.to_hash shards_setup_defaults.deep_merge(fetch(:shards_setup_settings, {})) end def _shards_remote_path File.join(shared_path, fetch(:shards_remote_path, 'config/shards.yml')) end def _shards_local_path File.join(local_rails_root, fetch(:shards_local_path, 'config/shards.yml')) end def _shards_template fetch(:shards_template, 'shards.yml.erb') end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
marcosgz-cap-recipe-0.0.14 | lib/capistrano/recipes/shards.rb |
marcosgz-cap-recipe-0.0.13 | lib/capistrano/recipes/shards.rb |
marcosgz-cap-recipe-0.0.12 | lib/capistrano/recipes/shards.rb |