README.md in native-1.0.0 vs README.md in native-2.0.0
- old
+ new
@@ -33,17 +33,19 @@
* [Installation](#installation)
* [Usage](#usage)
* [NativeGap](#nativegap)
* [Assets](#assets)
* [App methods](#app-methods)
+ * [Associate objects](#associate-objects)
* [View methods](#view-methods)
* [Notifications](#notifications)
* [Content scaling (Android)](#content-scaling-android)
* [Configuration](#configuration)
* [To Do](#to-do)
* [Contributing](#contributing)
* [Contributors](#contributors)
+ * [Semantic versioning](#semantic-versioning)
* [License](#license)
---
## Installation
@@ -115,25 +117,25 @@
## Usage
### NativeGap
-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).
+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).
Getting started with NativeGap:
1. Create a new NativeGap app
2. Wait until platforms processed
3. For each platform you want to support: click `Update` and enter the start path. The start path consists of your `Native::Engine` mount path and the platform. It could look like this: `native/android`
That's it!
-Native also supports the coexistence of multiple NativeGap apps with only one Rails app as a source.
+**Note:** Native also supports the coexistence of multiple NativeGap apps with only one Rails app as a source.
### Assets
-With Native it is fairly simple to add platform specific stylesheets and scripts. In your assets directory you have a separate folder (in `app/assets/native`) for every platform which behaves 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.
+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.
You simple have to include ...
```ruby
= native_assets
@@ -146,12 +148,12 @@
Native introduces an `App` activerecord model. Every object of your devise class can have multiple apps.
```ruby
a = App.first
-# Returns user (or other devise object) that this device belongs to. Can return `nil`.
-a.user
+# Returns associated object. Can return `nil`.
+a.owner
# Returns lowercase string of platform.
d.platform
# Returns url of mounted `NativeGap::Engine` class. This can be used to differentiate between apps, if you have multiple NativeGap apps with one Rails app as source.
@@ -173,10 +175,24 @@
# Group apps by `url`
d.apps
```
+#### Associate objects
+
+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.
+
+Let's say our Devise model is named `Admin`. Just add a `private` method to your `ApplicationController`:
+
+```ruby
+def set_app_owner
+ current_admin if current_admin
+end
+```
+
+**Note:** Essentially `set_app_owner` has to return a class object *or* `nil`.
+
### View methods
**`current_app`** Returns `App` object related to current session. Returns `nil` when the Rails is being used normally.
**`current_platform`** Returns lowercase string of current platform. Returns `'web'` when the Rails is being used normally.
@@ -209,16 +225,14 @@
You can configure Native by passing a block to `configure`:
```ruby
Native.configure do |config|
- config.devise_class = 'User'
+ config.android = true
end
```
-**`devise_class`** Specify your devise class. Takes a string. Defaults to `'User'`.
-
**`#{platform}`** Set to `false` to disable the platform. Takes a boolean. Defaults to `true`.
**`#{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'`.
**`scale_size`** Defining `:root` `font-size` on Android apps, [learn more](#content-scaling-android). Takes a string. Defaults to `'18px'`.
@@ -242,9 +256,13 @@
### Contributors
Give the people some :heart: who are working on this project. See them all at:
https://github.com/NativeGap/native-rails/graphs/contributors
+
+### Semantic Versioning
+
+Native follows Semantic Versioning 2.0 as defined at http://semver.org.
## License
MIT License