with_git_repo 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/with_git_repo.rb +3 -7
- data/lib/with_git_repo/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: 11404482fd0e815e170d7d4500f30c0f6dda2d4f
|
4
|
+
data.tar.gz: fd5497b42a2862e5531e4a7a3191919472d93fa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31fcfa61332363257054317fcdf8baa10bc6982b98d766edd08c87b41620c7b503d698a99cb1a2a6737c773f8fd1766d114d23e24152b64b4b1a3d30d4d83883
|
7
|
+
data.tar.gz: 55ed2e9772cb8dbc0da2f75f2b98bc2bcebe0f1e78b898ef7fa996283c61c20dba99b855287da2bed33a78ea44bd9fa171fb407434cfb5823fe9cbce3d74eed2
|
data/lib/with_git_repo.rb
CHANGED
@@ -13,11 +13,7 @@ class WithGitRepo
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def commit_changes_to_branch(branch, message)
|
16
|
-
|
17
|
-
git.checkout(branch)
|
18
|
-
else
|
19
|
-
git.checkout(branch, new_branch: true)
|
20
|
-
end
|
16
|
+
checkout_branch!(branch)
|
21
17
|
git.chdir { yield }
|
22
18
|
git.add
|
23
19
|
return unless git.status.changed.any? || git.status.added.any?
|
@@ -27,8 +23,8 @@ class WithGitRepo
|
|
27
23
|
|
28
24
|
private
|
29
25
|
|
30
|
-
def checkout_branch(branch)
|
31
|
-
if git.branches["origin/#{branch}"]
|
26
|
+
def checkout_branch!(branch)
|
27
|
+
if git.branches[branch] || git.branches["origin/#{branch}"]
|
32
28
|
git.checkout(branch)
|
33
29
|
else
|
34
30
|
git.checkout(branch, new_branch: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: with_git_repo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Mytton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|