capistrano-rails 0.0.7 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3e8fe1523ecab9c8b2d4712403d2453226bda1d
4
- data.tar.gz: 34eb72b078a2967aa6447102408dd81a15a389d6
3
+ metadata.gz: 50fc35b8cd9723dcb73171c9c666d6569eeb2e85
4
+ data.tar.gz: 73ed9253e148cc20700021781f6dc638a360d209
5
5
  SHA512:
6
- metadata.gz: 325e9f1fffcfa4665491b4d064bbd3198fb4a601896673c1a7b6dc1181808ebaef6419b023c952bbcf6b5846debce8b2780e72935d80fc260e7ee824d1059adb
7
- data.tar.gz: dfb240548e76a9b7f28bcef744f156ce35f138bc3fa8117b2f86f20de6b24537b626bb322303bf530506182e3b4808fb82b0bd5f6e99bffdb9cc28902fbaa98d
6
+ metadata.gz: d648704fa0fbbb0e001bb0f06d028ba764dcd0d41e7cc1772a036a99141a99af37717b0679787988d5d9310fe3c9c71af957bbaeb994a92fce72281fda1aee18
7
+ data.tar.gz: 872e46c1d0109dace75fd16b366fad09ecdba081a470ea1ef158754f29d8090f72bd57020e9f454553b137dad62b5ed8f0aaa732ee909498a8aed585476cddd5
data/README.md CHANGED
@@ -5,14 +5,27 @@ Rails specific tasks for Capistrano v3:
5
5
  - `cap deploy:migrate`
6
6
  - `cap deploy:normalise_assets`
7
7
 
8
- Assumes that `RAILS_ENV` matches stage, tasks are currently early examples
8
+ Tasks are currently early examples.
9
+
10
+ Some rails specific options.
11
+
12
+ ```ruby
13
+ set :rails_env, 'staging' # If the environment differs from the stage
14
+ set :migration_role, 'migrator' # Defaults to 'db'
15
+ ```
16
+
17
+ If you need to touch `public/images`, `public/javascripts` and `public/stylesheets` on each deploy:
18
+
19
+ ```ruby
20
+ set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets}
21
+ ```
9
22
 
10
23
  ## Installation
11
24
 
12
25
  Add this line to your application's Gemfile:
13
26
 
14
- gem 'capistrano', version: '~> 3.0.0'
15
- gem 'capistrano-rails', version: '~> 1.0.0'
27
+ gem 'capistrano', '~> 3.0.0'
28
+ gem 'capistrano-rails'
16
29
 
17
30
  And then execute:
18
31
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "capistrano-rails"
7
- gem.version = '0.0.7'
7
+ gem.version = '1.0.0'
8
8
  gem.authors = ["Tom Clements", "Lee Hambley"]
9
9
  gem.email = ["seenmyfate@gmail.com", "lee.hambley@gmail.com"]
10
10
  gem.description = %q{Rails specific Capistrano tasks}
@@ -1,2 +1,4 @@
1
+ load File.expand_path("../tasks/rails.rake", __FILE__)
2
+
1
3
  require 'capistrano/rails/assets'
2
4
  require 'capistrano/rails/migrations'
@@ -11,9 +11,11 @@ namespace :deploy do
11
11
  desc 'Normalise asset timestamps'
12
12
  task :normalise_assets do
13
13
  on roles :web do
14
- within release_path do
15
- assets = %{public/images public/javascripts public/stylesheets}
16
- execute :find, "#{assets} -exec touch -t #{asset_timestamp} {} ';'; true"
14
+ assets = fetch(:normalize_asset_timestamps)
15
+ if assets
16
+ within release_path do
17
+ execute :find, "#{assets} -exec touch -t #{asset_timestamp} {} ';'; true"
18
+ end
17
19
  end
18
20
  end
19
21
  end
@@ -24,11 +26,14 @@ namespace :deploy do
24
26
  invoke 'deploy:assets:backup_manifest'
