capistrano-faster-rails 1.0.1 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c2c3730d3b927436497b333a98319aaf7d629d683e8c6fe59c116a8eff18bcb
4
- data.tar.gz: c848c81e5bcd3836a7ba184c83666b41124c43c4a9e1eeebbde317ad68dc6616
3
+ metadata.gz: 9be7709b36d541d72465155698e5b9d8f6df3c526f651cfd75f42062ccb6a26f
4
+ data.tar.gz: b7cb9a66577b095f79a56d4819f4cd893141d0fedc67e40f56e29e979d254e21
5
5
  SHA512:
6
- metadata.gz: db51f5f8b561eca96d5eca0ff786b29cb7b301db26dbc61ea3fb0e9bf875a18ffe52ebb56da6770a8a5ffb25cdc90365c06ef5d4fcfb8694a48250d3bdb82908
7
- data.tar.gz: 6f0eb89c9151ee1d01f50e5dbe49b6af957722c6028ceb1142913555e876da5b6ce5465ca099d8d343992999f6003e8416a11ebd42aa81ffc19af4db7035e91f
6
+ metadata.gz: b90b59041cde3a4feb9b3313f0eed217a5c62cf0837e22473351c1dceefeac2f79786f52ce739bfdde828ad1345c424aef8691a8a5eb6ed1ee1910a3b03f741d
7
+ data.tar.gz: 31ec4c01fcdc068fe2ba8f2cd4b8fc4ee1a4c3d672cd9c6f67c351c02e4f55195502f9c8f41ceea9539ff69a99fef88f669f10f180c589256d1a9149fbae2e7a
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  Gemfile.lock
10
+ *.gem
data/README.md CHANGED
@@ -10,14 +10,14 @@ Capistrano runs each command separately on their own SSH session and it takes to
10
10
 
11
11
  `bundle install` takes few or dozens of seconds, most of the time your project's Gemfile will not be changed, and you don't have to execute `bundle install` if your Gemfile isn't changed.
12
12
 
13
- 3. Skip `rake assets:precompile` if asset files not chagned.
13
+ 3. Skip `rake assets:precompile` and `yarn:install` if asset files not chagned.
14
14
 
15
- `rake assets:precompile` is really slow if your Rails project has plenty of assets to precompile, even if they are not changed. You don't have to execute `rake assets:precompile` if your asset files not chagned.
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. You don't have to execute them if your asset files not chagned.
16
16
 
17
17
 
18
18
  ## Installation
19
19
 
20
- Add this line to your Rails application's Gemfile and below to `gem 'capistrano-rails'`:
20
+ Add this line to your Rails application's Gemfile and below to `gem 'capistrano-rails'`. if your project have `capistrano-yarn` installed, please add this line below to `gem 'capistrano-yarn'` too.
21
21
 
