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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 926a4cd11bab7224ddd290066e613ff90f74bca0
4
- data.tar.gz: c3abfebc9d0a410ea3a973441384cc7b9aba3418
3
+ metadata.gz: 98b74df8a049ec3bba517e2098c0c5c9e7bf7d8f
4
+ data.tar.gz: 1e8fd322a51623e92fe501ca476338eacfb81ca0
5
5
  SHA512:
6
- metadata.gz: 319284829202d4a4dfbad0ac2ea97156ffd835ae6381de39f978304074cae7f59f9ebd534a6230f5693ac5eacfada277ac9d79e8b85a67e24fe4413bab8d1450
7
- data.tar.gz: 44ba7bc832a2418ad4f02185ec78aec4480733146f83a0cd2862db76a4cb18c7e91af389e0c7676ff712352638a0583032681451fea955fd0b9160e2d6a5605c
6
+ metadata.gz: 7775317f24f84eef15ba9394ae0c892f7dd38a22dbf98efc2048a132f6c8fcacd6631725d0d8e432cf1469123d0ec92b43422a49a54e60a6d097f4e5a4c39c24
7
+ data.tar.gz: d7871e3210036b2d41998365f673f1a45843babb3eba5ec2283816e587f8f3357505a85bf4fcaf08ac579316f72a50fa9b18333394e0e7ba708c1aee9fbadb03
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
1
+ --format Fuubar
2
2
  --color
data/Gemfile CHANGED
@@ -2,3 +2,13 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in gitguard.gemspec
4
4
  gemspec
5
+
6
+ group :development, :test do
7
+ gem "rails"
8
+
9
+ gem "pry"
10
+ gem "pry-byebug"
11
+ gem "pry-stack_explorer"
12
+ gem "simplecov"
13
+ gem "fuubar"
14
+ end
@@ -19,9 +19,7 @@ module Gitguard
19
19
  end
20
20
  yield
21
21
  return if clean?
22
- root_dir = DirSearch.up{|dir| Dir.exist?(File.join(dir, '.git')) }
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
@@ -1,3 +1,3 @@
1
1
  module Gitguard
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: gitguard
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
  - akm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler