ppgit 0.4.0 → 0.5.0
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/CHANGELOG +3 -0
- data/VERSION +1 -1
- data/bin/git-pp +8 -1
- data/bin/ppgit +8 -1
- data/lib/ppgit/commands.rb +7 -1
- data/lib/ppgit/quick_usage.txt +17 -0
- data/lib/ppgit/utils.rb +13 -0
- data/lib/ppgit/version_utils.rb +34 -0
- data/ppgit.gemspec +4 -2
- metadata +6 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
0.5.0
|
2
|
+
- print warning if a new version is available - closes gh-3
|
3
|
+
- display info in green, error in red - http://bit.ly/aHb1pw - closes gh-2
|
1
4
|
0.4.0
|
2
5
|
- use a bash & platform-agnostic ruby location
|
3
6
|
- fixed that ppgit.emailroot would be stored in the local config file, instead of ~/.gitconfig.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/bin/git-pp
CHANGED
@@ -30,7 +30,14 @@ else
|
|
30
30
|
do_ppgit_info()
|
31
31
|
|
32
32
|
else
|
33
|
-
|
33
|
+
puts yellow( "\nError - invalid command : ")
|
34
|
+
puts yellow( ' ppgit ') + lred(ARGV.join(' '))
|
35
|
+
puts "\n----------------------------\n\n"
|
36
|
+
do_ppgit_show_quick_usage_message
|
37
|
+
puts "\n----------------------------\n\n"
|
38
|
+
end
|
34
39
|
|
40
|
+
unless in_test_mode
|
41
|
+
print_message_if_new_version_available('alainravet', 'ppgit')
|
35
42
|
end
|
36
43
|
end
|
data/bin/ppgit
CHANGED
@@ -30,7 +30,14 @@ else
|
|
30
30
|
do_ppgit_info()
|
31
31
|
|
32
32
|
else
|
33
|
-
|
33
|
+
puts yellow( "\nError - invalid command : ")
|
34
|
+
puts yellow( ' ppgit ') + lred(ARGV.join(' '))
|
35
|
+
puts "\n----------------------------\n\n"
|
36
|
+
do_ppgit_show_quick_usage_message
|
37
|
+
puts "\n----------------------------\n\n"
|
38
|
+
end
|
34
39
|
|
40
|
+
unless in_test_mode
|
41
|
+
print_message_if_new_version_available('alainravet', 'ppgit')
|
35
42
|
end
|
36
43
|
end
|
data/lib/ppgit/commands.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ppgit/git_utils'
|
2
2
|
require 'ppgit/ppgit_utils'
|
3
|
+
require 'ppgit/version_utils'
|
3
4
|
|
4
5
|
|
5
6
|
def do_ppgit_clear
|
@@ -49,6 +50,11 @@ def do_ppgit_show_usage_message
|
|
49
50
|
puts File.open(path).read
|
50
51
|
end
|
51
52
|
|
53
|
+
def do_ppgit_show_quick_usage_message
|
54
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), 'quick_usage.txt'))
|
55
|
+
puts File.open(path).read
|
56
|
+
end
|
57
|
+
|
52
58
|
|
53
59
|
def do_ppgit_info
|
54
60
|
name, email = get_local_git_value('user.name'), get_local_git_value('user.email')
|
@@ -77,5 +83,5 @@ def do_ppgit_info
|
|
77
83
|
end
|
78
84
|
s << ' '
|
79
85
|
|
80
|
-
puts s.join("\n")
|
86
|
+
puts green s.join("\n")
|
81
87
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Quick Usage:
|
2
|
+
|
3
|
+
$ ppgit john andy andy_john@acme.com
|
4
|
+
$ ppgit clear
|
5
|
+
$ ppgit info
|
6
|
+
|
7
|
+
$ ppgit --email_root *@acme.com
|
8
|
+
$ ppgit john andy
|
9
|
+
|
10
|
+
remark : 'ppgit' is a synonym of 'git pp' => you can write
|
11
|
+
|
12
|
+
$ git pp john andy
|
13
|
+
$ git pp clear
|
14
|
+
|
15
|
+
|
16
|
+
To see full usage :
|
17
|
+
$ ppgit
|
data/lib/ppgit/utils.rb
CHANGED
@@ -17,3 +17,16 @@ def argv_value_of(prefix)
|
|
17
17
|
the_value = ARGV.delete_at(idx)
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
NO_COLOUR="\033[0m"
|
22
|
+
RED ="\033[31m"
|
23
|
+
LRED ="\033[1;31m"
|
24
|
+
BLUE ="\033[34m"
|
25
|
+
GREEN ="\033[32m"
|
26
|
+
YELLOW ="\033[1;33m"
|
27
|
+
|
28
|
+
def red( str) [RED, str, NO_COLOUR].join end
|
29
|
+
def lred( str) [LRED, str, NO_COLOUR].join end
|
30
|
+
def blue( str) [BLUE, str, NO_COLOUR].join end
|
31
|
+
def green( str) [GREEN, str, NO_COLOUR].join end
|
32
|
+
def yellow(str) [YELLOW, str, NO_COLOUR].join end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
def latest_github_version(user, project)
|
4
|
+
version_path = "http://github.com/#{user}/#{project}/raw/master/VERSION"
|
5
|
+
begin
|
6
|
+
version = open(version_path).read.chomp # ex: '1.2.3'
|
7
|
+
rescue SocketError
|
8
|
+
# unable to fetch the version
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def this_version
|
13
|
+
version_file = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'VERSION')
|
14
|
+
File.open(version_file).read.chomp
|
15
|
+
end
|
16
|
+
|
17
|
+
def new_version_available?(project, user)
|
18
|
+
this_version != latest_github_version(user, project)
|
19
|
+
end
|
20
|
+
|
21
|
+
def print_message_if_new_version_available(user, project)
|
22
|
+
if new_version_available?(project, user)
|
23
|
+
s = ["\033[1;33m"] # yellow
|
24
|
+
s << '------------------------------------------------------'
|
25
|
+
s << " There is a new version of #{project} (#{latest_github_version(user, project)})."
|
26
|
+
s << " You are using version #{this_version}"
|
27
|
+
s << ' To update :'
|
28
|
+
s << " gem update #{project}"
|
29
|
+
s << '------------------------------------------------------'
|
30
|
+
s << "\033[0m" # no color
|
31
|
+
msg = s.join("\n")
|
32
|
+
puts msg
|
33
|
+
end
|
34
|
+
end
|
data/ppgit.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ppgit}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alain Ravet"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-26}
|
13
13
|
s.description = %q{git users' pairs switcher}
|
14
14
|
s.email = %q{alain.ravet+git@gmail.com}
|
15
15
|
s.executables = ["git-pp", "ppgit"]
|
@@ -31,8 +31,10 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/ppgit/commands.rb",
|
32
32
|
"lib/ppgit/git_utils.rb",
|
33
33
|
"lib/ppgit/ppgit_utils.rb",
|
34
|
+
"lib/ppgit/quick_usage.txt",
|
34
35
|
"lib/ppgit/usage.txt",
|
35
36
|
"lib/ppgit/utils.rb",
|
37
|
+
"lib/ppgit/version_utils.rb",
|
36
38
|
"ppgit.gemspec",
|
37
39
|
"spec/ppgit_clear_spec.rb",
|
38
40
|
"spec/ppgit_email_root_spec.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ppgit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 5
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alain Ravet
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-26 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -58,8 +58,10 @@ files:
|
|
58
58
|
- lib/ppgit/commands.rb
|
59
59
|
- lib/ppgit/git_utils.rb
|
60
60
|
- lib/ppgit/ppgit_utils.rb
|
61
|
+
- lib/ppgit/quick_usage.txt
|
61
62
|
- lib/ppgit/usage.txt
|
62
63
|
- lib/ppgit/utils.rb
|
64
|
+
- lib/ppgit/version_utils.rb
|
63
65
|
- ppgit.gemspec
|
64
66
|
- spec/ppgit_clear_spec.rb
|
65
67
|
- spec/ppgit_email_root_spec.rb
|