serviceworker-rails 0.5.5 → 0.7.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.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +66 -0
  3. data/.github/workflows/release.yml +31 -0
  4. data/.gitignore +4 -3
  5. data/.node-version +1 -0
  6. data/.rubocop.yml +18 -91
  7. data/.ruby-version +1 -0
  8. data/.standard.yml +1 -0
  9. data/CHANGELOG.md +13 -0
  10. data/Gemfile +8 -6
  11. data/Gemfile.lock +355 -0
  12. data/Guardfile +5 -3
  13. data/README.md +6 -5
  14. data/Rakefile +19 -5
  15. data/bin/_guard-core +2 -1
  16. data/bin/console +1 -0
  17. data/bin/guard +2 -1
  18. data/bin/rake +3 -1
  19. data/bin/rubocop +3 -1
  20. data/bin/setup +4 -1
  21. data/bin/standardrb +29 -0
  22. data/gemfiles/rails_7.0.gemfile +12 -0
  23. data/gemfiles/rails_7.0.gemfile.lock +324 -0
  24. data/gemfiles/rails_7.1.gemfile +12 -0
  25. data/gemfiles/rails_7.1.gemfile.lock +348 -0
  26. data/gemfiles/rails_8.0.gemfile +12 -0
  27. data/gemfiles/rails_8.0.gemfile.lock +479 -0
  28. data/gemfiles/rails_8.1.gemfile +12 -0
  29. data/gemfiles/rails_8.1.gemfile.lock +486 -0
  30. data/gemfiles/rails_8.1_rack3.gemfile +20 -0
  31. data/gemfiles/rails_8.1_rack3.gemfile.lock +485 -0
  32. data/lib/assets/images/convert.rb +4 -0
  33. data/lib/assets/images/serviceworker-rails/heart-144x144.png +0 -0
  34. data/lib/assets/images/serviceworker-rails/heart-384x384.png +0 -0
  35. data/lib/generators/serviceworker/install_generator.rb +4 -20
  36. data/lib/generators/serviceworker/templates/serviceworker-companion.js +10 -5
  37. data/lib/generators/serviceworker/templates/serviceworker.js +3 -3
  38. data/lib/generators/serviceworker/templates/serviceworker.rb +2 -0
  39. data/lib/service_worker.rb +2 -0
  40. data/lib/serviceworker/engine.rb +3 -2
  41. data/lib/serviceworker/handlers/rack_handler.rb +35 -0
  42. data/lib/serviceworker/{rails/handler.rb → handlers/sprockets_handler.rb} +14 -5
  43. data/lib/serviceworker/handlers.rb +64 -0
  44. data/lib/serviceworker/middleware.rb +16 -14
  45. data/lib/serviceworker/rails/version.rb +2 -1
  46. data/lib/serviceworker/rails.rb +2 -1
  47. data/lib/serviceworker/route.rb +28 -23
  48. data/lib/serviceworker/router.rb +9 -9
  49. data/lib/serviceworker-rails.rb +2 -1
  50. data/lib/serviceworker.rb +2 -0
  51. data/serviceworker-rails.gemspec +28 -19
  52. metadata +163 -41
  53. data/.travis.yml +0 -10
  54. data/Appraisals +0 -12
  55. data/bin/appraisal +0 -17
  56. data/gemfiles/rails_3.gemfile +0 -15
  57. data/gemfiles/rails_4.gemfile +0 -14
  58. data/gemfiles/rails_5.gemfile +0 -14
  59. data/lib/serviceworker/handler.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6e58a2ae3f4679e8cd32a024d0114d5a924a174a
4
- data.tar.gz: 474f2390c03df7be5efb55d7f173b40dd863c259
2
+ SHA256:
3
+ metadata.gz: 60cd0c1028c478edcfae14b058d22b2481fb5a52f0c76c2847be131d23d1ca40
4
+ data.tar.gz: f8ae0dada68fa1301405bfa90206526dfc82c60e224c89c2f91f6cecbc9b6e85
5
5
  SHA512:
