phonegap-rails 0.0.2.alpha → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +29 -1
- data/lib/generators/phonegap_rails/install/install_generator.rb +23 -0
- data/lib/generators/phonegap_rails/install/templates/config/phonegap_rails.yml +8 -0
- data/lib/phonegap/rails/{railtie.rb → engine.rb} +1 -1
- data/lib/phonegap/rails/tasks/rails.rake +77 -8
- data/lib/phonegap/rails/version.rb +1 -1
- data/lib/phonegap_rails.rb +1 -1
- data/lib/public/android_index.html.erb +32 -0
- data/phonegap-rails.gemspec +4 -4
- metadata +13 -44
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDUwMTYyNTUwMmJiMzM5OWQwNmU4NzBiMWEwNzM4YWFlMTNmNDExZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YTM4YTM0M2FhNzcxYjA5OGY5NTA4ZGNiYjAwMWRlOTViNTFhMDcwOA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZWI3NjYzZmM0Mjg5YzE2ODc1YTU3YjYyODVhOGJlNGI0YWY2NDNlOWRiMDhj
|
10
|
+
NWNiNDQwMmY3YWQzYmVhYTUwZmRmZWI1YTUyM2JmMjRjMGQzZDM0OGRlNGY2
|
11
|
+
NTM3ZTc4OTFkY2ZjODZiZTU0MzU0MzczMDBiNThjNzFmYWU4MjQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Y2MzM2Y5ZWE4MzZmYTFmNGI3ZjJjMzM2MDhhZDRlMGIzMDlkZjJiNDMzYmVk
|
14
|
+
YzUyNTU4ODA2YmFhMzY1ODQxY2UyOWFlOWM1ZTdmNjQ2ZDRhYmUwMzgwNzQy
|
15
|
+
MjQwYmVkOGYwM2VmMThjYWMzYzUzZGQ4Yjc2MGZiZTZmMzNlYzU=
|
data/README.md
CHANGED
@@ -18,12 +18,40 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install phonegap-rails
|
20
20
|
|
21
|
+
Initialize:
|
22
|
+
|
23
|
+
$ rails g phonegap_rails:install
|
24
|
+
|
25
|
+
Edit your config file according to your environment:
|
26
|
+
|
27
|
+
config/phonegap_rails.yml
|
28
|
+
|
21
29
|
## Usage
|
22
30
|
|
23
|
-
|
31
|
+
Create android project
|
32
|
+
|
33
|
+
$ rake phonegap:rails:android:create
|
34
|
+
|
35
|
+
Export application application assets to the android Phonegap project
|
24
36
|
|
25
37
|
$ rake phonegap:rails:android:export
|
26
38
|
|
39
|
+
Build project
|
40
|
+
|
41
|
+
$ rake phonegap:rails:android:build
|
42
|
+
|
43
|
+
Launch emulator
|
44
|
+
|
45
|
+
$ rake phonegap:rails:android:emulate
|
46
|
+
|
47
|
+
Clean
|
48
|
+
|
49
|
+
$ rake phonegap:rails:android:clean
|
50
|
+
|
51
|
+
Log
|
52
|
+
|
53
|
+
$ rake phonegap:rails:android:log
|
54
|
+
|
27
55
|
#### Requirements
|
28
56
|
- Phonegap
|
29
57
|
- Android SDK [http://developer.android.com](http://developer.android.com)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module PhonegapRails
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
desc "Create config file"
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
8
|
+
|
9
|
+
def create_config_file
|
10
|
+
copy_file "config/phonegap_rails.yml"
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_android_dir
|
14
|
+
empty_directory Rails.root.join("phonegap/android")
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_ios_dir
|
18
|
+
empty_directory Rails.root.join("phonegap/ios")
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,22 +1,91 @@
|
|
1
1
|
namespace :phonegap do
|
2
2
|
namespace :rails do
|
3
|
+
config_path = File.join(Rails.root, 'config', 'phonegap_rails.yml')
|
4
|
+
if File.exist?(config_path)
|
5
|
+
config_file = File.read(config_path)
|
6
|
+
#end
|
7
|
+
#unless config_file.nil?
|
8
|
+
config = YAML.load(config_file)
|
9
|
+
unless config.nil?
|
10
|
+
unless config['phonegap_path'].nil?
|
11
|
+
phonegap_path = config['phonegap_path']
|
12
|
+
scripts_path = phonegap_path + '/lib/android/bin'
|
13
|
+
end
|
14
|
+
main_activity = Rails.application.class.to_s.split("::").first
|
15
|
+
project_path = 'phonegap/android/' + main_activity
|
16
|
+
unless config['android'].nil?
|
17
|
+
package = config['android']["package"] unless config['android']["package"].nil?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
3
22
|
namespace :android do
|
4
|
-
desc '
|
23
|
+
desc 'create Phonegap project for android'
|
24
|
+
task :create => :environment do
|
25
|
+
if phonegap_path.blank?
|
26
|
+
puts "You have to specify phonegap path at config/phonegap_rails.yml"
|
27
|
+
abort
|
28
|
+
end
|
29
|
+
if package.blank?
|
30
|
+
puts "You have to specify an android package at config/phonegap_rails.yml"
|
31
|
+
abort
|
32
|
+
end
|
33
|
+
puts "Creating android project"
|
34
|
+
command = "#{scripts_path}/create #{project_path} #{package} #{main_activity}"
|
35
|
+
puts "creating project: #{command}"
|
36
|
+
puts `#{command}`
|
37
|
+
end
|
38
|
+
desc 'export application assets to android phonegap project'
|
5
39
|
task :export => :environment do
|
6
40
|
puts "Exporting android project"
|
7
|
-
environment =
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
41
|
+
environment = Rails.application.assets
|
42
|
+
puts '* javascript assets'
|
43
|
+
file = File.open("#{project_path}/assets/www/js/application.js", "w")
|
44
|
+
file.write environment['application.js']
|
45
|
+
file.close
|
46
|
+
puts '* css assets'
|
47
|
+
file = File.open("#{project_path}/assets/www/css/application.css", "w")
|
48
|
+
file.write environment['application.css']
|
49
|
+
file.close
|
50
|
+
puts '* images'
|
51
|
+
FileUtils.cp_r "app/assets/images/.", "#{project_path}/assets/www/img"
|
52
|
+
puts '* index.html'
|
53
|
+
@app_title = main_activity
|
54
|
+
public_source = File.expand_path('../../../../public', __FILE__)
|
55
|
+
file = File.open("#{project_path}/assets/www/index.html", "w")
|
56
|
+
file.write ERB.new(File.read("#{public_source}/android_index.html.erb")).result
|
57
|
+
file.close
|
58
|
+
end
|
59
|
+
desc 'build android phonegap project'
|
60
|
+
task :build => :environment do
|
61
|
+
command = "#{project_path}/cordova/build"
|
62
|
+
puts "Building project: #{command}"
|
63
|
+
puts `#{command}`
|
64
|
+
end
|
65
|
+
desc 'Launch emulator for android phonegap project'
|
66
|
+
task :emulate => :environment do
|
67
|
+
command = "#{project_path}/cordova/run"
|
68
|
+
puts "Launching emulator: #{command}"
|
69
|
+
puts `#{command}`
|
70
|
+
end
|
71
|
+
desc 'Clean android phonegap project'
|
72
|
+
task :clean => :environment do
|
73
|
+
command = "#{project_path}/cordova/clean"
|
74
|
+
puts "Cleaning project: #{command}"
|
75
|
+
puts `#{command}`
|
76
|
+
end
|
77
|
+
desc 'Log'
|
78
|
+
task :clean => :environment do
|
79
|
+
command = "#{project_path}/cordova/log"
|
80
|
+
puts "Log: #{command}"
|
81
|
+
puts `#{command}`
|
14
82
|
end
|
15
83
|
end
|
16
84
|
namespace :ios do
|
17
85
|
desc 'export Phonegap project for ios'
|
18
86
|
task :export => :environment do
|
19
87
|
# TODO: export project
|
88
|
+
puts "Not implemented"
|
20
89
|
end
|
21
90
|
end
|
22
91
|
end
|
data/lib/phonegap_rails.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
4
|
+
or more contributor license agreements. See the NOTICE file
|
5
|
+
distributed with this work for additional information
|
6
|
+
regarding copyright ownership. The ASF licenses this file
|
7
|
+
to you under the Apache License, Version 2.0 (the
|
8
|
+
"License"); you may not use this file except in compliance
|
9
|
+
with the License. You may obtain a copy of the License at
|
10
|
+
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
|
13
|
+
Unless required by applicable law or agreed to in writing,
|
14
|
+
software distributed under the License is distributed on an
|
15
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
+
KIND, either express or implied. See the License for the
|
17
|
+
specific language governing permissions and limitations
|
18
|
+
under the License.
|
19
|
+
-->
|
20
|
+
<html>
|
21
|
+
<head>
|
22
|
+
<meta charset="utf-8" />
|
23
|
+
<meta name="format-detection" content="telephone=no" />
|
24
|
+
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
|
25
|
+
<link rel="stylesheet" type="text/css" href="css/application.css" />
|
26
|
+
<title><%=@app_title%></title>
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" src="cordova-2.6.0.js"></script>
|
30
|
+
<script type="text/javascript" src="js/application.js"></script>
|
31
|
+
</body>
|
32
|
+
</html>
|
data/phonegap-rails.gemspec
CHANGED
@@ -10,13 +10,13 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["joscas@gmail.com"]
|
11
11
|
gem.description = %q{Export a rails single page app as a Phonegap project}
|
12
12
|
gem.summary = %q{Handle asset pipeline and generate Phonegap projects for single page web apps such as Ember-Rails apps}
|
13
|
-
gem.homepage = ""
|
13
|
+
gem.homepage = "http://rubygems.org/gems/phonegap-rails"
|
14
14
|
|
15
|
-
gem.add_development_dependency "rspec"
|
16
|
-
gem.add_dependency "sprockets"
|
15
|
+
#gem.add_development_dependency "rspec"
|
16
|
+
#gem.add_dependency "sprockets"
|
17
17
|
|
18
18
|
gem.files = `git ls-files`.split($/)
|
19
19
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
20
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
21
21
|
gem.require_paths = ["lib"]
|
22
|
-
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,48 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phonegap-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease: 6
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Josep Casals
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rspec
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: sprockets
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
11
|
+
date: 2013-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
46
13
|
description: Export a rails single page app as a Phonegap project
|
47
14
|
email:
|
48
15
|
- joscas@gmail.com
|
@@ -55,35 +22,37 @@ files:
|
|
55
22
|
- LICENSE.txt
|
56
23
|
- README.md
|
57
24
|
- Rakefile
|
25
|
+
- lib/generators/phonegap_rails/install/install_generator.rb
|
26
|
+
- lib/generators/phonegap_rails/install/templates/config/phonegap_rails.yml
|
58
27
|
- lib/phonegap-rails.rb
|
59
|
-
- lib/phonegap/rails/
|
28
|
+
- lib/phonegap/rails/engine.rb
|
60
29
|
- lib/phonegap/rails/tasks/rails.rake
|
61
30
|
- lib/phonegap/rails/version.rb
|
62
31
|
- lib/phonegap_rails.rb
|
32
|
+
- lib/public/android_index.html.erb
|
63
33
|
- phonegap-rails.gemspec
|
64
|
-
homepage:
|
34
|
+
homepage: http://rubygems.org/gems/phonegap-rails
|
65
35
|
licenses: []
|
36
|
+
metadata: {}
|
66
37
|
post_install_message:
|
67
38
|
rdoc_options: []
|
68
39
|
require_paths:
|
69
40
|
- lib
|
70
41
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
42
|
requirements:
|
73
43
|
- - ! '>='
|
74
44
|
- !ruby/object:Gem::Version
|
75
45
|
version: '0'
|
76
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
47
|
requirements:
|
79
|
-
- - ! '
|
48
|
+
- - ! '>='
|
80
49
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
50
|
+
version: '0'
|
82
51
|
requirements: []
|
83
52
|
rubyforge_project:
|
84
|
-
rubygems_version:
|
53
|
+
rubygems_version: 2.0.3
|
85
54
|
signing_key:
|
86
|
-
specification_version:
|
55
|
+
specification_version: 4
|
87
56
|
summary: Handle asset pipeline and generate Phonegap projects for single page web
|
88
57
|
apps such as Ember-Rails apps
|
89
58
|
test_files: []
|