jbox-gitolite 1.2.6 → 1.2.7
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 +5 -5
- data/.travis.yml +19 -12
- data/AUTHORS +10 -0
- data/CHANGELOG.md +82 -0
- data/Gemfile +3 -2
- data/Guardfile +13 -10
- data/LICENSE +19 -0
- data/README.md +216 -29
- data/Rakefile +9 -53
- data/bin/_guard-core +29 -0
- data/bin/guard +29 -0
- data/gitolite.gemspec +18 -23
- data/lib/gitolite.rb +3 -2
- data/lib/gitolite/config/repo.rb +4 -4
- data/lib/gitolite/version.rb +1 -1
- data/spec/spec_helper.rb +16 -15
- data/spec/support/helper.rb +12 -0
- data/spec/{config_spec.rb → unit_tests/config_spec.rb} +1 -1
- data/spec/{dirty_proxy_spec.rb → unit_tests/dirty_proxy_spec.rb} +0 -0
- data/spec/{gitolite_admin_spec.rb → unit_tests/gitolite_admin_spec.rb} +8 -8
- data/spec/{group_spec.rb → unit_tests/group_spec.rb} +0 -0
- data/spec/{repo_spec.rb → unit_tests/repo_spec.rb} +1 -1
- data/spec/{ssh_key_spec.rb → unit_tests/ssh_key_spec.rb} +44 -44
- metadata +49 -150
- data/.gemtest +0 -0
- data/LICENSE.txt +0 -22
data/Rakefile
CHANGED
|
@@ -1,59 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Bundler::GemHelper.install_tasks
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
require '
|
|
3
|
+
require 'bundler/gem_tasks'
|
|
5
4
|
require 'rspec/core/rake_task'
|
|
6
|
-
require 'rdoc/task'
|
|
7
5
|
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
+
task default: :spec
|
|
8
8
|
|
|
9
|
-
## Helper Functions
|
|
10
|
-
def name
|
|
11
|
-
@name ||= Dir['*.gemspec'].first.split('.').first
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def version
|
|
16
|
-
line = File.read("lib/#{name}/version.rb")[/^\s*VERSION\s*=\s*.*/]
|
|
17
|
-
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## RDoc Task
|
|
22
|
-
Rake::RDocTask.new do |rdoc|
|
|
23
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
24
|
-
rdoc.title = "#{name} #{version}"
|
|
25
|
-
rdoc.rdoc_files.include('README*')
|
|
26
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Other Tasks
|
|
31
|
-
desc "Open an irb session preloaded with this library"
|
|
32
9
|
task :console do
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
task :version do
|
|
39
|
-
puts "#{name} #{version}"
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
desc "Start unit tests"
|
|
44
|
-
task :test => :default
|
|
45
|
-
task :default do
|
|
46
|
-
RSpec::Core::RakeTask.new(:spec) do |config|
|
|
47
|
-
config.rspec_opts = "--color --format documentation"
|
|
48
|
-
end
|
|
49
|
-
Rake::Task["spec"].invoke
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
desc "Start unit tests in JUnit format"
|
|
54
|
-
task :test_junit do
|
|
55
|
-
RSpec::Core::RakeTask.new(:spec) do |config|
|
|
56
|
-
config.rspec_opts = "--format RspecJunitFormatter --out junit/rspec.xml"
|
|
57
|
-
end
|
|
58
|
-
Rake::Task["spec"].invoke
|
|
10
|
+
require 'pry'
|
|
11
|
+
require 'gitolite'
|
|
12
|
+
puts 'Loaded Gitolite'
|
|
13
|
+
ARGV.clear
|
|
14
|
+
Pry.start
|
|
59
15
|
end
|
data/bin/_guard-core
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application '_guard-core' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("guard", "_guard-core")
|
data/bin/guard
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'guard' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
|
13
|
+
Pathname.new(__FILE__).realpath)
|
|
14
|
+
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
16
|
+
|
|
17
|
+
if File.file?(bundle_binstub)
|
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
19
|
+
load(bundle_binstub)
|
|
20
|
+
else
|
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
require "rubygems"
|
|
27
|
+
require "bundler/setup"
|
|
28
|
+
|
|
29
|
+
load Gem.bin_path("guard", "guard")
|
data/gitolite.gemspec
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/gitolite/version'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |s|
|
|
6
|
-
s.name =
|
|
6
|
+
s.name = 'jbox-gitolite'
|
|
7
7
|
s.version = Gitolite::VERSION
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
|
9
|
-
s.authors = [
|
|
10
|
-
s.email = [
|
|
11
|
-
s.homepage =
|
|
9
|
+
s.authors = ['Nicolas Rodriguez']
|
|
10
|
+
s.email = ['nrodriguez@jbox-web.com']
|
|
11
|
+
s.homepage = 'https://github.com/jbox-web/gitolite'
|
|
12
12
|
s.summary = %q{A Ruby gem for manipulating the Gitolite Git backend via the gitolite-admin repository.}
|
|
13
|
-
s.description = %q{This gem is designed to provide a Ruby interface to the Gitolite Git backend system.
|
|
13
|
+
s.description = %q{This gem is designed to provide a Ruby interface to the Gitolite Git backend system. This gem aims to provide all management functionality that is available via the gitolite-admin repository (like SSH keys, repository permissions, etc)}
|
|
14
14
|
s.license = 'MIT'
|
|
15
15
|
|
|
16
|
-
s.rubyforge_project =
|
|
16
|
+
s.rubyforge_project = 'jbox-gitolite'
|
|
17
17
|
|
|
18
|
-
s.
|
|
19
|
-
s.add_development_dependency 'rdoc', '~> 4.1', '>= 4.1.1'
|
|
20
|
-
s.add_development_dependency 'rspec', '~> 3.0', '>= 3.0.0'
|
|
21
|
-
s.add_development_dependency 'guard-rspec', '~> 4.2', '>= 4.2.8'
|
|
22
|
-
s.add_development_dependency 'guard-spork', '~> 1.5', '>= 1.5.1'
|
|
23
|
-
s.add_development_dependency 'forgery', '~> 0.6', '>= 0.6.0'
|
|
24
|
-
s.add_development_dependency 'simplecov', '~> 0.8', '>= 0.8.2'
|
|
25
|
-
s.add_development_dependency 'simplecov-rcov', '~> 0.2', '>= 0.2.3'
|
|
26
|
-
s.add_development_dependency 'rspec_junit_formatter', '~> 0.2', '>= 0.2.0'
|
|
18
|
+
s.files = `git ls-files`.split("\n")
|
|
27
19
|
|
|
28
|
-
s.add_runtime_dependency 'gitlab-grit', '~> 2.7', '>= 2.7.
|
|
20
|
+
s.add_runtime_dependency 'gitlab-grit', '~> 2.7', '>= 2.7.2'
|
|
29
21
|
s.add_runtime_dependency 'gratr19', '~> 0.4', '>= 0.4.4.1'
|
|
30
22
|
|
|
31
|
-
s.
|
|
32
|
-
s.
|
|
33
|
-
s.
|
|
34
|
-
s.
|
|
23
|
+
s.add_development_dependency 'forgery'
|
|
24
|
+
s.add_development_dependency 'guard-rspec'
|
|
25
|
+
s.add_development_dependency 'pry'
|
|
26
|
+
s.add_development_dependency 'rake'
|
|
27
|
+
s.add_development_dependency 'rdoc'
|
|
28
|
+
s.add_development_dependency 'rspec'
|
|
29
|
+
s.add_development_dependency 'simplecov'
|
|
35
30
|
end
|
data/lib/gitolite.rb
CHANGED
data/lib/gitolite/config/repo.rb
CHANGED
|
@@ -95,12 +95,12 @@ module Gitolite
|
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
+
end
|
|
98
99
|
|
|
99
|
-
# Gets raised if a permission that isn't in the allowed
|
|
100
|
-
# list is passed in
|
|
101
|
-
class InvalidPermissionError < ArgumentError
|
|
102
|
-
end
|
|
103
100
|
|
|
101
|
+
# Gets raised if a permission that isn't in the allowed
|
|
102
|
+
# list is passed in
|
|
103
|
+
class InvalidPermissionError < ArgumentError
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
end
|
data/lib/gitolite/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
require '
|
|
2
|
-
require 'spork'
|
|
1
|
+
require 'simplecov'
|
|
3
2
|
require 'forgery'
|
|
3
|
+
require 'rspec'
|
|
4
|
+
require 'support/helper'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
## Start Simplecov
|
|
7
|
+
SimpleCov.start do
|
|
8
|
+
add_filter 'spec/'
|
|
9
|
+
end
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# need to restart spork for it take effect.
|
|
11
|
+
## Configure RSpec
|
|
12
|
+
RSpec.configure do |config|
|
|
13
|
+
include Helper
|
|
14
14
|
|
|
15
|
+
config.color = true
|
|
16
|
+
config.fail_fast = false
|
|
17
|
+
config.expect_with :rspec do |c|
|
|
18
|
+
c.syntax = :expect
|
|
19
|
+
end
|
|
15
20
|
end
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
# This code will be run each time you run your specs.
|
|
19
|
-
require File.expand_path('../../lib/gitolite', __FILE__)
|
|
20
|
-
include Gitolite
|
|
21
|
-
end
|
|
22
|
+
require 'gitolite'
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Gitolite::GitoliteAdmin do
|
|
4
4
|
|
|
5
|
-
conf_dir =
|
|
5
|
+
conf_dir = config_files_dir
|
|
6
6
|
output_dir = '/tmp'
|
|
7
7
|
# output_dir = File.join(File.dirname(File.dirname(__FILE__)), 'tmp')
|
|
8
8
|
|
|
@@ -10,26 +10,26 @@ describe Gitolite::GitoliteAdmin do
|
|
|
10
10
|
it 'should bootstrap a gitolite-admin repository' do
|
|
11
11
|
test_dir = File.join(output_dir, 'gitolite-admin-test1')
|
|
12
12
|
opts = { :overwrite => false }
|
|
13
|
-
gl_admin = GitoliteAdmin.bootstrap(test_dir, opts)
|
|
13
|
+
gl_admin = Gitolite::GitoliteAdmin.bootstrap(test_dir, opts)
|
|
14
14
|
|
|
15
15
|
expect(gl_admin).to be_a Gitolite::GitoliteAdmin
|
|
16
|
-
expect(GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be true
|
|
16
|
+
expect(Gitolite::GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be true
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it 'should bootstrap (overwrite) a gitolite-admin repository' do
|
|
20
20
|
test_dir = File.join(output_dir, 'gitolite-admin-test1')
|
|
21
21
|
opts = { :overwrite => true }
|
|
22
|
-
gl_admin = GitoliteAdmin.bootstrap(test_dir, opts)
|
|
22
|
+
gl_admin = Gitolite::GitoliteAdmin.bootstrap(test_dir, opts)
|
|
23
23
|
|
|
24
24
|
expect(gl_admin).to be_a Gitolite::GitoliteAdmin
|
|
25
|
-
expect(GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be true
|
|
25
|
+
expect(Gitolite::GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be true
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
describe '#is_gitolite_admin_repo?' do
|
|
30
30
|
it 'should detect a non gitolite-admin repository' do
|
|
31
31
|
test_dir = output_dir
|
|
32
|
-
expect(GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be false
|
|
32
|
+
expect(Gitolite::GitoliteAdmin.is_gitolite_admin_repo?(test_dir)).to be false
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -37,13 +37,13 @@ describe Gitolite::GitoliteAdmin do
|
|
|
37
37
|
it 'should commit file to gitolite-admin repository' do
|
|
38
38
|
test_dir = File.join(output_dir, 'gitolite-admin-test2')
|
|
39
39
|
opts = { :overwrite => true }
|
|
40
|
-
gl_admin = GitoliteAdmin.bootstrap(test_dir, opts)
|
|
40
|
+
gl_admin = Gitolite::GitoliteAdmin.bootstrap(test_dir, opts)
|
|
41
41
|
|
|
42
42
|
c = Gitolite::Config.new(File.join(conf_dir, 'complicated.conf'))
|
|
43
43
|
c.filename = 'gitolite.conf'
|
|
44
44
|
|
|
45
45
|
gl_admin.config = c
|
|
46
|
-
gl_admin.save
|
|
46
|
+
gl_admin.save('new commit', author: 'Test <test@example.com>')
|
|
47
47
|
|
|
48
48
|
new_file = File.join(test_dir, 'conf', c.filename)
|
|
49
49
|
expect(File.file?(new_file)).to be true
|
|
File without changes
|
|
@@ -52,7 +52,7 @@ describe Gitolite::Config::Repo do
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
it 'should not allow adding an invalid permission via an InvalidPermissionError' do
|
|
55
|
-
expect {@repo.add_permission("BadPerm")}.to raise_error
|
|
55
|
+
expect {@repo.add_permission("BadPerm")}.to raise_error(Gitolite::Config::InvalidPermissionError)
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Gitolite::SSHKey do
|
|
4
4
|
|
|
5
|
-
key_dir =
|
|
5
|
+
key_dir = ssh_key_files_dir
|
|
6
6
|
output_dir = '/tmp'
|
|
7
7
|
# output_dir = File.join(File.dirname(File.dirname(__FILE__)), 'tmp')
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ describe Gitolite::SSHKey do
|
|
|
10
10
|
it 'should construct an SSH key from a string' do
|
|
11
11
|
key = File.join(key_dir, 'bob.pub')
|
|
12
12
|
key_string = File.read(key)
|
|
13
|
-
s = SSHKey.from_string(key_string, "bob")
|
|
13
|
+
s = Gitolite::SSHKey.from_string(key_string, "bob")
|
|
14
14
|
|
|
15
15
|
expect(s.owner).to eq 'bob'
|
|
16
16
|
expect(s.location).to eq ""
|
|
@@ -19,13 +19,13 @@ describe Gitolite::SSHKey do
|
|
|
19
19
|
|
|
20
20
|
it 'should raise an ArgumentError when an owner isnt specified' do
|
|
21
21
|
key_string = "not_a_real_key"
|
|
22
|
-
expect(lambda { SSHKey.from_string(key_string) }).to raise_error
|
|
22
|
+
expect(lambda { Gitolite::SSHKey.from_string(key_string) }).to raise_error(ArgumentError)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it 'should have a location when one is specified' do
|
|
26
26
|
key = File.join(key_dir, 'bob.pub')
|
|
27
27
|
key_string = File.read(key)
|
|
28
|
-
s = SSHKey.from_string(key_string, "bob", "kansas")
|
|
28
|
+
s = Gitolite::SSHKey.from_string(key_string, "bob", "kansas")
|
|
29
29
|
|
|
30
30
|
expect(s.owner).to eq 'bob'
|
|
31
31
|
expect(s.location).to eq "kansas"
|
|
@@ -33,18 +33,18 @@ describe Gitolite::SSHKey do
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it 'should raise an ArgumentError when owner is nil' do
|
|
36
|
-
expect(lambda { SSHKey.from_string("bad_string", nil) }).to raise_error
|
|
36
|
+
expect(lambda { Gitolite::SSHKey.from_string("bad_string", nil) }).to raise_error(ArgumentError)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
it 'should raise an ArgumentError when we get an invalid SSHKey string' do
|
|
40
|
-
expect(lambda { SSHKey.from_string("bad_string", "bob") }).to raise_error
|
|
39
|
+
it 'should raise an ArgumentError when we get an invalid Gitolite::SSHKey string' do
|
|
40
|
+
expect(lambda { Gitolite::SSHKey.from_string("bad_string", "bob") }).to raise_error(ArgumentError)
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
describe "#from_file" do
|
|
45
45
|
it 'should load a key from a file' do
|
|
46
46
|
key = File.join(key_dir, 'bob.pub')
|
|
47
|
-
s = SSHKey.from_file(key)
|
|
47
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
48
48
|
key_string = File.read(key).split
|
|
49
49
|
|
|
50
50
|
expect(s.owner).to eq "bob"
|
|
@@ -53,14 +53,14 @@ describe Gitolite::SSHKey do
|
|
|
53
53
|
|
|
54
54
|
it 'should load a key with a location from a file' do
|
|
55
55
|
key = File.join(key_dir, 'bob@desktop.pub')
|
|
56
|
-
s = SSHKey.from_file(key)
|
|
56
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
57
57
|
expect(s.owner).to eq 'bob'
|
|
58
58
|
expect(s.location).to eq 'desktop'
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
it 'should load a key with owner and location from a file' do
|
|
62
62
|
key = File.join(key_dir, 'joe-bob@god-zilla.com@desktop.pub')
|
|
63
|
-
s = SSHKey.from_file(key)
|
|
63
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
64
64
|
expect(s.owner).to eq 'joe-bob@god-zilla.com'
|
|
65
65
|
expect(s.location).to eq 'desktop'
|
|
66
66
|
end
|
|
@@ -69,67 +69,67 @@ describe Gitolite::SSHKey do
|
|
|
69
69
|
describe '#owner' do
|
|
70
70
|
it 'owner should be bob for bob.pub' do
|
|
71
71
|
key = File.join(key_dir, 'bob.pub')
|
|
72
|
-
s = SSHKey.from_file(key)
|
|
72
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
73
73
|
expect(s.owner).to eq 'bob'
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it 'owner should be bob for bob@desktop.pub' do
|
|
77
77
|
key = File.join(key_dir, 'bob@desktop.pub')
|
|
78
|
-
s = SSHKey.from_file(key)
|
|
78
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
79
79
|
expect(s.owner).to eq 'bob'
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
it 'owner should be bob@zilla.com for bob@zilla.com.pub' do
|
|
83
83
|
key = File.join(key_dir, 'bob@zilla.com.pub')
|
|
84
|
-
s = SSHKey.from_file(key)
|
|
84
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
85
85
|
expect(s.owner).to eq 'bob@zilla.com'
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
it "owner should be joe-bob@god-zilla.com for joe-bob@god-zilla.com@desktop.pub" do
|
|
89
89
|
key = File.join(key_dir, 'joe-bob@god-zilla.com@desktop.pub')
|
|
90
|
-
s = SSHKey.from_file(key)
|
|
90
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
91
91
|
expect(s.owner).to eq 'joe-bob@god-zilla.com'
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
it "owner should be bob.joe@test.zilla.com for bob.joe@test.zilla.com@desktop.pub" do
|
|
95
95
|
key = File.join(key_dir, 'bob.joe@test.zilla.com@desktop.pub')
|
|
96
|
-
s = SSHKey.from_file(key)
|
|
96
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
97
97
|
expect(s.owner).to eq 'bob.joe@test.zilla.com'
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
it "owner should be bob+joe@test.zilla.com for bob+joe@test.zilla.com@desktop.pub" do
|
|
101
101
|
key = File.join(key_dir, 'bob+joe@test.zilla.com@desktop.pub')
|
|
102
|
-
s = SSHKey.from_file(key)
|
|
102
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
103
103
|
expect(s.owner).to eq 'bob+joe@test.zilla.com'
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
it 'owner should be bob@zilla.com for bob@zilla.com@desktop.pub' do
|
|
107
107
|
key = File.join(key_dir, 'bob@zilla.com@desktop.pub')
|
|
108
|
-
s = SSHKey.from_file(key)
|
|
108
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
109
109
|
expect(s.owner).to eq 'bob@zilla.com'
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
it 'owner should be jakub123 for jakub123.pub' do
|
|
113
113
|
key = File.join(key_dir, 'jakub123.pub')
|
|
114
|
-
s = SSHKey.from_file(key)
|
|
114
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
115
115
|
expect(s.owner).to eq 'jakub123'
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
it 'owner should be jakub123@foo.net for jakub123@foo.net.pub' do
|
|
119
119
|
key = File.join(key_dir, 'jakub123@foo.net.pub')
|
|
120
|
-
s = SSHKey.from_file(key)
|
|
120
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
121
121
|
expect(s.owner).to eq 'jakub123@foo.net'
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
it 'owner should be joe@sch.ool.edu for joe@sch.ool.edu' do
|
|
125
125
|
key = File.join(key_dir, 'joe@sch.ool.edu.pub')
|
|
126
|
-
s = SSHKey.from_file(key)
|
|
126
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
127
127
|
expect(s.owner).to eq 'joe@sch.ool.edu'
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
it 'owner should be joe@sch.ool.edu for joe@sch.ool.edu@desktop.pub' do
|
|
131
131
|
key = File.join(key_dir, 'joe@sch.ool.edu@desktop.pub')
|
|
132
|
-
s = SSHKey.from_file(key)
|
|
132
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
133
133
|
expect(s.owner).to eq 'joe@sch.ool.edu'
|
|
134
134
|
end
|
|
135
135
|
end
|
|
@@ -137,55 +137,55 @@ describe Gitolite::SSHKey do
|
|
|
137
137
|
describe '#location' do
|
|
138
138
|
it 'location should be "" for bob.pub' do
|
|
139
139
|
key = File.join(key_dir, 'bob.pub')
|
|
140
|
-
s = SSHKey.from_file(key)
|
|
140
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
141
141
|
expect(s.location).to eq ''
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
it 'location should be "desktop" for bob@desktop.pub' do
|
|
145
145
|
key = File.join(key_dir, 'bob@desktop.pub')
|
|
146
|
-
s = SSHKey.from_file(key)
|
|
146
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
147
147
|
expect(s.location).to eq 'desktop'
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
it 'location should be "" for bob@zilla.com.pub' do
|
|
151
151
|
key = File.join(key_dir, 'bob@zilla.com.pub')
|
|
152
|
-
s = SSHKey.from_file(key)
|
|
152
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
153
153
|
expect(s.location).to eq ''
|
|
154
154
|
end
|
|
155
155
|
|
|
156
156
|
it 'location should be "desktop" for bob@zilla.com@desktop.pub' do
|
|
157
157
|
key = File.join(key_dir, 'bob@zilla.com@desktop.pub')
|
|
158
|
-
s = SSHKey.from_file(key)
|
|
158
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
159
159
|
expect(s.location).to eq 'desktop'
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
it 'location should be "" for jakub123.pub' do
|
|
163
163
|
key = File.join(key_dir, 'jakub123.pub')
|
|
164
|
-
s = SSHKey.from_file(key)
|
|
164
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
165
165
|
expect(s.location).to eq ''
|
|
166
166
|
end
|
|
167
167
|
|
|
168
168
|
it 'location should be "" for jakub123@foo.net.pub' do
|
|
169
169
|
key = File.join(key_dir, 'jakub123@foo.net.pub')
|
|
170
|
-
s = SSHKey.from_file(key)
|
|
170
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
171
171
|
expect(s.location).to eq ''
|
|
172
172
|
end
|
|
173
173
|
|
|
174
174
|
it 'location should be "" for joe@sch.ool.edu' do
|
|
175
175
|
key = File.join(key_dir, 'joe@sch.ool.edu.pub')
|
|
176
|
-
s = SSHKey.from_file(key)
|
|
176
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
177
177
|
expect(s.location).to eq ''
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
it 'location should be "desktop" for joe@sch.ool.edu@desktop.pub' do
|
|
181
181
|
key = File.join(key_dir, 'joe@sch.ool.edu@desktop.pub')
|
|
182
|
-
s = SSHKey.from_file(key)
|
|
182
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
183
183
|
expect(s.location).to eq 'desktop'
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
it 'location should be "foo-bar" for bob@foo-bar.pub' do
|
|
187
187
|
key = File.join(key_dir, 'bob@foo-bar.pub')
|
|
188
|
-
s = SSHKey.from_file(key)
|
|
188
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
189
189
|
expect(s.location).to eq 'foo-bar'
|
|
190
190
|
end
|
|
191
191
|
end
|
|
@@ -193,7 +193,7 @@ describe Gitolite::SSHKey do
|
|
|
193
193
|
describe '#keys' do
|
|
194
194
|
it 'should load ssh key properly' do
|
|
195
195
|
key = File.join(key_dir, 'bob.pub')
|
|
196
|
-
s = SSHKey.from_file(key)
|
|
196
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
197
197
|
parts = File.read(key).split #should get type, blob, email
|
|
198
198
|
|
|
199
199
|
expect(s.type).to eq parts[0]
|
|
@@ -205,7 +205,7 @@ describe Gitolite::SSHKey do
|
|
|
205
205
|
describe '#email' do
|
|
206
206
|
it 'should use owner if email is missing' do
|
|
207
207
|
key = File.join(key_dir, 'jakub123@foo.net.pub')
|
|
208
|
-
s = SSHKey.from_file(key)
|
|
208
|
+
s = Gitolite::SSHKey.from_file(key)
|
|
209
209
|
expect(s.owner).to eq s.email
|
|
210
210
|
end
|
|
211
211
|
end
|
|
@@ -216,7 +216,7 @@ describe Gitolite::SSHKey do
|
|
|
216
216
|
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
|
|
217
217
|
email = Forgery::Internet.email_address
|
|
218
218
|
|
|
219
|
-
s = SSHKey.new(type, blob, email)
|
|
219
|
+
s = Gitolite::SSHKey.new(type, blob, email)
|
|
220
220
|
|
|
221
221
|
expect(s.to_s).to eq [type, blob, email].join(' ')
|
|
222
222
|
expect(s.owner).to eq email
|
|
@@ -228,7 +228,7 @@ describe Gitolite::SSHKey do
|
|
|
228
228
|
email = Forgery::Internet.email_address
|
|
229
229
|
owner = Forgery::Name.first_name
|
|
230
230
|
|
|
231
|
-
s = SSHKey.new(type, blob, email, owner)
|
|
231
|
+
s = Gitolite::SSHKey.new(type, blob, email, owner)
|
|
232
232
|
|
|
233
233
|
expect(s.to_s).to eq [type, blob, email].join(' ')
|
|
234
234
|
expect(s.owner).to eq owner
|
|
@@ -241,7 +241,7 @@ describe Gitolite::SSHKey do
|
|
|
241
241
|
owner = Forgery::Name.first_name
|
|
242
242
|
location = Forgery::Name.location
|
|
243
243
|
|
|
244
|
-
s = SSHKey.new(type, blob, email, owner, location)
|
|
244
|
+
s = Gitolite::SSHKey.new(type, blob, email, owner, location)
|
|
245
245
|
|
|
246
246
|
expect(s.to_s).to eq [type, blob, email].join(' ')
|
|
247
247
|
expect(s.owner).to eq owner
|
|
@@ -258,7 +258,7 @@ describe Gitolite::SSHKey do
|
|
|
258
258
|
location = Forgery::Name.location
|
|
259
259
|
|
|
260
260
|
hash_test = [owner, location, type, blob, email].hash
|
|
261
|
-
s = SSHKey.new(type, blob, email, owner, location)
|
|
261
|
+
s = Gitolite::SSHKey.new(type, blob, email, owner, location)
|
|
262
262
|
|
|
263
263
|
expect(s.hash).to eq hash_test
|
|
264
264
|
end
|
|
@@ -270,7 +270,7 @@ describe Gitolite::SSHKey do
|
|
|
270
270
|
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
|
|
271
271
|
email = Forgery::Internet.email_address
|
|
272
272
|
|
|
273
|
-
s = SSHKey.new(type, blob, email)
|
|
273
|
+
s = Gitolite::SSHKey.new(type, blob, email)
|
|
274
274
|
|
|
275
275
|
expect(s.filename).to eq "#{email}.pub"
|
|
276
276
|
end
|
|
@@ -281,7 +281,7 @@ describe Gitolite::SSHKey do
|
|
|
281
281
|
email = Forgery::Internet.email_address
|
|
282
282
|
owner = Forgery::Name.first_name
|
|
283
283
|
|
|
284
|
-
s = SSHKey.new(type, blob, email, owner)
|
|
284
|
+
s = Gitolite::SSHKey.new(type, blob, email, owner)
|
|
285
285
|
|
|
286
286
|
expect(s.filename).to eq "#{owner}.pub"
|
|
287
287
|
end
|
|
@@ -292,7 +292,7 @@ describe Gitolite::SSHKey do
|
|
|
292
292
|
email = Forgery::Internet.email_address
|
|
293
293
|
location = Forgery::Basic.text(:at_least => 8, :at_most => 15)
|
|
294
294
|
|
|
295
|
-
s = SSHKey.new(type, blob, email, nil, location)
|
|
295
|
+
s = Gitolite::SSHKey.new(type, blob, email, nil, location)
|
|
296
296
|
|
|
297
297
|
expect(s.filename).to eq "#{email}@#{location}.pub"
|
|
298
298
|
end
|
|
@@ -304,7 +304,7 @@ describe Gitolite::SSHKey do
|
|
|
304
304
|
owner = Forgery::Name.first_name
|
|
305
305
|
location = Forgery::Basic.text(:at_least => 8, :at_most => 15)
|
|
306
306
|
|
|
307
|
-
s = SSHKey.new(type, blob, email, owner, location)
|
|
307
|
+
s = Gitolite::SSHKey.new(type, blob, email, owner, location)
|
|
308
308
|
|
|
309
309
|
expect(s.filename).to eq "#{owner}@#{location}.pub"
|
|
310
310
|
end
|
|
@@ -318,7 +318,7 @@ describe Gitolite::SSHKey do
|
|
|
318
318
|
owner = Forgery::Name.first_name
|
|
319
319
|
location = Forgery::Basic.text(:at_least => 8, :at_most => 15)
|
|
320
320
|
|
|
321
|
-
s = SSHKey.new(type, blob, email, owner, location)
|
|
321
|
+
s = Gitolite::SSHKey.new(type, blob, email, owner, location)
|
|
322
322
|
|
|
323
323
|
## write file
|
|
324
324
|
s.to_file(output_dir)
|
|
@@ -334,7 +334,7 @@ describe Gitolite::SSHKey do
|
|
|
334
334
|
owner = Forgery::Name.first_name
|
|
335
335
|
location = Forgery::Basic.text(:at_least => 8, :at_most => 15)
|
|
336
336
|
|
|
337
|
-
s = SSHKey.new(type, blob, email, owner, location)
|
|
337
|
+
s = Gitolite::SSHKey.new(type, blob, email, owner, location)
|
|
338
338
|
|
|
339
339
|
expect(s.to_file(output_dir)).to eq File.join(output_dir, s.filename)
|
|
340
340
|
end
|
|
@@ -346,8 +346,8 @@ describe Gitolite::SSHKey do
|
|
|
346
346
|
blob = Forgery::Basic.text(:at_least => 372, :at_most => 372)
|
|
347
347
|
email = Forgery::Internet.email_address
|
|
348
348
|
|
|
349
|
-
s1 = SSHKey.new(type, blob, email)
|
|
350
|
-
s2 = SSHKey.new(type, blob, email)
|
|
349
|
+
s1 = Gitolite::SSHKey.new(type, blob, email)
|
|
350
|
+
s2 = Gitolite::SSHKey.new(type, blob, email)
|
|
351
351
|
|
|
352
352
|
expect(s1).to eq s2
|
|
353
353
|
end
|