git_remote_branch 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/grb +1 -1
- data/lib/constants.rb +1 -1
- data/lib/git_remote_branch.rb +8 -8
- data/lib/param_reader.rb +8 -8
- data/lib/version.rb +4 -4
- data/tasks/gem.rake +19 -21
- metadata +35 -53
data/bin/grb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Check out the README (or try 'grb help') before you screw up your repos ;-)
|
4
4
|
|
5
5
|
THIS_FILE = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
|
6
|
-
require
|
6
|
+
require File.expand_path('../lib/git_remote_branch', File.dirname(THIS_FILE))
|
7
7
|
|
8
8
|
include GitRemoteBranch
|
9
9
|
|
data/lib/constants.rb
CHANGED
data/lib/git_remote_branch.rb
CHANGED
@@ -84,7 +84,7 @@ module GitRemoteBranch
|
|
84
84
|
]
|
85
85
|
}
|
86
86
|
} unless defined?(COMMANDS)
|
87
|
-
|
87
|
+
|
88
88
|
def self.get_reverse_map(commands)
|
89
89
|
h={}
|
90
90
|
commands.each_pair do |cmd, params|
|
@@ -99,7 +99,7 @@ module GitRemoteBranch
|
|
99
99
|
h
|
100
100
|
end
|
101
101
|
ALIAS_REVERSE_MAP = get_reverse_map(COMMANDS) unless defined?(ALIAS_REVERSE_MAP)
|
102
|
-
|
102
|
+
|
103
103
|
def get_welcome
|
104
104
|
"git_remote_branch version #{VERSION::STRING}\n\n"
|
105
105
|
end
|
@@ -109,19 +109,19 @@ module GitRemoteBranch
|
|
109
109
|
Usage:
|
110
110
|
|
111
111
|
#{[:create, :publish, :rename, :delete, :track].map{|action|
|
112
|
-
" grb #{action} branch_name [origin_server]
|
113
|
-
}
|
112
|
+
" grb #{action} branch_name [origin_server]"
|
113
|
+
} * "\n"
|
114
114
|
}
|
115
|
-
|
115
|
+
|
116
116
|
Notes:
|
117
117
|
- If origin_server is not specified, the name 'origin' is assumed (git's default)
|
118
118
|
- The rename functionality renames the current branch
|
119
|
-
|
119
|
+
|
120
120
|
The explain meta-command: you can also prepend any command with the keyword 'explain'. Instead of executing the command, git_remote_branch will simply output the list of commands you need to run to accomplish that goal.
|
121
|
-
Example:
|
121
|
+
Example:
|
122
122
|
grb explain create
|
123
123
|
grb explain create my_branch github
|
124
|
-
|
124
|
+
|
125
125
|
All commands also have aliases:
|
126
126
|
#{ COMMANDS.keys.map{|k| k.to_s}.sort.map {|cmd|
|
127
127
|
"#{cmd}: #{COMMANDS[cmd.to_sym][:aliases].join(', ')}" }.join("\n ") }
|
data/lib/param_reader.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
module GitRemoteBranch
|
2
|
-
|
3
|
-
private
|
2
|
+
|
3
|
+
private
|
4
4
|
HELP_PARAMS = {:action => :help}
|
5
5
|
|
6
6
|
public
|
7
7
|
def read_params(argv)
|
8
8
|
#TODO Some validation on the params
|
9
|
-
|
9
|
+
|
10
10
|
p={}
|
11
11
|
p[:silent] = silent!(argv)
|
12
12
|
p[:explain] = explain_mode!(argv)
|
13
|
-
|
13
|
+
|
14
14
|
p[:action] = get_action(argv[0]) or return HELP_PARAMS
|
15
15
|
|
16
16
|
return HELP_PARAMS if p[:action] == :help
|
17
17
|
|
18
18
|
p[:branch] = get_branch(argv[1])
|
19
19
|
p[:origin] = get_origin(argv[2])
|
20
|
-
|
20
|
+
|
21
21
|
# If in explain mode, the user doesn't have to specify a branch or be on in
|
22
|
-
# actual repo to get the explanation.
|
22
|
+
# actual repo to get the explanation.
|
23
23
|
# Of course if he is, the explanation will be made better by using contextual info.
|
24
24
|
if p[:explain]
|
25
25
|
p[:branch] ||= "branch_to_#{p[:action]}"
|
@@ -44,7 +44,7 @@ module GitRemoteBranch
|
|
44
44
|
false
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def silent!(argv)
|
49
49
|
!!argv.delete('--silent')
|
50
50
|
end
|
@@ -56,7 +56,7 @@ module GitRemoteBranch
|
|
56
56
|
def get_branch(branch)
|
57
57
|
branch
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def get_origin(origin)
|
61
61
|
return origin || 'origin'
|
62
62
|
end
|
data/lib/version.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
module GitRemoteBranch
|
1
|
+
module GitRemoteBranch
|
2
2
|
module VERSION #:nodoc:
|
3
3
|
MAJOR = 0
|
4
4
|
MINOR = 3
|
5
|
-
TINY =
|
6
|
-
|
5
|
+
TINY = 2
|
6
|
+
|
7
7
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
NAME = 'git_remote_branch'
|
11
11
|
COMPLETE_NAME = "#{NAME} #{VERSION::STRING}"
|
12
12
|
COMMAND_NAME = 'grb'
|
data/tasks/gem.rake
CHANGED
@@ -17,14 +17,14 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.has_rdoc = true
|
18
18
|
s.extra_rdoc_files << 'README.rdoc'
|
19
19
|
s.rdoc_options << '--main' << 'README.rdoc' << '--exclude' << 'lib'
|
20
|
-
|
20
|
+
|
21
21
|
s.test_files = Dir['test/**/*'].reject{|f| f =~ /test_runs/}
|
22
22
|
s.files = Dir['**/*'].reject{|f| f =~ /\Apkg|\Acoverage|\Ardoc|test_runs|\.gemspec\Z/}
|
23
|
-
|
23
|
+
|
24
24
|
s.executable = 'grb'
|
25
25
|
s.bindir = "bin"
|
26
26
|
s.require_path = "lib"
|
27
|
-
|
27
|
+
|
28
28
|
s.add_dependency( 'rainbow', '>= 1.0.1' )
|
29
29
|
end
|
30
30
|
|
@@ -35,6 +35,7 @@ Gem::PackageTask.new(spec) do |p|
|
|
35
35
|
end
|
36
36
|
|
37
37
|
TAG_COMMAND = "git tag -m 'Tagging version #{GitRemoteBranch::VERSION::STRING}' -a v#{GitRemoteBranch::VERSION::STRING}"
|
38
|
+
push_tags_command = 'git push --tags'
|
38
39
|
task :tag_warn do
|
39
40
|
puts "*" * 40,
|
40
41
|
"Don't forget to tag the release:",
|
@@ -46,39 +47,36 @@ task :tag_warn do
|
|
46
47
|
end
|
47
48
|
task :tag do
|
48
49
|
sh TAG_COMMAND
|
49
|
-
puts "Upload tags to repo with '
|
50
|
+
puts "Upload tags to repo with '#{push_tags_command}'"
|
50
51
|
end
|
51
52
|
task :gem => :tag_warn
|
52
53
|
|
53
54
|
namespace :gem do
|
54
|
-
desc
|
55
|
-
task :
|
56
|
-
|
57
|
-
puts "gemspec generated here: #{GitRemoteBranch::NAME}.gemspec"
|
55
|
+
desc 'Upload gem to rubygems.org'
|
56
|
+
task :publish => :gem do
|
57
|
+
sh "gem push pkg/#{spec.full_name}.gem"
|
58
58
|
end
|
59
|
-
|
60
|
-
desc 'Upload gem to rubyforge.org'
|
61
|
-
task :rubyforge => :gem do
|
62
|
-
sh 'rubyforge login'
|
63
|
-
sh "rubyforge add_release grb grb '#{GitRemoteBranch::VERSION::STRING}' pkg/#{spec.full_name}.gem"
|
64
|
-
sh "rubyforge add_file grb grb #{GitRemoteBranch::VERSION::STRING} pkg/#{spec.full_name}.gem"
|
65
|
-
end
|
66
|
-
|
59
|
+
|
67
60
|
desc 'Install the gem built locally'
|
68
61
|
task :install => [:clean, :gem] do
|
69
|
-
sh "
|
62
|
+
sh "gem install pkg/#{spec.full_name}.gem"
|
70
63
|
end
|
71
|
-
|
64
|
+
|
72
65
|
desc "Uninstall version #{GitRemoteBranch::VERSION::STRING} of the gem"
|
73
66
|
task :uninstall do
|
74
|
-
sh "
|
67
|
+
sh "gem uninstall -v #{GitRemoteBranch::VERSION::STRING} -x #{GitRemoteBranch::NAME}"
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Build and publish the gem, tag the commit and push the tags in one command"
|
71
|
+
task :feeling_lucky => [:gem, :publish, :tag] do
|
72
|
+
sh push_tags_command
|
75
73
|
end
|
76
|
-
|
74
|
+
|
77
75
|
if WINDOWS
|
78
76
|
win_spec = spec.dup
|
79
77
|
win_spec.platform = Gem::Platform::CURRENT
|
80
78
|
win_spec.add_dependency( 'win32console', '~> 1.1' ) # Missing dependency in the 'colored' gem
|
81
|
-
|
79
|
+
|
82
80
|
desc "Generate the Windows version of the gem"
|
83
81
|
namespace :windows do
|
84
82
|
Rake::GemPackageTask.new(win_spec) do |p|
|
metadata
CHANGED
@@ -1,49 +1,37 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_remote_branch
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 1
|
10
|
-
version: 0.3.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Mathieu Martin
|
14
9
|
- Carl Mercier
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
13
|
+
date: 2011-12-07 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rainbow
|
17
|
+
requirement: &70256987240960 !ruby/object:Gem::Requirement
|
24
18
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 21
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
- 1
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
33
22
|
version: 1.0.1
|
34
|
-
requirement: *id001
|
35
|
-
prerelease: false
|
36
|
-
name: rainbow
|
37
23
|
type: :runtime
|
38
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70256987240960
|
26
|
+
description: git_remote_branch is a learning tool to ease the interaction with remote
|
27
|
+
branches in simple situations.
|
39
28
|
email: webmat@gmail.com
|
40
|
-
executables:
|
29
|
+
executables:
|
41
30
|
- grb
|
42
31
|
extensions: []
|
43
|
-
|
44
|
-
extra_rdoc_files:
|
32
|
+
extra_rdoc_files:
|
45
33
|
- README.rdoc
|
46
|
-
files:
|
34
|
+
files:
|
47
35
|
- bin/grb
|
48
36
|
- CHANGELOG
|
49
37
|
- Gemfile
|
@@ -76,44 +64,38 @@ files:
|
|
76
64
|
- test/unit/param_reader_test.rb
|
77
65
|
- test/unit/state_test.rb
|
78
66
|
- vendor/capture_fu.rb
|
79
|
-
has_rdoc: true
|
80
67
|
homepage: http://github.com/webmat/git_remote_branch
|
81
68
|
licenses: []
|
82
|
-
|
83
69
|
post_install_message:
|
84
|
-
rdoc_options:
|
70
|
+
rdoc_options:
|
85
71
|
- --main
|
86
72
|
- README.rdoc
|
87
73
|
- --exclude
|
88
74
|
- lib
|
89
|
-
require_paths:
|
75
|
+
require_paths:
|
90
76
|
- lib
|
91
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
78
|
none: false
|
93
|
-
requirements:
|
94
|
-
- -
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
|
97
|
-
segments:
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
segments:
|
98
84
|
- 0
|
99
|
-
|
100
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
hash: -1687953634532625560
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
87
|
none: false
|
102
|
-
requirements:
|
103
|
-
- -
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
|
106
|
-
segments:
|
107
|
-
- 0
|
108
|
-
version: "0"
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
109
92
|
requirements: []
|
110
|
-
|
111
93
|
rubyforge_project: grb
|
112
|
-
rubygems_version: 1.
|
94
|
+
rubygems_version: 1.8.10
|
113
95
|
signing_key:
|
114
96
|
specification_version: 3
|
115
97
|
summary: git_remote_branch eases the interaction with remote branches
|
116
|
-
test_files:
|
98
|
+
test_files:
|
117
99
|
- test/functional/grb_test.rb
|
118
100
|
- test/helpers/array_extensions.rb
|
119
101
|
- test/helpers/constants.rb
|