capistrano-local-precompile 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano-local-precompile/version.rb +1 -1
- data/lib/capistrano/local_precompile.rb +11 -15
- data/spec/configuration_spec.rb +9 -9
- data/spec/integration_spec.rb +9 -30
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 644ce2bff333643050f8d23e36e3a4b997beebfb
|
4
|
+
data.tar.gz: 90e77669bed672c85d0d85a18b1cefd36ac748c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 327e6ba7b98758a78fa4f32e55d8692477560d66f402848e092c036554eaee345e6659c99ca87982fde7995a1977f802c1f8c1ec082103a4bc9b0da76ef2be3b
|
7
|
+
data.tar.gz: e245dd1789bff46cbe55f6b46798652157d87d5e4302407068ba49e279cf6312f9e8578988b16531f0ca26728a652df51413b47eeb4c8ff4e798d6170602d79a
|
@@ -6,34 +6,30 @@ module Capistrano
|
|
6
6
|
def self.load_into(configuration)
|
7
7
|
configuration.load do
|
8
8
|
|
9
|
-
set(:
|
9
|
+
set(:precompile_env) { rails_env }
|
10
|
+
set(:precompile_cmd) { "RAILS_ENV=#{precompile_env.to_s.shellescape} #{asset_env} #{rake} assets:precompile" }
|
10
11
|
set(:cleanexpired_cmd) { "RAILS_ENV=#{rails_env.to_s.shellescape} #{asset_env} #{rake} assets:clean_expired" }
|
11
12
|
set(:assets_dir) { "public/assets" }
|
12
|
-
|
13
|
-
set(:turbosprockets_enabled) { false }
|
14
|
-
set(:turbosprockets_backup_dir) { "public/.assets" }
|
15
|
-
set(:rsync_cmd) { "rsync -av" }
|
13
|
+
set(:rsync_cmd) { "rsync -av" }
|
16
14
|
|
17
15
|
before "deploy:assets:precompile", "deploy:assets:prepare"
|
16
|
+
before "deploy:assets:symlink", "deploy:assets:remove_manifest"
|
17
|
+
|
18
18
|
after "deploy:assets:precompile", "deploy:assets:cleanup"
|
19
19
|
|
20
20
|
namespace :deploy do
|
21
21
|
namespace :assets do
|
22
22
|
|
23
|
+
desc "remove manifest file from remote server"
|
24
|
+
task :remove_manifest do
|
25
|
+
run "rm -f #{fetch(:assets_dir)}/manifest*.json"
|
26
|
+
end
|
27
|
+
|
23
28
|
task :cleanup, :on_no_matching_servers => :continue do
|
24
|
-
|
25
|
-
run_locally "mv #{fetch(:assets_dir)} #{fetch(:turbosprockets_backup_dir)}"
|
26
|
-
else
|
27
|
-
run_locally "rm -rf #{fetch(:assets_dir)}"
|
28
|
-
end
|
29
|
+
run_locally "rm -rf #{fetch(:assets_dir)}"
|
29
30
|
end
|
30
31
|
|
31
32
|
task :prepare, :on_no_matching_servers => :continue do
|
32
|
-
if fetch(:turbosprockets_enabled)
|
33
|
-
run_locally "mkdir -p #{fetch(:turbosprockets_backup_dir)}"
|
34
|
-
run_locally "mv #{fetch(:turbosprockets_backup_dir)} #{fetch(:assets_dir)}"
|
35
|
-
run_locally "#{fetch(:cleanexpired_cmd)}"
|
36
|
-
end
|
37
33
|
run_locally "#{fetch(:precompile_cmd)}"
|
38
34
|
end
|
39
35
|
|
data/spec/configuration_spec.rb
CHANGED
@@ -11,6 +11,10 @@ describe Capistrano::LocalPrecompile, "configuration" do
|
|
11
11
|
Capistrano::LocalPrecompile.load_into(@configuration)
|
12
12
|
end
|
13
13
|
|
14
|
+
it "defines precompile_env" do
|
15
|
+
expect(@configuration.fetch(:precompile_env)).to eq('production')
|
16
|
+
end
|
17
|
+
|
14
18
|
it "defines precompile_cmd" do
|
15
19
|
cmd = 'RAILS_ENV=production RAILS_GROUPS=assets rake assets:precompile'
|
16
20
|
expect(@configuration.fetch(:precompile_cmd)).to eq(cmd)
|
@@ -25,15 +29,6 @@ describe Capistrano::LocalPrecompile, "configuration" do
|
|
25
29
|
expect(@configuration.fetch(:assets_dir)).to eq('public/assets')
|
26
30
|
end
|
27
31
|
|
28
|
-
it "defines turbosprockets_enabled" do
|
29
|
-
expect(@configuration.fetch(:turbosprockets_enabled)).to be_false
|
30
|
-
end
|
31
|
-
|
32
|
-
it "defines turbosprockets_backup_dir" do
|
33
|
-
dir = 'public/.assets'
|
34
|
-
expect(@configuration.fetch(:turbosprockets_backup_dir)).to eq(dir)
|
35
|
-
end
|
36
|
-
|
37
32
|
it "defines rsync_cmd" do
|
38
33
|
expect(@configuration.fetch(:rsync_cmd)).to eq('rsync -av')
|
39
34
|
end
|
@@ -43,6 +38,11 @@ describe Capistrano::LocalPrecompile, "configuration" do
|
|
43
38
|
before('deploy:assets:precompile')
|
44
39
|
end
|
45
40
|
|
41
|
+
it "performs deploy:assets:remove before deploy:assets:precompile" do
|
42
|
+
expect(@configuration).to callback('deploy:assets:remove').
|
43
|
+
before('deploy:assets:symlink')
|
44
|
+
end
|
45
|
+
|
46
46
|
it "performs deploy:assets:cleanup after deploy:assets:precompile" do
|
47
47
|
expect(@configuration).to callback('deploy:assets:cleanup').
|
48
48
|
after('deploy:assets:precompile')
|
data/spec/integration_spec.rb
CHANGED
@@ -29,6 +29,15 @@ describe Capistrano::LocalPrecompile, "integration" do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
describe 'remove manifest task' do
|
33
|
+
it 'invokes the precompile command' do
|
34
|
+
expect(@configuration).to receive(:run).
|
35
|
+
with('rm -f public/assets/manifest*.json').once
|
36
|
+
|
37
|
+
@configuration.find_and_execute_task('deploy:assets:remove_manifest')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
32
41
|
describe 'precompile task' do
|
33
42
|
let(:servers) { %w(10.0.1.1 10.0.1.2) }
|
34
43
|
|
@@ -53,34 +62,4 @@ describe Capistrano::LocalPrecompile, "integration" do
|
|
53
62
|
@configuration.find_and_execute_task('deploy:assets:precompile')
|
54
63
|
end
|
55
64
|
end
|
56
|
-
|
57
|
-
context 'with turbosprockets enabled' do
|
58
|
-
before do
|
59
|
-
@configuration.set :turbosprockets_enabled, true
|
60
|
-
end
|
61
|
-
|
62
|
-
describe 'cleanup task' do
|
63
|
-
it 'moves assets to the configured turbosprockets backup dir' do
|
64
|
-
expect(@configuration).to receive(:run_locally).
|
65
|
-
with('mv public/assets public/.assets')
|
66
|
-
|
67
|
-
@configuration.find_and_execute_task('deploy:assets:cleanup')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'prepare task' do
|
72
|
-
it 'invokes the precompile command' do
|
73
|
-
expect(@configuration).to receive(:run_locally).
|
74
|
-
with('mkdir -p public/.assets').once
|
75
|
-
expect(@configuration).to receive(:run_locally).
|
76
|
-
with('mv public/.assets public/assets').once
|
77
|
-
expect(@configuration).to receive(:run_locally).
|
78
|
-
with('RAILS_ENV=production RAILS_GROUPS=assets rake assets:clean_expired').once
|
79
|
-
expect(@configuration).to receive(:run_locally).
|
80
|
-
with('RAILS_ENV=production RAILS_GROUPS=assets rake assets:precompile').once
|
81
|
-
|
82
|
-
@configuration.find_and_execute_task('deploy:assets:prepare')
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
65
|
end
|
metadata
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-local-precompile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Agalloco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2'
|
20
|
-
- - <
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '3'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '2'
|
30
|
-
- - <
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3'
|
33
33
|
description: Local asset-pipeline precompilation for Capstrano
|
@@ -36,14 +36,14 @@ executables: []
|
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
-
- .yardopts
|
39
|
+
- ".yardopts"
|
40
40
|
- LICENSE.md
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
43
43
|
- capistrano-local-precompile.gemspec
|
44
|
-
- lib/capistrano/local_precompile.rb
|
45
|
-
- lib/capistrano-local-precompile/version.rb
|
46
44
|
- lib/capistrano-local-precompile.rb
|
45
|
+
- lib/capistrano-local-precompile/version.rb
|
46
|
+
- lib/capistrano/local_precompile.rb
|
47
47
|
- spec/configuration_spec.rb
|
48
48
|
- spec/integration_spec.rb
|
49
49
|
- spec/spec_helper.rb
|
@@ -57,17 +57,17 @@ require_paths:
|
|
57
57
|
- lib
|
58
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
requirements: []
|
69
69
|
rubyforge_project:
|
70
|
-
rubygems_version: 2.
|
70
|
+
rubygems_version: 2.2.2
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: Local asset-pipeline precompilation for Capstrano
|