zotplus-rakehelper 0.0.135 → 0.0.136

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: b5668b6cf0487a4831a5a7671823c90820d6b867
4
- data.tar.gz: 34cc77083be1172ceafac8b140bcb56f3e548656
3
+ metadata.gz: 24b7f4fc1e5502636e041d1e3a43f03e02e53889
4
+ data.tar.gz: 4f8ecf49ff197a0a68c2019daf5008a1911ba989
5
5
  SHA512:
6
- metadata.gz: 26e9668e3f9f1dcef17a35140df4cfc189881293662280bfd814b21f03289886f01d384180f2c2df2466c75c16f04a9127317c8dfbd93659ab76ef283bf153fc
7
- data.tar.gz: 6573acdf57e993e41e5d0f5fd5516991bdb0ecff2d4261911a91c42173f9bc325f77ff91fe35a5cc701531f4218109515907bb19a4fe44d6a713f6f2f4e63f05
6
+ metadata.gz: a28e612f3298489388dd0222ad292caa0292024d68b3f822b13ca86fcdca8e37b324fce48ea80cec362c57452da54bf7dd181239ce10c48b12f6f781fdf9271a
7
+ data.tar.gz: 00a2fcb3092a7100406c7be59dc187f5f21bed84b95a60771793c8ad546d1472b8ca669054e80ce5f56a3105f29ca0f28c8126986e5fe622b69494aa60543d1a
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zotplus-rakehelper (0.0.123)
4
+ zotplus-rakehelper (0.0.135)
5
+ github_api
5
6
  nokogiri
6
7
  rake
7
8
  rest-client
@@ -12,18 +13,42 @@ PATH
12
13
  GEM
13
14
  remote: https://rubygems.org/
14
15
  specs:
16
+ addressable (2.4.0)
17
+ descendants_tracker (0.0.4)
18
+ thread_safe (~> 0.3, >= 0.3.1)
15
19
  domain_name (0.5.25)
16
20
  unf (>= 0.0.5, < 1.0.0)
17
21
  ethon (0.8.0)
18
22
  ffi (>= 1.3.0)
23
+ faraday (0.9.2)
24
+ multipart-post (>= 1.2, < 3)
19
25
  ffi (1.9.10)
26
+ github_api (0.13.1)
27
+ addressable (~> 2.4.0)
28
+ descendants_tracker (~> 0.0.4)
29
+ faraday (~> 0.8, < 0.10)
30
+ hashie (>= 3.4)
31
+ multi_json (>= 1.7.5, < 2.0)
32
+ oauth2
33
+ hashie (3.4.3)
20
34
  http-cookie (1.0.2)
21
35
  domain_name (~> 0.5)
36
+ jwt (1.5.2)
22
37
  mime-types (2.99)
23
38
  mini_portile2 (2.0.0)
39
+ multi_json (1.11.2)
40
+ multi_xml (0.5.5)
41
+ multipart-post (2.0.0)
24
42
  netrc (0.11.0)
25
- nokogiri (1.6.7)
43
+ nokogiri (1.6.7.1)
26
44
  mini_portile2 (~> 2.0.0.rc2)
45
+ oauth2 (1.0.0)
46
+ faraday (>= 0.8, < 0.10)
47
+ jwt (~> 1.0)
48
+ multi_json (~> 1.3)
49
+ multi_xml (~> 0.5)
50
+ rack (~> 1.2)
51
+ rack (1.6.4)
27
52
  rake (10.4.2)
28
53
  rest-client (1.8.0)
29
54
  http-cookie (>= 1.0.2, < 2.0)
@@ -31,6 +56,7 @@ GEM
31
56
  netrc (~> 0.7)
32
57
  rickshaw (0.3.1)
33
58
  rubyzip (1.1.7)
59
+ thread_safe (0.3.5)
34
60
  typhoeus (0.8.0)
35
61
  ethon (>= 0.8.0)
36
62
  unf (0.1.4)
@@ -1,5 +1,5 @@
1
1
  module ZotPlus
2
2
  class RakeHelper
3
- VERSION = "0.0.135"
3
+ VERSION = "0.0.136"
4
4
  end
