jekyll-theme-open-project-helpers 2.1.5 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f94594d15f1b9e8b4c7a02d99a6ebfed8164ad00e65fedffb9fd5f3deed0bde
4
- data.tar.gz: e45b408956ce95fd59e813b1f1af8ec284d0c52938abe12fde4d90ee5d8be24b
3
+ metadata.gz: d2af15e9882d15732f6c20715f4823b9979f59c60febeae4edc26004db20fb2f
4
+ data.tar.gz: 41480819941abc2f376fddd95571b6473258f547338424b1b0a0f39894a4ebeb
5
5
  SHA512:
6
- metadata.gz: 5b0b8be8ff9299477f8d3ceb29c02832a4e3b61af1f98db082245862c18da9c3ea7441e41a8e4a0097fab6edc6c48524abe1d823a3a799001d809d6e1a1c4afa
7
- data.tar.gz: adc2f75f13ed2548901e9b8c008b7385f43a07a42a57c94e639d6e54a78e2032cd25a2f780463711593dd72a93e854237514b17f31906cc30e237ec2ef7373ac
6
+ metadata.gz: a46054eeb605e0aa6edf7d15a6d267bd3fe760d6134c2766466da109c939023229df0d77ada8e4078771fa920449400ac5b062a1102d11d131b11ffe2d7b3f96
7
+ data.tar.gz: 8e85bcc789cabdbb79f62d9eb5d5d8b08bf3ae45e92f43ca003ddeb7ecaa6c55cba407d816d47948ee5227bf9e130f064bc96526f853cc0884b4cc84c39871f9
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'jekyll-theme-open-project-helpers'
5
- s.version = '2.1.5'
5
+ s.version = '2.1.6'
6
6
  s.authors = ['Ribose Inc.']
7
7
  s.email = ['open.source@ribose.com']
8
8
 
@@ -6,7 +6,9 @@ module Jekyll
6
6
  DEFAULT_DOCS_SUBTREE = 'docs'
7
7
 
8
8
  DEFAULT_REPO_REMOTE_NAME = 'origin'
9
- DEFAULT_REPO_BRANCH = 'master'
9
+ DEFAULT_REPO_BRANCH = 'main'
10
+ # Can be overridden by default_repo_branch in site config.
11
+ # Used by shallow_git_checkout.
10
12
 
11
13
  class NonLiquidDocument < Jekyll::Document
12
14
  def render_with_liquid?
@@ -95,7 +97,8 @@ module Jekyll
95
97
  git_shallow_checkout(
96
98
  File.join(@site.source, 'parent-hub'),
97
99
  @site.config['parent_hub']['git_repo_url'],
98
- ['assets', 'title.html'])
100
+ ['assets', 'title.html'],
101
+ @site.config['parent_hub']['git_repo_branch'])
99
102
  end
100
103
  end
101
104
 
@@ -110,7 +113,8 @@ module Jekyll
110
113
  git_shallow_checkout(
111
114
  project_path,
112
115
  project['site']['git_repo_url'],
113
- ['assets', '_posts', '_software', '_specs'])
116
+ ['assets', '_posts', '_software', '_specs'],
117
+ project['site']['git_repo_branch'])
114
118
 
115
119
 
116
120
  Jekyll.logger.debug("OPF:", "Reading files in project #{project_path}")
@@ -131,6 +135,7 @@ module Jekyll
131
135
  src = index_doc.data['spec_source']
132
136
  repo_url = src['git_repo_url']
133
137
  repo_subtree = src['git_repo_subtree']
138
+ repo_branch = src['git_repo_branch']
134
139
  build = src['build']
135
140
  engine = build['engine']
136
141
  engine_opts = build['options'] || {}
@@ -142,7 +147,7 @@ module Jekyll
142
147
  spec_checkout_path
143
148
  end
144
149
 
145
- repo_checkout = git_shallow_checkout(spec_checkout_path, repo_url, [repo_subtree])
150
+ repo_checkout = git_shallow_checkout(spec_checkout_path, repo_url, [repo_subtree], repo_branch)
146
151
 
147
152
  if repo_checkout[:success]
148
153
  if build_pages
@@ -215,13 +220,15 @@ module Jekyll
215
220
 
216
221
  docs = index_doc.data['docs']
217
222
  main_repo = index_doc.data['repo_url']
223
+ main_repo_branch = index_doc.data['repo_branch']
218
224
 
219
225
  sw_docs_repo = (if docs then docs['git_repo_url'] end) || main_repo
220
226
  sw_docs_subtree = (if docs then docs['git_repo_subtree'] end) || DEFAULT_DOCS_SUBTREE
227
+ sw_docs_branch = (if docs then docs['git_repo_branch'] end) || nil
221
228
 
222
229
  docs_path = "#{index_doc.path.split('/')[0..-2].join('/')}/#{item_name}"
223
230
 
224
- sw_docs_checkout = git_shallow_checkout(docs_path, sw_docs_repo, [sw_docs_subtree])
231
+ sw_docs_checkout = git_shallow_checkout(docs_path, sw_docs_repo, [sw_docs_subtree], sw_docs_branch)
225
232
 
226
233
  if sw_docs_checkout[:success]
227
234
  CollectionDocReader.new(site).read(
@@ -234,7 +241,7 @@ module Jekyll
234
241
  # unless it’s the same as the repo where docs are.
235
242
  if !sw_docs_checkout[:success] or sw_docs_repo != main_repo
236
243
  repo_path = "#{index_doc.path.split('/')[0..-2].join('/')}/_#{item_name}_repo"
237
- repo_checkout = git_shallow_checkout(repo_path, main_repo)
244
+ repo_checkout = git_shallow_checkout(repo_path, main_repo, [], main_repo_branch)
238
245
  index_doc.merge_data!({ 'last_update' => repo_checkout[:modified_at] })
239
246
  else
240
247
  index_doc.merge_data!({ 'last_update' => sw_docs_checkout[:modified_at] })
@@ -242,7 +249,7 @@ module Jekyll
242
249
  end
243
250
  end
244
251
 
245
- def git_shallow_checkout(repo_path, remote_url, sparse_subtrees=[])
252
+ def git_shallow_checkout(repo_path, remote_url, sparse_subtrees, branch_name)
246
253
  # Returns hash with timestamp of latest repo commit
247
254
  # and boolean signifying whether new repo has been initialized
248
255
  # in the process of pulling the data.
@@ -279,6 +286,7 @@ module Jekyll
279
286
  end
280
287
 
281
288
  refresh_condition = @@siteconfig['refresh_remote_data'] || 'last-resort'
289
+ repo_branch = branch_name || @@siteconfig['default_repo_branch'] || DEFAULT_REPO_BRANCH
282
290
 
283
291
  unless ['always', 'last-resort', 'skip'].include?(refresh_condition)
284
292
  raise RuntimeError.new('Invalid refresh_remote_data value in site’s _config.yml!')
@@ -287,14 +295,14 @@ module Jekyll
287
295
  if refresh_condition == 'always'
288
296
  repo.fetch(DEFAULT_REPO_REMOTE_NAME, { :depth => 1 })
289
297
  repo.reset_hard
290
- repo.checkout("#{DEFAULT_REPO_REMOTE_NAME}/#{DEFAULT_REPO_BRANCH}", { :f => true })
298
+ repo.checkout("#{DEFAULT_REPO_REMOTE_NAME}/#{repo_branch}", { :f => true })
291
299
 
292
300
  elsif refresh_condition == 'last-resort'
293
301
  # This is the default case.
294
302
 
295
303
  begin
296
304
  # Let’s try in case this repo has been fetched before (this would never be the case on CI though)
297
- repo.checkout("#{DEFAULT_REPO_REMOTE_NAME}/#{DEFAULT_REPO_BRANCH}", { :f => true })
305
+ repo.checkout("#{DEFAULT_REPO_REMOTE_NAME}/#{repo_branch}", { :f => true })
298
306
  rescue Exception => e
299
307
  if is_sparse_checkout_error(e, sparse_subtrees)
300
308
  # Silence errors caused by nonexistent sparse checkout directories
@@ -309,7 +317,7 @@ module Jekyll
309
317
  repo.fetch(DEFAULT_REPO_REMOTE_NAME, { :depth => 1 })
310
318
  begin
311
319
  # Try checkout again
312
- repo.checkout("#{DEFAULT_REPO_REMOTE_NAME}/#{DEFAULT_REPO_BRANCH}", { :f => true })
320
+ repo.checkout("#{DEFAULT_REPO_REMOTE_NAME}/#{repo_branch}", { :f => true })
313
321
  rescue Exception => e
314
322
  if is_sparse_checkout_error(e, sparse_subtrees)
315
323
  # Again, silence an error caused by nonexistent sparse checkout directories…
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-open-project-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-27 00:00:00.000000000 Z
11
+ date: 2021-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.0.8
122
+ rubygems_version: 3.0.3
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Helpers for the Open Project Jekyll theme