git_pretty_accept 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.markdown +5 -0
- data/git_pretty_accept.gemspec +7 -7
- data/lib/git_pretty_accept/app.rb +31 -22
- data/lib/git_pretty_accept/version.rb +1 -1
- data/spec/git_pretty_accept/app_spec.rb +22 -3
- data/spec/spec_helper.rb +1 -1
- metadata +46 -70
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1bb08233347e08a6009b258782b3bb44798f530f
|
4
|
+
data.tar.gz: 224d416caa7722a452245b09fd3bd684addd3a84
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 309b1c8978ec26fecb968dfce874f7cac64fd33ef3fb2662c125659f2b97a5ed558886692866c621c2ab430d3fa50c930231213bb570c190f367247cfc9a1bc5
|
7
|
+
data.tar.gz: e51b2679cd21202663a487eb937657b20f8db223a1e4d04f8bce32fb949fd7a505de5e1b09cad4b374b76d945e7923af73b5aa8bfb5484abce2833f6937ae7a0
|
data/CHANGELOG.markdown
CHANGED
data/git_pretty_accept.gemspec
CHANGED
@@ -25,12 +25,12 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
27
|
spec.add_dependency 'git'
|
28
|
-
spec.add_dependency
|
28
|
+
spec.add_dependency 'methadone', '~> 1.3.1'
|
29
29
|
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
34
|
-
spec.add_development_dependency
|
35
|
-
spec.add_development_dependency
|
30
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
31
|
+
spec.add_development_dependency 'pry'
|
32
|
+
spec.add_development_dependency 'rdoc'
|
33
|
+
spec.add_development_dependency 'rake'
|
34
|
+
spec.add_development_dependency 'rspec'
|
35
|
+
spec.add_development_dependency 'rspec-example_steps'
|
36
36
|
end
|
@@ -4,28 +4,37 @@ module GitPrettyAccept
|
|
4
4
|
include Methadone::CLILogging
|
5
5
|
|
6
6
|
main do |branch|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
7
|
+
if branch == 'master'
|
8
|
+
error "You're trying to accept master as a pull request branch. " +
|
9
|
+
"Please checkout to master instead and accept this branch " +
|
10
|
+
"from there."
|
11
|
+
exit!
|
12
|
+
else
|
13
|
+
options[:edit] = true if options[:edit].nil?
|
14
|
+
|
15
|
+
our = Git.open('.')
|
16
|
+
source_branch = our.branches.find(&:current).to_s
|
17
|
+
|
18
|
+
commands = [
|
19
|
+
"git pull origin #{source_branch}",
|
20
|
+
"git checkout #{branch}",
|
21
|
+
"git rebase origin/#{source_branch}",
|
22
|
+
"git push --force origin #{branch}",
|
23
|
+
"git checkout #{source_branch}",
|
24
|
+
"git merge --no-ff #{options[:edit] ? '--edit' : '--no-edit'} #{branch}",
|
25
|
+
"git push origin #{source_branch}",
|
26
|
+
"git branch -D #{branch}",
|
27
|
+
"git push origin :#{branch}"
|
28
|
+
]
|
29
|
+
|
30
|
+
commands.each_with_index do |command, i|
|
31
|
+
info "\n#{command}"
|
32
|
+
unless system(command)
|
33
|
+
error "\nDue to the error above, " +
|
34
|
+
"the following commands were not executed: " +
|
35
|
+
commands[i + 1, commands.size].join("\n")
|
36
|
+
exit!
|
37
|
+
end
|
29
38
|
end
|
30
39
|
end
|
31
40
|
end
|
@@ -56,7 +56,7 @@ describe GitPrettyAccept::App do
|
|
56
56
|
|
57
57
|
When 'I run `git pretty-accept PR_BRANCH`' do
|
58
58
|
FileUtils.cd(our_path) do
|
59
|
-
|
59
|
+
`bundle exec #{project_path}/bin/git-pretty-accept --no-edit #{pr_branch}`
|
60
60
|
expect($CHILD_STATUS.exitstatus).to eq(0)
|
61
61
|
end
|
62
62
|
end
|
@@ -67,10 +67,10 @@ describe GitPrettyAccept::App do
|
|
67
67
|
expect(our.log[0].message).to eq("Merge branch 'pr_branch'")
|
68
68
|
expect(our.log[0].parents.size).to eq(2)
|
69
69
|
|
70
|
-
expect(our.log[1].message).to eq('
|
70
|
+
expect(our.log[1].message).to eq('Update readme')
|
71
71
|
expect(our.log[1].parents.size).to eq(1)
|
72
72
|
|
73
|
-
expect(our.log[2].message).to eq('
|
73
|
+
expect(our.log[2].message).to eq('Add changelog')
|
74
74
|
expect(our.log[2].parents.size).to eq(1)
|
75
75
|
|
76
76
|
expect(our.log[3].message).to eq('Add readme')
|
@@ -90,4 +90,23 @@ describe GitPrettyAccept::App do
|
|
90
90
|
expect(our.branches["origin/#{pr_branch}"]).to be_nil
|
91
91
|
end
|
92
92
|
end
|
93
|
+
|
94
|
+
Steps "should not allow master to be accepted as a PR branch" do
|
95
|
+
Given 'I have a local repo' do
|
96
|
+
Git.init(our_path)
|
97
|
+
end
|
98
|
+
|
99
|
+
When 'I run `git pretty-accept master`' do
|
100
|
+
command = "bundle exec #{project_path}/bin/git-pretty-accept --no-edit master"
|
101
|
+
FileUtils.cd(our_path) do
|
102
|
+
@result = system(command, err: '/tmp/err.log')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
Then 'I should be informed that master cannot be accepted as a PR branch' do
|
107
|
+
expect(@result).to be_false
|
108
|
+
expect(File.read('/tmp/err.log')).to include(
|
109
|
+
'trying to accept master as a pull request branch')
|
110
|
+
end
|
111
|
+
end
|
93
112
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,145 +1,128 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_pretty_accept
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- George Mendoza
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
21
22
|
version_requirements: !ruby/object:Gem::Requirement
|
22
23
|
requirements:
|
23
|
-
- -
|
24
|
+
- - '>='
|
24
25
|
- !ruby/object:Gem::Version
|
25
26
|
version: '0'
|
26
|
-
none: false
|
27
|
-
prerelease: false
|
28
|
-
name: git
|
29
|
-
type: :runtime
|
30
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: methadone
|
31
29
|
requirement: !ruby/object:Gem::Requirement
|
32
30
|
requirements:
|
33
31
|
- - ~>
|
34
32
|
- !ruby/object:Gem::Version
|
35
33
|
version: 1.3.1
|
36
|
-
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - ~>
|
40
39
|
- !ruby/object:Gem::Version
|
41
40
|
version: 1.3.1
|
42
|
-
none: false
|
43
|
-
prerelease: false
|
44
|
-
name: methadone
|
45
|
-
type: :runtime
|
46
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
47
43
|
requirement: !ruby/object:Gem::Requirement
|
48
44
|
requirements:
|
49
45
|
- - ~>
|
50
46
|
- !ruby/object:Gem::Version
|
51
47
|
version: '1.3'
|
52
|
-
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
52
|
- - ~>
|
56
53
|
- !ruby/object:Gem::Version
|
57
54
|
version: '1.3'
|
58
|
-
none: false
|
59
|
-
prerelease: false
|
60
|
-
name: bundler
|
61
|
-
type: :development
|
62
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
|
-
- -
|
59
|
+
- - '>='
|
66
60
|
- !ruby/object:Gem::Version
|
67
61
|
version: '0'
|
68
|
-
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
69
64
|
version_requirements: !ruby/object:Gem::Requirement
|
70
65
|
requirements:
|
71
|
-
- -
|
66
|
+
- - '>='
|
72
67
|
- !ruby/object:Gem::Version
|
73
68
|
version: '0'
|
74
|
-
none: false
|
75
|
-
prerelease: false
|
76
|
-
name: rdoc
|
77
|
-
type: :development
|
78
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdoc
|
79
71
|
requirement: !ruby/object:Gem::Requirement
|
80
72
|
requirements:
|
81
|
-
- -
|
73
|
+
- - '>='
|
82
74
|
- !ruby/object:Gem::Version
|
83
75
|
version: '0'
|
84
|
-
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
85
78
|
version_requirements: !ruby/object:Gem::Requirement
|
86
79
|
requirements:
|
87
|
-
- -
|
80
|
+
- - '>='
|
88
81
|
- !ruby/object:Gem::Version
|
89
82
|
version: '0'
|
90
|
-
none: false
|
91
|
-
prerelease: false
|
92
|
-
name: debugger
|
93
|
-
type: :development
|
94
83
|
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
95
85
|
requirement: !ruby/object:Gem::Requirement
|
96
86
|
requirements:
|
97
|
-
- -
|
87
|
+
- - '>='
|
98
88
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0
|
100
|
-
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
101
92
|
version_requirements: !ruby/object:Gem::Requirement
|
102
93
|
requirements:
|
103
|
-
- -
|
94
|
+
- - '>='
|
104
95
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0
|
106
|
-
none: false
|
107
|
-
prerelease: false
|
108
|
-
name: rake
|
109
|
-
type: :development
|
96
|
+
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
111
99
|
requirement: !ruby/object:Gem::Requirement
|
112
100
|
requirements:
|
113
|
-
- -
|
101
|
+
- - '>='
|
114
102
|
- !ruby/object:Gem::Version
|
115
103
|
version: '0'
|
116
|
-
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
117
106
|
version_requirements: !ruby/object:Gem::Requirement
|
118
107
|
requirements:
|
119
|
-
- -
|
108
|
+
- - '>='
|
120
109
|
- !ruby/object:Gem::Version
|
121
110
|
version: '0'
|
122
|
-
none: false
|
123
|
-
prerelease: false
|
124
|
-
name: rspec
|
125
|
-
type: :development
|
126
111
|
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-example_steps
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- -
|
115
|
+
- - '>='
|
130
116
|
- !ruby/object:Gem::Version
|
131
117
|
version: '0'
|
132
|
-
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
133
120
|
version_requirements: !ruby/object:Gem::Requirement
|
134
121
|
requirements:
|
135
|
-
- -
|
122
|
+
- - '>='
|
136
123
|
- !ruby/object:Gem::Version
|
137
124
|
version: '0'
|
138
|
-
|
139
|
-
prerelease: false
|
140
|
-
name: rspec-example_steps
|
141
|
-
type: :development
|
142
|
-
description: ! ' `git-pretty-accept` is a script that rebases a pull request before
|
125
|
+
description: ' `git-pretty-accept` is a script that rebases a pull request before
|
143
126
|
merging to master. Pull requests are _always_ merged recursively. The result is
|
144
127
|
a linear history with merge bubbles indicating pull requests. In short, pretty. '
|
145
128
|
email:
|
@@ -165,33 +148,26 @@ files:
|
|
165
148
|
homepage: https://github.com/gsmendoza/git_pretty_accept
|
166
149
|
licenses:
|
167
150
|
- MIT
|
151
|
+
metadata: {}
|
168
152
|
post_install_message:
|
169
153
|
rdoc_options: []
|
170
154
|
require_paths:
|
171
155
|
- lib
|
172
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
157
|
requirements:
|
174
|
-
- -
|
158
|
+
- - '>='
|
175
159
|
- !ruby/object:Gem::Version
|
176
|
-
hash: 150844083
|
177
160
|
version: '0'
|
178
|
-
segments:
|
179
|
-
- 0
|
180
|
-
none: false
|
181
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
162
|
requirements:
|
183
|
-
- -
|
163
|
+
- - '>='
|
184
164
|
- !ruby/object:Gem::Version
|
185
|
-
hash: 150844083
|
186
165
|
version: '0'
|
187
|
-
segments:
|
188
|
-
- 0
|
189
|
-
none: false
|
190
166
|
requirements: []
|
191
167
|
rubyforge_project:
|
192
|
-
rubygems_version: 1.
|
168
|
+
rubygems_version: 2.1.11
|
193
169
|
signing_key:
|
194
|
-
specification_version:
|
170
|
+
specification_version: 4
|
195
171
|
summary: Accept pull requests, the pretty way
|
196
172
|
test_files:
|
197
173
|
- spec/git_pretty_accept/app_spec.rb
|