simple_git 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec33662c6ec067a7ff1acfd4474faa39c266514095ea15d4e07a3dcc460a29d0
4
- data.tar.gz: 7868fef5e6f901c66c69719e981aa4ff3e02183fc0f4fca5a5c42a6d1b6409a1
3
+ metadata.gz: bdb1902dec8bb172009fcc2248ef4bd603fdd179ef9068c0d6811e813363a132
4
+ data.tar.gz: 5bb013a78bc27ed4a7969eb438597016f3e525347383f814caada7ba80c9b206
5
5
  SHA512:
6
- metadata.gz: 40483dd8f8d26fe3b9bec4a19974261598405edacd0ae661bb2b1f030b6595ea4f7500b7011ddad31bf38c239ba92f3c273aa7b2a0766933253a6c5ea01789e0
7
- data.tar.gz: 6eb55b0c2721adf84c3a2191a3c7f08fd4b983bc33a41ef2d79502801bffd9333d126fca8cf03f1bf55d8e6b27b0e2d7abf6dec55fdd7a93d1136769de750bee
6
+ metadata.gz: 66407df6d074172e70dae66d6cb5a20693ff1386997e5e28440296ce7743530a0ffa82360c5c950d58446a459ce5a7dbb7ecc90f2468e3f5b60d3e57a971c055
7
+ data.tar.gz: 3383ffa03fd3273bba8eb6e0a37dee14224b7af77c806f61c8dea121fdae19e4143b4e3d11f84ae4e1919f7bb42710acbbfde9e03a5a38fe00c858da84009101
data/README.md CHANGED
@@ -1,3 +1,28 @@
1
1
  # simple_git
2
2
 
3
3
  High-level git wrapper for rb-libgit2
4
+
5
+ ## Example
6
+
7
+ ```ruby
8
+ require 'simple_git'
9
+
10
+ repo = SimpleGit::Repository.new('/path/to/git/repo')
11
+ walk = SimpleGit::Revwalk.new(repo)
12
+
13
+ puts "Current HEAD: #{repo.revparse('HEAD')}\n"
14
+
15
+ walk.sort(:GIT_SORT_TOPOLOGICAL)
16
+ walk.push_head
17
+
18
+ puts 'Last 25 commits:\n'
19
+
20
+ walk.take(25).each do |c|
21
+ next if c.parent_count != 1
22
+
23
+ stat = c.diff(c.parent(0)).stats
24
+
25
+ puts "Commit #{c.oid[0..7]} by #{c.author.name} #{c.author.email} (+#{stat.insertions}/-#{stat.deletions}):"
26
+ puts " #{c.message}"
27
+ end
28
+ ```
@@ -4,7 +4,11 @@ module SimpleGit
4
4
 
5
5
  def initialize(path)
6
6
  wrapper = RepositoryWrapper.new
7
- Git2.git_repository_open(wrapper, path)
7
+ ret = Git2.git_repository_open(wrapper, path)
8
+ if ret != 0
9
+ error = Git2::GitError.new(Git2.giterr_last)
10
+ raise ArgumentError, error[:message].read_string
11
+ end
8
12
 
9
13
  @ptr = wrapper[:repo]
10
14
 
@@ -1,3 +1,3 @@
1
1
  module SimpleGit
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liam P. White