phonegap-rails 0.0.11 → 0.0.12
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
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmQ5ZTM5NTUxNzE1YTdiODdkMjI2ZDM2Yjg3ZGQwMDE4YWIxMDQ3Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWZkMTA0ZWFhMmJlMTk3MmFjNDBmMWFhOGVhYWFmODUwZTljNGQxNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTZlOTE2MzJlYTA3ZmViYjE1YTA0Y2MwMmY0YWQzYmQzYjRiYjgyMDZiNzkw
|
10
|
+
NWI1NzI3ZTUyN2Y0YzRiNWFmZmU4YTZlZjZkODVkZjcxNzk0NThlYzNjNDUy
|
11
|
+
NTExNThjZTBhMzM3ZDFhYmM1MzdjNzZiNjhjNmJiNjIzNjdkYjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDQ2OWM5ZTM3YWUyNGRmMDZjODI5MjA1ODJkMGY5OWU3NDgxYTZkYzZiY2I0
|
14
|
+
MTNjYTI0ODNlYjMzMGI5MjM1ZDlkODRlOGUxOGYzYjdhZTdlNTA0NDcwNTEz
|
15
|
+
ZmE1M2FlZTg3YTg3MDE5MTEyNmViNGFiZjc1N2I3ZWUxZTZlNWM=
|
@@ -14,7 +14,7 @@ namespace :phonegap do
|
|
14
14
|
unless config['android'].nil?
|
15
15
|
package = config['android']["package"] unless config['android']["package"].nil?
|
16
16
|
end
|
17
|
-
api_server = config['api_server'] unless config['api_server'].nil?
|
17
|
+
@api_server = config['api_server'] unless config['api_server'].nil?
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -75,7 +75,6 @@ namespace :phonegap do
|
|
75
75
|
file.write ERB.new(File.read("#{public_source}/android_index.html.erb")).result
|
76
76
|
file.close
|
77
77
|
## Fix relative paths and configure API server
|
78
|
-
puts 'Fix relative paths'
|
79
78
|
css_file_path = "#{project_path}/assets/www/css/application.css"
|
80
79
|
css_file = File.read(css_file_path)
|
81
80
|
new_css_file = css_file.gsub(/\/assets/, '../assets')
|
@@ -85,25 +84,12 @@ namespace :phonegap do
|
|
85
84
|
js_file_path = "#{project_path}/assets/www/js/application.js"
|
86
85
|
js_file = File.read(js_file_path)
|
87
86
|
new_js_file = js_file.gsub(/src=\\"\//, 'src=\"')
|
88
|
-
if api_server.blank?
|
87
|
+
if @api_server.blank?
|
89
88
|
puts "Warning: No API server is specified for this app"
|
90
89
|
else
|
91
90
|
if new_js_file =~ /href=\\"\//
|
92
|
-
puts "Relative paths found. Making absolute to reference API: #{api_server}"
|
93
|
-
new_js_file.gsub!(/href=\\"\//, 'href=\"'
|
94
|
-
end
|
95
|
-
if new_js_file =~ /ember/
|
96
|
-
if new_js_file =~ /DS\.Store\.extend/ and (
|
97
|
-
new_js_file =~ /RESTAdapter/ or
|
98
|
-
not new_js_file =~ /DS\.Store\.extend.*\(.*\{.*adapter:.*\}.*\)/mx
|
99
|
-
)
|
100
|
-
puts "ember.js RESTAdapter found. Adding API url #{api_server} to RESTAdapter"
|
101
|
-
new_js_file << "\nDS.RESTAdapter.reopen({url: '#{api_server}'});//Added phonegap-rails"
|
102
|
-
end
|
103
|
-
if new_js_file =~ /(Auth\.Config\.reopen[^\(\{]*\([^\(\{]*\{)/mx
|
104
|
-
puts "ember-auth found. Adding API baseUrl: #{api_server}"
|
105
|
-
new_js_file.sub!(/(Auth\.Config\.reopen[^\(\{]*\([^\(\{]*\{)/mx,"#{$1}\n\tbaseUrl: '#{api_server}',//Added phonegap-rails")
|
106
|
-
end
|
91
|
+
puts "Relative paths found. Making absolute to reference API: #{@api_server}"
|
92
|
+
new_js_file.gsub!(/href=\\"\//, 'href=\"'+@api_server+'/')
|
107
93
|
end
|
108
94
|
end
|
109
95
|
file = File.open(js_file_path, "w")
|
@@ -24,6 +24,9 @@
|
|
24
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
|
+
<script>
|
28
|
+
var API_SERVER = "<%=@api_server%>"; // Comes from phonegap_rails.yml
|
29
|
+
</script>
|
27
30
|
</head>
|
28
31
|
<body>
|
29
32
|
<script type="text/javascript" src="cordova-2.6.0.js"></script>
|