6
- metadata.gz: b212fcdba3d949901fb95462fda9472e9c27d241542c7303949d87eff1183e0c492c77596d01ddb70e41bb86f30e4eecd717a2403bb4edfea6da52724eb78d95
7
- data.tar.gz: 331f5ea58dbd378e481397ff48219a80e113aff428c904a93044f6b68cf613fa7f00c9530776397a87b8fde6bfffbba78431c9ea5ba701b8cb32face5a1b2b0d
6
+ metadata.gz: 8917e72bc44d90db1b6c47d66e29286b4f3821080e69e77b2fd9827060d9b91b44dd830a85dbc3120a7c1c53279326fc7b99ffd5d5b560ed196562ac3812c664
7
+ data.tar.gz: 4dec72509bf4dc64601735378d7a172e6d1ac78f5f60fbcf683318d03e86da3620cba9bed58126ba42dd2efe90a554fbb439ecfeca1b7eac3e19817454feecd7
@@ -0,0 +1,66 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - '*'
7
+ push:
8
+ branches:
9
+ - main
10
+ workflow_call:
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: ['3.2', '3.3', '4.0']
19
+ gemfile:
20
+ - rails_7.0
21
+ - rails_7.1
22
+ - rails_8.0
23
+ - rails_8.1
24
+ - rails_8.1_rack3
25
+ exclude:
26
+ - ruby: '4.0'
27
+ gemfile: rails_7.0
28
+ - ruby: '4.0'
29
+ gemfile: rails_7.1
30
+
31
+ env:
32
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
33
+ BUNDLE_PATH_RELATIVE_TO_CWD: true
34
+
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - name: Set up Ruby
39
+ uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: ${{ matrix.ruby }}
42
+ bundler: default
43
+ bundler-cache: true
44
+ rubygems: latest
45
+
46
+ - name: Setup Node
47
+ uses: actions/setup-node@v4
48
+ with:
49
+ node-version-file: .node-version
50
+ cache: yarn
51
+ cache-dependency-path: './test/sample/yarn.lock'
52
+
53
+ - name: Node version
54
+ run: |
55
+ node --version
56
+
57
+ - name: Install NPM packages for sample app
58
+ run: |
59
+ bundle exec rake app:yarn_install_frozen
60
+
61
+ - name: StandardRb check
62
+ run: bundle exec standardrb
63
+
64
+ - name: Run tests
65
+ run: |
66
+ bundle exec rake test
@@ -0,0 +1,31 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ push:
10
+ runs-on: ubuntu-latest
11
+
12
+ permissions:
13
+ contents: write
14
+ id-token: write
15
+
16
+ # If you configured a GitHub environment on RubyGems, you must use it here.
17
+ environment: release
18
+
19
+ steps:
20
+ # Set up
21
+ - uses: actions/checkout@v5
22
+ with:
23
+ persist-credentials: false
24
+ - name: Set up Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ bundler-cache: true
28
+ ruby-version: ruby
29
+
30
+ # Release
31
+ - uses: rubygems/release-gem@v1
data/.gitignore CHANGED
@@ -1,10 +1,11 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
7
6
  /pkg/
8
7
  /spec/reports/
9
- /tmp/
10
- /gemfiles/*.lock
8
+ **/tmp/
9
+ **/log/
10
+ **/node_modules/
11
+ .byebug_history
data/.node-version ADDED
@@ -0,0 +1 @@
1
+ 20.13.1
data/.rubocop.yml CHANGED
@@ -1,93 +1,20 @@
1
- AllCops:
2
- Exclude:
3
- - "test/tmp/**/*"
4
- - "tmp/**/*"
5
- - "coverage/**/*"
6
- - "gemfiles/**/*"
7
-
8
- Metrics/LineLength:
9
- Max: 120
10
-
11
- Metrics/ClassLength:
12
- Max: 300
13
-
14
- Metrics/ModuleLength:
15
- Max: 300
16
-
17
- Metrics/MethodLength:
18
- Max: 100
19
-
20
- Metrics/ParameterLists:
21
- Max: 8
22
-
23
- Metrics/AbcSize:
24
- Enabled: false
25
-
26
- Metrics/CyclomaticComplexity:
27
- Enabled: false
28
-
29
- Metrics/PerceivedComplexity:
30
- Enabled: false
31
-
32
- Style/AlignParameters:
33
- EnforcedStyle: with_fixed_indentation
34
-
35
- Style/StringLiterals:
36
- EnforcedStyle: double_quotes
37
-
38
- Style/StringLiteralsInInterpolation:
39
- EnforcedStyle: double_quotes
40
-
41
- Style/ClosingParenthesisIndentation:
42
- Enabled: false
43
-
44
- Style/OneLineConditional:
45
- Enabled: false
1
+ require:
2
+ - standard
46
3
 
