capistrano-faster-rails 1.0.4 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -6
- data/capistrano-faster-rails.gemspec +3 -6
- data/lib/capistrano/tasks/faster-rails.rake +22 -14
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16ce1a3fe53f9d1a9aeadc44ad7a765b0c48ec959d9f631b7202b19c9eb94d10
|
4
|
+
data.tar.gz: 9a1a9b0f1e244c2fdafd03ceefca7d892ff217d5eb287702562a2dbfea558778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d0cb3bdf6d705f496d3a36dd2ad753ce6f2bf881b7c3a0259bd6501a32fbad5604261ccacd749b588ebc7485a59979f5600ca710c14b0852f2b4181d6fa8807
|
7
|
+
data.tar.gz: be31e871d0fc234878803fb83663b2e5ff49b378cf7476231e18eec80f540dbe79ee6c87b45b5978b3e6a359cf338ddf9c09b4e10255309c38c851ecaf7ba2d2
|
data/README.md
CHANGED
@@ -2,17 +2,19 @@
|
|
2
2
|
|
3
3
|
## What does this gem do?
|
4
4
|
|
5
|
-
1.
|
5
|
+
1. Set `conditionally_migrate` to true to skip `rails db:migrate` if migration files not changed.
|
6
|
+
|
7
|
+
2. Execute copy `linked_files` and `linked_dirs` with one command on deployed servers.
|
6
8
|
|
7
9
|
Capistrano runs each command separately on their own SSH session and it takes too long to deploy an application, copy `linked_files` and `linked_dirs` on deployed servers with one command will speedup deploying process.
|
8
10
|
|
9
|
-
|
11
|
+
3. Skip `bundle install` if Gemfile isn't changed.
|
10
12
|
|
11
|
-
`bundle install` takes few
|
13
|
+
`bundle install` takes a few seconds even if Gemfile isn't changed, there is no need to execute `bundle install` if it isn't changed.
|
12
14
|
|
13
|
-
|
15
|
+
4. Skip `rake assets:precompile` and `yarn:install` if asset files aren't chagned.
|
14
16
|
|
15
|
-
`rake assets:precompile` and `yarn:install` is really slow if your Rails project has plenty of assets to precompile, even if they are not changed.
|
17
|
+
`rake assets:precompile` and `yarn:install` is really slow if your Rails project has plenty of assets to precompile, even if they are not changed. There is no need to execute these commands if asset files not chagned.
|
16
18
|
|
17
19
|
|
18
20
|
## Installation
|
@@ -41,7 +43,7 @@ use `set :asset_files` in config/deploy.rb to set your project assets files, `as
|
|
41
43
|
|
42
44
|
use `set :bundle_files` in config/deploy.rb to set your project ruby Gemfile files, `bundle_files` default to `"Gemfile Gemfile.lock .ruby-version"`
|
43
45
|
|
44
|
-
|
46
|
+
## Note
|
45
47
|
|
46
48
|
`asset_files` and `bundle_files` are both space separated string, not array!
|
47
49
|
|
@@ -4,17 +4,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "capistrano-faster-rails"
|
7
|
-
spec.version = "1.0.
|
7
|
+
spec.version = "1.0.8"
|
8
8
|
spec.authors = ["lifuzhong"]
|
9
9
|
spec.email = ["lifuzho@126.com"]
|
10
10
|
|
11
11
|
spec.summary = %q{Speedup deploy Ruby On Rails project when using capistrano}
|
12
12
|
spec.description = %q{
|
13
|
-
|
14
|
-
|
15
|
-
Skip `bundle install` if Gemfile isn't changed.
|
16
|
-
|
17
|
-
Skip `rake assets:precompile` and `yarn:install` if asset files not chagned.
|
13
|
+
Make your Ruby On Rails project deploying with Capistrano even faster.
|
14
|
+
It skips unnecessary steps(`rails db:migrate`, `bundle install`, `rake assets:precompile`, `yarn:install`) intelligently.
|
18
15
|
}
|
19
16
|
spec.homepage = "https://github.com/ifool/capistrano-faster-rails"
|
20
17
|
spec.license = 'MIT'
|
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
asset_files = fetch(:asset_files, "vendor/assets app/assets config/initializers/assets.rb")
|
3
|
-
within(repo_path) {
|
4
|
-
previous_revision, current_revision = fetch(:previous_revision), fetch(:current_revision)
|
5
|
-
previous_revision.to_s.empty? ||
|
6
|
-
!capture("cd #{repo_path} && git diff --name-only #{previous_revision} #{current_revision} -- #{asset_files}").empty?
|
7
|
-
}
|
8
|
-
}
|
1
|
+
set :conditionally_migrate, true
|
9
2
|
|
10
3
|
namespace :deploy do
|
11
4
|
namespace :symlink do
|
@@ -42,7 +35,14 @@ namespace :deploy do
|
|
42
35
|
task :precompile do
|
43
36
|
on(release_roles(fetch(:assets_roles))) {
|
44
37
|
log "[deploy:assets:precompile] Checking assets changes"
|
45
|
-
|
38
|
+
asset_files = fetch(:asset_files, "vendor/assets app/assets config/initializers/assets.rb")
|
39
|
+
asset_changed = within(repo_path) {
|
40
|
+
previous_revision = fetch(:previous_revision) rescue ''
|
41
|
+
current_revision = fetch(:current_revision)
|
42
|
+
previous_revision.to_s.empty? ||
|
43
|
+
!capture("cd #{repo_path} && git diff --name-only #{previous_revision} #{current_revision} -- #{asset_files}").empty?
|
44
|
+
}
|
45
|
+
if asset_changed
|
46
46
|
within(release_path) do
|
47
47
|
with rails_env: fetch(:rails_env), rails_groups: fetch(:rails_assets_groups) do
|
48
48
|
execute :rake, "assets:precompile"
|
@@ -64,12 +64,13 @@ namespace :bundler do
|
|
64
64
|
log "[bundler:install] Checking Gemfile and Gemfile.lock changes"
|
65
65
|
bundle_files = fetch(:bundle_files, "Gemfile Gemfile.lock .ruby-version")
|
66
66
|
gemfile_changed = within(repo_path) {
|
67
|
-
previous_revision
|
67
|
+
previous_revision = fetch(:previous_revision) rescue ''
|
68
|
+
current_revision = fetch(:current_revision)
|
68
69
|
previous_revision.to_s.empty? ||
|
69
70
|
!capture("cd #{repo_path} && git diff --name-only #{previous_revision} #{current_revision} -- #{bundle_files}").empty?
|
70
71
|
}
|
71
72
|
|
72
|
-
within
|
73
|
+
within(release_path) {
|
73
74
|
with fetch(:bundle_env_variables) do
|
74
75
|
options = []
|
75
76
|
options << "--gemfile #{fetch(:bundle_gemfile)}" if fetch(:bundle_gemfile)
|
@@ -100,15 +101,22 @@ if yarn_install_task
|
|
100
101
|
Rake::Task["yarn:install"]
|
101
102
|
task :install do
|
102
103
|
on roles fetch(:yarn_roles) do
|
103
|
-
log "[yarn:install] Checking
|
104
|
-
|
104
|
+
log "[yarn:install] Checking package.json and yarn.lock changes"
|
105
|
+
asset_files = fetch(:asset_files, "package.json yarn.lock")
|
106
|
+
asset_changed = within(repo_path) {
|
107
|
+
previous_revision = fetch(:previous_revision) rescue ''
|
108
|
+
current_revision = fetch(:current_revision)
|
109
|
+
previous_revision.to_s.empty? ||
|
110
|
+
!capture("cd #{repo_path} && git diff --name-only #{previous_revision} #{current_revision} -- #{asset_files}").empty?
|
111
|
+
}
|
112
|
+
if asset_changed
|
105
113
|
within fetch(:yarn_target_path, release_path) do
|
106
114
|
with fetch(:yarn_env_variables, {}) do
|
107
115
|
execute fetch(:yarn_bin), 'install', fetch(:yarn_flags)
|
108
116
|
end
|
109
117
|
end
|
110
118
|
else
|
111
|
-
log "[yarn:install] Skip `yarn:install` (
|
119
|
+
log "[yarn:install] Skip `yarn:install` (package.json and yarn.lock not changed)"
|
112
120
|
end
|
113
121
|
end
|
114
122
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-faster-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lifuzhong
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,10 +38,9 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description: "\n
|
42
|
-
|
43
|
-
|
44
|
-
\ "
|
41
|
+
description: "\n Make your Ruby On Rails project deploying with Capistrano even
|
42
|
+
faster.\n It skips unnecessary steps(`rails db:migrate`, `bundle install`, `rake
|
43
|
+
assets:precompile`, `yarn:install`) intelligently.\n "
|
45
44
|
email:
|
46
45
|
- lifuzho@126.com
|
47
46
|
executables: []
|
@@ -66,7 +65,7 @@ metadata:
|
|
66
65
|
homepage_uri: https://github.com/ifool/capistrano-faster-rails
|
67
66
|
source_code_uri: https://github.com/ifool/capistrano-faster-rails
|
68
67
|
changelog_uri: https://github.com/ifool/capistrano-faster-rails
|
69
|
-
post_install_message:
|
68
|
+
post_install_message:
|
70
69
|
rdoc_options: []
|
71
70
|
require_paths:
|
72
71
|
- lib
|
@@ -81,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
80
|
- !ruby/object:Gem::Version
|
82
81
|
version: '0'
|
83
82
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
85
|
-
signing_key:
|
83
|
+
rubygems_version: 3.2.3
|
84
|
+
signing_key:
|
86
85
|
specification_version: 4
|
87
86
|
summary: Speedup deploy Ruby On Rails project when using capistrano
|
88
87
|
test_files: []
|