pwa 3.0.0 → 4.0.0

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: e69136de72eed2e30d89504da58d8e4d2472cd3ab7fcb63cdd015cfc4e03922d
4
- data.tar.gz: ca30c0c3a157154d23d058454b3b64046cbf20fe7440a3b32be26f42631d6df4
3
+ metadata.gz: 79a9115e917a05a1ba27a01db53e8f0d992198f9748cc6e64727d569603cb0fb
4
+ data.tar.gz: bc9e3b279f638a17abafa6101b09495ab612ee2a08eeea47ae940c2bf3127a37
5
5
  SHA512:
6
- metadata.gz: 578ff53f36b826aa4e638ccba011020869a14be7cbbdf5e4b5625ddbc75cf75b66d3df939360bf083e85839218ac9e1b913886dd71695cb91b96cd44c433be69
7
- data.tar.gz: 5d2c5de041cc0415540a99a530ef7ff07b8e0d950da74eec6a3108848a69d2209079c33db681d3cf43fe261582ca7748dc0e3e625e9f1290b7dcb679cb8a4bd2
6
+ metadata.gz: 3950e131101fbfc4c0c6364ae1c0941a22e375179d144b071e8a16a9bfcb87def85ded1526ea3586ad10a80dc0ceab7866e7970f02157ff7e574bd29dcd4a700
7
+ data.tar.gz: 63e62558fa5234f5fa2f69125f6e2bbb2583cd3a10ab2c277cc354f06bbfee18f9990a83dec3bed1c6d1328115afa820c420b7b3e4a127199d32e4d1f4be5c6d
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
+ ### 4.0.0 - 2018/03/27
8
+
9
+ * features
10
+ * add theme support
11
+ * bugfixes
12
+ * fixed manifest URL in manifest component
13
+
7
14
  ### 3.0.0 - 2018/02/10
8
15
 
9
16
  * features
data/README.md CHANGED
@@ -11,11 +11,11 @@ This gem only provides the foundation you can build your Progressive Web App upo
11
11
  * **Fast** - Respond quickly to user interactions with silky smooth animations and no janky scrolling.
