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 +4 -4
- data/lib/pro/commands.rb +28 -6
- data/lib/pro/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: 3db7f68df476b807f22c2d69fce741dbe6cb9940
|
4
|
+
data.tar.gz: 95a0ced81a2cf42b99bb91deb5d47b48895136eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70eb07a63a67d9986b5a801b68d1e6ad64016e68d670efbc33d69981571cdd7a9bb8b74c574297e95761155bb44c4693cfbcd8b6e5e946a315c95e254d27a315
|
7
|
+
data.tar.gz: b9c79cb990b22445219cb8bc77b89eb5e9871f7a81b57d39305d302a483f1065d9b5d70b66b37909062ea158e851aff08020dc2c8ba0aa0f05de04868cbef5da
|
data/lib/pro/commands.rb
CHANGED
@@ -28,7 +28,9 @@ END
|
|
28
28
|
|
29
29
|
module Pro
|
30
30
|
class Commands
|
31
|
-
|
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 <<
|
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
|
98
|
-
def
|
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.
|
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
|
data/lib/pro/version.rb
CHANGED
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
|
+
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
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fuzzy_match
|