gollum-rjgit_adapter 1.0-java → 2.0-java

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
  SHA256:
3
- metadata.gz: 6bdbce54e2c9a4776e5f86ca0a2b549d35e3be6d816afb83e3ac028af24b9756
4
- data.tar.gz: 5373306b3d9279ab924eede20362ea9ee9aea96f875a1b17f0bbc31d9cd936f4
3
+ metadata.gz: 1b43b7c10bac608a25d31dd1e9ead18db91b115bfc022b892ae47eff6113ed59
4
+ data.tar.gz: 0a0e6af732771952c77f2f69215395c7c1ebf5dc178f800c7e2ea6b522ef4617
5
5
  SHA512:
6
- metadata.gz: 7467a015e62e23f710f0fe8e9e6e0a2a9e9216966cb9a57d2883d95ee000ae35087932624495e6a76569a849981f3523d62d4f4ae13776a5564b467f652f1216
7
- data.tar.gz: 4f0b0910be9ecf5767a65a99f730c609062b8bedda96759c7dc27d80f8c07035aa143e26938544feb5404c808927af1e101fc02fab27554fae77223354ba6ba3
6
+ metadata.gz: 92d672432737fedbf2edc45499292f12e238268b63c07ffc18ef94bd47fbe367f8eb4c35914a075d3863af6c5aea9bf8f6a5a6e3c8c607849e84e8879b441c2d
7
+ data.tar.gz: 3bde52190df00ef1921a04d4dcb777e2f8a37394b489a161ee92f880327e7512e0a54244f3409e07805e9cd6a74a943f350d1c6a229aeae58c59b5ef8a90ed11
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  gollum-lib_rjgit_adapter
2
2
  ========================
3
3
  [![Gem Version](https://badge.fury.io/rb/gollum-rjgit_adapter.svg)](http://badge.fury.io/rb/gollum-rjgit_adapter)
4
- [![Build Status](https://travis-ci.org/gollum/rjgit_adapter.svg?branch=master)](https://travis-ci.org/gollum/rjgit_adapter)
4
+ ![Build Status](https://github.com/gollum/rjgit_adapter/actions/workflows/test.yml/badge.svg)
5
+ [![Cutting Edge Dependency Status](https://cuttingedge.onrender.com/github/gollum/rjgit_adapter/svg 'Cutting Edge Dependency Status')](https://cuttingedge.onrender.com/github/gollum/rjgit_adapter/info)
5
6
 
6
7
  Adapter for Gollum to use [RJGit](https://github.com/repotag/rjgit) at the backend. The adapter requires using [JRuby](https://www.jruby.org/). This adapter is the default when your platform is JRuby, so you need only to `gem install gollum` and then use gollum normally.
data/Rakefile CHANGED
@@ -1,4 +1,7 @@
1
1
  require 'rubygems'
2
+ require 'rake'
3
+ require 'date'
4
+ require 'tempfile'
2
5
 
3
6
  task :default => :rspec
4
7
 
@@ -8,6 +11,18 @@ def name
8
11
  "rjgit_adapter"
9
12
  end
10
13
 
14
+ def date
15
+ Time.now.strftime("%Y-%m-%d")
16
+ end
17
+
18
+ def latest_changes_file
19
+ 'LATEST_CHANGES.md'
20
+ end
21
+
22
+ def history_file
23
+ 'HISTORY.md'
24
+ end
25
+
11
26
  def version
12
27
  line = File.read("lib/rjgit_adapter/version.rb")[/^\s*VERSION\s*=\s*.*/]
13
28
  line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
@@ -72,12 +87,13 @@ task :release => :build do
72
87
  puts "You must be on the master branch to release!"
73
88
  exit!
74
89
  end
90
+ Rake::Task[:changelog].execute
75
91
  sh "git commit --allow-empty -a -m 'Release #{version}'"
76
92
  sh "git pull --rebase origin master"
77
- sh "git tag v#{version}"
93
+ sh "git tag v#{version} -m 'Release v#{version}'"
78
94
  sh "git push origin master"
79
95
  sh "git push origin v#{version}"
80
- sh "gem push pkg/#{name}-#{version}-java.gem"
96
+ sh "gem push pkg/#{gem_file}"
81
97
  end
82
98
 
83
99
  desc 'Publish to rubygems. Same as release'
@@ -123,4 +139,44 @@ task :validate do
123
139
  puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
124
140
  exit!
125
141
  end
142
+ end
143
+
144
+ desc 'Build changlog'
145
+ task :changelog do
146
+ [latest_changes_file, history_file].each do |f|
147
+ unless File.exist?(f)
148
+ puts "#{f} does not exist but is required to build a new release."
149
+ exit!
150
+ end
151
+ end
152
+
153
+ latest_changes = File.open(latest_changes_file)
154
+ version_pattern = "# #{version}"
155
+
156
+ if !`grep "#{version_pattern}" #{history_file}`.empty?
157
+ puts "#{version} is already described in #{history_file}"
158
+ exit!
159
+ end
160
+
161
+ begin
162
+ unless latest_changes.readline.chomp! =~ %r{#{version_pattern}}
163
+ puts "#{latest_changes_file} should begin with '#{version_pattern}'"
164
+ exit!
165
+ end
166
+ rescue EOFError
167
+ puts "#{latest_changes_file} is empty!"
168
+ exit!
169
+ end
170
+
171
+ body = latest_changes.read
172
+ body.scan(/\s*#\s+\d\.\d.*/) do |match|
173
+ puts "#{latest_changes_file} may not contain multiple markdown headers!"
174
+ exit!
175
+ end
176
+
177
+ temp = Tempfile.new
178
+ temp.puts("#{version_pattern} / #{date}\n#{body}\n\n")
179
+ temp.close
180
+ `cat #{history_file} >> #{temp.path}`
181
+ `cat #{temp.path} > #{history_file}`
126
182
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{Adapter for Gollum to use RJGit at the backend.}
13
13
  s.description = %q{Adapter for Gollum to use RJGit at the backend.}
14
14
 
15
- s.add_runtime_dependency "rjgit", "~> 6.1"
15
+ s.add_runtime_dependency "rjgit", "~> 6.5"
16
16
  s.add_development_dependency "rspec", "3.4.0"
17
17
 
18
18
  s.files = Dir['lib/**/*.rb'] + ["README.md", "Gemfile"]
@@ -188,6 +188,14 @@ module Gollum
188
188
  end
189
189
  end
190
190
 
191
+ def note(ref='refs/notes/commits')
192
+ result = @commit.note(ref)
193
+ result ? result.to_s : nil
194
+ end
195
+
196
+ def note=(msg, ref='refs/notes/commits')
197
+ @commit.send(:note=,msg,ref)
198
+ end
191
199
  end
192
200
 
193
201
  class Git
@@ -429,7 +437,7 @@ module Gollum
429
437
  def lstree(sha, options={})
430
438
  entries = RJGit::Porcelain.ls_tree(@repo.jrepo, nil, @repo.find(sha, :tree), {:recursive => options[:recursive]})
431
439
  entries.map! do |entry|
432
- entry[:mode] = entry[:mode].to_s(8)
440
+ entry[:mode] = entry[:mode]
433
441
  entry[:sha] = entry[:id]
434
442
  entry
435
443
  end
@@ -470,13 +478,21 @@ module Gollum
470
478
  end
471
479
 
472
480
  def /(file)
473
- @tree.send(:/, file)
481
+ obj = @tree.send(:/, file)
482
+ return nil if obj.nil?
483
+ obj.is_a?(RJGit::Tree) ? Gollum::Git::Tree.new(obj) : Gollum::Git::Blob.new(obj)
474
484
  end
475
485
 
476
486
  def blobs
477
487
  return Array.new if @tree == {}
478
488
  @tree.blobs.map{|blob| Gollum::Git::Blob.new(blob) }
479
489
  end
490
+
491
+ def find_blob(&block)
492
+ return nil unless block_given?
493
+ blob = @tree.find_blob {|blob| yield blob[:name] }
494
+ blob ? Gollum::Git::Blob.new(blob) : nil
495
+ end
480
496
  end
481
497
 
482
498
  class NoSuchShaFound < StandardError
@@ -1,7 +1,7 @@
1
1
  module Gollum
2
2
  module Lib
3
3
  module Git
4
- VERSION = '1.0'
4
+ VERSION = '2.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum-rjgit_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '2.0'
5
5
  platform: java
6
6
  authors:
7
7
  - Bart Kamphorst, Dawa Ometto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-12 00:00:00.000000000 Z
11
+ date: 2023-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '6.1'
18
+ version: '6.5'
19
19
  name: rjgit
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '6.1'
26
+ version: '6.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  requirements: []
74
- rubygems_version: 3.2.29
74
+ rubygems_version: 3.3.25
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Adapter for Gollum to use RJGit at the backend.