Rugged 是一个 Git 的 Ruby 开发包,使用 libgit2 API
$ geminstallrugged
require'rugged'# => #<Rugged::Repository:2228536260 {path: "path/to/my/repository/.git/"}>Rugged::Repository.discover("/Users/me/projects/repo/lib/subdir/")# => "/Users/me/projects/repo/.git/"# Does the given SHA1 exist in this repository?repo.exists?('07b44cbda23b726e5d54e2ef383495922c024202')# => true# Boolean repository state values:repo.bare?# => falserepo.empty?# => truerepo.head_orphan?# => falserepo.head_detached?# => false# Path Accessorsrepo.path# => "path/to/my/repository/.git/"repo.workdir# => "path/to/my/repository/"# The HEAD of the repository.ref = repo.head# => #<Rugged::Reference:2228467240 {name: "refs/heads/master", target: "07b44cbda23b726e5d54e2ef383495922c024202"}># From the returned ref, you can also access the `name` and `target`:ref.name# => "refs/heads/master"ref.target# => "07b44cbda23b726e5d54e2ef383495922c024202"# Reading an objectobject = repo.read('a0ae5566e3c8a3bddffab21022056f0b5e03ef07')# => #<Rugged::OdbObject:0x109a64780>object.len# => 237object.Data# => "tree 76f23f186076fc291742816721ea8c3e95567241\nparent 8e3c5c52b8f29da0adc7e8be8a037cbeaea6de6b\nauthor VICEnt Mart\303\255 <tanoku@Gmail.com> 1333859005 +0200\ncommitter Vicent Mart\303\255 <tanoku@gmail.com> 1333859005 +0200\n\nAdd `Repository#blob_at`\n"object.type# => :commit
发布于 2016-03-11 01:28:54 | 108 次阅读
发布于 2016-03-03 00:27:37 | 168 次阅读
发布于 2016-02-16 23:30:52 | 109 次阅读
发布于 2015-08-14 00:00:16 | 187 次阅读
发布于 2015-06-29 23:56:56 | 123 次阅读
发布于 2015-06-27 01:29:46 | 97 次阅读
发布于 2015-05-18 23:27:03 | 124 次阅读
发布于 2015-03-10 04:32:19 | 205 次阅读
发布于 2015-01-18 23:47:27 | 188 次阅读
发布于 2014-12-19 00:22:32 | 161 次阅读
发布于 2014-11-19 00:56:26 | 166 次阅读