12
12
  * There are two technologies helping you with performance: *Turbolinks* & *AMP*. When you are using Turbolinks, use [TurbolinksAnimate](https://github.com/jonhue/turbolinks-animate) to get XHR requests + smooth page transitions that add some delight to using to your app. If you want to use AMP, take a look at [amp-html](https://github.com/jonhue/amp-html), an Accelerated Mobile Pages library for Rails apps.
13
13
  * **Engaging** - Feel like a natural app on the device, with an immersive user experience.
14
- * When you think about making your app more engaging, you can't get around user-notifications. OneSignal is a powerful (& free) solution. With [devise-onseignal](https://github.com/jonhue/devise-onesignal) and [notification-pusher-onesignal](https://github.com/jonhue/notifications-rails/tree/master/notification-pusher/notification-pusher-onesignal) adding native notification capabilities to your app becomes dead simple.
14
+ * When you think about making your app more engaging, you can't get around user-notifications. OneSignal is a powerful (& free) solution. With [OnSignal](https://github.com/jonhue/onsignal) and [notification-pusher-onesignal](https://github.com/jonhue/notifications-rails/tree/master/notification-pusher/notification-pusher-onesignal) adding native notification capabilities to your app becomes dead simple.
15
15
 
16
16
  ---
17
17
 
18
- If a PWA is not enough and you want to bring your Web App into the store - check out [Native](https://github.com/NativeGap/native-rails).
18
+ If a PWA is not enough and you want to bring your Web App into the store - check out [NativeGap](https://github.com/NativeGap/nativegap-rails).
19
19
 
20
20
  ---
21
21
 
@@ -29,7 +29,7 @@ If a PWA is not enough and you want to bring your Web App into the store - check
29
29
  * [Offline pages](#offline-pages)
30
30
  * [Themes](#themes)
31
31
  * [Service worker](#service-worker)
32
- * [Views](#views)
32
+ * [Styles](#styles)
33
33
  * [Configuration](#configuration)
34
34
  * [To Do](#to-do)
35
35
  * [Contributing](#contributing)
@@ -69,6 +69,7 @@ gem 'pwa', github: 'jonhue/pwa'
69
69
 
70
70
  Run the generators:
71
71
 
72
+ $ rails g mozaic:install
72
73
  $ rails g pwa:install
73
74
  $ rails g pwa:app -n "App"
74
75
 
@@ -86,13 +87,16 @@ Add the following to the `head` tag of your layout file:
86
87
  = component 'pwa/manifest'
87
88
  ```
88
89
 
89
- Make sure to add the required javascript in `app/assets/javascripts/application.js`:
90
+ Now add the `pwa-rails` NPM package and initialize it:
90
91
 
91
92
  ```js
92
- //= require pwa
93
+ import ProgressiveWebApp from 'pwa-rails';
94
+ document.addEventListener( 'turbolinks:load', () => {
95
+ const progressiveWebApp = new ProgressiveWebApp();
96
+ })
93
97
  ```
94
98
 
95
- **Note:** If you are using Webpack instead of Sprockets, add and import the `pwa-rails` NPM package.
99
+ **Note:** If the name of the service worker is not the default `/pwa-sw.js` you can specify a custom path: `new ProgressiveWebApp('/custom-path.js')`
96
100
 
97
101
  Lastly, go to your routes file (`config/routes.rb`) and mount the `Pwa::Engine` class:
98
102
 
@@ -153,7 +157,7 @@ You can customize the page that shows up when a requested page has not been cach
153
157
  importScripts('https://example.com/pwa-sw.js');
154
158
  ```
155
159
 
156
- ### Views
160
+ ### Styles
157
161
 
158
162
  To detect whether or not your app is currently being used as a Progressive Web App, you can use CSS media queries:
159
163
 
@@ -12,7 +12,7 @@ module Pwa
12
12
  private
13
13
 
14
14
  def get_app
15
- @app = ::Pwa::App.find_by_url(request.original_url)[0]
15
+ @app = Pwa::App.find_by_url(request.original_url).first
16
16
  end
17
17
 
18
18
  end
@@ -1 +1 @@
1
- <link rel='manifest' href='manifest.json' />
1
+ <link rel='manifest' href="#{request.base_url}/manifest.json" />
data/lib/pwa/railtie.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rails/railtie'
2
+ require 'mozaic'
2
3
 
3
4
  module Pwa
4
5
  class Railtie < Rails::Railtie
data/lib/pwa/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Pwa
2
2
 
3
- VERSION = '3.0.0'
3
+ VERSION = '4.0.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwa
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-10 00:00:00.000000000 Z
11
+ date: 2018-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -66,7 +66,8 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.52'
69
- description: Progressive Web Apps for Rails
69
+ description: Add a service worker and a manifest to your app, for it to be recognized
70
+ as a PWA and accessed without a network connection.
70
71
  email: me@jonhue.me
71
72
  executables: []
72
73
  extensions: []
@@ -93,28 +94,11 @@ files:
93
94
  - lib/pwa/engine.rb
94
95
  - lib/pwa/railtie.rb
95
96
  - lib/pwa/version.rb
96
- - vendor/assets/javascripts/pwa.js
97
- homepage: https://github.com/jonhue/pwa
97
+ homepage: https://jonhue.me/repos/progressive-web-apps-for-rails
98
98
  licenses:
99
99
  - MIT
100
100
  metadata: {}
101
- post_install_message: |
102
- **Thank you for installing Progressive Web Apps for Rails!**
103
-
104
-
105
- There are three more steps to take:
106
-
107
- 1) Run `rails g pwa:install` and `rails g pwa:install -n "Application Name"`
108
- 2) Include the manifest component in your head tag:
109
-
110
- <%= component 'pwa/manfest' %>
111
-
112
- 3) Mount engine in `config/routes.rb`:
113
-
114
- mount Pwa::Engine, at: ''
115
-
116
-
117
- Learn more at https://github.com/jonhue/pwa
101
+ post_install_message:
118
102
  rdoc_options: []
119
103
  require_paths:
120
104
  - lib
@@ -1,9 +0,0 @@
1
- if (navigator.serviceWorker.controller) {
2
- console.log('[PWA] Active service worker found')
3
- } else {
4
- navigator.serviceWorker.register( '/pwa-sw.js', { scope: './' }).then(function(reg) {
5
- console.log( '[PWA] ServiceWorker registration successful with scope: ', reg.scope );
6
- }, function(err) {
7
- console.log( '[PWA] ServiceWorker registration failed: ', err );
8
- });
9
- }