gitrb 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/gitrb.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gitrb'
3
- s.version = '0.0.9'
3
+ s.version = '0.1.0'
4
4
  s.summary = 'Pure ruby git implementation'
5
5
  s.author = 'Daniel Mendler'
6
6
  s.email = 'mail@daniel-mendler.de'
data/lib/gitrb/blob.rb CHANGED
@@ -9,7 +9,7 @@ module Gitrb
9
9
  def initialize(options = {})
10
10
  super(options)
11
11
  @data = options[:data]
12
- @mode = options[:mode] || '100644'
12
+ @mode = options[:mode] || 0100644
13
13
  end
14
14
 
15
15
  def type
@@ -12,12 +12,11 @@ module Gitrb
12
12
  instance_eval %{def self.#{name}(*args, &block); @object.send("#{name}", *args, &block); end}
13
13
  @object.send(name, *args, &block)
14
14
  elsif name == :type && (mode = @properties['mode'] || @properties[:mode])
15
- mode = mode.to_i(8)
16
- return (mode & 0x4000 == 0x4000) ? :tree : :blob
15
+ (mode & 040000 == 040000) ? :tree : :blob
17
16
  elsif @properties.include?(name)
18
- return @properties[name]
17
+ @properties[name]
19
18
  elsif @properties.include?(name.to_s)
20
- return @properties[name.to_s]
19
+ @properties[name.to_s]
21
20
  elsif object
22
21
  method_missing(name, *args, &block)
23
22
  else
data/lib/gitrb/tree.rb CHANGED
@@ -9,7 +9,7 @@ module Gitrb
9
9
  def initialize(options = {})
10
10
  super(options)
11
11
  @children = {}
12
- @mode = options[:mode] || "040000"
12
+ @mode = options[:mode] || 040000
13
13
  parse(options[:data]) if options[:data]
14
14
  @modified = true if !id
15
15
  end
@@ -36,11 +36,11 @@ module Gitrb
36
36
  def dump
37
37
  @children.to_a.sort {|a,b| a.first <=> b.first }.map do |name, child|
38
38
  child.save if !(Reference === child) || child.resolved?
39
- "#{child.mode} #{name}\0#{repository.set_encoding [child.id].pack("H*")}"
39
+ "#{child.mode.to_s(8)} #{name}\0#{repository.set_encoding [child.id].pack("H*")}"
40
40
  end.join
41
41
  end
42
42
 
43
- # Save this treetree back to the git repository.
43
+ # Save this tree back to the git repository.
44
44
  #
45
45
  # Returns the object id of the tree.
46
46
  def save
@@ -137,7 +137,7 @@ module Gitrb
137
137
  @children.clear
138
138
  data = StringIO.new(data)
139
139
  while !data.eof?
140
- mode = repository.set_encoding Util.read_bytes_until(data, ' ')
140
+ mode = Util.read_bytes_until(data, ' ').to_i(8)
141
141
  name = repository.set_encoding Util.read_bytes_until(data, "\0")
142
142
  id = repository.set_encoding data.read(20).unpack("H*").first
143
143
  @children[name] = Reference.new(:repository => repository, :id => id, :mode => mode)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Mendler
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-21 00:00:00 +02:00
12
+ date: 2010-05-26 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies: []
15
15