nativegap 3.0.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 +7 -0
- data/CHANGELOG.md +55 -0
- data/LICENSE +21 -0
- data/README.md +247 -0
- data/app/controllers/concerns/native_gap_controller.rb +36 -0
- data/app/helpers/native_helper.rb +15 -0
- data/app/models/concerns/native_model.rb +11 -0
- data/app/models/native_gap/app_library.rb +14 -0
- data/app/views/mozaic/nativegap/_assets.html.erb +2 -0
- data/lib/generators/nativegap_generator.rb +56 -0
- data/lib/generators/templates/README.md +1 -0
- data/lib/generators/templates/app_model.rb +2 -0
- data/lib/generators/templates/application.css.erb +6 -0
- data/lib/generators/templates/application.js.erb +3 -0
- data/lib/generators/templates/apps_migration.rb.erb +16 -0
- data/lib/generators/templates/initializer.rb +15 -0
- data/lib/generators/templates/keep-file +0 -0
- data/lib/native_gap/configuration.rb +35 -0
- data/lib/native_gap/engine.rb +7 -0
- data/lib/native_gap/railtie.rb +30 -0
- data/lib/native_gap/version.rb +5 -0
- data/lib/nativegap.rb +10 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 77ad6cce9642d37cc02fcfbc3fbfe1c328193d5ab08f3ddb31ebdac0093556f0
|
4
|
+
data.tar.gz: 73ea7e3f58805d79587aa58f31600949aa2abb2936f9f98808d1d5a8a29b9679
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 125bc598a87fe1754606e7ab1e190b80f60d80ebe430c7832153e46e0d4a10e632a2a38984fa7dac11ce0f04006cf112351a7805c17fd9015b43b759e396e88b
|
7
|
+
data.tar.gz: 4dd7ebf420e0b29d2bc300f81fcc6a2ea9dc7402b8774d65edc59d17f0940790f724b346437297752cad7e12b9789e38c80e0d0f27965d630957108239d409a9
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
### master
|
4
|
+
|
5
|
+
* nothing yet
|
6
|
+
|
7
|
+
### 3.0.0 - 2018/01/06
|
8
|
+
|
9
|
+
* features
|
10
|
+
* streamlined `App` model
|
11
|
+
* parameter based apps
|
12
|
+
|
13
|
+
### 2.1.4 - 2018/01/06
|
14
|
+
|
15
|
+
* enhancements
|
16
|
+
* cleaning up gem files
|
17
|
+
|
18
|
+
### 2.1.3 - 2018/01/02
|
19
|
+
|
20
|
+
* enhancements
|
21
|
+
* automatically include helper in controllers
|
22
|
+
* bugfixes
|
23
|
+
* fixed overriding `set_nativegap_user` method
|
24
|
+
|
25
|
+
### 2.1.2 - 2018/01/02
|
26
|
+
|
27
|
+
* bugfixes
|
28
|
+
* fixed overriding `set_nativegap_user` method
|
29
|
+
|
30
|
+
### 2.1.1 - 2017/12/28
|
31
|
+
|
32
|
+
* bugfixes
|
33
|
+
* fixed `uses_native_apps` method
|
34
|
+
|
35
|
+
### 2.1.0 - 2017/12/28
|
36
|
+
|
37
|
+
* features
|
38
|
+
* introduced `uses_native_apps` method to ActiveRecord models
|
39
|
+
* bugfixes
|
40
|
+
* fixed assets precompilation for native platforms
|
41
|
+
|
42
|
+
### 2.0.1 - 2017/12/21
|
43
|
+
|
44
|
+
* bugfixes
|
45
|
+
* fixed `undefined method 'set_device_owner' for ApplicationController:Class`
|
46
|
+
|
47
|
+
### 2.0.0 - 2017/12/21
|
48
|
+
|
49
|
+
* features
|
50
|
+
* made Devise optional
|
51
|
+
* added `owner` association to `App` model
|
52
|
+
|
53
|
+
### 1.0.0 - 2017/12/20
|
54
|
+
|
55
|
+
* initial release
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Jonas Hübotter
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,247 @@
|
|
1
|
+
# NativeGap on Rails
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/nativegap) <img src="https://travis-ci.org/NativeGap/nativegap-rails.svg?branch=master" />
|
4
|
+
|
5
|
+
Build native apps for all major platforms with NativeGap.
|
6
|
+
|
7
|
+
#### Platforms
|
8
|
+
|
9
|
+
* Android
|
10
|
+
* iOS
|
11
|
+
* Universal Windows Platform (Windows 10)
|
12
|
+
* Chrome (Extension)
|
13
|
+
|
14
|
+
#### How it works ...
|
15
|
+
|
16
|
+
1. Create and customize your apps from the [NativeGap dashboard](https://nativegap.com).
|
17
|
+
2. Add [NativeGap.js](https://github.com/NativeGap/nativegap.js) to your app in order to track currently used apps and to add some custom styling.
|
18
|
+
3. Use this gem to track app usage for your users and to add platform specific assets.
|
19
|
+
|
20
|
+
---
|
21
|
+
|
22
|
+
## Table of Contents
|
23
|
+
|
24
|
+
* [Installation](#installation)
|
25
|
+
* [Usage](#usage)
|
26
|
+
* [Setup](#setup)
|
27
|
+
* [Assets](#assets)
|
28
|
+
* [User associations](#user-associations)
|
29
|
+
* [Apps](#apps)
|
30
|
+
* [Methods](#methods)
|
31
|
+
* [Helpers](#helpers)
|
32
|
+
* [Notifications](#notifications)
|
33
|
+
* [Configuration](#configuration)
|
34
|
+
* [To Do](#to-do)
|
35
|
+
* [Contributing](#contributing)
|
36
|
+
* [Contributors](#contributors)
|
37
|
+
* [Semantic versioning](#semantic-versioning)
|
38
|
+
* [License](#license)
|
39
|
+
|
40
|
+
---
|
41
|
+
|
42
|
+
## Installation
|
43
|
+
|
44
|
+
NativeGap on Rails works with Rails 5 onwards. You can add it to your `Gemfile` with:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
gem 'nativegap'
|
48
|
+
```
|
49
|
+
|
50
|
+
And then execute:
|
51
|
+
|
52
|
+
$ bundle
|
53
|
+
|
54
|
+
Or install it yourself as:
|
55
|
+
|
56
|
+
$ gem install nativegap
|
57
|
+
|
58
|
+
If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
gem 'nativegap', github: 'NativeGap/nativegap-rails'
|
62
|
+
```
|
63
|
+
|
64
|
+
Now run the generator:
|
65
|
+
|
66
|
+
$ rails g nativegap
|
67
|
+
|
68
|
+
To wrap things up, migrate the changes into your database:
|
69
|
+
|
70
|
+
$ rails db:migrate
|
71
|
+
|
72
|
+
Make also sure to add the following to your app config (`config/application.rb`):
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
config.action_dispatch.default_headers = {
|
76
|
+
'X-Frame-Options' => 'ALLOWALL'
|
77
|
+
}
|
78
|
+
```
|
79
|
+
|
80
|
+
## Usage
|
81
|
+
|
82
|
+
### Setup
|
83
|
+
|
84
|
+
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).
|
85
|
+
|
86
|
+
Getting started with NativeGap:
|
87
|
+
|
88
|
+
1. Create a new NativeGap app.
|
89
|
+
2. Wait until the platforms processed successfully.
|
90
|
+
|
91
|
+
That's it!
|
92
|
+
|
93
|
+
**Note:** Native also supports the coexistence of multiple NativeGap apps with only one Rails app as a source.
|
94
|
+
|
95
|
+
### Assets
|
96
|
+
|
97
|
+
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/.../nativegap`). In these two folders you are able to add custom assets for specific platforms including `web` specific assets.
|
98
|
+
|
99
|
+
You simple have to add ...
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
= component 'nativegap/assets'
|
103
|
+
```
|
104
|
+
|
105
|
+
... to the `head` tag of your layout after your other asset include tags.
|
106
|
+
|
107
|
+
### User associations
|
108
|
+
|
109
|
+
Define an association in models whose objects are supposed to be associated with NativeGap apps. For example `Admin` in `app/models/admin.rb`.
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
class Admin < ApplicationRecord
|
113
|
+
nativegap
|
114
|
+
end
|
115
|
+
```
|
116
|
+
|
117
|
+
Next attach an admin record by defining a `set_nativegap_user` method. Let's say our model is named `Admin` and `current_admin` is available at controller level. Just add a method to your `ApplicationController`:
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
def set_nativegap_user
|
121
|
+
current_admin if current_admin
|
122
|
+
end
|
123
|
+
```
|
124
|
+
|
125
|
+
**Note:** If a `current_user` method is available at controller level this method is not required.
|
126
|
+
|
127
|
+
You are now able to get NativeGap apps for a specific user:
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
a = Admin.first
|
131
|
+
|
132
|
+
# All app records of a user
|
133
|
+
a.nativegap_apps
|
134
|
+
```
|
135
|
+
|
136
|
+
### Apps
|
137
|
+
|
138
|
+
Native introduces an `App` ActiveRecord model. Every object of an associated user class can have multiple apps.
|
139
|
+
|
140
|
+
#### Methods
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
a = App.first
|
144
|
+
|
145
|
+
# Returns associated object. Can return `nil`.
|
146
|
+
a.owner
|
147
|
+
|
148
|
+
# Returns lowercase string of platform.
|
149
|
+
d.platform
|
150
|
+
|
151
|
+
# Returns the apps start url. This can be used to differentiate between apps, if you have multiple NativeGap apps with one Rails app as source.
|
152
|
+
d.url
|
153
|
+
|
154
|
+
# Some timestamps
|
155
|
+
d.last_used
|
156
|
+
d.created_at
|
157
|
+
d.updated_at
|
158
|
+
|
159
|
+
|
160
|
+
# Returns ActiveRecord array of apps from a specific platform
|
161
|
+
d.android
|
162
|
+
d.ios
|
163
|
+
d.windows
|
164
|
+
d.chrome
|
165
|
+
|
166
|
+
# Group apps by `platform`
|
167
|
+
d.platforms
|
168
|
+
|
169
|
+
# Group apps by `url`
|
170
|
+
d.apps
|
171
|
+
```
|
172
|
+
|
173
|
+
#### Helpers
|
174
|
+
|
175
|
+
NativeGap on Rails adds some helpers which are available in your controllers and views:
|
176
|
+
|
177
|
+
* `current_app` `App` record related to current session. Returns `nil` when the Rails app is being used normally.
|
178
|
+
|
179
|
+
* `current_platform` Lowercase string of current platform. Returns `'web'` when the Rails app is being used normally.
|
180
|
+
|
181
|
+
### Notifications
|
182
|
+
|
183
|
+
You can enable native notifications on most platforms. To handle notifications NativeGem integrates with [OneSignal](https://onesignal.com). You could use the [NotificationsRails](https://github.com/jonhue/notifications-rails) gem and 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. [OnSignal](https://github.com/jonhue/onsignal) assists you with managing OneSignal along with a user authentication system.
|
184
|
+
|
185
|
+
---
|
186
|
+
|
187
|
+
## Configuration
|
188
|
+
|
189
|
+
You can configure NativeGap on Rails by passing a block to `configure`. This can be done in `config/initializers/nativegap.rb`:
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
NativeGap.configure do |config|
|
193
|
+
config.android = true
|
194
|
+
end
|
195
|
+
```
|
196
|
+
|
197
|
+
* `#{platform}` Set to `false` to disable the platform. Takes a boolean. Defaults to `true`.
|
198
|
+
|
199
|
+
---
|
200
|
+
|
201
|
+
## To Do
|
202
|
+
|
203
|
+
[Here](https://github.com/NativeGap/nativegap-rails/projects/1) is the full list of current projects.
|
204
|
+
|
205
|
+
To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/NativeGap/nativegap-rails/issues/new).
|
206
|
+
|
207
|
+
---
|
208
|
+
|
209
|
+
## Contributing
|
210
|
+
|
211
|
+
We hope that you will consider contributing to NativeGap on Rails. Please read this short overview for some information about how to get started:
|
212
|
+
|
213
|
+
[Learn more about contributing to this repository](CONTRIBUTING.md), [Code of Conduct](CODE_OF_CONDUCT.md)
|
214
|
+
|
215
|
+
### Contributors
|
216
|
+
|
217
|
+
Give the people some :heart: who are working on this project. See them all at:
|
218
|
+
|
219
|
+
https://github.com/NativeGap/nativegap-rails/graphs/contributors
|
220
|
+
|
221
|
+
### Semantic Versioning
|
222
|
+
|
223
|
+
NativeGap on Rails follows Semantic Versioning 2.0 as defined at http://semver.org.
|
224
|
+
|
225
|
+
## License
|
226
|
+
|
227
|
+
MIT License
|
228
|
+
|
229
|
+
Copyright (c) 2017 Jonas Hübotter
|
230
|
+
|
231
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
232
|
+
of this software and associated documentation files (the "Software"), to deal
|
233
|
+
in the Software without restriction, including without limitation the rights
|
234
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
235
|
+
copies of the Software, and to permit persons to whom the Software is
|
236
|
+
furnished to do so, subject to the following conditions:
|
237
|
+
|
238
|
+
The above copyright notice and this permission notice shall be included in all
|
239
|
+
copies or substantial portions of the Software.
|
240
|
+
|
241
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
242
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
243
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
244
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
245
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
246
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
247
|
+
SOFTWARE.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module NativeGapController
|
2
|
+
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_action :set_nativegap
|
7
|
+
end
|
8
|
+
|
9
|
+
def set_nativegap_user
|
10
|
+
current_user if current_user
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def set_nativegap
|
16
|
+
platform = params[:nativegap]
|
17
|
+
if platform && NativeGap.configuration.send(platform)
|
18
|
+
id = cookies[:nativegapAppId]
|
19
|
+
url = request.original_url.split('?').first
|
20
|
+
@app = NativeGap::App.find_by(id: id, platform: platform, url: url) if id && NativeGap::App.where(id: id, platform: platform, url: url).any?
|
21
|
+
|
22
|
+
if @app.nil?
|
23
|
+
@app = NativeGap::App.new
|
24
|
+
@app.platform = platform
|
25
|
+
@app.url = url
|
26
|
+
end
|
27
|
+
@app.owner = set_nativegap_user
|
28
|
+
@app.last_used = Time.now
|
29
|
+
@app.save!
|
30
|
+
|
31
|
+
cookies[:nativegapAppId] = @app.id
|
32
|
+
cookies[:nativegapApp] = url
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module NativeHelper
|
2
|
+
|
3
|
+
def current_app
|
4
|
+
NativeGap::App.find(cookies[:nativegapAppId]) if cookies[:nativegapAppId]
|
5
|
+
end
|
6
|
+
|
7
|
+
def current_platform
|
8
|
+
current_app&.platform || 'web'
|
9
|
+
end
|
10
|
+
|
11
|
+
def set_nativegap_user
|
12
|
+
current_user if current_user
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class NativeGap::AppLibrary < ApplicationRecord
|
2
|
+
|
3
|
+
self.table_name = 'native_gap_apps'
|
4
|
+
|
5
|
+
belongs_to :owner, polymorphic: true, optional: true
|
6
|
+
|
7
|
+
scope :android, -> { where(platform: 'android') }
|
8
|
+
scope :ios, -> { where(platform: 'ios') }
|
9
|
+
scope :windows, -> { where(platform: 'windows') }
|
10
|
+
scope :chrome, -> { where(platform: 'chrome') }
|
11
|
+
scope :platforms, -> { group_by(&:platform) }
|
12
|
+
scope :apps, -> { group_by(&:url) }
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class NativegapGenerator < Rails::Generators::Base
|
5
|
+
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
source_root File.join File.dirname(__FILE__), 'templates'
|
9
|
+
desc 'Install NativeGap'
|
10
|
+
|
11
|
+
def self.next_migration_number dirname
|
12
|
+
if ActiveRecord::Base.timestamped_migrations
|
13
|
+
Time.now.utc.strftime '%Y%m%d%H%M%S'
|
14
|
+
else
|
15
|
+
"%.3d" % ( current_migration_number(dirname) + 1 )
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_initializer
|
20
|
+
template 'initializer.rb', 'config/initializers/nativegap.rb'
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_app_model
|
24
|
+
migration_template 'apps_migration.rb.erb', 'db/migrate/nativegap_migration.rb', migration_version: migration_version
|
25
|
+
template 'app_model.rb', 'app/models/native_gap/app.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_assets
|
29
|
+
create_assets_for 'android'
|
30
|
+
create_assets_for 'ios'
|
31
|
+
create_assets_for 'windows'
|
32
|
+
create_assets_for 'chrome'
|
33
|
+
create_assets_for 'web'
|
34
|
+
end
|
35
|
+
|
36
|
+
def show_readme
|
37
|
+
readme 'README.md'
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def migration_version
|
43
|
+
if Rails.version >= '5.0.0'
|
44
|
+
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_assets_for platform
|
49
|
+
@platform = platform
|
50
|
+
template 'application.css.erb', "app/assets/stylesheets/nativegap/#{platform}.css"
|
51
|
+
template 'keep-file', "app/assets/stylesheets/nativegap/#{platform}/.keep"
|
52
|
+
template 'application.js.erb', "app/assets/javascripts/nativegap/#{platform}.js"
|
53
|
+
template 'keep-file', "app/assets/javascripts/nativegap/#{platform}/.keep"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Now run `rails db:migrate` to add NativeGap to your database.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class NativegapMigration < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
create_table :native_gap_apps do |t|
|
4
|
+
|
5
|
+
t.references :owner, polymorphic: true, index: true
|
6
|
+
|
7
|
+
t.string :platform, index: true
|
8
|
+
t.string :url, index: true
|
9
|
+
|
10
|
+
t.datetime :last_used
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
NativeGap.configure do |config|
|
2
|
+
|
3
|
+
# Specify platforms your app supports.
|
4
|
+
# config.android = true
|
5
|
+
# config.ios = true
|
6
|
+
# config.windows = true
|
7
|
+
# config.chrome = true
|
8
|
+
|
9
|
+
# Specify a stringified url helper to set a start url for each platform.
|
10
|
+
# config.android_url = 'root_url'
|
11
|
+
# config.ios_url = 'root_url'
|
12
|
+
# config.windows_url = 'root_url'
|
13
|
+
# config.chrome_url = 'root_url'
|
14
|
+
|
15
|
+
end
|
File without changes
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module NativeGap
|
2
|
+
|
3
|
+
class << self
|
4
|
+
attr_accessor :configuration
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.configure
|
8
|
+
self.configuration ||= Configuration.new
|
9
|
+
yield configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
class Configuration
|
13
|
+
|
14
|
+
attr_accessor :android
|
15
|
+
attr_accessor :ios
|
16
|
+
attr_accessor :windows
|
17
|
+
attr_accessor :chrome
|
18
|
+
attr_accessor :android_url
|
19
|
+
attr_accessor :ios_url
|
20
|
+
attr_accessor :windows_url
|
21
|
+
attr_accessor :chrome_url
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@android = true
|
25
|
+
@ios = true
|
26
|
+
@windows = true
|
27
|
+
@chrome = true
|
28
|
+
@android_url = 'root_url'
|
29
|
+
@ios_url = 'root_url'
|
30
|
+
@windows_url = 'root_url'
|
31
|
+
@chrome_url = 'root_url'
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails/railtie'
|
2
|
+
|
3
|
+
module NativeGap
|
4
|
+
class Railtie < Rails::Railtie
|
5
|
+
|
6
|
+
initializer 'nativegap.mozaic' do
|
7
|
+
Mozaic.configure do |config|
|
8
|
+
config.define_component 'nativegap/assets'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
initializer 'nativegap.active_record' do
|
13
|
+
ActiveSupport.on_load :active_record do
|
14
|
+
include NativeGapModel
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
initializer 'nativegap.action_controller' do
|
19
|
+
ActiveSupport.on_load :action_controller do
|
20
|
+
include NativeGapHelper
|
21
|
+
include NativeGapController
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
initializer 'nativegap.sprockets-rails' do
|
26
|
+
Rails.application.config.assets.precompile += %w( nativegap/android.js nativegap/ios.js nativegap/windows.js nativegap/chrome.js nativegap/web.js nativegap/android.css nativegap/ios.css nativegap/windows.css nativegap/chrome.css nativegap/web.css )
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
data/lib/nativegap.rb
ADDED
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nativegap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonas Hübotter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mozaic
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.52'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.52'
|
69
|
+
description: Build native apps for all major platforms from your Rails applications.
|
70
|
+
email: me@jonhue.me
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- CHANGELOG.md
|
76
|
+
- LICENSE
|
77
|
+
- README.md
|
78
|
+
- app/controllers/concerns/native_gap_controller.rb
|
79
|
+
- app/helpers/native_helper.rb
|
80
|
+
- app/models/concerns/native_model.rb
|
81
|
+
- app/models/native_gap/app_library.rb
|
82
|
+
- app/views/mozaic/nativegap/_assets.html.erb
|
83
|
+
- lib/generators/nativegap_generator.rb
|
84
|
+
- lib/generators/templates/README.md
|
85
|
+
- lib/generators/templates/app_model.rb
|
86
|
+
- lib/generators/templates/application.css.erb
|
87
|
+
- lib/generators/templates/application.js.erb
|
88
|
+
- lib/generators/templates/apps_migration.rb.erb
|
89
|
+
- lib/generators/templates/initializer.rb
|
90
|
+
- lib/generators/templates/keep-file
|
91
|
+
- lib/native_gap/configuration.rb
|
92
|
+
- lib/native_gap/engine.rb
|
93
|
+
- lib/native_gap/railtie.rb
|
94
|
+
- lib/native_gap/version.rb
|
95
|
+
- lib/nativegap.rb
|
96
|
+
homepage: https://github.com/NativeGap/nativegap-rails
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '2.3'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.7.4
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: Build native apps for all major platforms from your Rails applications
|
120
|
+
test_files: []
|