rjgit 0.1.0 → 0.2.0

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.
data/Gemfile CHANGED
@@ -1,6 +1,9 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem "mime-types", "~> 1.15"
4
+ gem "rake", "~> 0.9.2.2"
5
+
6
+ gem 'coveralls', require: false
4
7
 
5
8
  group :test do
6
9
  gem "rspec", "~> 2.0"
data/LICENSE CHANGED
@@ -6,8 +6,7 @@ Copyright (c) 2013, Team Repotag
6
6
 
7
7
  All rights reserved.
8
8
 
9
- Redistribution and use in source and binary forms, with or without
10
- modification, are permitted provided that the following conditions are met:
9
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
11
10
 
12
11
  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
13
12
  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
data/README.md CHANGED
@@ -1,8 +1,11 @@
1
- JGit
1
+ RJGit
2
2
  =====
3
3
 
4
4
  ###A JRuby wrapper around the [JGit library](https://github.com/eclipse/jgit) for manipulating Git repositories, the Ruby way.
5
5
 
6
+ [![Build Status](https://travis-ci.org/repotag/rjgit.png)](https://travis-ci.org/repotag/rjgit)
7
+ [![Coverage Status](https://coveralls.io/repos/repotag/rjgit/badge.png?branch=master)](https://coveralls.io/r/repotag/rjgit)
8
+
6
9
  Authors
7
10
  -------
8
11
 
@@ -15,7 +18,7 @@ RJGit is being developed by Team Repotag:
15
18
  - [Steven Woudenberg](https://github.com/stevenwoudenberg)
16
19
 
17
20
  With special thanks to:
18
- - Patrick Pepels
21
+ - [Patrick Pepels](https://github.com/bluedread)
19
22
 
20
23
  Installation
21
24
  ------------
@@ -1,11 +1,13 @@
1
1
  module RJGit
2
2
 
3
- import 'org.eclipse.jgit.lib.Config'
3
+ # Wraps 'org.eclipse.jgit.lib.Config'
4
4
 
5
5
  class Configuration
6
-
6
+
7
7
  attr_reader :jconfig, :path
8
8
 
9
+ RJGit.delegate_to(org.eclipse.jgit.lib.Config, :@jconfig)
10
+
9
11
  def initialize(path)
10
12
  @path = path
11
13
  @jconfig = org.eclipse.jgit.lib.Config.new
@@ -91,4 +93,4 @@ module RJGit
91
93
  end
92
94
 
93
95
  end # Config
94
- end
96
+ end
@@ -2,7 +2,6 @@ module RJGit
2
2
 
3
3
  import 'org.eclipse.jgit.lib.Repository'
4
4
  import 'org.eclipse.jgit.lib.RepositoryBuilder'
5
- import 'org.eclipse.jgit.storage.file.FileRepository'
6
5
  import 'org.eclipse.jgit.treewalk.TreeWalk'
7
6
  import 'org.eclipse.jgit.treewalk.filter.PathFilter'
8
7
  import 'org.eclipse.jgit.lib.Constants'
@@ -43,15 +42,23 @@ module RJGit
43
42
 
44
43
  def initialize(path, options = {})
45
44
  epath = File.expand_path(path)
46
-
45
+ gitpath = File.join(epath, '.git')
46
+
47
+ # Default value for bare
47
48
  bare = false
48
- if File.exist?(File.join(epath, '/.git'))
49
- bare = false
50
- elsif File.exist?(epath) || options[:bare]
51
- bare = true
49
+ # If the repo path is new
50
+ unless File.exists?(epath)
51
+ # take user setting if defined
52
+ bare = !! options[:bare] unless options[:bare].nil?
53
+ # If the repo path exists
54
+ else
55
+ # scan the directory for a .git directory
56
+ bare = File.exists?(gitpath) ? false : true
57
+ # but allow overriding user setting
58
+ bare = !! options[:bare] unless options[:bare].nil?
52
59
  end
53
-
54
- @path = bare ? epath : File.join(epath, '/.git')
60
+
61
+ @path = bare ? epath : gitpath
55
62
  @config = RJGit::Configuration.new(File.join(@path, 'config'))
56
63
  repo_path = java.io.File.new(@path)
57
64
  @jrepo = bare ? RepositoryBuilder.new().set_bare.set_git_dir(repo_path).build() : RepositoryBuilder.new().set_git_dir(repo_path).build()
@@ -62,16 +69,24 @@ module RJGit
62
69
  def bare?
63
70
  @jrepo.is_bare
64
71
  end
65
-
72
+
66
73
  def self.create(path, options = {:bare => false})
67
74
  options[:create] = true
68
75
  Repo.new(path, options)
69
76
  end
77
+
78
+ def create!
79
+ @jrepo.create(self.bare?)
80
+ end
70
81
 
71
82
  def commits(ref="master", limit=100)
72
83
  options = { :limit => limit }
73
84
  Commit.find_all(@jrepo, ref, options)
74
85
  end
86
+
87
+ def valid?
88
+ @jrepo.get_object_database.exists
89
+ end
75
90
 
76
91
  def config
77
92
  @config.load
@@ -1,3 +1,3 @@
1
1
  module RJGit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rjgit
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Maarten Engelen
@@ -13,19 +13,19 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-04-03 00:00:00.000000000 Z
16
+ date: 2013-07-18 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: mime-types
20
20
  version_requirements: !ruby/object:Gem::Requirement
21
21
  requirements:
22
- - - "~>"
22
+ - - ~>
23
23
  - !ruby/object:Gem::Version
24
24
  version: '1.15'
25
25
  none: false
26
26
  requirement: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
28
+ - - ~>
29
29
  - !ruby/object:Gem::Version
30
30
  version: '1.15'
31
31
  none: false
@@ -55,27 +55,30 @@ files:
55
55
  - LICENSE
56
56
  - Gemfile
57
57
  - lib/java/jars/jsch-0.1.49.jar
58
- - lib/java/jars/org.eclipse.jgit-2.3.1.201302201838-r.jar
58
+ - lib/java/jars/org.eclipse.jgit-3.0.0.201306101825-r.jar
59
59
  homepage: https://github.com/repotag/rjgit
60
- licenses: []
60
+ licenses:
61
+ - Modified BSD
62
+ - EPL
61
63
  post_install_message:
62
64
  rdoc_options:
63
- - "--charset=UTF-8"
65
+ - --charset=UTF-8
64
66
  require_paths:
65
67
  - lib
66
68
  required_ruby_version: !ruby/object:Gem::Requirement
67
69
  requirements:
68
- - - ">="
70
+ - - '>='
69
71
  - !ruby/object:Gem::Version
70
- version: !binary |-
71
- MA==
72
+ segments:
73
+ - 0
74
+ hash: 2
75
+ version: '0'
72
76
  none: false
73
77
  required_rubygems_version: !ruby/object:Gem::Requirement
74
78
  requirements:
75
- - - ">="
79
+ - - '>='
76
80
  - !ruby/object:Gem::Version
77
- version: !binary |-
78
- MA==
81
+ version: '0'
79
82
  none: false
80
83
  requirements: []
81
84
  rubyforge_project: