local_precompile 0.1.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -1
- data/lib/local_precompile/capistrano.rb +66 -7
- data/lib/local_precompile/version.rb +1 -1
- data/local_precompile.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0433ee8af5b5cd761ba6ce1d8152a344d5fdfa546f39425768d6eba4f87c04a7
|
4
|
+
data.tar.gz: 1702d47fc76def91944407875d19d776dc75a2f1094fd4162ee34a9cae8d926b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96f3cd9705266f523d4a58dda7f4ea3249c43e0dc1db7b19fa6a1a4d8eb27f58339aeb7086fc0b6bcbf9a8ab1bc75e14c9ad266081f451e863856083b3bdb003
|
7
|
+
data.tar.gz: de061e1892ef60f248912b34edb98ff4104139934d401c5fc6031347d8416a78cd3274ee8d452a1fa74a8f66c916291736a1bba8c1ed40f1e3724b5bc4d0756c
|
data/README.md
CHANGED
@@ -8,10 +8,17 @@ Add local-precompile to your Gemfile:
|
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
group :development do
|
11
|
-
gem 'local_precompile', '~> 0.
|
11
|
+
gem 'local_precompile', '~> 0.3.1', require: false
|
12
12
|
end
|
13
13
|
```
|
14
14
|
|
15
|
+
Remove any gems associated with assets, like:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'capistrano-faster-assets'
|
19
|
+
gem 'quiet_assets'
|
20
|
+
```
|
21
|
+
|
15
22
|
Then add the following line to your `Capfile`:
|
16
23
|
|
17
24
|
```ruby
|
@@ -24,6 +31,19 @@ Remove the following line from your `Capfile`:
|
|
24
31
|
require 'capistrano/rails/assets'
|
25
32
|
```
|
26
33
|
|
34
|
+
Change webpacker compile options in `config/webpacker.yml` to false:
|
35
|
+
|
36
|
+
```yaml
|
37
|
+
staging:
|
38
|
+
compile: false
|
39
|
+
```
|
40
|
+
```yaml
|
41
|
+
production:
|
42
|
+
compile: false
|
43
|
+
```
|
44
|
+
|
45
|
+
Remove node modules folder from `set :linked_dirs` your `config/deploy.rb`.
|
46
|
+
|
27
47
|
Here's the full set of configurable options:
|
28
48
|
|
29
49
|
```ruby
|
@@ -2,13 +2,15 @@ Rake::Task['deploy:compile_assets'].clear
|
|
2
2
|
|
3
3
|
namespace :load do
|
4
4
|
task :defaults do
|
5
|
-
set :assets_dir,
|
6
|
-
set :packs_dir,
|
7
|
-
set :rsync_cmd,
|
8
|
-
set :assets_role,
|
9
|
-
set :skip_assets,
|
5
|
+
set :assets_dir, 'public/assets'
|
6
|
+
set :packs_dir, 'public/packs'
|
7
|
+
set :rsync_cmd, 'rsync -av --delete'
|
8
|
+
set :assets_role, 'web'
|
9
|
+
set :skip_assets, ENV['skip_assets'] || false
|
10
|
+
set :package_file, fetch(:package_file, 'package.json')
|
10
11
|
|
11
12
|
unless fetch(:skip_assets)
|
13
|
+
before 'deploy:check:directories', 'deploy:assets:validate'
|
12
14
|
after 'bundler:install', 'deploy:assets:prepare'
|
13
15
|
after 'deploy:assets:prepare', 'deploy:assets:rsync'
|
14
16
|
after 'deploy:assets:rsync', 'deploy:assets:cleanup'
|
@@ -28,9 +30,11 @@ namespace :deploy do
|
|
28
30
|
|
29
31
|
desc 'Actually precompile the assets locally'
|
30
32
|
task :prepare do
|
33
|
+
invoke 'deploy:assets:cleanup'
|
34
|
+
|
31
35
|
run_locally do
|
32
|
-
execute 'RAILS_ENV=production DB_ADAPTER=nulldb rake assets:clean'
|
33
|
-
execute 'RAILS_ENV=production DB_ADAPTER=nulldb rake assets:precompile'
|
36
|
+
execute 'ASSETS_PRECOMPILE=true RAILS_ENV=production DB_ADAPTER=nulldb rake assets:clean'
|
37
|
+
execute 'ASSETS_PRECOMPILE=true RAILS_ENV=production DB_ADAPTER=nulldb rake assets:precompile'
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
@@ -54,5 +58,60 @@ namespace :deploy do
|
|
54
58
|
end
|
55
59
|
end
|
56
60
|
end
|
61
|
+
|
62
|
+
desc 'Check frontend tools valid versions'
|
63
|
+
task :validate do
|
64
|
+
set :package_file, fetch(:package_file, 'package.json')
|
65
|
+
|
66
|
+
on roles(fetch(:assets_role)) do
|
67
|
+
run_locally do
|
68
|
+
invoke 'deploy:assets:node:presence'
|
69
|
+
invoke 'deploy:assets:yarn:presence'
|
70
|
+
|
71
|
+
enabled_node_version = capture('node', '--version').tr('v', '')
|
72
|
+
enabled_yarn_version = capture('yarn', '--version').tr('v', '')
|
73
|
+
package = JSON.parse File.read(fetch(:package_file)), symbolize_names: true, quirks_mode: true
|
74
|
+
needed_node_version, needed_yarn_version = package[:engines].values_at(:node, :yarn)
|
75
|
+
|
76
|
+
if enabled_node_version != needed_node_version
|
77
|
+
warn 'Node.js version is wrong'
|
78
|
+
exit 1
|
79
|
+
end
|
80
|
+
|
81
|
+
if enabled_yarn_version != needed_yarn_version
|
82
|
+
warn 'Yarn version is wrong'
|
83
|
+
exit 1
|
84
|
+
end
|
85
|
+
|
86
|
+
info 'Frontend engine versions is ok'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
namespace :node do
|
92
|
+
task :presence do
|
93
|
+
on roles(fetch(:assets_role)) do
|
94
|
+
run_locally do
|
95
|
+
unless test('node', '--version')
|
96
|
+
warn 'Node.js is not installed'
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
namespace :yarn do
|
105
|
+
task :presence do
|
106
|
+
on roles(fetch(:assets_role)) do
|
107
|
+
run_locally do
|
108
|
+
unless test('yarn', '--version')
|
109
|
+
warn 'Yarn is not installed'
|
110
|
+
exit 1
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
57
116
|
end
|
58
117
|
end
|
data/local_precompile.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
|
11
11
|
gem.summary = 'Local compile assets and packs for Capistrano'
|
12
12
|
gem.description = 'Contains cap tasks'
|
13
|
-
gem.homepage = 'https://
|
13
|
+
gem.homepage = 'https://git.finstar.asia/general/webpacker_local_precompile'
|
14
14
|
|
15
15
|
gem.license = 'MIT'
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: local_precompile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DarkWater
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,12 +73,12 @@ files:
|
|
73
73
|
- lib/local_precompile/tasks.rb
|
74
74
|
- lib/local_precompile/version.rb
|
75
75
|
- local_precompile.gemspec
|
76
|
-
homepage: https://
|
76
|
+
homepage: https://git.finstar.asia/general/webpacker_local_precompile
|
77
77
|
licenses:
|
78
78
|
- MIT
|
79
79
|
metadata:
|
80
80
|
allowed_push_host: https://rubygems.org
|
81
|
-
post_install_message:
|
81
|
+
post_install_message:
|
82
82
|
rdoc_options: []
|
83
83
|
require_paths:
|
84
84
|
- lib
|
@@ -93,8 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
|
-
rubygems_version: 3.0.
|
97
|
-
signing_key:
|
96
|
+
rubygems_version: 3.0.9
|
97
|
+
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Local compile assets and packs for Capistrano
|
100
100
|
test_files: []
|