zotplus-rakehelper 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/zotplus-rakehelper.rb +26 -24
- data/lib/zotplus-rakehelper/version.rb +1 -1
- 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: 16ee29247bf70af8b543a1d6182a2d9b8f52a2b7
|
4
|
+
data.tar.gz: b775d2876b3f9fe7c27b4a263766501baee93a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc61e44a411575945f32d1c9e1dcd74344cf59073ecd3a622bcd818a8d6ab5c35823294099c02c6a6be0639aea4325b433f6c66290fbed6f21fcad9cf3a37947
|
7
|
+
data.tar.gz: 8b20d22b06d5317b5bcb310316816984ddd989b6fea088e63c1a345ffb1838b358f4426e13c793673b38902a49e8b9952135ba8e38207fdc5b69c83e9b0fef1e
|
data/Gemfile.lock
CHANGED
data/lib/zotplus-rakehelper.rb
CHANGED
@@ -4,7 +4,6 @@ require 'zip'
|
|
4
4
|
require 'rake'
|
5
5
|
|
6
6
|
SOURCES ||= []
|
7
|
-
ZIPFILES ||= []
|
8
7
|
|
9
8
|
%w{chrome test/import test/export resource defaults chrome.manifest install.rdf bootstrap.js}
|
10
9
|
.collect{|f| File.directory?(f) ? Dir["#{f}/**/*"] : f}.flatten
|
@@ -18,29 +17,6 @@ EXTENSION = ID.gsub(/@.*/, '')
|
|
18
17
|
RELEASE = Nokogiri::XML(File.open('install.rdf')).at('//em:version').inner_text
|
19
18
|
XPI = "zotero-#{EXTENSION}-#{RELEASE}.xpi"
|
20
19
|
|
21
|
-
def geturl(url)
|
22
|
-
response = Typhoeus.get(url, {followlocation: true})
|
23
|
-
raise "Request failed" unless response.success?
|
24
|
-
return response.body
|
25
|
-
end
|
26
|
-
|
27
|
-
def download(url, file)
|
28
|
-
puts "Downloading #{url} to #{file}"
|
29
|
-
target = File.open(file, 'wb')
|
30
|
-
request = Typhoeus::Request.new(url, {followlocation: true})
|
31
|
-
request.on_headers do |response|
|
32
|
-
raise "Request failed: #{response.code.to_s}" unless response.code == 200 # response.success?
|
33
|
-
end
|
34
|
-
request.on_body do |chunk|
|
35
|
-
target.write(chunk)
|
36
|
-
end
|
37
|
-
request.on_complete do |response|
|
38
|
-
target.close
|
39
|
-
throw "download failed" unless response.success?
|
40
|
-
end
|
41
|
-
request.run
|
42
|
-
end
|
43
|
-
|
44
20
|
task 'README.md' => ['install.rdf', "www/#{EXTENSION}/index.md"] do |t|
|
45
21
|
puts "Updating #{t.name}"
|
46
22
|
|
@@ -57,6 +33,9 @@ task 'README.md' => ['install.rdf', "www/#{EXTENSION}/index.md"] do |t|
|
|
57
33
|
open(t.name, 'w'){|f| f.write(md) }
|
58
34
|
end
|
59
35
|
|
36
|
+
task :default => XPI do
|
37
|
+
end
|
38
|
+
|
60
39
|
task 'update.rdf' => 'install.rdf' do
|
61
40
|
rdf = Nokogiri::XML(File.open(t.name))
|
62
41
|
rdf.at('//em:version').content = RELEASE
|
@@ -123,3 +102,26 @@ task :publish => XPI
|
|
123
102
|
system "git push"
|
124
103
|
system "cd www; rake publish"
|
125
104
|
end
|
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?
|
125
|
+
end
|
126
|
+
request.run
|
127
|
+
end
|