native 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/DEPRECATIONS.md +4 -0
- data/README.md +26 -8
- data/app/controllers/native/application_controller.rb +5 -0
- data/app/controllers/native/platforms_controller.rb +1 -1
- data/lib/generators/templates/app_model.rb +1 -1
- data/lib/generators/templates/apps_migration.rb.erb +1 -1
- data/lib/generators/templates/initializer.rb +0 -8
- data/lib/native/configuration.rb +0 -2
- data/lib/native/version.rb +1 -1
- data/native.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfb554ed0a23884a6355580ddee53294e29b6ddfee890d4b81c894b027c9359
|
4
|
+
data.tar.gz: dfc98650f1fa96e4f72f6047017d8326fb526a47967657d2713eedcc24d66504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5375af7ad6450574e0317b12ac34a4cc5e1575558c57512335174c284d65f8eda977a0018434970800b8584e57579ae486bfd99fd342a1ed7583425929df177e
|
7
|
+
data.tar.gz: 9f73e0a914cc98362dee8a0bf213cde5ffeb4329dbecac9f4d00e2a7efa38996ea63f67ee5153060e3229196a1f52860ceedefd1fbe06dced38e38b42c5a41db
|
data/CHANGELOG.md
CHANGED
data/DEPRECATIONS.md
CHANGED
data/README.md
CHANGED
@@ -35,6 +35,7 @@ Native is being powered by **[NativeGap](https://nativegap.com)**.
|
|
35
35
|
* [NativeGap](#nativegap)
|
36
36
|
* [Assets](#assets)
|
37
37
|
* [App methods](#app-methods)
|
38
|
+
* [Associate objects](#associate-objects)
|
38
39
|
* [View methods](#view-methods)
|
39
40
|
* [Notifications](#notifications)
|
40
41
|
* [Content scaling (Android)](#content-scaling-android)
|
@@ -42,6 +43,7 @@ Native is being powered by **[NativeGap](https://nativegap.com)**.
|
|
42
43
|
* [To Do](#to-do)
|
43
44
|
* [Contributing](#contributing)
|
44
45
|
* [Contributors](#contributors)
|
46
|
+
* [Semantic versioning](#semantic-versioning)
|
45
47
|
* [License](#license)
|
46
48
|
|
47
49
|
---
|
@@ -117,7 +119,7 @@ mount Native::Engine, at: '/native'
|
|
117
119
|
|
118
120
|
### NativeGap
|
119
121
|
|
120
|
-
While this gem assists you in creating a true cross-platform app, [NativeGap](https://nativegap.com) is still needed to create the actual native code. That's not too big of a deal though, NativeApp can be used entirely for free and it has an extensive [documentation](https://nativegap.com/guide).
|
122
|
+
While this gem assists you in creating a true cross-platform app, [NativeGap](https://nativegap.com) is still needed to create the actual native code. That's not too big of a deal though, NativeApp can be used entirely for free ([learn more](https://nativegap.com/pricing)) and it has an extensive [documentation](https://nativegap.com/guide).
|
121
123
|
|
122
124
|
Getting started with NativeGap:
|
123
125
|
|
@@ -127,11 +129,11 @@ Getting started with NativeGap:
|
|
127
129
|
|
128
130
|
That's it!
|
129
131
|
|
130
|
-
Native also supports the coexistence of multiple NativeGap apps with only one Rails app as a source.
|
132
|
+
**Note:** Native also supports the coexistence of multiple NativeGap apps with only one Rails app as a source.
|
131
133
|
|
132
134
|
### Assets
|
133
135
|
|
134
|
-
With Native it is fairly simple to add platform specific stylesheets and scripts. In your assets directory you have a separate folder (
|
136
|
+
With Native it is fairly simple to add platform specific stylesheets and scripts. In your assets directory you have a separate folder (`app/assets/native`) for every platform behaving similarly to the root assets folder. You are not only able to add custom assets for those platforms added by Native, but you can also add `web` specific assets.
|
135
137
|
|
136
138
|
You simple have to include ...
|
137
139
|
|
@@ -148,8 +150,8 @@ Native introduces an `App` activerecord model. Every object of your devise class
|
|
148
150
|
```ruby
|
149
151
|
a = App.first
|
150
152
|
|
151
|
-
# Returns
|
152
|
-
a.
|
153
|
+
# Returns associated object. Can return `nil`.
|
154
|
+
a.owner
|
153
155
|
|
154
156
|
# Returns lowercase string of platform.
|
155
157
|
d.platform
|
@@ -175,6 +177,20 @@ d.platforms
|
|
175
177
|
d.apps
|
176
178
|
```
|
177
179
|
|
180
|
+
#### Associate objects
|
181
|
+
|
182
|
+
If you are using Devise and your model is named `User`, the object returned by `current_user` will automatically be associated with the current app. If your Devise model is not named `User` or you are using a different user-management solution that does not implement a `current_user` method, you are able to override this default behavior.
|
183
|
+
|
184
|
+
Let's say our Devise model is named `Admin`. Just add a `private` method to your `ApplicationController`:
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
def set_app_owner
|
188
|
+
current_admin if current_admin
|
189
|
+
end
|
190
|
+
```
|
191
|
+
|
192
|
+
**Note:** Essentially `set_app_owner` has to return a class object *or* `nil`.
|
193
|
+
|
178
194
|
### View methods
|
179
195
|
|
180
196
|
**`current_app`** Returns `App` object related to current session. Returns `nil` when the Rails is being used normally.
|
@@ -211,12 +227,10 @@ You can configure Native by passing a block to `configure`:
|
|
211
227
|
|
212
228
|
```ruby
|
213
229
|
Native.configure do |config|
|
214
|
-
config.
|
230
|
+
config.android = true
|
215
231
|
end
|
216
232
|
```
|
217
233
|
|
218
|
-
**`devise_class`** Specify your devise class. Takes a string. Defaults to `'User'`.
|
219
|
-
|
220
234
|
**`#{platform}`** Set to `false` to disable the platform. Takes a boolean. Defaults to `true`.
|
221
235
|
|
222
236
|
**`#{platform}_url`** Specify the start url of your app on a given platform by passing a stringified route helper. Takes a string. Defaults to `'root_url'`.
|
@@ -245,6 +259,10 @@ Give the people some :heart: who are working on this project. See them all at:
|
|
245
259
|
|
246
260
|
https://github.com/NativeGap/native-rails/graphs/contributors
|
247
261
|
|
262
|
+
### Semantic Versioning
|
263
|
+
|
264
|
+
Native follows Semantic Versioning 2.0 as defined at http://semver.org.
|
265
|
+
|
248
266
|
## License
|
249
267
|
|
250
268
|
MIT License
|
@@ -60,7 +60,7 @@ module Native
|
|
60
60
|
@app.platform = platform
|
61
61
|
@app.url = url
|
62
62
|
end
|
63
|
-
@app.
|
63
|
+
@app.owner = ApplicationController.set_app_owner || set_app_owner
|
64
64
|
@app.last_used = Time.now
|
65
65
|
@app.save!
|
66
66
|
|
@@ -2,7 +2,7 @@ class NativeMigration < ActiveRecord::Migration<%= migration_version %>
|
|
2
2
|
def change
|
3
3
|
create_table :native_apps do |t|
|
4
4
|
|
5
|
-
t.references
|
5
|
+
t.references :owner, polymorphic: true, index: true
|
6
6
|
|
7
7
|
t.string :platform, index: true
|
8
8
|
t.string :url, index: true
|
@@ -1,13 +1,5 @@
|
|
1
1
|
Native.configure do |config|
|
2
2
|
|
3
|
-
### DEVISE ###
|
4
|
-
|
5
|
-
# Specify your devise class. Defaults to `'User'`.
|
6
|
-
# config.devise_class = 'User'
|
7
|
-
|
8
|
-
|
9
|
-
### CUSTOMIZATION ###
|
10
|
-
|
11
3
|
# Specify platforms your app supports.
|
12
4
|
# config.android = true
|
13
5
|
# config.ios = true
|
data/lib/native/configuration.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Native
|
2
2
|
class Configuration
|
3
3
|
|
4
|
-
attr_accessor :devise_class
|
5
4
|
attr_accessor :android
|
6
5
|
attr_accessor :ios
|
7
6
|
attr_accessor :uwp
|
@@ -23,7 +22,6 @@ module Native
|
|
23
22
|
attr_accessor :scale_size
|
24
23
|
|
25
24
|
def initialize
|
26
|
-
@devise_class = 'User'
|
27
25
|
@android = true
|
28
26
|
@ios = true
|
29
27
|
@uwp = true
|
data/lib/native/version.rb
CHANGED
data/native.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: native
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.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: 2017-12-
|
11
|
+
date: 2017-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: devise
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '4.3'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '4.3'
|
69
55
|
description: Build native apps for all major platforms from your Rails applications.
|
70
56
|
email: jonas.huebotter@gmail.com
|
71
57
|
executables: []
|