rake_commit 0.6.0 → 0.7.0
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.
- data/lib/git.rb +3 -2
- data/lib/shell.rb +7 -4
- metadata +2 -2
data/lib/git.rb
CHANGED
@@ -30,7 +30,7 @@ class Git
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def status
|
33
|
-
Shell.system
|
33
|
+
Shell.system("git status", false)
|
34
34
|
end
|
35
35
|
|
36
36
|
def add
|
@@ -56,7 +56,8 @@ class Git
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def nothing_to_commit?
|
59
|
-
Shell.backtick("git status")
|
59
|
+
status = Shell.backtick("git status", false)
|
60
|
+
status.empty? || status =~ /nothing to commit/m
|
60
61
|
end
|
61
62
|
|
62
63
|
def git_branch
|
data/lib/shell.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
+
require 'English'
|
2
|
+
|
1
3
|
class Shell
|
2
|
-
def self.system(cmd)
|
3
|
-
Kernel.system(cmd)
|
4
|
+
def self.system(cmd, raise_on_failure = true)
|
5
|
+
successful = Kernel.system(cmd)
|
6
|
+
raise if raise_on_failure && !successful
|
4
7
|
end
|
5
8
|
|
6
|
-
def self.backtick(cmd)
|
9
|
+
def self.backtick(cmd, raise_on_failure = true)
|
7
10
|
output = `#{cmd}`
|
8
|
-
raise "Command failed: #{cmd.inspect}"
|
11
|
+
raise "Command failed: #{cmd.inspect}" if raise_on_failure && !$CHILD_STATUS.success?
|
9
12
|
output
|
10
13
|
end
|
11
14
|
end
|