qb 0.1.61 → 0.1.62

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/qb/version.rb +1 -1
  3. data/library/path_facts +15 -15
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac5214f10fb124d147d91b4618033b426d389558
4
- data.tar.gz: f051f2779ee56a8aa1747642080c99e08e567f02
3
+ metadata.gz: dc698a19f08e02f09cc94319dd84194796fa2f02
4
+ data.tar.gz: b12408278e8de95b4c43476beb1bf61b5ea59034
5
5
  SHA512:
6
- metadata.gz: 2102fe8bf8be9a227dc3f5644c31c2e8d0ae57b9aa30dc4578914531c569afc05c71dbed9449f8ec0cda4c4a060203f0c1db91260fd9c423c1a3f6ede0a76323
7
- data.tar.gz: c992b406840a86966b0b8d8b9e59c215255b23245c0f764db261dfb666639d24a9f30f30ecc5b6ca258ef8b80333bd93949f54023ccd944f68a3ab677cb1970b
6
+ metadata.gz: 777fdb945902e6ba86735f99b0edcd9313b12eb08c4a88cd97bbb5eb864c2954c2d3027ebf244cad7b47557d2988bff7ec703710dcb9e5961dac91d7d20ea5ac
7
+ data.tar.gz: 30111c626a7c9b0aed7bf3ce8deac8d6d881d1a7329a774ebc571b8423e52edfff15ea99b7598f68cb2df7030d66c87c3e0b2e70bd4da56bbfd1c7f4d57b2579
@@ -1,7 +1,7 @@
1
1
  module QB
2
2
  GEM_NAME = 'qb'
3
3
 
4
- VERSION = "0.1.61"
4
+ VERSION = "0.1.62"
5
5
 
6
6
  def self.gemspec
7
7
  Gem.loaded_specs[GEM_NAME]
@@ -123,17 +123,23 @@ class PathFacts < QB::AnsibleModule
123
123
  # If the path is a Git repo (has a .git file in it's root) add useful
124
124
  # Git facts.
125
125
  def add_git_facts
126
- git_file_path = @path.join('.git')
126
+ # see if we're in a git repo. first, we need a directory that exists
127
+ dir = @path.expand_path.ascend.find {|p| p.directory? }
127
128
 
128
- unless @path.directory? && git_file_path.exist?
129
- @result.is_git = false
130
- return
131
- end
132
-
133
- @result.is_git = true
134
-
135
- Dir.chdir(@path) do
129
+ Dir.chdir(dir) do
130
+ root_result = Cmds.new "git rev-parse --show-toplevel"
131
+
132
+ unless root_result.ok?
133
+ @result.in_git_repo = false
134
+ @result.is_git_root = false
135
+ return
136
+ end
137
+
138
+ @result.in_git_repo = true
139
+
136
140
  git = @result.git = Result.new
141
+ git.root = Pathname.new root_result.out.chomp
142
+ @result.is_git_root = @path == git.root
137
143
 
138
144
  user = git.user = Result.new
139
145
 
@@ -144,11 +150,6 @@ class PathFacts < QB::AnsibleModule
144
150
  end
145
151
  }
146
152
 
147
- git.root = begin
148
- Cmds.chomp! "git rev-parse --show-toplevel"
149
- rescue
150
- end
151
-
152
153
  git.origin = begin
153
154
  Cmds.chomp! "git remote get-url origin"
154
155
  rescue
@@ -181,7 +182,6 @@ class PathFacts < QB::AnsibleModule
181
182
  end
182
183
 
183
184
  end
184
-
185
185
  end
186
186
  end
187
187
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.61
4
+ version: 0.1.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler