pro 1.1.4 → 1.1.5

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: b46ba0d458a00a3e57452241e9d84257bf1df7b2
4
- data.tar.gz: 95a98916c8e66f1859811c6f5dc3e1f98c3a483c
3
+ metadata.gz: 3db7f68df476b807f22c2d69fce741dbe6cb9940
4
+ data.tar.gz: 95a0ced81a2cf42b99bb91deb5d47b48895136eb
5
5
  SHA512:
6
- metadata.gz: 16274c408ee82cf3991f086ae2040f3fc0a896916b9815340bb13d0c0b70a1c1cb94a21897fcf27eb9fe2cdfed56174066370ec2ad07c1a25d1ecdcf535b4eb8
7
- data.tar.gz: 8fbc4d8148c271c092b7c5fcaa69c679c769c63d164a674a49c76d6a07dd7698ba38d68ca6e3c98aa09926926f8e00d85ce93c30f986b67962320faebaedc5c0
6
+ metadata.gz: 70eb07a63a67d9986b5a801b68d1e6ad64016e68d670efbc33d69981571cdd7a9bb8b74c574297e95761155bb44c4693cfbcd8b6e5e946a315c95e254d27a315
7
+ data.tar.gz: b9c79cb990b22445219cb8bc77b89eb5e9871f7a81b57d39305d302a483f1065d9b5d70b66b37909062ea158e851aff08020dc2c8ba0aa0f05de04868cbef5da
@@ -28,7 +28,9 @@ END
28
28
 
29
29
  module Pro
30
30
  class Commands
31
- DIRTY_MESSAGE = 'uncommitted'.red
31
+ EMPTY_MESSAGE = 'empty'.green
32
+ UNCOMMITTED_MESSAGE = 'uncommitted'.red
33
+ UNTRACKED_MESSAGE = 'untracked'.magenta
32
34
  UNPUSHED_MESSAGE = 'unpushed'.blue
33
35
  JOIN_STRING = ' + '
34
36
 
@@ -89,18 +91,38 @@ module Pro
89
91
  # returns a short status message for the repo
90
92
  def repo_status(path)
91
93
  messages = []
92
- messages << DIRTY_MESSAGE unless repo_clean?(path)
94
+ messages << EMPTY_MESSAGE if repo_empty?(path)
95
+ messages << UNCOMMITTED_MESSAGE if commit_pending?(path)
96
+ messages << UNTRACKED_MESSAGE if untracked_files?(path)
93
97
  messages << UNPUSHED_MESSAGE if repo_unpushed?(path)
94
98
  messages.join(JOIN_STRING)
95
99
  end
96
100
 
97
- # Checks if there are any uncommitted changes
98
- def repo_clean?(path)
101
+ # Checks if there are nothing in the repo
102
+ def repo_empty?(path)
99
103
  status = ""
100
104
  Dir.chdir(path) do
101
105
  status = `git status 2>/dev/null`
102
106
  end
103
- return status.end_with?("(working directory clean)\n") || status.end_with?("working directory clean\n")
107
+ return status.include?("Initial commit")
108
+ end
109
+
110
+ # Checks if there are pending commits / edited files
111
+ def commit_pending?(path)
112
+ status = ""
113
+ Dir.chdir(path) do
114
+ status = `git status 2>/dev/null`
115
+ end
116
+ return status.include?("Changes to be committed") || status.include?("Changes not staged for commit")
117
+ end
118
+
119
+ # Checks if there are untracked files in the repo
120
+ def untracked_files?(path)
121
+ status = ""
122
+ Dir.chdir(path) do
123
+ status = `git status 2>/dev/null`
124
+ end
125
+ return status.include?("Untracked files")
104
126
  end
105
127
 
106
128
  # Finds if there are any commits which have not been pushed to origin
@@ -148,4 +170,4 @@ module Pro
148
170
  end
149
171
  end
150
172
  end
151
- end
173
+ end
@@ -1,3 +1,3 @@
1
1
  module Pro
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Hume
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-11 00:00:00.000000000 Z
11
+ date: 2014-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fuzzy_match