Skip to content
Browse files

Ruby 1.8 support

  • Loading branch information...
1 parent 5643666 commit d0b34739e28c886dce95571be483a31c0bf6fedf @wingrunr21 wingrunr21 committed
Showing with 17 additions and 11 deletions.
  1. +1 −4 README.rdoc
  2. +1 −0 lib/gitolite.rb
  3. +1 −1 lib/gitolite/config.rb
  4. +8 −3 lib/gitolite/config/repo.rb
  5. +1 −1 lib/gitolite/ssh_key.rb
  6. +2 −0 spec/concurrency_spec.rb
  7. +1 −1 spec/config_spec.rb
  8. +2 −1 spec/repo_spec.rb
View
5 README.rdoc
@@ -13,7 +13,7 @@ This gem is still under very active development. There are a number of issues w
* Gem is not thread safe. For now, the gem will change directories in order to perform git operations. It will, however, return to the old working directory once it is finished. I am looking into making the gem thread safe.
== Requirements
-* Ruby 1.9.2 or higher
+* Ruby 1.8.x or 1.9.x
* a working {gitolite}[https://github.com/sitaramc/gitolite] installation
* the <tt>gitolite-admin</tt> repository checked out locally
@@ -121,9 +121,6 @@ You can also pass a message to be used for the initial bootstrap commit:
Please note that while bootstrapping is supported, I highly recommend that the initial gitolite-admin repo be created by gitolite itself.
== Caveats
-=== 1.8.x compatibility
-This gem should work properly on Ruby 1.8.x with the exception of deny rules. In order to fully support Ruby < 1.9.x, an ordered Hash is required. The one implemented by ActiveSupport could probably be used. Support will be added if there appears to be a demand for it.
-
=== Windows compatibility
The grit gem (which is used for under-the-hood git operations) does not currently support Windows. Until it does, gitolite will be unable to support Windows.
View
1 lib/gitolite.rb
@@ -1,5 +1,6 @@
module Gitolite
require 'grit'
+ require 'hashery'
require 'gitolite/ssh_key'
require 'gitolite/config'
require 'gitolite/gitolite_admin'
View
2 lib/gitolite/config.rb
@@ -15,7 +15,7 @@ def initialize(config)
def self.init(filename = "gitolite.conf")
file = Tempfile.new(filename)
- conf = self.new(file)
+ conf = self.new(file.path)
conf.filename = filename #kill suffix added by Tempfile
file.close(unlink_now = true)
conf
View
11 lib/gitolite/config/repo.rb
@@ -1,3 +1,5 @@
+require 'hashery'
+
module Gitolite
class Config
#Represents a repo inside the gitolite configuration. The name, permissions, and git config
@@ -8,11 +10,14 @@ class Repo
attr_accessor :permissions, :name, :config, :owner, :description
def initialize(name)
- @name = name
#Store the perm hash in a lambda since we have to create a new one on every deny rule
- @perm_hash_lambda = lambda { Hash.new {|k,v| k[v] = Hash.new{|k2, v2| k2[v2] = [] }} }
+ #The perm hash is stored as a 2D hash, with individual permissions being the first
+ #degree and individual refexes being the second degree. Both Hashes must respect order
+ @perm_hash_lambda = lambda { OrderedHash.new {|k,v| k[v] = OrderedHash.new{|k2, v2| k2[v2] = [] }} }
@permissions = Array.new.push(@perm_hash_lambda.call)
- @config = {}
+
+ @name = name
+ @config = {} #git config
end
def clean_permissions
View
2 lib/gitolite/ssh_key.rb
@@ -47,7 +47,7 @@ def to_s
def to_file(path)
key_file = File.join(path, self.filename)
File.open(key_file, "w") do |f|
- f.write (self.to_s)
+ f.write(self.to_s)
end
key_file
end
View
2 spec/concurrency_spec.rb
@@ -0,0 +1,2 @@
+#require 'gitolite'
+#require 'spec_helper'
View
2 spec/config_spec.rb
@@ -262,7 +262,7 @@
g = Gitolite::Config::Group.new('cool_group')
ngroups = @config.groups.size
@config.add_group(g)
- @config.groups.size.should eql (ngroups + 1)
+ @config.groups.size.should be ngroups + 1
@config.has_group?(:cool_group).should be true
end
View
3 spec/repo_spec.rb
@@ -1,4 +1,5 @@
-require 'gitolite/config'
+require 'gitolite/config/repo'
+require 'spec_helper'
describe Gitolite::Config::Repo do
before(:each) do

0 comments on commit d0b3473

Please sign in to comment.
Something went wrong with that request. Please try again.