22
22
  ```ruby
23
23
  # Gemfile
@@ -4,22 +4,17 @@ $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.1"
7
+ spec.version = "1.0.4"
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
- What does this gem do?
13
+ Execute copy `linked_files` and `linked_dirs` with one command on deployed servers.
14
14
 
15
- 1. Execute copy `linked_files` and `linked_dirs` with one command on deployed servers.
16
- 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.
15
+ Skip `bundle install` if Gemfile isn't changed.
17
16
 
18
- 2. Skip `bundle install` if Gemfile isn't changed.
19
- `bundle install` takes few or dozens of seconds, most of the time your project's Gemfile will not be changed, and you don't have to execute `bundle install` if your Gemfile isn't changed.
20
-
21
- 3. Skip `rake assets:precompile` if asset files not chagned.
22
- `rake assets:precompile` is really slow if your Rails project has plenty of assets to precompile, even if they are not changed. You don't have to execute `rake assets:precompile` if your asset files not chagned.
17
+ Skip `rake assets:precompile` and `yarn:install` if asset files not chagned.
23
18
  }
24
19
  spec.homepage = "https://github.com/ifool/capistrano-faster-rails"
25
20
  spec.license = 'MIT'
@@ -1,3 +1,12 @@
1
+ asset_change = proc {
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
+ }
9
+
1
10
  namespace :deploy do
2
11
  namespace :symlink do
3
12
  Rake::Task["deploy:symlink:linked_files"].clear_actions
@@ -33,14 +42,7 @@ namespace :deploy do
33
42
  task :precompile do
34
43
  on(release_roles(fetch(:assets_roles))) {
35
44
  log "[deploy:assets:precompile] Checking assets changes"
36
- asset_files = fetch(:asset_files, "vendor/assets app/assets config/initializers/assets.rb")
37
- asset_changed = within(repo_path) {
38
- previous_revision, current_revision = fetch(:previous_revision), fetch(:current_revision)
39
- previous_revision.to_s.empty? ||
40
- !capture("cd #{repo_path} && git diff --name-only #{previous_revision} #{current_revision} -- #{asset_files}").empty?
41
- }
42
-
43
- if asset_changed
45
+ if asset_change.call()
44
46
  within(release_path) do
45
47
  with rails_env: fetch(:rails_env), rails_groups: fetch(:rails_assets_groups) do
46
48
  execute :rake, "assets:precompile"
@@ -67,7 +69,7 @@ namespace :bundler do
67
69
  !capture("cd #{repo_path} && git diff --name-only #{previous_revision} #{current_revision} -- #{bundle_files}").empty?
68
70
  }
69
71
 
70
- within release_path do
72
+ within release_path {
71
73
  with fetch(:bundle_env_variables) do
72
74
  options = []
73
75
  options << "--gemfile #{fetch(:bundle_gemfile)}" if fetch(:bundle_gemfile)
@@ -85,6 +87,29 @@ namespace :bundler do
85
87
  end
86
88
  end
87
89
  end
90
+ }
91
+ end
92
+ end
93
+ end
94
+
95
+ yarn_install_task = Rake::Task["yarn:install"] rescue nil
96
+ if yarn_install_task
97
+ yarn_install_task.clear_actions
98
+
99
+ namespace :yarn do
100
+ Rake::Task["yarn:install"]
101
+ task :install do
102
+ on roles fetch(:yarn_roles) do
103
+ log "[yarn:install] Checking assets changes"
104
+ if asset_change.call()
105
+ within fetch(:yarn_target_path, release_path) do
106
+ with fetch(:yarn_env_variables, {}) do
107
+ execute fetch(:yarn_bin), 'install', fetch(:yarn_flags)
108
+ end
109
+ end
110
+ else
111
+ log "[yarn:install] Skip `yarn:install` (assets not changed)"
112
+ end
88
113
  end
89
114
  end
90
115
  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.1
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - lifuzhong
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-11 00:00:00.000000000 Z
11
+ date: 2019-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,17 +38,10 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: "\n What does this gem do?\n\n 1. Execute copy `linked_files`
42
- and `linked_dirs` with one command on deployed servers.\n Capistrano runs each
43
- command separately on their own SSH session and it takes too long to deploy an application,
44
- copy `linked_files` and `linked_dirs` on deployed servers with one command will
45
- speedup deploying process.\n\n 2. Skip `bundle install` if Gemfile isn't changed.\n
46
- \ `bundle install` takes few or dozens of seconds, most of the time your project's
47
- Gemfile will not be changed, and you don't have to execute `bundle install` if your
48
- Gemfile isn't changed.\n\n 3. Skip `rake assets:precompile` if asset files
49
- not chagned.\n `rake assets:precompile` is really slow if your Rails project
50
- has plenty of assets to precompile, even if they are not changed. You don't have
51
- to execute `rake assets:precompile` if your asset files not chagned.\n "
41
+ description: "\n Execute copy `linked_files` and `linked_dirs` with one command
42
+ on deployed servers.\n\n Skip `bundle install` if Gemfile isn't changed.\n\n
43
+ \ Skip `rake assets:precompile` and `yarn:install` if asset files not chagned.\n
44
+ \ "
52
45
  email:
53
46
  - lifuzho@126.com
54
47
  executables: []