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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd52cab755d59a43b6d31919d6b6038ce0835a7b
4
- data.tar.gz: eaff50ffae0a3d17b7726c36a60fbdfc6fba47d6
3
+ metadata.gz: b9018e1b04f6785a9e54215caf07b67139765762
4
+ data.tar.gz: 72d02f9d27a8f4e067f57a2f76ed20cf8d75de7b
5
5
  SHA512:
6
- metadata.gz: 4e3faea1ca53864eb3eb837ed3ff9f817fa1f54312eaa07f02ff9bb71a033ffee5644770f42789aff7ca76b3358d997beaac80d79b24102124e6b62b76d2cc28
7
- data.tar.gz: 6a9dbe23e4ce4593c989b0c514bd80779c3b79a5513d53388228eb672a0d240bb4fc2449a4ac818a1151d4fbaa68c246ecef5dd3ab0a6ccbe7cd115bec96dcdc
6
+ metadata.gz: ba12a941efa820a97a729dca4f9688ccba708ad84c3df19c747b946d299d40953b5d902b78da50f3c76ef5f8398ce8f08c0ec2552c69a54fd5ac9ddc6da4468b
7
+ data.tar.gz: 080af61cb4336cff7cdd761f7fbc4ebf16057ebfef971994d0e92d7cda9d9810040cacb23a2612d3dff5dc92f038e309a383ed86c478c207c84661640edb8a28
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zotplus-rakehelper (0.0.20)
4
+ zotplus-rakehelper (0.0.21)
5
5
  nokogiri
6
6
  rake
7
7
  rubyzip (>= 1.0.0)
@@ -1,5 +1,5 @@
1
1
  module ZotPlus
2
2
  class RakeHelper
3
- VERSION = "0.0.20"
3
+ VERSION = "0.0.21"
4
4
  end
5
5
  end
@@ -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
- def geturl(url)
107
- response = Typhoeus.get(url, {followlocation: true})
108
- raise "Request failed" unless response.success?
109
- return response.body
110
- end
111
-
112
- def download(url, file)
113
- puts "Downloading #{url} to #{file}"
114
- target = File.open(file, 'wb')
115
- request = Typhoeus::Request.new(url, {followlocation: true})
116
- request.on_headers do |response|
117
- raise "Request failed: #{response.code.to_s}" unless response.code == 200 # response.success?
118
- end
119
- request.on_body do |chunk|
120
- target.write(chunk)
121
- end
122
- request.on_complete do |response|
123
- target.close
124
- throw "download failed" unless response.success?
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zotplus-rakehelper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Heyns