phonegap-rails 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDUwMTYyNTUwMmJiMzM5OWQwNmU4NzBiMWEwNzM4YWFlMTNmNDExZg==
4
+ YjJiNzQ1MjBlNGZhZmEwNTIyY2E2MjJjNWJkYTdlODRlNTNkYTdlZA==
5
5
  data.tar.gz: !binary |-
6
- YTM4YTM0M2FhNzcxYjA5OGY5NTA4ZGNiYjAwMWRlOTViNTFhMDcwOA==
6
+ M2E1ZjliMjViYTA4NGQ5MmQzNTY5N2RlYjkyMGY5ZGUyYTZiY2EyZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZWI3NjYzZmM0Mjg5YzE2ODc1YTU3YjYyODVhOGJlNGI0YWY2NDNlOWRiMDhj
10
- NWNiNDQwMmY3YWQzYmVhYTUwZmRmZWI1YTUyM2JmMjRjMGQzZDM0OGRlNGY2
11
- NTM3ZTc4OTFkY2ZjODZiZTU0MzU0MzczMDBiNThjNzFmYWU4MjQ=
9
+ ZmI1NzkzMjdiM2Y2NzRhN2I5NGUwYzk4ODgwM2UyOTQ1ZGVjOGQ4ZWEwNTJh
10
+ ODQ4OWJjMDI5MTU1ODJjMTUxMzZjYzY0N2Q3N2RlYTQ3ODg5MDY4NDk1ZTQ3
11
+ MjZhMTU3ZGQ4MzUyZTU3OTZlYjlkMmMwODk1OTA5ZTg4YTU0Y2M=
12
12
  data.tar.gz: !binary |-
13
- Y2MzM2Y5ZWE4MzZmYTFmNGI3ZjJjMzM2MDhhZDRlMGIzMDlkZjJiNDMzYmVk
14
- YzUyNTU4ODA2YmFhMzY1ODQxY2UyOWFlOWM1ZTdmNjQ2ZDRhYmUwMzgwNzQy
15
- MjQwYmVkOGYwM2VmMThjYWMzYzUzZGQ4Yjc2MGZiZTZmMzNlYzU=
13
+ MzJkNTNkMGVmYTNhZWZlMGM5MjI2ODlhNmI4YzhiOWRiOTZhYTVjZGRkYTc3
14
+ ZDRhMTEzZTA4YzFmYTk1NzhlNjJiMzYxNTA0MTQ3MGM3Yzk3YzEwYjY3YTA3
15
+ Y2M4NGU1ODBkZWY2OWRhYjdhZjE0NWEwMzUwYjRjNWMxZDczNWM=
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Phonegap::Rails
2
+ [![Dependency Status](https://gemnasium.com/joscas/phonegap-rails.png)](https://gemnasium.com/joscas/phonegap-rails)
2
3
 
3
4
  This gem provides generators for the Phonegap APIs. It is intended to be used within the scope of single page web applications that have a Ruby on Rails API backend. For example, Ember.js / Rails apps.
4
5
 
@@ -1,7 +1,8 @@
1
1
  ##
2
2
  ## general settings
3
3
  ##
4
- # phonegap_path: '~/Development/phonegap-2.6.0'
4
+ #phonegap_path: '~/Development/phonegap-2.6.0'
5
+ #api_server: 'http://example.com'
5
6
  #
6
7
  ## android settings
7
8
  #android:
@@ -3,8 +3,6 @@ namespace :phonegap do
3
3
  config_path = File.join(Rails.root, 'config', 'phonegap_rails.yml')
4
4
  if File.exist?(config_path)
5
5
  config_file = File.read(config_path)
6
- #end
7
- #unless config_file.nil?
8
6
  config = YAML.load(config_file)
9
7
  unless config.nil?
10
8
  unless config['phonegap_path'].nil?
@@ -16,6 +14,7 @@ namespace :phonegap do
16
14
  unless config['android'].nil?
17
15
  package = config['android']["package"] unless config['android']["package"].nil?
18
16
  end
17
+ api_server = config['api_server'] unless config['api_server'].nil?
19
18
  end
20
19
  end
21
20
 
@@ -47,14 +46,43 @@ namespace :phonegap do
47
46
  file = File.open("#{project_path}/assets/www/css/application.css", "w")
48
47
  file.write environment['application.css']
49
48
  file.close
50
- puts '* images'
51
- FileUtils.cp_r "app/assets/images/.", "#{project_path}/assets/www/img"
49
+ puts '* other assets (images and fonts)'
50
+ FileUtils.mkdir_p "#{project_path}/assets/www/assets"
51
+ other_paths = Rails.configuration.assets.paths.select {|x| x =~ /\/fonts$|\/images$/}
52
+ other_paths.each do |path|
53
+ files = Dir.glob("#{path}/**/*.*")
54
+ files.each do |file|
55
+ FileUtils.cp file, "#{project_path}/assets/www/assets"
56
+ end
57
+ end
58
+ puts '* public folder'
59
+ FileUtils.cp_r 'public/.', "#{project_path}/assets/www/"
52
60
  puts '* index.html'
53
61
  @app_title = main_activity
54
62
  public_source = File.expand_path('../../../../public', __FILE__)
55
63
  file = File.open("#{project_path}/assets/www/index.html", "w")
56
64
  file.write ERB.new(File.read("#{public_source}/android_index.html.erb")).result
57
65
  file.close
66
+
67
+ puts '* fix relative paths'
68
+ css_file_path = "#{project_path}/assets/www/css/application.css"
69
+ css_file = File.read(css_file_path)
70
+ new_css_file = css_file.gsub(/\/assets/, '../assets')
71
+ file = File.open(css_file_path, "w")
72
+ file.puts new_css_file
73
+ file.close
74
+ js_file_path = "#{project_path}/assets/www/js/application.js"
75
+ js_file = File.read(js_file_path)
76
+ new_js_file = js_file.gsub(/src=\\"\//, 'src=\"')
77
+ if api_server.blank?
78
+ puts "Warning: No API server is specified for this app"
79
+ else
80
+ new_js_file = new_js_file.gsub(/href=\\"\//, 'href=\"'+api_server+'/')
81
+ end
82
+ file = File.open(js_file_path, "w")
83
+ file.puts new_js_file
84
+ file.close
85
+
58
86
  end
59
87
  desc 'build android phonegap project'
60
88
  task :build => :environment do
@@ -1,5 +1,5 @@
1
1
  module Phonegap
2
2
  module Rails
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -21,7 +21,7 @@
21
21
  <head>
22
22
  <meta charset="utf-8" />
23
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" />
24
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
25
25
  <link rel="stylesheet" type="text/css" href="css/application.css" />
26
26
  <title><%=@app_title%></title>
27
27
  </head>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonegap-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Casals
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-22 00:00:00.000000000 Z
11
+ date: 2013-04-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Export a rails single page app as a Phonegap project
14
14
  email: