brigit 0.9.1 → 0.9.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.
- data/Manifest +2 -0
- data/README.rdoc +5 -0
- data/Rakefile +2 -0
- data/brigit.gemspec +26 -3
- data/help/status.rdoc +9 -0
- data/lib/brigit/commands/command.rb +11 -1
- data/lib/brigit/commands/map_command.rb +0 -10
- data/lib/brigit/commands/status_command.rb +24 -0
- data/lib/brigit/commands/update_command.rb +14 -1
- data/lib/brigit/listable.rb +7 -1
- data/lib/brigit/version.rb +1 -1
- data/lib/brigit.rb +11 -0
- data/test/cli_test.rb +3 -3
- data/test/command_test.rb +6 -6
- data/test/fallible_test.rb +4 -4
- data/test/grab_command_test.rb +3 -3
- data/test/test_helper.rb +9 -4
- metadata +25 -2
data/Manifest
CHANGED
@@ -2,12 +2,14 @@ bin/brigit
|
|
2
2
|
help/grab.rdoc
|
3
3
|
help/hop.rdoc
|
4
4
|
help/map.rdoc
|
5
|
+
help/status.rdoc
|
5
6
|
help/update.rdoc
|
6
7
|
lib/brigit/cli.rb
|
7
8
|
lib/brigit/commands/command.rb
|
8
9
|
lib/brigit/commands/grab_command.rb
|
9
10
|
lib/brigit/commands/hop_command.rb
|
10
11
|
lib/brigit/commands/map_command.rb
|
12
|
+
lib/brigit/commands/status_command.rb
|
11
13
|
lib/brigit/commands/update_command.rb
|
12
14
|
lib/brigit/config_parser.rb
|
13
15
|
lib/brigit/fallible.rb
|
data/README.rdoc
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
A random collection of utilities for developers working with Git repositories.
|
4
4
|
|
5
|
+
== Dependencies
|
6
|
+
|
7
|
+
* git (>= 1.0.5) by Scott Chacon (sudo gem install git)
|
8
|
+
* highline (>= 1.4.0) by James Edward Gray II (sudo gem install highline)
|
9
|
+
|
5
10
|
== Contributing
|
6
11
|
|
7
12
|
Feel free to fork, send patches, etc. Development is done at http://github.com/fiveruns/brigit
|
data/Rakefile
CHANGED
@@ -12,4 +12,6 @@ Echoe.new 'brigit' do |p|
|
|
12
12
|
p.url = "http://github.com/fiveruns/brigit"
|
13
13
|
p.include_rakefile = true
|
14
14
|
p.rcov_options << '--sort coverage --exclude gems --text-summary'
|
15
|
+
p.runtime_dependencies << ['git', '>= 1.0.5']
|
16
|
+
p.runtime_dependencies << ['highline', '>= 1.4.0']
|
15
17
|
end
|
data/brigit.gemspec
CHANGED
@@ -1,20 +1,40 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Brigit-0.9.
|
2
|
+
# Gem::Specification for Brigit-0.9.2
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
--- !ruby/object:Gem::Specification
|
6
6
|
name: brigit
|
7
7
|
version: !ruby/object:Gem::Version
|
8
|
-
version: 0.9.
|
8
|
+
version: 0.9.2
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- FiveRuns Development Team
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
|
15
|
-
date: 2008-07-
|
15
|
+
date: 2008-07-28 00:00:00 -05:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: git
|
20
|
+
type: :runtime
|
21
|
+
version_requirement:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.5
|
27
|
+
version:
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: highline
|
30
|
+
type: :runtime
|
31
|
+
version_requirement:
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.4.0
|
37
|
+
version:
|
18
38
|
- !ruby/object:Gem::Dependency
|
19
39
|
name: echoe
|
20
40
|
type: :development
|
@@ -38,6 +58,7 @@ extra_rdoc_files:
|
|
38
58
|
- lib/brigit/commands/grab_command.rb
|
39
59
|
- lib/brigit/commands/hop_command.rb
|
40
60
|
- lib/brigit/commands/map_command.rb
|
61
|
+
- lib/brigit/commands/status_command.rb
|
41
62
|
- lib/brigit/commands/update_command.rb
|
42
63
|
- lib/brigit/config_parser.rb
|
43
64
|
- lib/brigit/fallible.rb
|
@@ -54,12 +75,14 @@ files:
|
|
54
75
|
- help/grab.rdoc
|
55
76
|
- help/hop.rdoc
|
56
77
|
- help/map.rdoc
|
78
|
+
- help/status.rdoc
|
57
79
|
- help/update.rdoc
|
58
80
|
- lib/brigit/cli.rb
|
59
81
|
- lib/brigit/commands/command.rb
|
60
82
|
- lib/brigit/commands/grab_command.rb
|
61
83
|
- lib/brigit/commands/hop_command.rb
|
62
84
|
- lib/brigit/commands/map_command.rb
|
85
|
+
- lib/brigit/commands/status_command.rb
|
63
86
|
- lib/brigit/commands/update_command.rb
|
64
87
|
- lib/brigit/config_parser.rb
|
65
88
|
- lib/brigit/fallible.rb
|
data/help/status.rdoc
ADDED
@@ -37,7 +37,7 @@ module Brigit
|
|
37
37
|
|
38
38
|
def say(message)
|
39
39
|
message = pretending? ? "{PRETENDING} #{message}" : message
|
40
|
-
|
40
|
+
HighLine.say message
|
41
41
|
end
|
42
42
|
|
43
43
|
def sh(command)
|
@@ -65,6 +65,16 @@ module Brigit
|
|
65
65
|
File.directory?(File.join(Dir.pwd, '.git'))
|
66
66
|
end
|
67
67
|
|
68
|
+
def submodules_at(path)
|
69
|
+
filename = File.join(path, '.gitmodules')
|
70
|
+
result = config_parser.parse(File.readlines(filename))
|
71
|
+
result.values
|
72
|
+
end
|
73
|
+
|
74
|
+
def config_parser
|
75
|
+
@config_parser ||= ConfigParser.new
|
76
|
+
end
|
77
|
+
|
68
78
|
end
|
69
79
|
|
70
80
|
end
|
@@ -42,16 +42,6 @@ module Brigit
|
|
42
42
|
result = config_parser.parse(File.readlines(filename))
|
43
43
|
result['remote "origin"']['url']
|
44
44
|
end
|
45
|
-
|
46
|
-
def submodules_at(path)
|
47
|
-
filename = File.join(path, '.gitmodules')
|
48
|
-
result = config_parser.parse(File.readlines(filename))
|
49
|
-
result.values
|
50
|
-
end
|
51
|
-
|
52
|
-
def config_parser
|
53
|
-
@config_parser ||= ConfigParser.new
|
54
|
-
end
|
55
45
|
|
56
46
|
end
|
57
47
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'brigit/commands/command'
|
2
|
+
require 'find'
|
3
|
+
|
4
|
+
module Brigit
|
5
|
+
|
6
|
+
class StatusCommand < Command
|
7
|
+
|
8
|
+
def run
|
9
|
+
super
|
10
|
+
say "<%= color '#{Dir.pwd}', :yellow, :bold %>"
|
11
|
+
sh "git status"
|
12
|
+
Brigit.at_dot_gitmodules do |path|
|
13
|
+
submodules_at(path).each do |sub|
|
14
|
+
say %<\n<%= color 'Submodule:', :yellow %> <%= color '#{sub['path']}', :yellow, :bold %> <%= color "(#{sub['url']})", :white %>>
|
15
|
+
Dir.chdir sub['path'] do
|
16
|
+
sh "git status"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -6,8 +6,21 @@ module Brigit
|
|
6
6
|
class UpdateCommand < Command
|
7
7
|
|
8
8
|
def run
|
9
|
-
|
9
|
+
pull = false
|
10
|
+
super do
|
11
|
+
parser.on('-p', '--pull', "Pull master repo (if on branch `master')") do
|
12
|
+
pull = true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
if pull
|
16
|
+
if Brigit.repo.branch.name == 'master'
|
17
|
+
sh "git pull origin master"
|
18
|
+
else
|
19
|
+
say "Not on `master' branch; skipping update of main repo..."
|
20
|
+
end
|
21
|
+
end
|
10
22
|
Brigit.at_dot_gitmodules do |path|
|
23
|
+
say "---\nSubmodule: #{path}"
|
11
24
|
sh "git submodule init"
|
12
25
|
sh "git submodule update"
|
13
26
|
end
|
data/lib/brigit/listable.rb
CHANGED
@@ -9,7 +9,13 @@ module Brigit
|
|
9
9
|
module ClassMethods
|
10
10
|
|
11
11
|
def [](name)
|
12
|
-
list.
|
12
|
+
matching = list.select { |klass| klass.name =~ /^#{Regexp.quote name}/io }
|
13
|
+
return false unless matching.any?
|
14
|
+
if matching.size > 1
|
15
|
+
HighLine.say %|<%= color "Too many matches for `#{name}'", :red %>|
|
16
|
+
return false
|
17
|
+
end
|
18
|
+
matching.first
|
13
19
|
end
|
14
20
|
|
15
21
|
def inherited(klass)
|
data/lib/brigit/version.rb
CHANGED
data/lib/brigit.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'find'
|
2
3
|
|
4
|
+
gem 'git', '>= 1.0.5'
|
5
|
+
require 'git'
|
6
|
+
|
7
|
+
gem 'highline', '>= 1.4.0'
|
8
|
+
require 'highline/import'
|
9
|
+
|
3
10
|
module Brigit
|
4
11
|
|
5
12
|
def self.at_dot_gitmodules(base = Dir.pwd)
|
@@ -44,6 +51,10 @@ module Brigit
|
|
44
51
|
end
|
45
52
|
end
|
46
53
|
end
|
54
|
+
|
55
|
+
def self.repo
|
56
|
+
Git.open(Dir.pwd)
|
57
|
+
end
|
47
58
|
|
48
59
|
end
|
49
60
|
|
data/test/cli_test.rb
CHANGED
@@ -8,11 +8,11 @@ class CLITest < Test::Unit::TestCase
|
|
8
8
|
context "Brigit::CLI" do
|
9
9
|
|
10
10
|
setup do
|
11
|
-
|
11
|
+
mock_streams!
|
12
12
|
end
|
13
13
|
|
14
14
|
teardown do
|
15
|
-
|
15
|
+
restore_streams!
|
16
16
|
end
|
17
17
|
|
18
18
|
should "parse valid command" do
|
@@ -26,7 +26,7 @@ class CLITest < Test::Unit::TestCase
|
|
26
26
|
assert_raises SystemExit do
|
27
27
|
parse %w(this-does-not-exist)
|
28
28
|
end
|
29
|
-
assert !
|
29
|
+
assert !stream_output.empty?
|
30
30
|
end
|
31
31
|
|
32
32
|
should "have banner with version number" do
|
data/test/command_test.rb
CHANGED
@@ -23,22 +23,22 @@ class CommandTest < Test::Unit::TestCase
|
|
23
23
|
|
24
24
|
context "say instance method" do
|
25
25
|
setup do
|
26
|
-
|
26
|
+
mock_streams!
|
27
27
|
end
|
28
28
|
teardown do
|
29
|
-
|
29
|
+
restore_streams!
|
30
30
|
end
|
31
31
|
should "output message" do
|
32
32
|
@klass.new.run
|
33
|
-
assert
|
34
|
-
assert !
|
33
|
+
assert stream_output.include?('foo')
|
34
|
+
assert !stream_output.include?('PRETEND')
|
35
35
|
end
|
36
36
|
should "mention pretending if doing so" do
|
37
37
|
instance = @klass.new
|
38
38
|
instance.pretend!
|
39
39
|
instance.run
|
40
|
-
assert
|
41
|
-
assert
|
40
|
+
assert stream_output.include?('foo')
|
41
|
+
assert stream_output.include?('PRETEND')
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
data/test/fallible_test.rb
CHANGED
@@ -8,11 +8,11 @@ class FallibleTest < Test::Unit::TestCase
|
|
8
8
|
setup do
|
9
9
|
@klass = Class.new
|
10
10
|
@klass.send(:include, Brigit::Fallible)
|
11
|
-
|
11
|
+
mock_streams!
|
12
12
|
end
|
13
13
|
|
14
14
|
teardown do
|
15
|
-
|
15
|
+
restore_streams!
|
16
16
|
end
|
17
17
|
|
18
18
|
context "fail method" do
|
@@ -22,8 +22,8 @@ class FallibleTest < Test::Unit::TestCase
|
|
22
22
|
should "output CLI banner and message" do
|
23
23
|
assert_raises SystemExit do
|
24
24
|
@klass.new.fail @failed
|
25
|
-
assert
|
26
|
-
assert
|
25
|
+
assert stream_output.include?(Brigit::CLI.banner)
|
26
|
+
assert stream_output.include?(@failed)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/test/grab_command_test.rb
CHANGED
@@ -5,11 +5,11 @@ class GrabCommandTest < Test::Unit::TestCase
|
|
5
5
|
context "GrabCommand" do
|
6
6
|
|
7
7
|
setup do
|
8
|
-
|
8
|
+
mock_streams!
|
9
9
|
@command = Brigit::GrabCommand.new
|
10
10
|
end
|
11
11
|
|
12
|
-
teardown {
|
12
|
+
teardown { restore_streams! }
|
13
13
|
|
14
14
|
context "update instance method" do
|
15
15
|
setup do
|
@@ -33,7 +33,7 @@ class GrabCommandTest < Test::Unit::TestCase
|
|
33
33
|
assert_nothing_raised do
|
34
34
|
update 'missing_directory'
|
35
35
|
end
|
36
|
-
assert
|
36
|
+
assert stream_output.include?('skipping')
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/test/test_helper.rb
CHANGED
@@ -20,18 +20,23 @@ class Test::Unit::TestCase
|
|
20
20
|
FileUtils.rm_rf File.join(location, '.git') rescue nil
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def mock_streams!
|
24
|
+
@old_output = $terminal.instance_variable_get(:@output)
|
25
|
+
$terminal.instance_variable_set(:@output, StringIO.new)
|
24
26
|
@old_stderr = $stderr
|
25
27
|
$stderr = StringIO.new
|
26
28
|
end
|
27
29
|
|
28
|
-
def
|
30
|
+
def restore_streams!
|
31
|
+
$terminal.instance_variable_set(:@output, @old_output)
|
29
32
|
$stderr = @old_stderr
|
30
33
|
end
|
31
34
|
|
32
|
-
def
|
35
|
+
def stream_output
|
36
|
+
output = $terminal.instance_variable_get(:@output)
|
37
|
+
output.rewind
|
33
38
|
$stderr.rewind
|
34
|
-
$stderr.read
|
39
|
+
output.read << $stderr.read
|
35
40
|
end
|
36
41
|
|
37
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brigit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FiveRuns Development Team
|
@@ -9,9 +9,29 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-28 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: git
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.5
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: highline
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.4.0
|
34
|
+
version:
|
15
35
|
- !ruby/object:Gem::Dependency
|
16
36
|
name: echoe
|
17
37
|
type: :development
|
@@ -35,6 +55,7 @@ extra_rdoc_files:
|
|
35
55
|
- lib/brigit/commands/grab_command.rb
|
36
56
|
- lib/brigit/commands/hop_command.rb
|
37
57
|
- lib/brigit/commands/map_command.rb
|
58
|
+
- lib/brigit/commands/status_command.rb
|
38
59
|
- lib/brigit/commands/update_command.rb
|
39
60
|
- lib/brigit/config_parser.rb
|
40
61
|
- lib/brigit/fallible.rb
|
@@ -51,12 +72,14 @@ files:
|
|
51
72
|
- help/grab.rdoc
|
52
73
|
- help/hop.rdoc
|
53
74
|
- help/map.rdoc
|
75
|
+
- help/status.rdoc
|
54
76
|
- help/update.rdoc
|
55
77
|
- lib/brigit/cli.rb
|
56
78
|
- lib/brigit/commands/command.rb
|
57
79
|
- lib/brigit/commands/grab_command.rb
|
58
80
|
- lib/brigit/commands/hop_command.rb
|
59
81
|
- lib/brigit/commands/map_command.rb
|
82
|
+
- lib/brigit/commands/status_command.rb
|
60
83
|
- lib/brigit/commands/update_command.rb
|
61
84
|
- lib/brigit/config_parser.rb
|
62
85
|
- lib/brigit/fallible.rb
|