gitguard 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 +4 -4
- data/.rspec +1 -1
- data/Gemfile +10 -0
- data/lib/gitguard/runner.rb +21 -3
- data/lib/gitguard/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: 98b74df8a049ec3bba517e2098c0c5c9e7bf7d8f
|
4
|
+
data.tar.gz: 1e8fd322a51623e92fe501ca476338eacfb81ca0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7775317f24f84eef15ba9394ae0c892f7dd38a22dbf98efc2048a132f6c8fcacd6631725d0d8e432cf1469123d0ec92b43422a49a54e60a6d097f4e5a4c39c24
|
7
|
+
data.tar.gz: d7871e3210036b2d41998365f673f1a45843babb3eba5ec2283816e587f8f3357505a85bf4fcaf08ac579316f72a50fa9b18333394e0e7ba708c1aee9fbadb03
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--format
|
1
|
+
--format Fuubar
|
2
2
|
--color
|
data/Gemfile
CHANGED
data/lib/gitguard/runner.rb
CHANGED
@@ -19,9 +19,7 @@ module Gitguard
|
|
19
19
|
end
|
20
20
|
yield
|
21
21
|
return if clean?
|
22
|
-
|
23
|
-
raise Error, "Directory not found: .git" unless root_dir
|
24
|
-
Dir.chdir(root_dir) do
|
22
|
+
at_root do
|
25
23
|
cmd = "git add . && git commit -m #{Shellwords.escape(user_command)}"
|
26
24
|
puts "\e[34m#{cmd}"
|
27
25
|
r = false
|
@@ -34,9 +32,29 @@ module Gitguard
|
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
35
|
+
def at_root(&block)
|
36
|
+
root_dir = DirSearch.up{|dir| Dir.exist?(File.join(dir, '.git')) }
|
37
|
+
raise Error, "Directory not found: .git" unless root_dir
|
38
|
+
Dir.chdir(root_dir, &block)
|
39
|
+
end
|
40
|
+
|
37
41
|
def clean?
|
42
|
+
unchanged? && no_untracked_files?
|
43
|
+
end
|
44
|
+
|
45
|
+
def unchanged?
|
38
46
|
system("git diff --exit-code > /dev/null")
|
39
47
|
end
|
48
|
+
def changed?
|
49
|
+
!unchanged?
|
50
|
+
end
|
51
|
+
|
52
|
+
def no_untracked_files?
|
53
|
+
at_root{ `git ls-files --others --exclude-standard`.empty? }
|
54
|
+
end
|
55
|
+
def untracked_files?
|
56
|
+
!no_untracked_files?
|
57
|
+
end
|
40
58
|
|
41
59
|
end
|
42
60
|
end
|
data/lib/gitguard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitguard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|