5
5
  end
@@ -1,16 +1,16 @@
1
- require 'nokogiri'
2
- require 'zip'
3
- require 'rake'
4
- require 'rickshaw'
5
- require 'uri'
6
1
  require 'fileutils'
2
+ require 'github_api'
3
+ require 'jwt'
4
+ require 'nokogiri'
7
5
  require 'open-uri'
8
6
  require 'ostruct'
9
- require 'open-uri'
7
+ require 'rake'
10
8
  require 'rest-client'
9
+ require 'rickshaw'
11
10
  require 'securerandom'
12
- require 'jwt'
13
- require 'rest-client'
11
+ require 'tempfile'
12
+ require 'uri'
13
+ require 'zip'
14
14
 
15
15
  case ENV['DEBUGBUILD']
16
16
  when 'true'
@@ -39,6 +39,7 @@ task XPI => ZIPFILES do
39
39
  if File.basename(src) == 'install.rdf' && DEBUGBUILD != ''
40
40
  install_rdf = Nokogiri::XML(File.open('install.rdf'))
41
41
  install_rdf.at('//em:version').content = RELEASE
42
+ # TODO: update to https://github.com/ZotPlus/zotero-#{EXTENSION}/releases/download/update.rdf/update.rdf
42
43
  install_rdf.at('//em:updateURL').content = "https://zotplus.github.io/#{EXTENSION}/update.rdf"
43
44
 
44
45
  zipfile.get_output_stream(src){|f| install_rdf.write_xml_to f }
@@ -84,7 +85,6 @@ task :bump, :what do |t, args|
84
85
 
85
86
  install_rdf = Nokogiri::XML(File.open('install.rdf'))
86
87
  install_rdf.at('//em:version').content = release
87
- install_rdf.at('//em:updateURL').content = "https://zotplus.github.io/#{EXTENSION}/update.rdf"
88
88
  File.open('install.rdf','w') {|f| install_rdf.write_xml_to f}
89
89
 
90
90
  md = open("https://raw.githubusercontent.com/ZotPlus/ZotPlus.github.io/master/#{EXTENSION}/index.md").read
@@ -104,15 +104,6 @@ task :bump, :what do |t, args|
104
104
  sh "git tag #{release}"
105
105
  end
106
106
 
107
- GR="bin/github-release"
108
- file GR do
109
- FileUtils.mkdir_p('bin')
110
- FileUtils.mkdir_p('tmp')
111
- tmp = 'tmp/github-release.tar.bz2'
112
- ZotPlus::RakeHelper.download('https://github.com/aktau/github-release/releases/download/v0.5.3/linux-amd64-github-release.tar.bz2', tmp)
113
- sh "tar xjf #{tmp} -C bin --strip-components 3"
114
- end
115
-
116
107
  def sign
