minad-git 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +244 -0
- data/lib/git/author.rb +14 -0
- data/lib/git/base.rb +479 -0
- data/lib/git/branch.rb +104 -0
- data/lib/git/branches.rb +48 -0
- data/lib/git/diff.rb +146 -0
- data/lib/git/lib.rb +664 -0
- data/lib/git/log.rb +117 -0
- data/lib/git/object.rb +277 -0
- data/lib/git/path.rb +27 -0
- data/lib/git/remote.rb +40 -0
- data/lib/git/stash.rb +27 -0
- data/lib/git/stashes.rb +44 -0
- data/lib/git/status.rb +109 -0
- data/lib/git.rb +106 -0
- metadata +68 -0
data/lib/git.rb
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
|
2
|
+
# Add the directory containing this file to the start of the load path if it
|
3
|
+
# isn't there already.
|
4
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
5
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
6
|
+
|
7
|
+
require 'git/base'
|
8
|
+
require 'git/path'
|
9
|
+
require 'git/lib'
|
10
|
+
|
11
|
+
require 'git/log'
|
12
|
+
require 'git/object'
|
13
|
+
|
14
|
+
require 'git/branches'
|
15
|
+
require 'git/branch'
|
16
|
+
require 'git/remote'
|
17
|
+
|
18
|
+
require 'git/diff'
|
19
|
+
require 'git/status'
|
20
|
+
require 'git/author'
|
21
|
+
|
22
|
+
require 'git/stashes'
|
23
|
+
require 'git/stash'
|
24
|
+
|
25
|
+
|
26
|
+
# Git/Ruby Library
|
27
|
+
#
|
28
|
+
# This provides bindings for working with git in complex
|
29
|
+
# interactions, including branching and merging, object
|
30
|
+
# inspection and manipulation, history, patch generation
|
31
|
+
# and more. You should be able to do most fundamental git
|
32
|
+
# operations with this library.
|
33
|
+
#
|
34
|
+
# This module provides the basic functions to open a git
|
35
|
+
# reference to work with. You can open a working directory,
|
36
|
+
# open a bare repository, initialize a new repo or clone an
|
37
|
+
# existing remote repository.
|
38
|
+
#
|
39
|
+
# Author:: Scott Chacon (mailto:schacon@gmail.com)
|
40
|
+
# License:: MIT License
|
41
|
+
module Git
|
42
|
+
|
43
|
+
VERSION = '1.1.1'
|
44
|
+
|
45
|
+
# open a bare repository
|
46
|
+
#
|
47
|
+
# this takes the path to a bare git repo
|
48
|
+
# it expects not to be able to use a working directory
|
49
|
+
# so you can't checkout stuff, commit things, etc.
|
50
|
+
# but you can do most read operations
|
51
|
+
def self.bare(git_dir, options = {})
|
52
|
+
Base.bare(git_dir, options)
|
53
|
+
end
|
54
|
+
|
55
|
+
# open an existing git working directory
|
56
|
+
#
|
57
|
+
# this will most likely be the most common way to create
|
58
|
+
# a git reference, referring to a working directory.
|
59
|
+
# if not provided in the options, the library will assume
|
60
|
+
# your git_dir and index are in the default place (.git/, .git/index)
|
61
|
+
#
|
62
|
+
# options
|
63
|
+
# :repository => '/path/to/alt_git_dir'
|
64
|
+
# :index => '/path/to/alt_index_file'
|
65
|
+
def self.open(working_dir, options = {})
|
66
|
+
Base.open(working_dir, options)
|
67
|
+
end
|
68
|
+
|
69
|
+
# initialize a new git repository, defaults to the current working directory
|
70
|
+
#
|
71
|
+
# options
|
72
|
+
# :repository => '/path/to/alt_git_dir'
|
73
|
+
# :index => '/path/to/alt_index_file'
|
74
|
+
def self.init(working_dir = '.', options = {})
|
75
|
+
Base.init(working_dir, options)
|
76
|
+
end
|
77
|
+
|
78
|
+
# clones a remote repository
|
79
|
+
#
|
80
|
+
# options
|
81
|
+
# :bare => true (does a bare clone)
|
82
|
+
# :repository => '/path/to/alt_git_dir'
|
83
|
+
# :index => '/path/to/alt_index_file'
|
84
|
+
#
|
85
|
+
# example
|
86
|
+
# Git.clone('git://repo.or.cz/rubygit.git', 'clone.git', :bare => true)
|
87
|
+
#
|
88
|
+
def self.clone(repository, name, options = {})
|
89
|
+
Base.clone(repository, name, options)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Export the current HEAD (or a branch, if <tt>options[:branch]</tt>
|
93
|
+
# is specified) into the +name+ directory, then remove all traces of git from the
|
94
|
+
# directory.
|
95
|
+
#
|
96
|
+
# See +clone+ for options. Does not obey the <tt>:remote</tt> option,
|
97
|
+
# since the .git info will be deleted anyway; always uses the default
|
98
|
+
# remote, 'origin.'
|
99
|
+
def self.export(repository, name, options = {})
|
100
|
+
options.delete(:remote)
|
101
|
+
repo = clone(repository, name, {:depth => 1}.merge(options))
|
102
|
+
repo.checkout("origin/#{options[:branch]}") if options[:branch]
|
103
|
+
Dir.chdir(repo.dir.to_s) { FileUtils.rm_r '.git' }
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minad-git
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Chacon
|
8
|
+
autorequire: git
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-13 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: schacon@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
files:
|
25
|
+
- lib/git
|
26
|
+
- lib/git/author.rb
|
27
|
+
- lib/git/base.rb
|
28
|
+
- lib/git/branch.rb
|
29
|
+
- lib/git/branches.rb
|
30
|
+
- lib/git/diff.rb
|
31
|
+
- lib/git/lib.rb
|
32
|
+
- lib/git/log.rb
|
33
|
+
- lib/git/object.rb
|
34
|
+
- lib/git/path.rb
|
35
|
+
- lib/git/remote.rb
|
36
|
+
- lib/git/stash.rb
|
37
|
+
- lib/git/stashes.rb
|
38
|
+
- lib/git/status.rb
|
39
|
+
- lib/git.rb
|
40
|
+
- README
|
41
|
+
has_rdoc: true
|
42
|
+
homepage:
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
version:
|
60
|
+
requirements: []
|
61
|
+
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.2.0
|
64
|
+
signing_key:
|
65
|
+
specification_version: 2
|
66
|
+
summary: A package for using Git in Ruby code.
|
67
|
+
test_files: []
|
68
|
+
|