47
- Style/AndOr:
48
- Enabled: false
4
+ inherit_gem:
5
+ standard: config/base.yml
49
6
 
50
- Style/Not:
51
- Enabled: false
52
-
53
- Documentation:
54
- Enabled: false # TODO: Enable again once we have more docs
55
-
56
- Style/CaseIndentation:
57
- IndentWhenRelativeTo: case
58
- SupportedStyles:
59
- - case
60
- - end
61
- IndentOneStep: true
62
-
63
- Style/PercentLiteralDelimiters:
64
- PreferredDelimiters:
65
- '%w': "[]"
66
- '%W': "[]"
67
-
68
- Style/AccessModifierIndentation:
69
- Enabled: false
70
-
71
- Style/SignalException:
72
- Enabled: false
73
-
74
- Style/IndentationWidth:
75
- Enabled: false
76
-
77
- Style/TrivialAccessors:
78
- ExactNameMatch: true
79
-
80
- Lint/DefEndAlignment:
81
- Enabled: false
82
-
83
- Lint/HandleExceptions:
84
- Enabled: false
85
-
86
- Style/SpecialGlobalVars:
87
- Enabled: false
88
-
89
- Style/TrivialAccessors:
90
- Enabled: false
91
-
92
- Style/ClassAndModuleChildren:
93
- Enabled: false
7
+ AllCops:
8
+ Exclude:
9
+ - 'node_modules/**/*'
10
+ - 'tmp/**/*'
11
+ - 'vendor/**/*'
12
+ - '.git/**/*'
13
+ - 'build/**/*'
14
+ - 'rubies/**/*'
15
+ SuggestExtensions: false
16
+
17
+ Lint/Debugger:
18
+ Enabled: true
19
+ DebuggerRequires:
20
+ - debug
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 4.0
data/.standard.yml ADDED
@@ -0,0 +1 @@
1
+ ruby_version: 3.3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### 0.7.0 - 2026-06-20
2
+
3
+ * enhancements
4
+ * Add trusted publishing release workflow for GitHub Actions
5
+ * Add Rack 3 appraisal coverage for Rails 8
6
+
7
+ ### 0.6.0 - 2019-04-11
8
+
9
+ * enhancements
10
+ * experimental support for Webpacker (@rossta, @pedantic-git)
11
+ * allow cache override (@omnibs)
12
+ * support recent rubies (@grzuy)
13
+
1
14
  ### 0.5.5 - 2017-05-01
2
15
 
3
16
  * bug fixes
data/Gemfile CHANGED
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in serviceworker-rails.gemspec
4
6
  gemspec
5
7
 
8
+ gem "debug"
9
+
6
10
  group :development, :test do
7
- unless ENV["TRAVIS"]
8
- gem "guard", require: false
9
- gem "guard-minitest", require: false
10
- gem "pry"
11
- gem "pry-byebug", platforms: [:mri]
12
- end
11
+ gem "guard", require: false
12
+ gem "guard-minitest", require: false
13
+ gem "pry"
14
+ gem "pry-byebug", platforms: [:mri]
13
15
  end