117
108
  token = lambda {
118
109
  payload = {
@@ -173,7 +164,7 @@ def sign
173
164
  }
174
165
  end
175
166
 
176
- task :deploy => [XPI, GR] do
167
+ task :deploy => XPI do
177
168
  throw "GITHUB_TOKEN not set" unless ENV['GITHUB_TOKEN']
178
169
  checkin = `git log -n 1 --pretty=oneline`.strip
179
170
 
@@ -188,8 +179,74 @@ task :deploy => [XPI, GR] do
188
179
  if checkin == release
189
180
  STDERR.puts "Deploying #{RELEASE} (#{sha1})"
190
181
 
191
- sh "#{GR} release --user ZotPlus --repo zotero-#{EXTENSION} --tag #{RELEASE} --name 'v#{RELEASE}'"
192
- sh "#{GR} upload --user ZotPlus --repo zotero-#{EXTENSION} --tag #{RELEASE} --name '#{XPI}' --file '#{XPI}'"
182
+ raise "GITHUB_TOKEN not set" unless GITHUB_TOKEN
183
+ github = Github.new({oauth_token: ENV['GITHUB_TOKEN']})
184
+
185
+ # create release and upload assets
186
+
187
+ release = github.repos.releases.create('ZotPlus', "zotero-#{EXTENSION}", {
188
+ tag_name: RELEASE,
189
+ name: RELEASE,
190
+ body: RELEASE
191
+ })
192
+
193
+ github.repos.releases.assets.upload('ZotPlus', "zotero-#{EXTENSION}", release.id, "zotero-#{EXTENSION}-#{RELEASE}.xpi", {
194
+ name: "zotero-#{EXTENSION}-#{RELEASE}.xpi",
195
+ content_type: 'application/x-xpinstall'
196
+ })
197
+
198
+ # point update.rdf to the right place
199
+ release = github.repos.releases.list('ZotPlus', "zotero-#{EXTENSION}").detect{|rel| rel.name == 'update.rdf' }
200
+
201
+ ## Remove any existing assets
202
+ github.repos.releases.assets.list('ZotPlus', "zotero-#{EXTENSION}", release.id){ |asset|
203
+ github.repos.releases.assets.delete 'ZotPlus', "zotero-#{EXTENSION}", asset.id
204
+ }
205
+
206
+ update_rdf = Nokogiri::XML::Builder.new { |xml|
207
+ xml.RDF('xmlns:RDF'=>'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'xmlns:em' => 'http://www.mozilla.org/2004/em-rdf#') {
208
+ xml.parent.namespace = xml.parent.namespace_definitions.find{|ns|ns.prefix=='RDF'}
209
+ xml['RDF'].Description(about: "urn:mozilla:extension:#{EXTENSION_ID}") {
210
+ xml['em'].updates {
211
+ xml['RDF'].Seq {
212
+ xml['RDF'].li {
213
+ xml['RDF'].Description {
214
+ xml['em'].version { xml.text RELEASE }
215
+ xml['em'].targetApplication {
216
+ xml['RDF'].Description {
217
+ xml['em'].id { xml.text "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" }
218
+ xml['em'].minVersion { xml.text "17.0" }
219
+ xml['em'].maxVersion { xml.text "43.*" }
220
+ xml['em'].updateLink { xml.text "https://github.com/ZotPlus/zotero-better-bibtex/releases/download/#{RELEASE}/zotero-#{EXTENSION}-#{RELEASE}.xpi" }
221
+ xml['em'].updateInfoURL { xml.text "https://zotplus.github.io/better-bibtex/CHANGELOG.html" }
222
+ }
223
+ }
224
+ xml['em'].targetApplication {
225
+ xml['RDF'].Description {
226
+ xml['em'].id { xml.text "zotero@chnm.gmu.edu" }
227
+ xml['em'].minVersion { "3.0" }
228
+ xml['em'].maxVersion { "4.0.*" }
229
+ xml['em'].updateLink{ xml.text "https://github.com/ZotPlus/zotero-better-bibtex/releases/download/#{RELEASE}/zotero-#{EXTENSION}-#{RELEASE}.xpi" }
230
+ xml['em'].updateInfoURL { xml.text "https://zotplus.github.io/better-bibtex/CHANGELOG.html" }
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ }
240
+
241
+ Tempfile.create('update_rdf') do |tmp|
242
+ File.open(tmp, 'wb') {|f| f.write update_rdf.to_xml }
243
+
244
+ ## upload new update.rdf
245
+ github.repos.releases.assets.upload('ZotPlus', "zotero-#{EXTENSION}", release.id, tmp.path, {
246
+ name: 'update.rdf',
247
+ content_type: 'application/rdf+xml'
248
+ })
249
+ end
193
250
 
194
251
  open("www/_includes/#{EXTENSION}-version.html", 'w'){|f| f.write(RELEASE) }
195
252
  Dir.chdir('www'){
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_runtime_dependency 'rubyzip', '>= 1.0.0' # will load new rubyzip version
28
28
  spec.add_runtime_dependency 'rickshaw'
29
29
  spec.add_runtime_dependency 'rest-client'
30
+ spec.add_runtime_dependency 'github_api'
30
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zotplus-rakehelper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.135
4
+ version: 0.0.136
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Heyns
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-19 00:00:00.000000000 Z
11
+ date: 2016-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: github_api
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: ZotPlus rake helper
112
126
  email:
113
127
  - Emiliano.Heyns@iris-advies.com