gitreport 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -1
- data/VERSION +1 -1
- data/gitreport.gemspec +25 -13
- 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/index.rb +5 -0
- data/lib/git/lib.rb +720 -0
- data/lib/git/log.rb +117 -0
- data/lib/git/object.rb +273 -0
- data/lib/git/path.rb +27 -0
- data/lib/git/remote.rb +40 -0
- data/lib/git/repository.rb +4 -0
- data/lib/git/stash.rb +27 -0
- data/lib/git/stashes.rb +44 -0
- data/lib/git/status.rb +110 -0
- data/lib/git/working_directory.rb +4 -0
- data/lib/git.rb +156 -0
- metadata +109 -163
data/lib/git.rb
ADDED
@@ -0,0 +1,156 @@
|
|
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/repository'
|
12
|
+
require 'git/index'
|
13
|
+
require 'git/working_directory'
|
14
|
+
|
15
|
+
require 'git/log'
|
16
|
+
require 'git/object'
|
17
|
+
|
18
|
+
require 'git/branches'
|
19
|
+
require 'git/branch'
|
20
|
+
require 'git/remote'
|
21
|
+
|
22
|
+
require 'git/diff'
|
23
|
+
require 'git/status'
|
24
|
+
require 'git/author'
|
25
|
+
|
26
|
+
require 'git/stashes'
|
27
|
+
require 'git/stash'
|
28
|
+
|
29
|
+
lib = Git::Lib.new(nil, nil)
|
30
|
+
unless lib.meets_required_version?
|
31
|
+
$stderr.puts "[WARNING] The git gem requires git #{lib.required_command_version.join('.')} or later, but only found #{lib.current_command_version.join('.')}. You should probably upgrade."
|
32
|
+
end
|
33
|
+
|
34
|
+
# Git/Ruby Library
|
35
|
+
#
|
36
|
+
# This provides bindings for working with git in complex
|
37
|
+
# interactions, including branching and merging, object
|
38
|
+
# inspection and manipulation, history, patch generation
|
39
|
+
# and more. You should be able to do most fundamental git
|
40
|
+
# operations with this library.
|
41
|
+
#
|
42
|
+
# This module provides the basic functions to open a git
|
43
|
+
# reference to work with. You can open a working directory,
|
44
|
+
# open a bare repository, initialize a new repo or clone an
|
45
|
+
# existing remote repository.
|
46
|
+
#
|
47
|
+
# Author:: Scott Chacon (mailto:schacon@gmail.com)
|
48
|
+
# License:: MIT License
|
49
|
+
module Git
|
50
|
+
|
51
|
+
VERSION = '1.0.4'
|
52
|
+
|
53
|
+
# open a bare repository
|
54
|
+
#
|
55
|
+
# this takes the path to a bare git repo
|
56
|
+
# it expects not to be able to use a working directory
|
57
|
+
# so you can't checkout stuff, commit things, etc.
|
58
|
+
# but you can do most read operations
|
59
|
+
def self.bare(git_dir, options = {})
|
60
|
+
Base.bare(git_dir, options)
|
61
|
+
end
|
62
|
+
|
63
|
+
# open an existing git working directory
|
64
|
+
#
|
65
|
+
# this will most likely be the most common way to create
|
66
|
+
# a git reference, referring to a working directory.
|
67
|
+
# if not provided in the options, the library will assume
|
68
|
+
# your git_dir and index are in the default place (.git/, .git/index)
|
69
|
+
#
|
70
|
+
# options
|
71
|
+
# :repository => '/path/to/alt_git_dir'
|
72
|
+
# :index => '/path/to/alt_index_file'
|
73
|
+
def self.open(working_dir, options = {})
|
74
|
+
Base.open(working_dir, options)
|
75
|
+
end
|
76
|
+
|
77
|
+
# initialize a new git repository, defaults to the current working directory
|
78
|
+
#
|
79
|
+
# options
|
80
|
+
# :repository => '/path/to/alt_git_dir'
|
81
|
+
# :index => '/path/to/alt_index_file'
|
82
|
+
def self.init(working_dir = '.', options = {})
|
83
|
+
Base.init(working_dir, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
# clones a remote repository
|
87
|
+
#
|
88
|
+
# options
|
89
|
+
# :bare => true (does a bare clone)
|
90
|
+
# :repository => '/path/to/alt_git_dir'
|
91
|
+
# :index => '/path/to/alt_index_file'
|
92
|
+
#
|
93
|
+
# example
|
94
|
+
# Git.clone('git://repo.or.cz/rubygit.git', 'clone.git', :bare => true)
|
95
|
+
#
|
96
|
+
def self.clone(repository, name, options = {})
|
97
|
+
Base.clone(repository, name, options)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Export the current HEAD (or a branch, if <tt>options[:branch]</tt>
|
101
|
+
# is specified) into the +name+ directory, then remove all traces of git from the
|
102
|
+
# directory.
|
103
|
+
#
|
104
|
+
# See +clone+ for options. Does not obey the <tt>:remote</tt> option,
|
105
|
+
# since the .git info will be deleted anyway; always uses the default
|
106
|
+
# remote, 'origin.'
|
107
|
+
def self.export(repository, name, options = {})
|
108
|
+
options.delete(:remote)
|
109
|
+
repo = clone(repository, name, {:depth => 1}.merge(options))
|
110
|
+
repo.checkout("origin/#{options[:branch]}") if options[:branch]
|
111
|
+
Dir.chdir(repo.dir.to_s) { FileUtils.rm_r '.git' }
|
112
|
+
end
|
113
|
+
|
114
|
+
#g.config('user.name', 'Scott Chacon') # sets value
|
115
|
+
#g.config('user.email', 'email@email.com') # sets value
|
116
|
+
#g.config('user.name') # returns 'Scott Chacon'
|
117
|
+
#g.config # returns whole config hash
|
118
|
+
def config(name = nil, value = nil)
|
119
|
+
lib = Git::Lib.new
|
120
|
+
if(name && value)
|
121
|
+
# set value
|
122
|
+
lib.config_set(name, value)
|
123
|
+
elsif (name)
|
124
|
+
# return value
|
125
|
+
lib.config_get(name)
|
126
|
+
else
|
127
|
+
# return hash
|
128
|
+
lib.config_list
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Same as g.config, but forces it to be at the global level
|
133
|
+
#
|
134
|
+
#g.config('user.name', 'Scott Chacon') # sets value
|
135
|
+
#g.config('user.email', 'email@email.com') # sets value
|
136
|
+
#g.config('user.name') # returns 'Scott Chacon'
|
137
|
+
#g.config # returns whole config hash
|
138
|
+
def self.global_config(name = nil, value = nil)
|
139
|
+
lib = Git::Lib.new(nil, nil)
|
140
|
+
if(name && value)
|
141
|
+
# set value
|
142
|
+
lib.global_config_set(name, value)
|
143
|
+
elsif (name)
|
144
|
+
# return value
|
145
|
+
lib.global_config_get(name)
|
146
|
+
else
|
147
|
+
# return hash
|
148
|
+
lib.global_config_list
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def global_config(name = nil, value = nil)
|
153
|
+
self.class.global_config(name, value)
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
metadata
CHANGED
@@ -1,178 +1,116 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitreport
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
segments_generated: true
|
11
|
-
version: 0.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
12
6
|
platform: ruby
|
13
|
-
authors:
|
7
|
+
authors:
|
14
8
|
- Jan Roesner
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
23
|
-
type: :runtime
|
24
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
segments_generated: true
|
33
|
-
version: "0"
|
34
|
-
prerelease: false
|
12
|
+
date: 2011-10-16 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
35
15
|
name: json
|
36
|
-
requirement:
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
type: :runtime
|
39
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70154220983680 !ruby/object:Gem::Requirement
|
40
17
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
- 1
|
47
|
-
- 2
|
48
|
-
- 5
|
49
|
-
segments_generated: true
|
50
|
-
version: 1.2.5
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
51
23
|
prerelease: false
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: *70154220983680
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: spork
|
27
|
+
requirement: &70154220983200 !ruby/object:Gem::Requirement
|
57
28
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
hash: 7712082
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
- 9
|
65
|
-
- 0
|
66
|
-
- rc
|
67
|
-
segments_generated: true
|
29
|
+
requirements:
|
30
|
+
- - ! '>'
|
31
|
+
- !ruby/object:Gem::Version
|
68
32
|
version: 0.9.0.rc
|
69
|
-
prerelease: false
|
70
|
-
name: spork
|
71
|
-
requirement: *id003
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
33
|
type: :development
|
74
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
|
-
requirements:
|
77
|
-
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
hash: 3
|
80
|
-
segments:
|
81
|
-
- 0
|
82
|
-
segments_generated: true
|
83
|
-
version: "0"
|
84
34
|
prerelease: false
|
35
|
+
version_requirements: *70154220983200
|
36
|
+
- !ruby/object:Gem::Dependency
|
85
37
|
name: rspec
|
86
|
-
requirement:
|
87
|
-
- !ruby/object:Gem::Dependency
|
88
|
-
type: :development
|
89
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70154220982720 !ruby/object:Gem::Requirement
|
90
39
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
|
95
|
-
|
96
|
-
- 0
|
97
|
-
segments_generated: true
|
98
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
99
45
|
prerelease: false
|
46
|
+
version_requirements: *70154220982720
|
47
|
+
- !ruby/object:Gem::Dependency
|
100
48
|
name: webmock
|
101
|
-
requirement:
|
102
|
-
- !ruby/object:Gem::Dependency
|
103
|
-
type: :development
|
104
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70154220982240 !ruby/object:Gem::Requirement
|
105
50
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
- 0
|
112
|
-
segments_generated: true
|
113
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
114
56
|
prerelease: false
|
57
|
+
version_requirements: *70154220982240
|
58
|
+
- !ruby/object:Gem::Dependency
|
115
59
|
name: shoulda
|
116
|
-
requirement:
|
117
|
-
|
60
|
+
requirement: &70154220981760 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
118
66
|
type: :development
|
119
|
-
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70154220981760
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: &70154220981280 !ruby/object:Gem::Requirement
|
120
72
|
none: false
|
121
|
-
requirements:
|
73
|
+
requirements:
|
122
74
|
- - ~>
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
hash: 23
|
125
|
-
segments:
|
126
|
-
- 1
|
127
|
-
- 0
|
128
|
-
- 0
|
129
|
-
segments_generated: true
|
75
|
+
- !ruby/object:Gem::Version
|
130
76
|
version: 1.0.0
|
131
|
-
prerelease: false
|
132
|
-
name: bundler
|
133
|
-
requirement: *id007
|
134
|
-
- !ruby/object:Gem::Dependency
|
135
77
|
type: :development
|
136
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70154220981280
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: jeweler
|
82
|
+
requirement: &70154220980800 !ruby/object:Gem::Requirement
|
137
83
|
none: false
|
138
|
-
requirements:
|
84
|
+
requirements:
|
139
85
|
- - ~>
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
hash: 7
|
142
|
-
segments:
|
143
|
-
- 1
|
144
|
-
- 6
|
145
|
-
- 4
|
146
|
-
segments_generated: true
|
86
|
+
- !ruby/object:Gem::Version
|
147
87
|
version: 1.6.4
|
148
|
-
prerelease: false
|
149
|
-
name: jeweler
|
150
|
-
requirement: *id008
|
151
|
-
- !ruby/object:Gem::Dependency
|
152
88
|
type: :development
|
153
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
|
-
requirements:
|
156
|
-
- - ">="
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
hash: 3
|
159
|
-
segments:
|
160
|
-
- 0
|
161
|
-
segments_generated: true
|
162
|
-
version: "0"
|
163
89
|
prerelease: false
|
90
|
+
version_requirements: *70154220980800
|
91
|
+
- !ruby/object:Gem::Dependency
|
164
92
|
name: rcov
|
165
|
-
requirement:
|
166
|
-
|
93
|
+
requirement: &70154220980320 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70154220980320
|
102
|
+
description: gitreport keeps track of your projects. It collects info about commited
|
103
|
+
and pushed data, submits it to our servers and provides a gorgous frontend to examine,
|
104
|
+
discover and extract the data that you need to generate the payment recipes for
|
105
|
+
your customers. No longer searching or `what did I commit when and where`...
|
167
106
|
email: jan@roesner.it
|
168
|
-
executables:
|
107
|
+
executables:
|
169
108
|
- gitreport
|
170
109
|
extensions: []
|
171
|
-
|
172
|
-
extra_rdoc_files:
|
110
|
+
extra_rdoc_files:
|
173
111
|
- LICENSE.txt
|
174
112
|
- README.rdoc
|
175
|
-
files:
|
113
|
+
files:
|
176
114
|
- .document
|
177
115
|
- Gemfile
|
178
116
|
- Gemfile.lock
|
@@ -186,6 +124,23 @@ files:
|
|
186
124
|
- lib/commit.rb
|
187
125
|
- lib/configuration.rb
|
188
126
|
- lib/current_branch.rb
|
127
|
+
- lib/git.rb
|
128
|
+
- lib/git/author.rb
|
129
|
+
- lib/git/base.rb
|
130
|
+
- lib/git/branch.rb
|
131
|
+
- lib/git/branches.rb
|
132
|
+
- lib/git/diff.rb
|
133
|
+
- lib/git/index.rb
|
134
|
+
- lib/git/lib.rb
|
135
|
+
- lib/git/log.rb
|
136
|
+
- lib/git/object.rb
|
137
|
+
- lib/git/path.rb
|
138
|
+
- lib/git/remote.rb
|
139
|
+
- lib/git/repository.rb
|
140
|
+
- lib/git/stash.rb
|
141
|
+
- lib/git/stashes.rb
|
142
|
+
- lib/git/status.rb
|
143
|
+
- lib/git/working_directory.rb
|
189
144
|
- lib/git_configuration.rb
|
190
145
|
- lib/gitreport.rb
|
191
146
|
- lib/history.rb
|
@@ -211,41 +166,32 @@ files:
|
|
211
166
|
- spec/models/supplier_spec.rb
|
212
167
|
- spec/spec_helper.rb
|
213
168
|
- spec/support/fake_repository.rb
|
214
|
-
has_rdoc: true
|
215
169
|
homepage: http://github.com/janroesner/gitreport
|
216
|
-
licenses:
|
170
|
+
licenses:
|
217
171
|
- MIT
|
218
172
|
post_install_message:
|
219
173
|
rdoc_options: []
|
220
|
-
|
221
|
-
require_paths:
|
174
|
+
require_paths:
|
222
175
|
- lib
|
223
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
224
177
|
none: false
|
225
|
-
requirements:
|
226
|
-
- -
|
227
|
-
- !ruby/object:Gem::Version
|
228
|
-
|
229
|
-
segments:
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
segments:
|
230
183
|
- 0
|
231
|
-
|
232
|
-
|
233
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
|
+
hash: 1846363214430054671
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
186
|
none: false
|
235
|
-
requirements:
|
236
|
-
- -
|
237
|
-
- !ruby/object:Gem::Version
|
238
|
-
|
239
|
-
segments:
|
240
|
-
- 0
|
241
|
-
segments_generated: true
|
242
|
-
version: "0"
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
243
191
|
requirements: []
|
244
|
-
|
245
192
|
rubyforge_project:
|
246
|
-
rubygems_version: 1.
|
193
|
+
rubygems_version: 1.8.10
|
247
194
|
signing_key:
|
248
195
|
specification_version: 3
|
249
196
|
summary: gitreport tracks commit and push info of your git projects
|
250
197
|
test_files: []
|
251
|
-
|