gpr 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gpr/cli.rb +3 -3
- data/lib/gpr/git_helper.rb +22 -6
- data/lib/gpr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ebb91a2b27eaa19285b573821f2e654a4eae0da
|
4
|
+
data.tar.gz: 3930255785d40eee536855a72900b8bb8afc0885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: debf8c21b110ec4bd22528d1fc7bd3cfc37b744a647872570e1795e9788e61ba552a1cf320173b074a631f28ac186c916f63b0f60a44caf86149cb1a96e58cbd
|
7
|
+
data.tar.gz: 2e81e1e35114218e7413d9fe8a4a6342d9c5ff83d5287a9e44a6b4d045850d4942331059045d57ab4d27d484ca5f8889abf008fadc49e46103784c0ea5af0f3a
|
data/lib/gpr/cli.rb
CHANGED
@@ -169,13 +169,13 @@ module Gpr
|
|
169
169
|
repositories = get_repositories
|
170
170
|
table do
|
171
171
|
row do
|
172
|
-
column('REPOSITORY NAME'.style(:bold),
|
173
|
-
column('BRANCH STATUS'.style(:bold),
|
172
|
+
column('REPOSITORY NAME'.style(:bold), 25)
|
173
|
+
column('BRANCH STATUS'.style(:bold), 45)
|
174
174
|
column('DIRECTORY STATUS'.style(:bold), 25)
|
175
175
|
end
|
176
176
|
repositories.each do |repository|
|
177
177
|
row do
|
178
|
-
column(repository.match(/.+\/(
|
178
|
+
column(repository.match(/.+\/(.+\/.+)/)[1])
|
179
179
|
column(GitHelper.status(repository)[:branch])
|
180
180
|
column(GitHelper.status(repository)[:directory])
|
181
181
|
end
|
data/lib/gpr/git_helper.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
+
require 'safe_colorize'
|
2
|
+
|
1
3
|
module Gpr
|
2
4
|
module GitHelper
|
5
|
+
using SafeColorize
|
6
|
+
|
3
7
|
class << self
|
4
8
|
def clone(url, path)
|
5
9
|
`git clone #{url} #{path}`
|
@@ -22,19 +26,31 @@ module Gpr
|
|
22
26
|
def status(path)
|
23
27
|
Dir.chdir(path)
|
24
28
|
result = {}
|
25
|
-
|
29
|
+
git_status = `git status`
|
30
|
+
branch_status = `git status -sb`.split("\n")[0].match(/## (.+)/)[1]
|
26
31
|
|
27
|
-
|
32
|
+
case branch_status
|
33
|
+
# Means ahead || behind
|
34
|
+
when /\[.+\]/
|
35
|
+
result[:branch] = branch_status.color(:red)
|
36
|
+
when /master/
|
37
|
+
result[:branch] = git_status.match(/Your branch (is|and) (.+?)(,|\.)/)[2].color(:green)
|
38
|
+
else
|
39
|
+
result[:branch] = git_status.match(/(On branch .+)/)[1].color(:green)
|
40
|
+
end
|
28
41
|
|
29
|
-
case
|
42
|
+
case git_status
|
30
43
|
when /nothing to commit, working directory clean/
|
31
|
-
result[:directory] = 'Working directory clean'
|
44
|
+
result[:directory] = 'Working directory clean'.color(:green)
|
45
|
+
|
46
|
+
when /Changes to be committed:/
|
47
|
+
result[:directory] = 'Exist staged changes'.color(:red)
|
32
48
|
|
33
49
|
when /Changes not staged for commit:/
|
34
|
-
result[:directory] = 'Exist unstaged changes'
|
50
|
+
result[:directory] = 'Exist unstaged changes'.color(:red)
|
35
51
|
|
36
52
|
when /Untracked files:/
|
37
|
-
result[:directory] = 'Exist untracked files'
|
53
|
+
result[:directory] = 'Exist untracked files'.color(:red)
|
38
54
|
end
|
39
55
|
result
|
40
56
|
end
|
data/lib/gpr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaihar4
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|