data/Gemfile.lock ADDED
@@ -0,0 +1,355 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ serviceworker-rails (0.7.0)
5
+ benchmark
6
+ bigdecimal
7
+ cgi
8
+ drb
9
+ logger
10
+ mutex_m
11
+ ostruct
12
+ rack (>= 2.1)
13
+ railties (>= 7.0)
14
+
15
+ GEM
16
+ remote: https://rubygems.org/
17
+ specs:
18
+ actioncable (7.1.3.4)
19
+ actionpack (= 7.1.3.4)
20
+ activesupport (= 7.1.3.4)
21
+ nio4r (~> 2.0)
22
+ websocket-driver (>= 0.6.1)
23
+ zeitwerk (~> 2.6)
24
+ actionmailbox (7.1.3.4)
25
+ actionpack (= 7.1.3.4)
26
+ activejob (= 7.1.3.4)
27
+ activerecord (= 7.1.3.4)
28
+ activestorage (= 7.1.3.4)
29
+ activesupport (= 7.1.3.4)
30
+ mail (>= 2.7.1)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ actionmailer (7.1.3.4)
35
+ actionpack (= 7.1.3.4)
36
+ actionview (= 7.1.3.4)
37
+ activejob (= 7.1.3.4)
38
+ activesupport (= 7.1.3.4)
39
+ mail (~> 2.5, >= 2.5.4)
40
+ net-imap
41
+ net-pop
42
+ net-smtp
43
+ rails-dom-testing (~> 2.2)
44
+ actionpack (7.1.3.4)
45
+ actionview (= 7.1.3.4)
46
+ activesupport (= 7.1.3.4)
47
+ nokogiri (>= 1.8.5)
48
+ racc
49
+ rack (>= 2.2.4)
50
+ rack-session (>= 1.0.1)
51
+ rack-test (>= 0.6.3)
52
+ rails-dom-testing (~> 2.2)
53
+ rails-html-sanitizer (~> 1.6)
54
+ actiontext (7.1.3.4)
55
+ actionpack (= 7.1.3.4)
56
+ activerecord (= 7.1.3.4)
57
+ activestorage (= 7.1.3.4)
58
+ activesupport (= 7.1.3.4)
59
+ globalid (>= 0.6.0)
60
+ nokogiri (>= 1.8.5)
61
+ actionview (7.1.3.4)
62
+ activesupport (= 7.1.3.4)
63
+ builder (~> 3.1)
64
+ erubi (~> 1.11)
65
+ rails-dom-testing (~> 2.2)
66
+ rails-html-sanitizer (~> 1.6)
67
+ activejob (7.1.3.4)
68
+ activesupport (= 7.1.3.4)
69
+ globalid (>= 0.3.6)
70
+ activemodel (7.1.3.4)
71
+ activesupport (= 7.1.3.4)
72
+ activerecord (7.1.3.4)
73
+ activemodel (= 7.1.3.4)
74
+ activesupport (= 7.1.3.4)
75
+ timeout (>= 0.4.0)
76
+ activestorage (7.1.3.4)
77
+ actionpack (= 7.1.3.4)
78
+ activejob (= 7.1.3.4)
79
+ activerecord (= 7.1.3.4)
80
+ activesupport (= 7.1.3.4)
81
+ marcel (~> 1.0)
82
+ activesupport (7.1.3.4)
83
+ base64
84
+ bigdecimal
85
+ concurrent-ruby (~> 1.0, >= 1.0.2)
86
+ connection_pool (>= 2.2.5)
87
+ drb
88
+ i18n (>= 1.6, < 2)
89
+ minitest (>= 5.1)
90
+ mutex_m
91
+ tzinfo (~> 2.0)
92
+ ast (2.4.3)
93
+ base64 (0.2.0)
94
+ benchmark (0.5.0)
95
+ bigdecimal (3.1.8)
96
+ builder (3.3.0)
97
+ byebug (13.0.0)
98
+ reline (>= 0.6.0)
99
+ cgi (0.5.1)
100
+ coderay (1.1.3)
101
+ concurrent-ruby (1.3.3)
102
+ connection_pool (2.4.1)
103
+ crass (1.0.6)
104
+ date (3.3.4)
105
+ debug (1.11.0)
106
+ irb (~> 1.10)
107
+ reline (>= 0.3.8)
108
+ docile (1.4.0)
109
+ drb (2.2.1)
110
+ erubi (1.13.0)
111
+ ffi (1.17.4-aarch64-linux-gnu)
112
+ ffi (1.17.4-aarch64-linux-musl)
113
+ ffi (1.17.4-arm-linux-gnu)
114
+ ffi (1.17.4-arm-linux-musl)
115
+ ffi (1.17.4-arm64-darwin)
116
+ ffi (1.17.4-x86-linux-gnu)
117
+ ffi (1.17.4-x86-linux-musl)
118
+ ffi (1.17.4-x86_64-darwin)
119
+ ffi (1.17.4-x86_64-linux-gnu)
120
+ ffi (1.17.4-x86_64-linux-musl)
121
+ formatador (1.1.0)
122
+ globalid (1.2.1)
123
+ activesupport (>= 6.1)
124
+ guard (2.18.1)
125
+ formatador (>= 0.2.4)
126
+ listen (>= 2.7, < 4.0)
127
+ lumberjack (>= 1.0.12, < 2.0)
128
+ nenv (~> 0.1)
129
+ notiffany (~> 0.0)
130
+ pry (>= 0.13.0)
131
+ shellany (~> 0.0)
132
+ thor (>= 0.18.1)
133
+ guard-compat (1.2.1)
134
+ guard-minitest (2.4.6)
135
+ guard-compat (~> 1.2)
136
+ minitest (>= 3.0)
137
+ i18n (1.14.5)
138
+ concurrent-ruby (~> 1.0)
139
+ io-console (0.8.2)
140
+ irb (1.14.0)
141
+ rdoc (>= 4.0.0)
142
+ reline (>= 0.4.2)
143
+ json (2.13.2)
144
+ language_server-protocol (3.17.0.5)
145
+ lint_roller (1.1.0)
146
+ listen (3.9.0)
147
+ rb-fsevent (~> 0.10, >= 0.10.3)
148
+ rb-inotify (~> 0.9, >= 0.9.10)
149
+ logger (1.7.0)
150
+ loofah (2.22.0)
151
+ crass (~> 1.0.2)
152
+ nokogiri (>= 1.12.0)
153
+ lumberjack (1.2.10)
154
+ mail (2.8.1)
155
+ mini_mime (>= 0.1.1)
156
+ net-imap
157
+ net-pop
158
+ net-smtp
159
+ marcel (1.0.4)
160
+ method_source (1.1.0)
161
+ mini_mime (1.1.5)
162
+ mini_portile2 (2.8.9)
163
+ minitest (5.27.0)
164
+ mutex_m (0.2.0)
165
+ nenv (0.3.0)
166
+ net-imap (0.4.14)
167
+ date
168
+ net-protocol
169
+ net-pop (0.1.2)
170
+ net-protocol
171
+ net-protocol (0.2.2)
172
+ timeout
173
+ net-smtp (0.5.0)
174
+ net-protocol
175
+ nio4r (2.7.3)
176
+ nokogiri (1.19.4)
177
+ mini_portile2 (~> 2.8.2)
178
+ racc (~> 1.4)
179
+ nokogiri (1.19.4-aarch64-linux-gnu)
180
+ racc (~> 1.4)
181
+ nokogiri (1.19.4-aarch64-linux-musl)
182
+ racc (~> 1.4)
183
+ nokogiri (1.19.4-arm-linux-gnu)
184
+ racc (~> 1.4)
185
+ nokogiri (1.19.4-arm-linux-musl)
186
+ racc (~> 1.4)
187
+ nokogiri (1.19.4-arm64-darwin)
188
+ racc (~> 1.4)
189
+ nokogiri (1.19.4-x86_64-darwin)
190
+ racc (~> 1.4)
191
+ nokogiri (1.19.4-x86_64-linux-gnu)
192
+ racc (~> 1.4)
193
+ nokogiri (1.19.4-x86_64-linux-musl)
194
+ racc (~> 1.4)
195
+ notiffany (0.1.3)
196
+ nenv (~> 0.1)
197
+ shellany (~> 0.0)
198
+ ostruct (0.6.3)
199
+ parallel (1.28.0)
200
+ parser (3.3.9.0)
201
+ ast (~> 2.4.1)
202
+ racc
203
+ prism (1.9.0)
204
+ pry (0.16.0)
205
+ coderay (~> 1.1)
206
+ method_source (~> 1.0)
207
+ reline (>= 0.6.0)
208
+ pry-byebug (3.12.0)
209
+ byebug (~> 13.0)
210
+ pry (>= 0.13, < 0.17)
211
+ psych (5.1.2)
212
+ stringio
213
+ racc (1.8.1)
214
+ rack (2.2.9)
215
+ rack-session (1.0.2)
216
+ rack (< 3)
217
+ rack-test (2.1.0)
218
+ rack (>= 1.3)
219
+ rackup (1.0.0)
220
+ rack (< 3)
221
+ webrick
222
+ rails (7.1.3.4)
223
+ actioncable (= 7.1.3.4)
224
+ actionmailbox (= 7.1.3.4)
225
+ actionmailer (= 7.1.3.4)
226
+ actionpack (= 7.1.3.4)
227
+ actiontext (= 7.1.3.4)
228
+ actionview (= 7.1.3.4)
229
+ activejob (= 7.1.3.4)
230
+ activemodel (= 7.1.3.4)
231
+ activerecord (= 7.1.3.4)
232
+ activestorage (= 7.1.3.4)
233
+ activesupport (= 7.1.3.4)
234
+ bundler (>= 1.15.0)
235
+ railties (= 7.1.3.4)
236
+ rails-dom-testing (2.2.0)
237
+ activesupport (>= 5.0.0)
238
+ minitest
239
+ nokogiri (>= 1.6)
240
+ rails-html-sanitizer (1.6.0)
241
+ loofah (~> 2.21)
242
+ nokogiri (~> 1.14)
243
+ railties (7.1.3.4)
244
+ actionpack (= 7.1.3.4)
245
+ activesupport (= 7.1.3.4)
246
+ irb
247
+ rackup (>= 1.0.0)
248
+ rake (>= 12.2)
249
+ thor (~> 1.0, >= 1.2.2)
250
+ zeitwerk (~> 2.6)
251
+ rainbow (3.1.1)
252
+ rake (13.2.1)
253
+ rb-fsevent (0.11.2)
254
+ rb-inotify (0.11.1)
255
+ ffi (~> 1.0)
256
+ rdoc (6.7.0)
257
+ psych (>= 4.0.0)
258
+ regexp_parser (2.11.3)
259
+ reline (0.6.3)
260
+ io-console (~> 0.5)
261
+ rubocop (1.87.0)
262
+ json (~> 2.3)
263
+ language_server-protocol (~> 3.17.0.2)
264
+ lint_roller (~> 1.1.0)
265
+ parallel (>= 1.10)
266
+ parser (>= 3.3.0.2)
267
+ rainbow (>= 2.2.2, < 4.0)
268
+ regexp_parser (>= 2.9.3, < 3.0)
269
+ rubocop-ast (>= 1.49.0, < 2.0)
270
+ ruby-progressbar (~> 1.7)
271
+ unicode-display_width (>= 2.4.0, < 4.0)
272
+ rubocop-ast (1.49.1)
273
+ parser (>= 3.3.7.2)
274
+ prism (~> 1.7)
275
+ rubocop-performance (1.25.0)
276
+ lint_roller (~> 1.1)
277
+ rubocop (>= 1.75.0, < 2.0)
278
+ rubocop-ast (>= 1.38.0, < 2.0)
279
+ ruby-progressbar (1.13.0)
280
+ shellany (0.0.1)
281
+ simplecov (0.22.0)
282
+ docile (~> 1.1)
283
+ simplecov-html (~> 0.11)
284
+ simplecov_json_formatter (~> 0.1)
285
+ simplecov-html (0.12.3)
286
+ simplecov_json_formatter (0.1.4)
287
+ sprockets (3.7.3)
288
+ base64
289
+ concurrent-ruby (~> 1.0)
290
+ rack (> 1, < 3)
291
+ sprockets-rails (3.5.1)
292
+ actionpack (>= 6.1)
293
+ activesupport (>= 6.1)
294
+ sprockets (>= 3.0.0)
295
+ standard (1.55.0)
296
+ language_server-protocol (~> 3.17.0.2)
297
+ lint_roller (~> 1.0)
298
+ rubocop (~> 1.87.0)
299
+ standard-custom (~> 1.0.0)
300
+ standard-performance (~> 1.8)
301
+ standard-custom (1.0.2)
302
+ lint_roller (~> 1.0)
303
+ rubocop (~> 1.50)
304
+ standard-performance (1.8.0)
305
+ lint_roller (~> 1.1)
306
+ rubocop-performance (~> 1.25.0)
307
+ stringio (3.1.1)
308
+ thor (1.3.1)
309
+ timeout (0.4.1)
310
+ tzinfo (2.0.6)
311
+ concurrent-ruby (~> 1.0)
312
+ unicode-display_width (3.2.0)
313
+ unicode-emoji (~> 4.1)
314
+ unicode-emoji (4.2.0)
315
+ webrick (1.8.1)
316
+ websocket-driver (0.7.6)
317
+ websocket-extensions (>= 0.1.0)
318
+ websocket-extensions (0.1.5)
319
+ zeitwerk (2.6.16)
320
+
321
+ PLATFORMS
322
+ aarch64-linux
323
+ aarch64-linux-gnu
324
+ aarch64-linux-musl
325
+ arm-linux
326
+ arm-linux-gnu
327
+ arm-linux-musl
328
+ arm64-darwin
329
+ x86-linux
330
+ x86-linux-gnu
331
+ x86-linux-musl
332
+ x86_64-darwin
333
+ x86_64-linux
334
+ x86_64-linux-gnu
335
+ x86_64-linux-musl
336
+
337
+ DEPENDENCIES
338
+ debug
339
+ guard
340
+ guard-minitest
341
+ minitest (~> 5.0)
342
+ parallel (~> 1.27)
343
+ pry
344
+ pry-byebug
345
+ rack-test
346
+ rails
347
+ rake
348
+ serviceworker-rails!
349
+ simplecov
350
+ sprockets (~> 3.0)
351
+ sprockets-rails
352
+ standard
353
+
354
+ BUNDLED WITH
355
+ 2.5.16
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5
 
@@ -17,9 +19,9 @@
17
19
 
18
20
  guard :minitest do
19
21
  # with Minitest::Unit
20
- watch(%r{^test/(.*)\/?(.*)_test\.rb$})
21
- watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
22
- watch(%r{^test/test_helper\.rb$}) { "test" }
22
+ watch(%r{^test/(.*)/?(.*)_test\.rb$})
23
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
24
+ watch(%r{^test/test_helper\.rb$}) { "test" }
23
25
 
24
26
  # with Minitest::Spec
25
27
  # watch(%r{^spec/(.*)_spec\.rb$})
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/rossta/serviceworker-rails.svg?branch=master)](https://travis-ci.org/rossta/serviceworker-rails)
4
4
  [![Code Climate](https://codeclimate.com/github/rossta/serviceworker-rails/badges/gpa.svg)](https://codeclimate.com/github/rossta/serviceworker-rails)
5
5
 
6
- Turn your Rails app into a Progressive Web App. Use [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) with the Rails asset pipeline.
6
+ Turn your Rails app into a Progressive Web App. Use [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) with the Rails [asset pipeline](https://github.com/rails/sprockets-rails)
7
7
 
8
8
  ## Why?
9
9
 
@@ -18,7 +18,7 @@ with requests and responses within `/assets/`<em>**</em>. This is not what we wa
18
18
 
19
19
  * [MDN states](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API#Download_install_and_activate) browsers check for updated service worker scripts in the background every 24 hours (possibly less). Rails developers wouldn't be able to take advantage of this feature since the fingerprint strategy means assets at a given url are immutable. Beside fingerprintings, the `Cache-Control` headers used for static files served from Rails also work against browser's treatment of service workers.
20
20
 
21
- We want Sprockets to compile service worker JavaScript from ES6/7, CoffeeScript, ERB, etc. but must remove the caching and scoping mechanisms offered by Rails asset pipeline defaults. This is where `serviceworker-rails` comes in.
21
+ We want Sprockets to compile service worker JavaScript from ES6/7, CoffeeScript, ERB, etc. but must remove the caching and scoping mechanisms offered by Rails defaults. This is where `serviceworker-rails` comes in.
22
22
 
23
23
  *Check out the [blog post](https://rossta.net/blog/service-worker-on-rails.html)
24
24
  for more background.*
@@ -75,13 +75,15 @@ The generator will create the following files:
75
75
 
76
76
  It will also make the following modifications to existing files:
77
77
 
78
- * Adds a sprockets directive to `application.js` to require
79
- `serviceworker-companion.js`
80
78
  * Adds `serviceworker.js` and `manifest.json` to the list of compiled assets in
81
79
  `config/initializers/assets.rb`
82
80
  * Injects tags into the `head` of `app/views/layouts/application.html.erb` for
83
81
  linking to the web app manifest
84
82
 
83
+ Due to the variety of possible javascript implementations, you will still need to perform the following task manually:
84
+
85
+ * Require the Service Worker companion in your javascript entry point. For example, using the Sprockets asset pipeline, you would add `//= require serviceworker-companion` in `app/assets/javascripts/application.js`. If you're using Importmaps and the `app/javascript` directory, you can move the generated files in `app/assets/javascripts` to `app/javascript` and add `import 'serviceworker-companion'` to `app/javascript/application.js`.
86
+
85
87
  **NOTE** Given that Service Worker operates in a separate browser thread, outside the context of your web pages, you don't want to include `serviceworker.js` script in your `application.js`. So if you have a line like `require_tree .` in your `application.js` file, you'll either need to move your `serviceworker.js` to another location or replace `require_tree` with something more explicit.
86
88
 
87
89
  To learn more about each of the changes or to perform the set up yourself, check
@@ -297,4 +299,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/rossta
297
299
  ## License
298
300
 
299
301
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
300
-