gpr 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/lib/gpr/cli.rb +2 -1
- data/lib/gpr/git_helper.rb +18 -20
- 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: 6fc828306cf6fcbd57901691545268d4fce5fac8
|
4
|
+
data.tar.gz: c07bf80b3194da4ed975ab34d6713cc1a6b2c54d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f731f0de4b5dec48f3778c8da6d80edfa9aa7de5ba608616a5ec8d8a2df991e0672915448250767a001405ce5a5df203c8f082ab31870b5e45fd21dee5acd4d6
|
7
|
+
data.tar.gz: e09dd812a64e122c9fd6fbb3876bb4bf6f1a98ee2665acdd61f798e2b8af275074d404af44fd4b999e4278078b7e5edb96f4d0bbc68f702f474b9819b7c49df1
|
data/lib/gpr/cli.rb
CHANGED
@@ -137,7 +137,8 @@ module Gpr
|
|
137
137
|
puts 'Processing...'
|
138
138
|
|
139
139
|
Dir.glob("#{APP_PATH}/*/*").each do |path|
|
140
|
-
|
140
|
+
# Unregistered directories returns [".", ".."].
|
141
|
+
Dir.rmdir(path) if Dir.entries(path).size == 2
|
141
142
|
end
|
142
143
|
end
|
143
144
|
|
data/lib/gpr/git_helper.rb
CHANGED
@@ -26,34 +26,32 @@ module Gpr
|
|
26
26
|
def status(path)
|
27
27
|
Dir.chdir(path)
|
28
28
|
result = {}
|
29
|
-
git_status = `git status
|
30
|
-
branch_name = git_status.match(
|
31
|
-
|
29
|
+
git_status = `git status -sb`.split("\n")
|
30
|
+
branch_name = git_status.shift.match(/## (.+)/)[1]
|
31
|
+
unstaged_changes = []
|
32
|
+
untracked_files = []
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
git_status.each do |file|
|
35
|
+
if match_object = file.match(/^\sM (.+)$/)
|
36
|
+
unstaged_changes << match_object[1]
|
37
|
+
elsif match_object = file.match(/^\?\? (.+)$/)
|
38
|
+
untracked_files << match_object[1]
|
39
|
+
end
|
40
|
+
end
|
39
41
|
|
42
|
+
# Means no branch || ahead || behind
|
43
|
+
if branch_name =~ /HEAD|\[.+\]/
|
44
|
+
result[:branch] = branch_name.color(:red)
|
40
45
|
else
|
41
46
|
result[:branch] = branch_name.color(:green)
|
42
47
|
end
|
43
48
|
|
44
|
-
|
45
|
-
when /nothing to commit, working directory clean/
|
49
|
+
if unstaged_changes.empty? && untracked_files.empty?
|
46
50
|
result[:directory] = 'Working directory clean'.color(:green)
|
47
|
-
|
48
|
-
|
49
|
-
result[:directory] = 'Exist staged changes'.color(:red)
|
50
|
-
|
51
|
-
when /Changes not staged for commit:/
|
52
|
-
result[:directory] = 'Exist unstaged changes'.color(:red)
|
53
|
-
|
54
|
-
when /Untracked files:/
|
55
|
-
result[:directory] = 'Exist untracked files'.color(:red)
|
51
|
+
else
|
52
|
+
result[:directory] = "Modified[#{unstaged_changes.size}] ??[#{untracked_files.size}]".color(:red)
|
56
53
|
end
|
54
|
+
|
57
55
|
result
|
58
56
|
end
|
59
57
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaihar4
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|