xqcoretools 0.1.9 → 0.2.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.
Files changed (2) hide show
  1. data/bin/xqcoretools +34 -22
  2. metadata +2 -2
data/bin/xqcoretools CHANGED
@@ -119,45 +119,57 @@ class XQCoreTools < Thor
119
119
 
120
120
  XQCoreTools::modifyHostEvents(platform, document)
121
121
 
122
- nodes = document.css('script')
122
+ nodes = document.css('script,link')
123
123
 
124
124
  isDirty = false
125
125
 
126
126
  for node in nodes do
127
- if node.has_attribute?('type') && node.get_attribute('type') == 'text/javascript'
128
- if node.has_attribute?('src')
129
- srcComponents = node.get_attribute('src').scan(/library\.xqcore.com\/local\/debug\/([^\/]+)\/xqcore.js/)
130
- if srcComponents.length > 0
131
- scriptVersion = srcComponents[0][0]
127
+ attribute = nil
132
128
 
133
- includeFolder = 'inc'
129
+ if node.has_attribute?('src')
130
+ attribute = node.get_attribute('src')
131
+ elsif node.has_attribute?('href')
132
+ attribute = node.get_attribute('href')
133
+ end
134
+
135
+ if attribute != nil
136
+ srcComponents = attribute.scan(/library\.xqcore.com\/local\/debug\/([^\/]+)\/([^\/]+)\.(\w+)/)
137
+ if srcComponents.length > 0
138
+ scriptVersion = srcComponents[0][0]
139
+ scriptName = srcComponents[0][1]
140
+ scriptExtension = srcComponents[0][2]
141
+
142
+ includeFolder = 'inc'
134
143
 
135
- runtimeFile = "xqcore-web-#{platform.downcase}.js"
136
- runtimeFolder = "#{includeFolder}/#{runtimeFile}"
137
- runtimePath = "#{path}/#{runtimeFolder}"
144
+ runtimeFile = "#{scriptName}.#{scriptExtension}"
145
+ runtimeFolder = "#{includeFolder}/#{runtimeFile}"
146
+ runtimePath = "#{path}/#{runtimeFolder}"
138
147
 
139
- url = "#{scriptVersion}/#{runtimeFile}"
148
+ url = "local/#{platform.downcase}/#{scriptVersion}/#{runtimeFile}"
140
149
 
141
- if runtimePath == 'latest'
142
- downloadCache.cacheFile(url)
143
- end
150
+ if runtimePath == 'latest'
151
+ downloadCache.cacheFile(url)
152
+ end
144
153
 
145
- downloadCache.saveFile(url, runtimePath)
154
+ downloadCache.saveFile(url, runtimePath)
146
155
 
147
- node.set_attribute('src', runtimeFolder)
156
+ node.set_attribute('src', runtimeFolder)
148
157
 
158
+ if scriptName == 'xqcore' && scriptExtension == 'js'
149
159
  XQCoreTools::compileTemplates(platform, subPath, document, scriptVersion, downloadCache, node)
160
+ end
150
161
 
151
- isDirty = true
152
- end
153
- else
162
+ isDirty = true
163
+ end
164
+ else
165
+ if node.has_attribute?('type') && node.get_attribute('type') == 'text/javascript'
154
166
  if platform != "Windows"
155
167
  node.content = node.content.gsub(/\.click\(/, ".on('touchstart', ")
156
168
 
157
169
  isDirty = true
158
170
  end
159
171
  end
160
- end
172
+ end
161
173
  end
162
174
 
163
175
  if isDirty
@@ -178,7 +190,7 @@ class XQCoreTools < Thor
178
190
  script = ''
179
191
 
180
192
  compilerFile = "compiler.js"
181
- compilerPath = downloadCache.cacheFile("#{version}/#{compilerFile}")
193
+ compilerPath = downloadCache.cacheFile("local/#{platform.downcase}/#{version}/#{compilerFile}")
182
194
 
183
195
  compilerFileHandle = File.open(compilerPath)
184
196
  compilerSource = compilerFileHandle.read
@@ -404,7 +416,7 @@ class XQCoreToolsDownloadCache
404
416
  def downloadFile(url, file)
405
417
  http = Net::HTTP.start(@host)
406
418
  response = http.get("/#{url}")
407
-
419
+
408
420
  fileHandle = File.open(file, 'w')
409
421
  fileHandle.write(response.body)
410
422
  fileHandle.close
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xqcoretools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-24 00:00:00.000000000 Z
12
+ date: 2013-07-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Tools for synchronizing multiple CSharp projects and deploying to several
15
15
  platform