native 2.0.1 → 2.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/INSTALL.md +2 -25
- data/README.md +6 -31
- data/Rakefile +10 -2
- data/app/helpers/native_helper.rb +2 -2
- data/lib/generators/native_generator.rb +18 -20
- data/lib/generators/templates/.keep +0 -0
- data/lib/generators/templates/{application.css → application.css.erb} +1 -1
- data/lib/generators/templates/{application.js → application.js.erb} +1 -1
- data/lib/native/configuration.rb +10 -0
- data/lib/native/engine.rb +7 -0
- data/lib/native/owner.rb +15 -0
- data/lib/native/railtie.rb +15 -0
- data/lib/native/version.rb +1 -1
- data/lib/native.rb +4 -12
- data/native.gemspec +3 -2
- metadata +25 -45
- data/init.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adf08cc05c139ad102c40376c26a7aa4ba109d5560264bf11f47074b6acb0dac
|
4
|
+
data.tar.gz: 61bc8444e11fdfffc6121e795b76beeaf1599def2f6761e5ff06bb6f039be416
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbd90a80e5dcb830be66244426b91536f5ba529676181a88c9cc2bf792d8b231ddd74a3fb19386e95d7cc2d90de314d0ec441ee85dd2303988134e6dfa63ad07
|
7
|
+
data.tar.gz: 57bc32905f7ad0c1758d3a6039a4f39d4cd153a5c3dd978a8d18e7711c8c2751797daf3076330836c0ea8edd1b7209138cb6d0a866d054794b0f9d8f8df1adea
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/INSTALL.md
CHANGED
@@ -1,33 +1,10 @@
|
|
1
1
|
**Thank you for installing Native!**
|
2
2
|
|
3
3
|
|
4
|
-
There are
|
4
|
+
There are two more steps to take:
|
5
5
|
|
6
6
|
1) Run `rails g native` and `rails db:migrate`
|
7
|
-
2)
|
8
|
-
|
9
|
-
//= link_directory ../native/android/javascripts .js
|
10
|
-
//= link_directory ../native/android/stylesheets .css
|
11
|
-
//= link_directory ../native/ios/javascripts .js
|
12
|
-
//= link_directory ../native/ios/stylesheets .css
|
13
|
-
//= link_directory ../native/uwp/javascripts .js
|
14
|
-
//= link_directory ../native/uwp/stylesheets .css
|
15
|
-
//= link_directory ../native/chrome/javascripts .js
|
16
|
-
//= link_directory ../native/chrome/stylesheets .css
|
17
|
-
//= link_directory ../native/osx/javascripts .js
|
18
|
-
//= link_directory ../native/osx/stylesheets .css
|
19
|
-
//= link_directory ../native/win32/javascripts .js
|
20
|
-
//= link_directory ../native/win32/stylesheets .css
|
21
|
-
//= link_directory ../native/win64/javascripts .js
|
22
|
-
//= link_directory ../native/win64/stylesheets .css
|
23
|
-
//= link_directory ../native/lin32/javascripts .js
|
24
|
-
//= link_directory ../native/lin32/stylesheets .css
|
25
|
-
//= link_directory ../native/lin64/javascripts .js
|
26
|
-
//= link_directory ../native/lin64/stylesheets .css
|
27
|
-
//= link_directory ../native/web/javascripts .js
|
28
|
-
//= link_directory ../native/web/stylesheets .css
|
29
|
-
|
30
|
-
3) Mount engine in `config/routes.rb`:
|
7
|
+
2) Mount engine in `config/routes.rb`:
|
31
8
|
|
32
9
|
mount Native::Engine, at: '/native'
|
33
10
|
|
data/README.md
CHANGED
@@ -78,35 +78,10 @@ To wrap things up, migrate the changes into your database:
|
|
78
78
|
|
79
79
|
$ rails db:migrate
|
80
80
|
|
81
|
-
Go to `app/assets/config/manifest.js` and add the following lines:
|
82
|
-
|
83
|
-
```js
|
84
|
-
//= link_directory ../native/android/javascripts .js
|
85
|
-
//= link_directory ../native/android/stylesheets .css
|
86
|
-
//= link_directory ../native/ios/javascripts .js
|
87
|
-
//= link_directory ../native/ios/stylesheets .css
|
88
|
-
//= link_directory ../native/uwp/javascripts .js
|
89
|
-
//= link_directory ../native/uwp/stylesheets .css
|
90
|
-
//= link_directory ../native/chrome/javascripts .js
|
91
|
-
//= link_directory ../native/chrome/stylesheets .css
|
92
|
-
//= link_directory ../native/osx/javascripts .js
|
93
|
-
//= link_directory ../native/osx/stylesheets .css
|
94
|
-
//= link_directory ../native/win32/javascripts .js
|
95
|
-
//= link_directory ../native/win32/stylesheets .css
|
96
|
-
//= link_directory ../native/win64/javascripts .js
|
97
|
-
//= link_directory ../native/win64/stylesheets .css
|
98
|
-
//= link_directory ../native/lin32/javascripts .js
|
99
|
-
//= link_directory ../native/lin32/stylesheets .css
|
100
|
-
//= link_directory ../native/lin64/javascripts .js
|
101
|
-
//= link_directory ../native/lin64/stylesheets .css
|
102
|
-
//= link_directory ../native/web/javascripts .js
|
103
|
-
//= link_directory ../native/web/stylesheets .css
|
104
|
-
```
|
105
|
-
|
106
81
|
Let's move on to your devise class. For instance `User` located in `app/models/user.rb`. Associate belonging `App` objects:
|
107
82
|
|
108
83
|
```ruby
|
109
|
-
|
84
|
+
uses_native_apps
|
110
85
|
```
|
111
86
|
|
112
87
|
Lastly, got to your routes file (`config/routes.rb`) and mount the `Native::Engine` class:
|
@@ -133,7 +108,7 @@ That's it!
|
|
133
108
|
|
134
109
|
### Assets
|
135
110
|
|
136
|
-
With Native it is fairly simple to add platform specific stylesheets and scripts. In your assets directory you have a
|
111
|
+
With Native it is fairly simple to add platform specific stylesheets and scripts. In your assets directory you have a new folder for your `javascripts` and `stylesheets` (`app/assets/.../native`). In these two folders you are able to add custom assets for specific platforms including `web` specific assets.
|
137
112
|
|
138
113
|
You simple have to include ...
|
139
114
|
|
@@ -141,11 +116,11 @@ You simple have to include ...
|
|
141
116
|
= native_assets
|
142
117
|
```
|
143
118
|
|
144
|
-
... in the `head` tag of your layout.
|
119
|
+
... in the `head` tag of your layout after your other asset include tags.
|
145
120
|
|
146
121
|
### App methods
|
147
122
|
|
148
|
-
Native introduces an `App`
|
123
|
+
Native introduces an `App` ActiveRecord model. Every object of your devise class can have multiple apps.
|
149
124
|
|
150
125
|
```ruby
|
151
126
|
a = App.first
|
@@ -203,7 +178,7 @@ If you want to use them in your controllers, just add `include NativeHelper` at
|
|
203
178
|
|
204
179
|
### Notifications
|
205
180
|
|
206
|
-
You can enable native notifications on most platforms. To handle notifications Native integrates with
|
181
|
+
You can enable native notifications on most platforms. To handle notifications Native integrates with the [notifications-rails](https://github.com/jonhue/notifications-rails) gem. Implement the [notification-pusher-onesignal](https://github.com/jonhue/notifications-rails/tree/master/notification-pusher/notification-pusher-onesignal) component to push notifications to your native applications.
|
207
182
|
|
208
183
|
### Content scaling (Android)
|
209
184
|
|
@@ -223,7 +198,7 @@ This will adjust the `font-size` of `:root`. The pixel value can be [configured]
|
|
223
198
|
|
224
199
|
## Configuration
|
225
200
|
|
226
|
-
You can configure Native by passing a block to `configure`:
|
201
|
+
You can configure Native by passing a block to `configure`. This can be done in `config/initializers/native.rb`:
|
227
202
|
|
228
203
|
```ruby
|
229
204
|
Native.configure do |config|
|
data/Rakefile
CHANGED
@@ -9,8 +9,8 @@ module NativeHelper
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def native_assets
|
12
|
-
stylesheet = stylesheet_link_tag "native/#{current_platform}
|
13
|
-
javascript = javascript_include_tag "native/#{current_platform}
|
12
|
+
stylesheet = stylesheet_link_tag "native/#{current_platform}", media: 'all', 'data-turbolinks-track': 'reload'
|
13
|
+
javascript = javascript_include_tag "native/#{current_platform}", 'data-turbolinks-track': 'reload'
|
14
14
|
stylesheet.concat javascript
|
15
15
|
end
|
16
16
|
|
@@ -26,26 +26,16 @@ class NativeGenerator < Rails::Generators::Base
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def create_assets
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
template 'application.css', 'app/assets/native/win32/stylesheets/application.css'
|
40
|
-
template 'application.js', 'app/assets/native/win32/javascripts/application.js'
|
41
|
-
template 'application.css', 'app/assets/native/win64/stylesheets/application.css'
|
42
|
-
template 'application.js', 'app/assets/native/win64/javascripts/application.js'
|
43
|
-
template 'application.css', 'app/assets/native/lin32/stylesheets/application.css'
|
44
|
-
template 'application.js', 'app/assets/native/lin32/javascripts/application.js'
|
45
|
-
template 'application.css', 'app/assets/native/lin64/stylesheets/application.css'
|
46
|
-
template 'application.js', 'app/assets/native/lin64/javascripts/application.js'
|
47
|
-
template 'application.css', 'app/assets/native/web/stylesheets/application.css'
|
48
|
-
template 'application.js', 'app/assets/native/web/javascripts/application.js'
|
29
|
+
create_assets_for 'android'
|
30
|
+
create_assets_for 'ios'
|
31
|
+
create_assets_for 'uwp'
|
32
|
+
create_assets_for 'chrome'
|
33
|
+
create_assets_for 'osx'
|
34
|
+
create_assets_for 'win32'
|
35
|
+
create_assets_for 'win64'
|
36
|
+
create_assets_for 'lin32'
|
37
|
+
create_assets_for 'lin64'
|
38
|
+
create_assets_for 'web'
|
49
39
|
end
|
50
40
|
|
51
41
|
def show_readme
|
@@ -60,4 +50,12 @@ class NativeGenerator < Rails::Generators::Base
|
|
60
50
|
end
|
61
51
|
end
|
62
52
|
|
53
|
+
def create_assets_for platform
|
54
|
+
@platform = platform
|
55
|
+
template 'application.css.erb', "app/assets/stylesheets/native/#{platform}.css"
|
56
|
+
template '.keep', "app/assets/stylesheets/native/#{platform}/.keep"
|
57
|
+
template 'application.js.erb', "app/assets/javascripts/native/#{platform}.js"
|
58
|
+
template '.keep', "app/assets/javascripts/native/#{platform}/.keep"
|
59
|
+
end
|
60
|
+
|
63
61
|
end
|
File without changes
|
data/lib/native/configuration.rb
CHANGED
data/lib/native/owner.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module Native
|
4
|
+
class Railtie < Rails::Railtie
|
5
|
+
|
6
|
+
initializer 'native.initialize' do
|
7
|
+
Rails.application.config.assets.precompile += %w( native/android.js native/ios.js native/uwp.js native/chrome.js native/osx.js native/win32.js native/win64.js native/lin32.js native/lin64.js native/web.js native/android.css native/ios.css native/uwp.css native/chrome.css native/osx.css native/win32.css native/win64.css native/lin32.css native/lin64.css native/web.css )
|
8
|
+
|
9
|
+
ActiveSupport.on_load :active_record do
|
10
|
+
include Native::Owner
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
data/lib/native/version.rb
CHANGED
data/lib/native.rb
CHANGED
@@ -2,19 +2,11 @@ require 'native/version'
|
|
2
2
|
|
3
3
|
module Native
|
4
4
|
|
5
|
-
|
5
|
+
require 'native/configuration'
|
6
6
|
|
7
|
-
|
8
|
-
attr_accessor :configuration
|
9
|
-
end
|
7
|
+
autoload :Owner, 'native/owner'
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
yield configuration
|
14
|
-
end
|
15
|
-
|
16
|
-
class Engine < ::Rails::Engine
|
17
|
-
# isolate_namespace Native
|
18
|
-
end
|
9
|
+
require 'native/engine'
|
10
|
+
require 'native/railtie'
|
19
11
|
|
20
12
|
end
|
data/native.gemspec
CHANGED
@@ -19,7 +19,8 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.required_ruby_version = '>= 2.3'
|
21
21
|
|
22
|
-
gem.add_development_dependency 'bundler', '~> 1.16'
|
23
|
-
gem.add_development_dependency 'rake', '~> 10.0'
|
24
22
|
gem.add_dependency 'rails', '>= 5.0'
|
23
|
+
|
24
|
+
gem.add_development_dependency 'rspec', '~> 3.7'
|
25
|
+
gem.add_development_dependency 'rubocop', '~> 0.52'
|
25
26
|
end
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: native
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.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: 2017-12-
|
11
|
+
date: 2017-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.7'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
47
|
+
version: '0.52'
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0.52'
|
55
55
|
description: Build native apps for all major platforms from your Rails applications.
|
56
56
|
email: jonas.huebotter@gmail.com
|
57
57
|
executables: []
|
@@ -76,16 +76,19 @@ files:
|
|
76
76
|
- app/helpers/native_helper.rb
|
77
77
|
- app/models/concerns/native/app_lib.rb
|
78
78
|
- config/routes.rb
|
79
|
-
- init.rb
|
80
79
|
- lib/generators/native_generator.rb
|
80
|
+
- lib/generators/templates/.keep
|
81
81
|
- lib/generators/templates/README.md
|
82
82
|
- lib/generators/templates/app_model.rb
|
83
|
-
- lib/generators/templates/application.css
|
84
|
-
- lib/generators/templates/application.js
|
83
|
+
- lib/generators/templates/application.css.erb
|
84
|
+
- lib/generators/templates/application.js.erb
|
85
85
|
- lib/generators/templates/apps_migration.rb.erb
|
86
86
|
- lib/generators/templates/initializer.rb
|
87
87
|
- lib/native.rb
|
88
88
|
- lib/native/configuration.rb
|
89
|
+
- lib/native/engine.rb
|
90
|
+
- lib/native/owner.rb
|
91
|
+
- lib/native/railtie.rb
|
89
92
|
- lib/native/version.rb
|
90
93
|
- native.gemspec
|
91
94
|
- vendor/assets/javascripts/nativeScale.js.erb
|
@@ -97,33 +100,10 @@ post_install_message: |
|
|
97
100
|
**Thank you for installing Native!**
|
98
101
|
|
99
102
|
|
100
|
-
There are
|
103
|
+
There are two more steps to take:
|
101
104
|
|
102
105
|
1) Run `rails g native` and `rails db:migrate`
|
103
|
-
2)
|
104
|
-
|
105
|
-
//= link_directory ../native/android/javascripts .js
|
106
|
-
//= link_directory ../native/android/stylesheets .css
|
107
|
-
//= link_directory ../native/ios/javascripts .js
|
108
|
-
//= link_directory ../native/ios/stylesheets .css
|
109
|
-
//= link_directory ../native/uwp/javascripts .js
|
110
|
-
//= link_directory ../native/uwp/stylesheets .css
|
111
|
-
//= link_directory ../native/chrome/javascripts .js
|
112
|
-
//= link_directory ../native/chrome/stylesheets .css
|
113
|
-
//= link_directory ../native/osx/javascripts .js
|
114
|
-
//= link_directory ../native/osx/stylesheets .css
|
115
|
-
//= link_directory ../native/win32/javascripts .js
|
116
|
-
//= link_directory ../native/win32/stylesheets .css
|
117
|
-
//= link_directory ../native/win64/javascripts .js
|
118
|
-
//= link_directory ../native/win64/stylesheets .css
|
119
|
-
//= link_directory ../native/lin32/javascripts .js
|
120
|
-
//= link_directory ../native/lin32/stylesheets .css
|
121
|
-
//= link_directory ../native/lin64/javascripts .js
|
122
|
-
//= link_directory ../native/lin64/stylesheets .css
|
123
|
-
//= link_directory ../native/web/javascripts .js
|
124
|
-
//= link_directory ../native/web/stylesheets .css
|
125
|
-
|
126
|
-
3) Mount engine in `config/routes.rb`:
|
106
|
+
2) Mount engine in `config/routes.rb`:
|
127
107
|
|
128
108
|
mount Native::Engine, at: '/native'
|
129
109
|
|
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'native'
|