minigit 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -0
- data/lib/minigit.rb +3 -0
- data/lib/minigit/version.rb +1 -1
- data/spec/minigit_spec.rb +18 -0
- metadata +61 -71
data/README.md
CHANGED
@@ -162,6 +162,17 @@ CustomGit.git_command # => "/path/to/git"
|
|
162
162
|
CustomGit.new.git_command # => "/path/to/git"
|
163
163
|
```
|
164
164
|
|
165
|
+
### Debugging
|
166
|
+
|
167
|
+
Set `MiniGit.debug` to true to see what MiniGit is doing:
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
MiniGit.debug = true
|
171
|
+
MiniGit.new('.').status
|
172
|
+
# + [/Users/japhy/Projekty/minigit] git rev-parse --git-dir --show-toplevel # => ".git\n/Users/japhy/Projekty/minigit\n"
|
173
|
+
# + git status
|
174
|
+
```
|
175
|
+
|
165
176
|
## Issues
|
166
177
|
|
167
178
|
Non-capturing MiniGit doesn't always play well when Git is configured
|
data/lib/minigit.rb
CHANGED
@@ -5,6 +5,7 @@ require "minigit/version"
|
|
5
5
|
|
6
6
|
class MiniGit
|
7
7
|
class << self
|
8
|
+
attr_accessor :debug
|
8
9
|
attr_writer :git_command
|
9
10
|
|
10
11
|
def git_command
|
@@ -49,6 +50,7 @@ class MiniGit
|
|
49
50
|
path = path.dirname unless path.directory?
|
50
51
|
Dir.chdir(path.to_s) do
|
51
52
|
out = `#{git_command} rev-parse --git-dir --show-toplevel`
|
53
|
+
$stderr.puts "+ [#{Dir.pwd}] #{git_command} rev-parse --git-dir --show-toplevel # => #{out.inspect}" if MiniGit.debug
|
52
54
|
raise ArgumentError, "Invalid repository path #{where}" unless $?.success?
|
53
55
|
out
|
54
56
|
end.lines.map { |ln| path.join(Pathname.new(ln.strip)).realpath.to_s }
|
@@ -68,6 +70,7 @@ class MiniGit
|
|
68
70
|
def git(*args)
|
69
71
|
argv = switches_for(*args)
|
70
72
|
with_git_env do
|
73
|
+
$stderr.puts "+ #{git_command} #{Shellwords.join(argv)}" if MiniGit.debug
|
71
74
|
rv = system(git_command, *argv)
|
72
75
|
raise GitError.new(argv, $?) unless $?.success?
|
73
76
|
rv
|
data/lib/minigit/version.rb
CHANGED
data/spec/minigit_spec.rb
CHANGED
@@ -137,4 +137,22 @@ describe MiniGit do
|
|
137
137
|
MiniGit.git :status
|
138
138
|
end
|
139
139
|
end
|
140
|
+
|
141
|
+
describe '.debug' do
|
142
|
+
before { MiniGit.debug = true }
|
143
|
+
after { MiniGit.debug = false }
|
144
|
+
|
145
|
+
it 'makes MiniGit print the commands it runs' do
|
146
|
+
git.stubs(:system)
|
147
|
+
out, err = capture_io { git.status }
|
148
|
+
assert { err.include?("+ git status\n") }
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'makes MiniGit also print out rev-parse command with its directory' do
|
152
|
+
out, err = capture_io { MiniGit.new('.') }
|
153
|
+
assert { err.include?(
|
154
|
+
"+ [#{Dir.pwd}] git rev-parse --git-dir --show-toplevel # => "
|
155
|
+
) }
|
156
|
+
end
|
157
|
+
end
|
140
158
|
end
|
metadata
CHANGED
@@ -1,104 +1,96 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minigit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Maciej Pasternacki
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: wrong
|
16
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
17
18
|
requirements:
|
18
|
-
- -
|
19
|
+
- - ! '>='
|
19
20
|
- !ruby/object:Gem::Version
|
20
21
|
version: 0.7.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
25
|
none: false
|
22
|
-
requirement: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 0.7.0
|
27
|
-
none: false
|
28
|
-
prerelease: false
|
29
|
-
type: :development
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
33
34
|
requirements:
|
34
|
-
- -
|
35
|
+
- - ! '>='
|
35
36
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
37
|
-
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
none: false
|
39
|
-
requirement: !ruby/object:Gem::Requirement
|
40
42
|
requirements:
|
41
|
-
- -
|
43
|
+
- - ! '>='
|
42
44
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
MA==
|
45
|
-
none: false
|
46
|
-
prerelease: false
|
47
|
-
type: :development
|
45
|
+
version: '0'
|
48
46
|
- !ruby/object:Gem::Dependency
|
49
47
|
name: minitest
|
50
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
51
50
|
requirements:
|
52
|
-
- -
|
51
|
+
- - ! '>='
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
56
57
|
none: false
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
MA==
|
63
|
-
none: false
|
64
|
-
prerelease: false
|
65
|
-
type: :development
|
61
|
+
version: '0'
|
66
62
|
- !ruby/object:Gem::Dependency
|
67
63
|
name: mocha
|
68
|
-
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
69
66
|
requirements:
|
70
|
-
- -
|
67
|
+
- - ! '>='
|
71
68
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
73
|
-
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
73
|
none: false
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
76
74
|
requirements:
|
77
|
-
- -
|
75
|
+
- - ! '>='
|
78
76
|
- !ruby/object:Gem::Version
|
79
|
-
version:
|
80
|
-
MA==
|
81
|
-
none: false
|
82
|
-
prerelease: false
|
83
|
-
type: :development
|
77
|
+
version: '0'
|
84
78
|
- !ruby/object:Gem::Dependency
|
85
79
|
name: simplecov
|
86
|
-
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
87
82
|
requirements:
|
88
|
-
- -
|
83
|
+
- - ! '>='
|
89
84
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
91
|
-
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
89
|
none: false
|
93
|
-
requirement: !ruby/object:Gem::Requirement
|
94
90
|
requirements:
|
95
|
-
- -
|
91
|
+
- - ! '>='
|
96
92
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
98
|
-
MA==
|
99
|
-
none: false
|
100
|
-
prerelease: false
|
101
|
-
type: :development
|
93
|
+
version: '0'
|
102
94
|
description: A simple Ruby interface for Git
|
103
95
|
email:
|
104
96
|
- maciej@pasternacki.net
|
@@ -106,8 +98,8 @@ executables: []
|
|
106
98
|
extensions: []
|
107
99
|
extra_rdoc_files: []
|
108
100
|
files:
|
109
|
-
-
|
110
|
-
-
|
101
|
+
- .gitignore
|
102
|
+
- .travis.yml
|
111
103
|
- Gemfile
|
112
104
|
- LICENSE.txt
|
113
105
|
- README.md
|
@@ -123,34 +115,32 @@ files:
|
|
123
115
|
- spec/spec_helper.rb~
|
124
116
|
homepage: https://github.com/3ofcoins/minigit
|
125
117
|
licenses: []
|
126
|
-
post_install_message:
|
118
|
+
post_install_message:
|
127
119
|
rdoc_options: []
|
128
120
|
require_paths:
|
129
121
|
- lib
|
130
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
131
124
|
requirements:
|
132
|
-
- -
|
125
|
+
- - ! '>='
|
133
126
|
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
134
128
|
segments:
|
135
129
|
- 0
|
136
|
-
hash:
|
137
|
-
version: !binary |-
|
138
|
-
MA==
|
139
|
-
none: false
|
130
|
+
hash: 360386013991135033
|
140
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
141
133
|
requirements:
|
142
|
-
- -
|
134
|
+
- - ! '>='
|
143
135
|
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
144
137
|
segments:
|
145
138
|
- 0
|
146
|
-
hash:
|
147
|
-
version: !binary |-
|
148
|
-
MA==
|
149
|
-
none: false
|
139
|
+
hash: 360386013991135033
|
150
140
|
requirements: []
|
151
|
-
rubyforge_project:
|
152
|
-
rubygems_version: 1.8.
|
153
|
-
signing_key:
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 1.8.25
|
143
|
+
signing_key:
|
154
144
|
specification_version: 3
|
155
145
|
summary: A simple Ruby interface for Git
|
156
146
|
test_files:
|