zotplus-rakehelper 0.0.20 → 0.0.21
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/zotplus-rakehelper/version.rb +1 -1
- data/lib/zotplus-rakehelper.rb +26 -22
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9018e1b04f6785a9e54215caf07b67139765762
|
4
|
+
data.tar.gz: 72d02f9d27a8f4e067f57a2f76ed20cf8d75de7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba12a941efa820a97a729dca4f9688ccba708ad84c3df19c747b946d299d40953b5d902b78da50f3c76ef5f8398ce8f08c0ec2552c69a54fd5ac9ddc6da4468b
|
7
|
+
data.tar.gz: 080af61cb4336cff7cdd761f7fbc4ebf16057ebfef971994d0e92d7cda9d9810040cacb23a2612d3dff5dc92f038e309a383ed86c478c207c84661640edb8a28
|
data/Gemfile.lock
CHANGED
data/lib/zotplus-rakehelper.rb
CHANGED
@@ -49,7 +49,7 @@ task :debugbridge do
|
|
49
49
|
update = Nokogiri::XML(geturl('http://zotplus.github.io/debug-bridge/update.rdf')).at('//em:updateLink').inner_text
|
50
50
|
debug_bridge = Dir['tmp/zotero-debug-bridge-*.xpi']
|
51
51
|
debug_bridge.each{|f| File.unlink(f)} if debug_bridge.size != 1 || update.sub(/.*\//, '') != File.basename(debug_bridge[0])
|
52
|
-
download(update, "tmp/#{update.sub(/.*\//, '')}") unless File.file?("tmp/#{update.sub(/.*\//, '')}")
|
52
|
+
ZotPlus::RakeHelper.download(update, "tmp/#{update.sub(/.*\//, '')}") unless File.file?("tmp/#{update.sub(/.*\//, '')}")
|
53
53
|
end
|
54
54
|
|
55
55
|
task XPI => SOURCES + ['install/rdf'] do
|
@@ -60,7 +60,7 @@ task XPI => SOURCES + ['install/rdf'] do
|
|
60
60
|
if file.is_a?(Hash)
|
61
61
|
file.each_pair{|name, contents|
|
62
62
|
zipfile.get_output_stream(name){|f|
|
63
|
-
f.write(contents)
|
63
|
+
f.write(contents.to_s)
|
64
64
|
}
|
65
65
|
}
|
66
66
|
else
|
@@ -103,25 +103,29 @@ task :publish => XPI do
|
|
103
103
|
system "cd www; rake publish"
|
104
104
|
end
|
105
105
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
106
|
+
module ZotPlus
|
107
|
+
class RakeHelper
|
108
|
+
def self.geturl(url)
|
109
|
+
response = Typhoeus.get(url, {followlocation: true})
|
110
|
+
raise "Request failed" unless response.success?
|
111
|
+
return response.body
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.download(url, file)
|
115
|
+
puts "Downloading #{url} to #{file}"
|
116
|
+
target = File.open(file, 'wb')
|
117
|
+
request = Typhoeus::Request.new(url, {followlocation: true})
|
118
|
+
request.on_headers do |response|
|
119
|
+
raise "Request failed: #{response.code.to_s}" unless response.code == 200 # response.success?
|
120
|
+
end
|
121
|
+
request.on_body do |chunk|
|
122
|
+
target.write(chunk)
|
123
|
+
end
|
124
|
+
request.on_complete do |response|
|
125
|
+
target.close
|
126
|
+
throw "download failed" unless response.success?
|
127
|
+
end
|
128
|
+
request.run
|
129
|
+
end
|
125
130
|
end
|
126
|
-
request.run
|
127
131
|
end
|