capistrano-faster-assets 1.0.2 → 1.1.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 +4 -4
- data/README.md +15 -0
- data/lib/capistrano/faster_assets/version.rb +1 -1
- data/lib/capistrano/tasks/faster_assets.rake +29 -8
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12a197de2882391f9c34f9a9b9a414b9fd6a2612
|
4
|
+
data.tar.gz: 7a14555c30cbb1163e742cbd06f654d9ee771587
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511770f382e324d408dcbbfb4a8b672d2020567cf3df322b5c22843df01420a42ea8b497ee529db0c6a166a5a2e39d9da350f2869e53d2571fe361c4cbf2429b
|
7
|
+
data.tar.gz: 2343d1b04f675967354c4692741c8690a2729e0ac00c1d2b12d3291f1a65eede037d0d391f0018e87b9c17cae8a4461718f5b2dbd051360dc61fa2d881a61fc9
|
data/README.md
CHANGED
@@ -11,6 +11,7 @@ Add this to `Gemfile`:
|
|
11
11
|
|
12
12
|
group :development do
|
13
13
|
gem 'capistrano', '~> 3.1'
|
14
|
+
gem 'capistrano-rails', '~> 1.1'
|
14
15
|
gem 'capistrano-faster-assets', '~> 1.0'
|
15
16
|
end
|
16
17
|
|
@@ -23,6 +24,20 @@ And then:
|
|
23
24
|
Add this line to `Capfile`, after `require 'capistrano/rails/assets'`
|
24
25
|
|
25
26
|
require 'capistrano/faster_assets'
|
27
|
+
|
28
|
+
Configure your asset depedencies in deploy.rb if you need to check additional paths (e.g. if you have some assets in YOUR_APP/engines/YOUR_ENGINE/app/assets). Default paths are:
|
29
|
+
|
30
|
+
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb)
|
31
|
+
|
32
|
+
### Warning
|
33
|
+
|
34
|
+
Please keep in mind, that if you use ERB in your assets, you might run into cases where Capistrano won't recompile assets when needed. For instance, let's say you have a CoffeeScript file like this:
|
35
|
+
|
36
|
+
```coffee
|
37
|
+
text = <%= helper.get_text %>
|
38
|
+
```
|
39
|
+
|
40
|
+
The assets might not get recompiled, even if they have to, as this gem only checks if the asset file has changed (which is probably the only safe/fast way to do this).
|
26
41
|
|
27
42
|
### More Capistrano automation?
|
28
43
|
|
@@ -17,7 +17,7 @@ namespace :deploy do
|
|
17
17
|
within release_path do
|
18
18
|
with rails_env: fetch(:rails_env) do
|
19
19
|
begin
|
20
|
-
|
20
|
+
# find the most recent release
|
21
21
|
latest_release = capture(:ls, '-xr', releases_path).split[1]
|
22
22
|
|
23
23
|
# precompile if this is the first deploy
|
@@ -29,12 +29,12 @@ namespace :deploy do
|
|
29
29
|
execute(:ls, latest_release_path.join('assets_manifest_backup')) rescue raise(PrecompileRequired)
|
30
30
|
|
31
31
|
fetch(:assets_dependencies).each do |dep|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
release = release_path.join(dep)
|
33
|
+
latest = latest_release_path.join(dep)
|
34
|
+
|
35
|
+
# skip if both directories/files do not exist
|
36
|
+
next if [release, latest].map{|d| test "[ -e #{d} ]"}.uniq == [false]
|
37
|
+
|
38
38
|
# execute raises if there is a diff
|
39
39
|
execute(:diff, '-Nqr', release, latest) rescue raise(PrecompileRequired)
|
40
40
|
end
|
@@ -42,7 +42,28 @@ namespace :deploy do
|
|
42
42
|
info("Skipping asset precompile, no asset diff found")
|
43
43
|
|
44
44
|
# copy over all of the assets from the last release
|
45
|
-
|
45
|
+
release_asset_path = release_path.join('public', fetch(:assets_prefix))
|
46
|
+
# skip if assets directory is symlink
|
47
|
+
begin
|
48
|
+
execute(:test, '-L', release_asset_path.to_s)
|
49
|
+
rescue
|
50
|
+
execute(:cp, '-r', latest_release_path.join('public', fetch(:assets_prefix)), release_asset_path.parent)
|
51
|
+
end
|
52
|
+
|
53
|
+
# check that the manifest has been created correctly, if not
|
54
|
+
# trigger a precompile
|
55
|
+
begin
|
56
|
+
# Support sprockets 2
|
57
|
+
execute(:ls, release_asset_path.join('manifest*'))
|
58
|
+
rescue
|
59
|
+
begin
|
60
|
+
# Support sprockets 3
|
61
|
+
execute(:ls, release_asset_path.join('.sprockets-manifest*'))
|
62
|
+
rescue
|
63
|
+
raise(PrecompileRequired)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
46
67
|
rescue PrecompileRequired
|
47
68
|
execute(:rake, "assets:precompile")
|
48
69
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-faster-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Thal
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -79,9 +79,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.6.10
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Speeds up asset compilation if none of the assets were changed since last
|
86
86
|
release.
|
87
87
|
test_files: []
|
88
|
+
has_rdoc:
|