capistrano-rails-multiple-db 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4dcf85ce54f24a7c13bebb648c409f24ef5f1659
4
+ data.tar.gz: 6ee548084c78a4e318993162227fe9307be8e4a7
5
+ SHA512:
6
+ metadata.gz: f072759dae57b5b3ad37f2dfbe4818d0e27f94e06f571348683b7d408f9872dbdfcbcf1b8597c048c17eb027f3ba04387a1572ead2940ad742d6823ab23799b4
7
+ data.tar.gz: 65f6f513dcf54b5a5a13f75ae6eb452d0b6de3f314d2b63288ff3cb19a577ea122aa5f9b75e654d7f456e8050193de8bdc3d7add544930f8a9571804d1f0dd9c
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .vagrant
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ provision.sh
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ Vagrantfile
data/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # 1.1.3 (Apr 18 2015)
2
+
3
+ * Fixed no_release behaviour (https://github.com/capistrano/rails/pull/95)
4
+ * Allow assets manifest backup with folder "manifests" (https://github.com/capistrano/rails/pull/92)
5
+ * Handle Sprocket 3 manifest filename
6
+
7
+ # 1.1.2 (Sep 1 2014)
8
+
9
+ * rails_env is set before deploy (https://github.com/capistrano/rails/pull/66)
10
+ * with `conditionally_migrate` option enabled you can skip `db:migrate` if there were no new migrations (https://github.com/capistrano/rails/pull/71)
11
+ * Allow early overriding of assets_* parameters (https://github.com/capistrano/rails/pull/73)
12
+
13
+ # 1.1.1
14
+
15
+ * New `asset_roles` options: https://github.com/capistrano/rails/pull/30
16
+ * normalized task spelling: 'deploy:normalise_assets' is now 'deploy:normalize_assets'
17
+ * depend on capistrano 3.1 to support multiple role arguments
18
+
19
+ # 1.1.0
20
+
21
+ * set rails_env even if capistrano-rails was required partly
22
+ * depend on capistrano-bundler
23
+ * require bundler with capistrano-rails/all
24
+
25
+ # 1.0.0
26
+
27
+ Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tom Clements
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # Capistrano::Rails
2
+
3
+ Rails specific tasks for Capistrano v3:
4
+
5
+ - `cap deploy:migrate`
6
+ - `cap deploy:compile_assets`
7
+
8
+ Some rails specific options.
9
+
10
+ ```ruby
11
+ set :rails_env, 'staging' # If the environment differs from the stage name
12
+ set :migration_role, 'migrator' # Defaults to 'db'
13
+ set :conditionally_migrate, true # Defaults to false. If true, it's skip migration if files in db/migrate not modified
14
+ set :assets_roles, [:web, :app] # Defaults to [:web]
15
+ set :assets_prefix, 'prepackaged-assets' # Defaults to 'assets' this should match config.assets.prefix in your rails config/application.rb
16
+ set :multiple_migration_servers, true # Defaults to false. If true, it would run migrations on all servers under the migration_role
17
+ ```
18
+
19
+ If you need to touch `public/images`, `public/javascripts` and `public/stylesheets` on each deploy:
20
+
21
+ ```ruby
22
+ set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets}
23
+ ```
24
+
25
+ ## Installation
26
+
27
+ Add this line to your application's Gemfile:
28
+
29
+ gem 'capistrano', '~> 3.1'
30
+ gem 'capistrano-rails', '~> 1.1'
31
+
32
+ ## Usage
33
+
34
+ Require everything (bundler, rails/assets and rails/migrations)
35
+
36
+ # Capfile
37
+ require 'capistrano/rails'
38
+
39
+ Or require just what you need manually:
40
+
41
+ # Capfile
42
+ require 'capistrano/bundler' # Rails needs Bundler, right?
43
+ require 'capistrano/rails/assets'
44
+ require 'capistrano/rails/migrations'
45
+
46
+ Please note that any `require` should be placed in `Capfile`, not `config/deploy.rb`.
47
+
48
+ ### Symlinks
49
+
50
+ You'll probably want to symlink Rails shared files and directories like `log`, `tmp` and `public/uploads`.
51
+ Make sure you enable it by setting `linked_dirs` and `linked_files` options:
52
+
53
+ # deploy.rb
54
+ set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads')
55
+ set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
56
+
57
+ ## Contributing
58
+
59
+ 1. Fork it
60
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
61
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
62
+ 4. Push to the branch (`git push origin my-new-feature`)
63
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "capistrano-rails-multiple-db"
7
+ gem.version = '1.1.3'
8
+ gem.authors = ["Tom Clements", "Lee Hambley", "Kir Shatrov"]
9
+ gem.email = ["seenmyfate@gmail.com", "lee.hambley@gmail.com", "shatrov@me.com"]
10
+ gem.description = %q{Rails specific Capistrano tasks}
11
+ gem.summary = %q{Rails specific Capistrano tasks with the integrated patch for multiple db servers}
12
+ gem.homepage = "https://github.com/tonkonogov/rails"
13
+
14
+ gem.files = `git ls-files`.split($/)
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.require_paths = ["lib"]
17
+
18
+ gem.add_dependency 'capistrano', '~> 3.1'
19
+ gem.add_dependency 'capistrano-bundler', '~> 1.1'
20
+
21
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ require 'capistrano/bundler'
2
+ require 'capistrano/rails/assets'
3
+ require 'capistrano/rails/migrations'
@@ -0,0 +1 @@
1
+ load File.expand_path("../../tasks/assets.rake", __FILE__)
@@ -0,0 +1 @@
1
+ load File.expand_path("../../tasks/migrations.rake", __FILE__)
@@ -0,0 +1,115 @@
1
+ load File.expand_path("../set_rails_env.rake", __FILE__)
2
+
3
+ module Capistrano
4
+ class FileNotFound < StandardError
5
+ end
6
+ end
7
+
8
+ namespace :deploy do
9
+ desc 'Normalize asset timestamps'
10
+ task :normalize_assets => [:set_rails_env] do
11
+ on release_roles(fetch(:assets_roles)) do
12
+ assets = fetch(:normalize_asset_timestamps)
13
+ if assets
14
+ within release_path do
15
+ execute :find, "#{assets} -exec touch -t #{asset_timestamp} {} ';'; true"
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ desc 'Compile assets'
22
+ task :compile_assets => [:set_rails_env] do
23
+ invoke 'deploy:assets:precompile'
24
+ invoke 'deploy:assets:backup_manifest'
25
+ end
26
+
27
+ # FIXME: it removes every asset it has just compiled
28
+ desc 'Cleanup expired assets'
29
+ task :cleanup_assets => [:set_rails_env] do
30
+ on release_roles(fetch(:assets_roles)) do
31
+ within release_path do
32
+ with rails_env: fetch(:rails_env) do
33
+ execute :rake, "assets:clean"
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ desc 'Rollback assets'
40
+ task :rollback_assets => [:set_rails_env] do
41
+ begin
42
+ invoke 'deploy:assets:restore_manifest'
43
+ rescue Capistrano::FileNotFound
44
+ invoke 'deploy:compile_assets'
45
+ end
46
+ end
47
+
48
+ after 'deploy:updated', 'deploy:compile_assets'
49
+ # NOTE: we don't want to remove assets we've just compiled
50
+ # after 'deploy:updated', 'deploy:cleanup_assets'
51
+ after 'deploy:updated', 'deploy:normalize_assets'
52
+ after 'deploy:reverted', 'deploy:rollback_assets'
53
+
54
+ namespace :assets do
55
+ task :precompile do
56
+ on release_roles(fetch(:assets_roles)) do
57
+ within release_path do
58
+ with rails_env: fetch(:rails_env) do
59
+ execute :rake, "assets:precompile"
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ task :backup_manifest do
66
+ on release_roles(fetch(:assets_roles)) do
67
+ within release_path do
68
+ backup_path = release_path.join('assets_manifest_backup')
69
+
70
+ execute :mkdir, '-p', backup_path
71
+ execute :cp,
72
+ detect_manifest_path,
73
+ backup_path
74
+ end
75
+ end
76
+ end
77
+
78
+ task :restore_manifest do
79
+ on release_roles(fetch(:assets_roles)) do
80
+ within release_path do
81
+ target = detect_manifest_path
82
+ source = release_path.join('assets_manifest_backup', File.basename(target))
83
+ if test "[[ -f #{source} && -f #{target} ]]"
84
+ execute :cp, source, target
85
+ else
86
+ msg = 'Rails assets manifest file (or backup file) not found.'
87
+ warn msg
88
+ fail Capistrano::FileNotFound, msg
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ def detect_manifest_path
95
+ %w(
96
+ .sprockets-manifest*
97
+ manifest*.*
98
+ ).each do |pattern|
99
+ candidate = release_path.join('public', fetch(:assets_prefix), pattern)
100
+ return capture(:ls, candidate).strip if test(:ls, candidate)
101
+ end
102
+ msg = 'Rails assets manifest file not found.'
103
+ warn msg
104
+ fail Capistrano::FileNotFound, msg
105
+ end
106
+ end
107
+ end
108
+
109
+ namespace :load do
110
+ task :defaults do
111
+ set :assets_roles, fetch(:assets_roles, [:web])
112
+ set :assets_prefix, fetch(:assets_prefix, 'assets')
113
+ set :linked_dirs, fetch(:linked_dirs, []).push("public/#{fetch(:assets_prefix)}")
114
+ end
115
+ end
@@ -0,0 +1,33 @@
1
+ load File.expand_path("../set_rails_env.rake", __FILE__)
2
+
3
+ namespace :deploy do
4
+
5
+ desc 'Runs rake db:migrate if migrations are set'
6
+ task :migrate => [:set_rails_env] do
7
+ migration_servers = fetch(:multiple_migration_servers) ? roles(fetch(:migration_role)) : primary(fetch(:migration_role))
8
+ on migration_servers do
9
+ conditionally_migrate = fetch(:conditionally_migrate)
10
+ info '[deploy:migrate] Checking changes in /db/migrate' if conditionally_migrate
11
+ if conditionally_migrate && test("diff -q #{release_path}/db/migrate #{current_path}/db/migrate")
12
+ info '[deploy:migrate] Skip `deploy:migrate` (nothing changed in db/migrate)'
13
+ else
14
+ info '[deploy:migrate] Run `rake db:migrate`'
15
+ within release_path do
16
+ with rails_env: fetch(:rails_env) do
17
+ execute :rake, "db:migrate"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ after 'deploy:updated', 'deploy:migrate'
25
+ end
26
+
27
+ namespace :load do
28
+ task :defaults do
29
+ set :conditionally_migrate, fetch(:conditionally_migrate, false)
30
+ set :migration_role, fetch(:migration_role, :db)
31
+ set :multiple_migration_servers, fetch(:multiple_migration_servers, false)
32
+ end
33
+ end
@@ -0,0 +1,9 @@
1
+ namespace :deploy do
2
+ task :set_rails_env do
3
+ set :rails_env, (fetch(:rails_env) || fetch(:stage))
4
+ end
5
+ end
6
+
7
+ Capistrano::DSL.stages.each do |stage|
8
+ after stage, 'deploy:set_rails_env'
9
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-rails-multiple-db
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Tom Clements
8
+ - Lee Hambley
9
+ - Kir Shatrov
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2015-07-08 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: capistrano
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '3.1'
29
+ - !ruby/object:Gem::Dependency
30
+ name: capistrano-bundler
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '1.1'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.1'
43
+ description: Rails specific Capistrano tasks
44
+ email:
45
+ - seenmyfate@gmail.com
46
+ - lee.hambley@gmail.com
47
+ - shatrov@me.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - ".gitignore"
53
+ - CHANGELOG.md
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - capistrano-rails.gemspec
59
+ - lib/capistrano-rails.rb
60
+ - lib/capistrano/rails.rb
61
+ - lib/capistrano/rails/assets.rb
62
+ - lib/capistrano/rails/migrations.rb
63
+ - lib/capistrano/tasks/assets.rake
64
+ - lib/capistrano/tasks/migrations.rake
65
+ - lib/capistrano/tasks/set_rails_env.rake
66
+ homepage: https://github.com/tonkonogov/rails
67
+ licenses: []
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.4.8
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Rails specific Capistrano tasks with the integrated patch for multiple db
89
+ servers
90
+ test_files: []