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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09a37952ff672aa804dd9ed53da451b70f8de187
4
- data.tar.gz: 2e78a77ee446ae0790f8919039edc87bc7040a99
3
+ metadata.gz: 3ebb91a2b27eaa19285b573821f2e654a4eae0da
4
+ data.tar.gz: 3930255785d40eee536855a72900b8bb8afc0885
5
5
  SHA512:
6
- metadata.gz: 4c90b35c596c6def17b6e917eb7b09ff0beaafdb539ce7b331772132260a0f6d15ff584671ee7ddea5de497ed733a35e36de1d2f9a70f52add6095f09558b685
7
- data.tar.gz: 1739611ba31101e707b1c07ba8ced63b8fc8b55ea5d9e39e29e62ad55337b34ad6cf96483358e496ae5c3c20221f7e7f9d3a78a665682d8aa8b48d55127eba26
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), 15)
173
- column('BRANCH STATUS'.style(:bold), 40)
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(/.+\/(.+)/)[1])
178
+ column(repository.match(/.+\/(.+\/.+)/)[1])
179
179
  column(GitHelper.status(repository)[:branch])
180
180
  column(GitHelper.status(repository)[:directory])
181
181
  end
@@ -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
- status = `git status`
29
+ git_status = `git status`
30
+ branch_status = `git status -sb`.split("\n")[0].match(/## (.+)/)[1]
26
31
 
27
- result[:branch] = status.match(/Your branch (is|and) (.+?)(,|\.)/)[2]
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 status
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
@@ -1,3 +1,3 @@
1
1
  module Gpr
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
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.0
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-10-15 00:00:00.000000000 Z
11
+ date: 2014-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor