git-pcheckout 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/README.md +5 -3
- data/git-pcheckout.gemspec +1 -0
- data/lib/git-pcheckout.rb +2 -27
- data/lib/git-pcheckout/version.rb +1 -1
- data/spec/git-pcheckout_spec.rb +0 -6
- data/spec/spec_helper.rb +3 -0
- metadata +17 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 962ae0262f03c2d8ee9e7d852865f309a3c28411
|
|
4
|
+
data.tar.gz: 03ba6068918bacc974d61b3c7bd675d5b1af74b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42d0d26981b86a8e9cf73453720ceb00f1c52e4eff40d8450e9ca63c84204d451afb93bc786bbc572e26e5f56fcdba50e20220a36b156a45dddb2ae68ff34042
|
|
7
|
+
data.tar.gz: b45511597f1c0a20e0bff5f5cfaa647975e1dfaeaa7de5b44e4389f5231d3ba4f4f835c4e26288cd474860c60fc3530cbc4d2c82a14dd8729093dcb2349ea740
|
data/.travis.yml
ADDED
data/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# git-pcheckout
|
|
2
2
|
|
|
3
|
-
[][gem]
|
|
4
|
+
[][codeclimate]
|
|
5
|
+
[][coverage]
|
|
6
|
+
[][travis]
|
|
6
7
|
|
|
7
8
|
Git command to evenly checkout local/remote branches and source/fork
|
|
8
9
|
pull requests by URL (with Hub)
|
|
@@ -49,3 +50,4 @@ pull requests by URL (with Hub)
|
|
|
49
50
|
[travis]: https://travis-ci.org/vrybas/git-pcheckout
|
|
50
51
|
[gem]: http://rubygems.org/gems/git-pcheckout
|
|
51
52
|
[codeclimate]: https://codeclimate.com/github/vrybas/git-pcheckout
|
|
53
|
+
[coverage]: https://coveralls.io/r/vrybas/git-pcheckout?branch=master
|
data/git-pcheckout.gemspec
CHANGED
data/lib/git-pcheckout.rb
CHANGED
|
@@ -7,24 +7,17 @@ module GitPcheckout
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def perform
|
|
10
|
-
validate_current_branch_state
|
|
11
|
-
|
|
12
10
|
if pull_request_url?(arg)
|
|
13
11
|
handle_pull_request_url(arg)
|
|
14
12
|
else
|
|
15
13
|
handle_branch_name(arg)
|
|
16
14
|
end
|
|
15
|
+
rescue
|
|
16
|
+
puts 'aborted'
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
private
|
|
20
20
|
|
|
21
|
-
def validate_current_branch_state
|
|
22
|
-
if dirty_branch?
|
|
23
|
-
puts errors[:dirty_branch]
|
|
24
|
-
exit(1)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
21
|
def pull_request_url?(arg)
|
|
29
22
|
arg.match /https:\/\/github.com\//
|
|
30
23
|
end
|
|
@@ -74,24 +67,6 @@ module GitPcheckout
|
|
|
74
67
|
HandleBranch.new(branch).perform
|
|
75
68
|
end
|
|
76
69
|
|
|
77
|
-
def dirty_branch?
|
|
78
|
-
status_lines = get_status_lines
|
|
79
|
-
return false if status_lines.empty?
|
|
80
|
-
|
|
81
|
-
if modified_deleted_renamed?(status_lines)
|
|
82
|
-
puts status_lines
|
|
83
|
-
true
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def get_status_lines
|
|
88
|
-
`git status -s`.split("\n").map(&:lstrip)
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def modified_deleted_renamed?(lines)
|
|
92
|
-
lines.any? { |line| line.match(/(^M|^D|^R)\s/) }
|
|
93
|
-
end
|
|
94
|
-
|
|
95
70
|
def errors
|
|
96
71
|
{ dirty_branch: "Please, commit your changes or stash them before you can switch branches"}
|
|
97
72
|
end
|
data/spec/git-pcheckout_spec.rb
CHANGED
|
@@ -9,12 +9,6 @@ describe GitPcheckout::Base do
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
context '#perofrm' do
|
|
12
|
-
it 'doesn\'t run if current branch is dirty' do
|
|
13
|
-
instance = described_class.new('foo')
|
|
14
|
-
instance.stub(:dirty_branch?).and_return(true)
|
|
15
|
-
expect { instance.perform }.to raise_error(SystemExit)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
12
|
context 'plain branch name' do
|
|
19
13
|
it 'handles plain branch name' do
|
|
20
14
|
instance = described_class.new('foo')
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: git-pcheckout
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vladimir Rybas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-06-
|
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: codeclimate-test-reporter
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
description: Git command to evenly checkout local/remote branches and source/fork
|
|
56
70
|
pull requests by URL (with Hub)
|
|
57
71
|
email:
|
|
@@ -63,6 +77,7 @@ extra_rdoc_files: []
|
|
|
63
77
|
files:
|
|
64
78
|
- ".gitignore"
|
|
65
79
|
- ".rspec"
|
|
80
|
+
- ".travis.yml"
|
|
66
81
|
- Gemfile
|
|
67
82
|
- Guardfile
|
|
68
83
|
- LICENSE.txt
|