25
27
  end
26
28
 
29
+ # FIXME: it removes every asset it has just compiled
27
30
  desc 'Cleanup expired assets'
28
31
  task :cleanup_assets do
29
32
  on roles :web do
30
33
  within release_path do
31
- execute :rake, "assets:clean RAILS_ENV=#{fetch(:stage)}"
34
+ with rails_env: fetch(:rails_env) do
35
+ execute :rake, "assets:clean"
36
+ end
32
37
  end
33
38
  end
34
39
  end
@@ -43,7 +48,8 @@ namespace :deploy do
43
48
  end
44
49
 
45
50
  after 'deploy:updated', 'deploy:compile_assets'
46
- after 'deploy:updated', 'deploy:cleanup_assets'
51
+ # NOTE: we don't want to remove assets we've just compiled
52
+ # after 'deploy:updated', 'deploy:cleanup_assets'
47
53
  after 'deploy:updated', 'deploy:normalise_assets'
48
54
  after 'deploy:reverted', 'deploy:rollback_assets'
49
55
 
@@ -51,7 +57,9 @@ namespace :deploy do
51
57
  task :precompile do
52
58
  on roles :web do
53
59
  within release_path do
54
- execute :rake, "assets:precompile RAILS_ENV=#{fetch(:stage)}"
60
+ with rails_env: fetch(:rails_env) do
61
+ execute :rake, "assets:precompile"
62
+ end
55
63
  end
56
64
  end
57
65
  end
@@ -60,8 +68,8 @@ namespace :deploy do
60
68
  on roles :web do
61
69
  within release_path do
62
70
  execute :cp,
63
- release_path.join('public', 'assets', 'manifest*.json'),
64
- release_path.join('assets_manifest_backup.json')
71
+ release_path.join('public', 'assets', 'manifest*'),
72
+ release_path.join('assets_manifest_backup')
65
73
  end
66
74
  end
67
75
  end
@@ -69,7 +77,7 @@ namespace :deploy do
69
77
  task :restore_manifest do
70
78
  on roles :web do
71
79
  within release_path do
72
- source = release_path.join('assets_manifest_backup.json')
80
+ source = release_path.join('assets_manifest_backup')
73
81
  target = capture(:ls, release_path.join('public', 'assets',
74
82
  'manifest*')).strip
75
83
  if test "[[ -f #{source} && -f #{target} ]]"
@@ -2,9 +2,11 @@ namespace :deploy do
2
2
 
3
3
  desc 'Runs rake db:migrate if migrations are set'
4
4
  task :migrate do
5
- on primary :db do
5
+ on primary fetch(:migration_role) do
6
6
  within release_path do
7
- execute :rake, "db:migrate RAILS_ENV=#{fetch(:stage)}"
7
+ with rails_env: fetch(:rails_env) do
8
+ execute :rake, "db:migrate"
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -12,3 +14,8 @@ namespace :deploy do
12
14
  after 'deploy:updated', 'deploy:migrate'
13
15
  end
14
16
 
17
+ namespace :load do
18
+ task :defaults do
19
+ set :migration_role, fetch(:migration_role, :db)
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ namespace :deploy do
2
+ before :starting, :set_rails_env do
3
+ set :rails_env, (fetch(:rails_env) || fetch(:stage))
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Clements
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-15 00:00:00.000000000 Z
12
+ date: 2013-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -45,6 +45,7 @@ files:
45
45
  - lib/capistrano/rails/migrations.rb
46
46
  - lib/capistrano/tasks/assets.rake
47
47
  - lib/capistrano/tasks/migrations.rake
48
+ - lib/capistrano/tasks/rails.rake
48
49
  homepage: https://github.com/capistrano/rails
49
50
  licenses: []
50
51
  metadata: {}
@@ -69,4 +70,3 @@ signing_key:
69
70
  specification_version: 4
70
71
  summary: Rails specific Capistrano tasks
71
72
  test_files: []
72
- has_rdoc: