gollum-rugged_adapter 2.0.0 → 3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/Rakefile +58 -2
- data/lib/rugged_adapter/git_layer_rugged.rb +40 -6
- data/lib/rugged_adapter/version.rb +1 -1
- data/rugged_adapter.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a7a4dc762df0ff1cb91195f8be624c1516945b5ed1d37271aa9791b609158cf
|
4
|
+
data.tar.gz: e167a14946f31bd07d751ae9dfb7bd5bf210beebb0cc69bf27d2179694c407bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c32be19c86ab9f0480ebf4786fcefa8ccf6b83af86a02127feaa130595203bc616ec08980bf8ea77d91d948300e2021942b5777cb5b4b627f00a51eb932d18f7
|
7
|
+
data.tar.gz: 737583e56222388d0a4657190636c2d37fb6a42ee2caa147c45b743949e27ebf45468671f9f99cd611360efb1624dcc883630248105619b8498ca83386e3ebff
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/gollum-rugged_adapter.svg)](
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/gollum-rugged_adapter.svg)](https://badge.fury.io/rb/gollum-rugged_adapter)
|
2
2
|
![Build Status](https://github.com/gollum/rugged_adapter/actions/workflows/test.yaml/badge.svg)
|
3
|
-
[![Dependency Status](https://
|
3
|
+
[![Cutting Edge Dependency Status](https://cuttingedge.onrender.com/github/gollum/rugged_adapter/svg 'Cutting Edge Dependency Status')](https://cuttingedge.onrender.com/github/gollum/rugged_adapter/info)
|
4
4
|
|
5
5
|
## DESCRIPTION
|
6
6
|
|
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
|
"rugged_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/rugged_adapter/version.rb")[/^\s*VERSION\s*=\s*.*/]
|
13
28
|
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
@@ -72,9 +87,10 @@ 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
96
|
sh "gem push pkg/#{gem_file}"
|
@@ -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
|
126
|
-
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}`
|
182
|
+
end
|
@@ -143,6 +143,22 @@ module Gollum
|
|
143
143
|
@commit.parents.empty? ? nil : Gollum::Git::Commit.new(@commit.parents.first)
|
144
144
|
end
|
145
145
|
|
146
|
+
def note(ref='refs/notes/commits')
|
147
|
+
result = @commit.notes(ref)
|
148
|
+
result ? result[:message] : nil
|
149
|
+
end
|
150
|
+
|
151
|
+
def note=(msg, actor = nil, ref='refs/notes/commits')
|
152
|
+
actor = Gollum::Git::Actor.default_actor if actor.nil?
|
153
|
+
@commit.create_note(
|
154
|
+
author: actor.to_h,
|
155
|
+
committer: actor.to_h,
|
156
|
+
message: msg,
|
157
|
+
ref: ref,
|
158
|
+
force: true
|
159
|
+
)
|
160
|
+
end
|
161
|
+
|
146
162
|
private
|
147
163
|
|
148
164
|
def build_stats
|
@@ -638,11 +654,7 @@ module Gollum
|
|
638
654
|
def lstree(sha, options = {})
|
639
655
|
results = []
|
640
656
|
@repo.lookup(sha).tree.walk(:postorder) do |root, entry|
|
641
|
-
|
642
|
-
entry[:mode] = entry[:filemode].to_s(8)
|
643
|
-
entry[:type] = entry[:type].to_s
|
644
|
-
entry[:path] = "#{root}#{entry[:name]}"
|
645
|
-
results << entry
|
657
|
+
results << ::Gollum::Git::Tree.tree_entry_from_rugged_hash(entry, root)
|
646
658
|
end
|
647
659
|
results
|
648
660
|
end
|
@@ -673,6 +685,16 @@ module Gollum
|
|
673
685
|
|
674
686
|
class Tree
|
675
687
|
|
688
|
+
def self.tree_entry_from_rugged_hash(entry, root = '')
|
689
|
+
{
|
690
|
+
sha: entry[:oid],
|
691
|
+
mode: entry[:filemode],
|
692
|
+
type: entry[:type].to_s,
|
693
|
+
name: entry[:name],
|
694
|
+
path: "#{root}#{entry[:name]}"
|
695
|
+
}
|
696
|
+
end
|
697
|
+
|
676
698
|
def initialize(tree)
|
677
699
|
@tree = tree
|
678
700
|
end
|
@@ -703,10 +725,22 @@ module Gollum
|
|
703
725
|
|
704
726
|
def blobs
|
705
727
|
blobs = []
|
706
|
-
@tree.each_blob {|blob| blobs <<
|
728
|
+
@tree.each_blob {|blob| blobs << blob_for_tree_entry(blob) }
|
707
729
|
blobs
|
708
730
|
end
|
709
731
|
|
732
|
+
def find_blob(&block)
|
733
|
+
return nil unless block_given?
|
734
|
+
blob = @tree.each_blob.find {|blob| yield blob[:name] }
|
735
|
+
blob ? blob_for_tree_entry(blob) : nil
|
736
|
+
end
|
737
|
+
|
738
|
+
private
|
739
|
+
|
740
|
+
def blob_for_tree_entry(blob)
|
741
|
+
Gollum::Git::Blob.new(@tree.owner.lookup(blob[:oid]), self.class.tree_entry_from_rugged_hash(blob))
|
742
|
+
end
|
743
|
+
|
710
744
|
end
|
711
745
|
|
712
746
|
end
|
data/rugged_adapter.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = %q{Adapter for Gollum to use Rugged (libgit2) at the backend.}
|
14
14
|
s.license = "MIT"
|
15
15
|
|
16
|
-
s.add_runtime_dependency 'rugged', '~> 1.
|
17
|
-
s.add_runtime_dependency 'mime-types', '~>
|
16
|
+
s.add_runtime_dependency 'rugged', '~> 1.5'
|
17
|
+
s.add_runtime_dependency 'mime-types', '~> 3.4'
|
18
18
|
s.add_development_dependency 'rspec', "3.4.0"
|
19
19
|
|
20
20
|
s.files = Dir['lib/**/*.rb'] + ["README.md", "Gemfile"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gollum-rugged_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: '3.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bart Kamphorst, Dawa Ometto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mime-types
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
89
|
+
rubygems_version: 3.2.3
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: Adapter for Gollum to use Rugged (libgit2) at the backend.
|