gollum-rugged_adapter 0.3b → 0.4
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 +4 -4
- data/Gemfile +0 -2
- data/LICENSE +21 -0
- data/Rakefile +127 -0
- data/lib/rugged_adapter/git_layer_rugged.rb +1 -2
- data/lib/rugged_adapter/version.rb +1 -1
- data/rugged_adapter.gemspec +36 -0
- metadata +21 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87745f1aafc4f070e0f1a04a13f4e6fa8c4ca4d0
|
|
4
|
+
data.tar.gz: 83e14a3b21d9a581e03900bd43d1051d15110044
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b25df8424f190e1cb1456acf98ce6930813d2fba0fa20737fca058ba39fe27f24b008b3616f98494e8ba6d6e2cfb654d9180853e56f20a1a2eda7a3c3ab3b84e
|
|
7
|
+
data.tar.gz: 44dc7d64157fb8083f9269fbd1a14e8026f89d4becabca7eb7a4ddd08762786bb7eaa8d4e5666bef3ed391c77688ca155b3534a2fe7d4ab2ca1ca9ffe9fa0a88
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Bart Kamphorst, Dawa Ometto
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
3
|
+
task :default => :rspec
|
|
4
|
+
|
|
5
|
+
require 'rspec/core/rake_task'
|
|
6
|
+
|
|
7
|
+
def name
|
|
8
|
+
"rugged_adapter"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def version
|
|
12
|
+
line = File.read("lib/rugged_adapter/version.rb")[/^\s*VERSION\s*=\s*.*/]
|
|
13
|
+
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# assumes x.y.z all digit version
|
|
17
|
+
def next_version
|
|
18
|
+
# x.y.z
|
|
19
|
+
v = version.split '.'
|
|
20
|
+
# bump z
|
|
21
|
+
v[-1] = v[-1].to_i + 1
|
|
22
|
+
v.join '.'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def bump_version
|
|
26
|
+
old_file = File.read("lib/#{name}/version.rb")
|
|
27
|
+
old_version_line = old_file[/^\s*VERSION\s*=\s*.*/]
|
|
28
|
+
new_version = next_version
|
|
29
|
+
# replace first match of old version with new version
|
|
30
|
+
old_file.sub!(old_version_line, " VERSION = '#{new_version}'")
|
|
31
|
+
|
|
32
|
+
File.write("lib/#{name}/version.rb", old_file)
|
|
33
|
+
|
|
34
|
+
new_version
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def date
|
|
38
|
+
Date.today.to_s
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def gemspec
|
|
42
|
+
"#{name}.gemspec"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def gem_file
|
|
46
|
+
"gollum-#{name}-#{version}.gem"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def replace_header(head, header_name)
|
|
50
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
desc "Run specs."
|
|
54
|
+
RSpec::Core::RakeTask.new(:rspec) do |spec|
|
|
55
|
+
ruby_opts = "-w"
|
|
56
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
|
57
|
+
spec.rspec_opts = ['--backtrace --color']
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
desc "Update version number and gemspec"
|
|
61
|
+
task :bump do
|
|
62
|
+
puts "Updated version to #{bump_version}"
|
|
63
|
+
# Execute does not invoke dependencies.
|
|
64
|
+
# Manually invoke gemspec then validate.
|
|
65
|
+
Rake::Task[:gemspec].execute
|
|
66
|
+
Rake::Task[:validate].execute
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
desc 'Create a release build'
|
|
70
|
+
task :release => :build do
|
|
71
|
+
unless `git branch` =~ /^\* master$/
|
|
72
|
+
puts "You must be on the master branch to release!"
|
|
73
|
+
exit!
|
|
74
|
+
end
|
|
75
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
|
76
|
+
sh "git pull --rebase origin master"
|
|
77
|
+
sh "git tag v#{version}"
|
|
78
|
+
sh "git push origin master"
|
|
79
|
+
sh "git push origin v#{version}"
|
|
80
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
|
81
|
+
sh "gem push pkg/#{name}-#{version}-java.gem"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
desc 'Publish to rubygems. Same as release'
|
|
85
|
+
task :publish => :release
|
|
86
|
+
|
|
87
|
+
desc 'Build gem'
|
|
88
|
+
task :build => :gemspec do
|
|
89
|
+
sh "mkdir -p pkg"
|
|
90
|
+
sh "gem build #{gemspec}"
|
|
91
|
+
sh "mv #{gem_file} pkg"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
desc 'Update gemspec'
|
|
95
|
+
task :gemspec => :validate do
|
|
96
|
+
# read spec file and split out manifest section
|
|
97
|
+
spec = File.read(gemspec)
|
|
98
|
+
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
|
99
|
+
|
|
100
|
+
# replace name version and date
|
|
101
|
+
replace_header(head, :name)
|
|
102
|
+
replace_header(head, :date)
|
|
103
|
+
|
|
104
|
+
# determine file list from git ls-files
|
|
105
|
+
files = `git ls-files`.
|
|
106
|
+
split("\n").
|
|
107
|
+
sort.
|
|
108
|
+
reject { |file| file =~ /^\./ }.
|
|
109
|
+
reject { |file| file =~ /^(rdoc|pkg|spec|\.gitattributes|Guardfile)/ }.
|
|
110
|
+
map { |file| " #{file}" }.
|
|
111
|
+
join("\n")
|
|
112
|
+
|
|
113
|
+
# piece file back together and write
|
|
114
|
+
manifest = " s.files = %w(\n#{files}\n )\n"
|
|
115
|
+
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
|
116
|
+
File.open(gemspec, 'w') { |io| io.write(spec) }
|
|
117
|
+
puts "Updated #{gemspec}"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
desc 'Validate lib files and version file'
|
|
121
|
+
task :validate do
|
|
122
|
+
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
|
|
123
|
+
unless libfiles.empty?
|
|
124
|
+
puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
|
|
125
|
+
exit!
|
|
126
|
+
end
|
|
127
|
+
end
|
|
@@ -165,14 +165,13 @@ module Gollum
|
|
|
165
165
|
results = []
|
|
166
166
|
tree.walk_blobs(:postorder) do |root, entry|
|
|
167
167
|
blob = @repo.lookup(entry[:oid])
|
|
168
|
-
next if blob.binary?
|
|
169
168
|
count = 0
|
|
170
169
|
blob.content.each_line do |line|
|
|
171
170
|
next unless line.match(/#{Regexp.escape(query)}/i)
|
|
172
171
|
count += 1
|
|
173
172
|
end
|
|
174
173
|
path = options[:path] ? ::File.join(options[:path], root, entry[:name]) : "#{root}#{entry[:name]}"
|
|
175
|
-
results << {:name => path, :count => count}
|
|
174
|
+
results << {:name => path, :count => count} unless count == 0
|
|
176
175
|
end
|
|
177
176
|
results
|
|
178
177
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "rugged_adapter/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "gollum-rugged_adapter"
|
|
7
|
+
s.version = Gollum::Lib::Git::VERSION
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = ["Bart Kamphorst, Dawa Ometto"]
|
|
10
|
+
s.email = ["repotag-dev@googlegroups.com"]
|
|
11
|
+
s.homepage = "https://github.com/gollum/rugged_adapter"
|
|
12
|
+
s.summary = %q{Adapter for Gollum to use Rugged (libgit2) at the backend.}
|
|
13
|
+
s.description = %q{Adapter for Gollum to use Rugged (libgit2) at the backend.}
|
|
14
|
+
s.license = "MIT"
|
|
15
|
+
|
|
16
|
+
s.add_runtime_dependency 'rugged', '~> 0.21.3', '>=0.21.3'
|
|
17
|
+
s.add_runtime_dependency 'mime-types', '~> 2.6'
|
|
18
|
+
s.add_development_dependency "rspec", "2.13.0"
|
|
19
|
+
|
|
20
|
+
s.files = Dir['lib/**/*.rb'] + ["README.md", "Gemfile"]
|
|
21
|
+
s.require_paths = ["lib"]
|
|
22
|
+
|
|
23
|
+
# = MANIFEST =
|
|
24
|
+
s.files = %w(
|
|
25
|
+
Gemfile
|
|
26
|
+
LICENSE
|
|
27
|
+
README.md
|
|
28
|
+
Rakefile
|
|
29
|
+
lib/rugged_adapter.rb
|
|
30
|
+
lib/rugged_adapter/git_layer_rugged.rb
|
|
31
|
+
lib/rugged_adapter/version.rb
|
|
32
|
+
rugged_adapter.gemspec
|
|
33
|
+
)
|
|
34
|
+
# = MANIFEST =
|
|
35
|
+
|
|
36
|
+
end
|
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: 0.
|
|
4
|
+
version: '0.4'
|
|
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: 2015-
|
|
11
|
+
date: 2015-07-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rugged
|
|
@@ -30,6 +30,20 @@ dependencies:
|
|
|
30
30
|
- - '>='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: 0.21.3
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: mime-types
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ~>
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.6'
|
|
40
|
+
type: :runtime
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ~>
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '2.6'
|
|
33
47
|
- !ruby/object:Gem::Dependency
|
|
34
48
|
name: rspec
|
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,10 +66,13 @@ extensions: []
|
|
|
52
66
|
extra_rdoc_files: []
|
|
53
67
|
files:
|
|
54
68
|
- Gemfile
|
|
69
|
+
- LICENSE
|
|
55
70
|
- README.md
|
|
71
|
+
- Rakefile
|
|
56
72
|
- lib/rugged_adapter.rb
|
|
57
73
|
- lib/rugged_adapter/git_layer_rugged.rb
|
|
58
74
|
- lib/rugged_adapter/version.rb
|
|
75
|
+
- rugged_adapter.gemspec
|
|
59
76
|
homepage: https://github.com/gollum/rugged_adapter
|
|
60
77
|
licenses:
|
|
61
78
|
- MIT
|
|
@@ -71,9 +88,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
71
88
|
version: '0'
|
|
72
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
90
|
requirements:
|
|
74
|
-
- - '
|
|
91
|
+
- - '>='
|
|
75
92
|
- !ruby/object:Gem::Version
|
|
76
|
-
version:
|
|
93
|
+
version: '0'
|
|
77
94
|
requirements: []
|
|
78
95
|
rubyforge_project:
|
|
79
96
|
rubygems_version: 2.2.2
|