git-merge-pr 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e3619e70e8a8bf820b63d7cd705712c8582b5d67
4
+ data.tar.gz: 7a287e9ebc8efa41283b03b4c9bda5b3fc4aa933
5
+ SHA512:
6
+ metadata.gz: ff81e737286b3c05ed48369352e721d6dff438446352e41852e779dfc1b1b08e244443fa4355a7d7d47a94ca0a4b4d7d8496f51f3b16ac7942a9252e72275ddc
7
+ data.tar.gz: 79df8a71ff40a7becaec903970552adccbb02b59115e68f7ae9c71db927a36d97c3b25a8fcd4fa68d87671eaae646f954b2c20ed042d9b5770dc67dfcbab608e
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in git_merge_pr.gemspec
4
+ gemspec
data/History.markdown ADDED
@@ -0,0 +1,18 @@
1
+ ## HEAD
2
+
3
+ ## 0.3.0 / 2014-03-17
4
+
5
+ * DON'T DELETE THE MASTER BRANCH, LIKE EVER (#4)
6
+
7
+ ## 0.2.0 / 2014-02-24
8
+
9
+ * Delete the merged branch if it's on the repo (#2)
10
+ * Kill newline after 'Continue Anyway' prompt (#3)
11
+
12
+ ## 0.1.0 / 2014-02-10
13
+
14
+ * Fixed netrc support (#1)
15
+
16
+ ## 0.0.1 / 2014-01-21
17
+
18
+ * Birthday!
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Parker Moore
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # git-merge-pr
2
+
3
+ Merge a pull request for the current directory's project on GitHub.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'git-merge-pr'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install git-merge-pr
18
+
19
+ ## Usage
20
+
21
+ 1. Navigate to your local clone of the project
22
+ 2. Run `git merge-pr PR_NUM`. Do not include the `#`.
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it ( http://github.com/<my-github-username>/git_merge_pr/fork )
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/git-merge-pr ADDED
@@ -0,0 +1,50 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # git-merge-pr(1)
4
+ #
5
+ # Summary:
6
+ # Merge a pull request on github.com
7
+ #
8
+ # Usage:
9
+ # git-merge-pr 1776
10
+ #
11
+ # Author:
12
+ # Parker Moore (@parkr)
13
+ #
14
+
15
+ require 'octokit'
16
+ require 'netrc'
17
+ require 'rugged'
18
+
19
+ abort "Provide a PR number (no '#' tho)" if ARGV.empty?
20
+
21
+ pr_num = ARGV.first
22
+ remote = Rugged::Repository.new(Rugged::Repository.discover(Dir.pwd)).remotes.first.url
23
+ remote.sub!("git@github.com:", "https://github.com/")
24
+ remote.sub!(/\.git$/, "")
25
+
26
+ client = Octokit::Client.new(netrc: true)
27
+ repo = Octokit::Repository.from_url(remote)
28
+
29
+ unless client.pull_merged?(repo, pr_num)
30
+ begin
31
+ client.merge_pull_request(repo, pr_num)
32
+ rescue Octokit::NotFound => e
33
+ abort "Got a 404 -- looks like #{repo}##{pr_num} doesn't exist."
34
+ end
35
+
36
+ # delete branch if it's on the repo
37
+ merged_branch = client.pull_request(repo, pr_num).head.ref
38
+ begin
39
+ if client.ref(repo, "heads/#{merged_branch}")
40
+ unless %w[master gh-pages].include?(merged_branch)
41
+ client.delete_branch(repo, merged_branch)
42
+ end
43
+ end
44
+ rescue Octokit::NotFound
45
+ end
46
+ else
47
+ puts "Pull request #{repo}##{pr_num} has already been merged."
48
+ print "Continue anyway? (y/n) "
49
+ abort unless STDIN.gets.chomp == "y"
50
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'git-merge-pr/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "git-merge-pr"
8
+ spec.version = GitMergePr::VERSION
9
+ spec.authors = ["Parker Moore"]
10
+ spec.email = ["parkrmoore@gmail.com"]
11
+ spec.summary = %q{Merge a pull request on GitHub.com from the command-line.}
12
+ spec.homepage = "https://github.com/parkr/git-merge-pr"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "octokit", "~> 2.7"
21
+ spec.add_runtime_dependency "rugged", "~> 0.19.0"
22
+ spec.add_runtime_dependency "netrc", "~> 0.7.7"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.5"
25
+ spec.add_development_dependency "rake"
26
+ end
@@ -0,0 +1,5 @@
1
+ require "git_merge_pr/version"
2
+
3
+ module GitMergePr
4
+ # There is no code here, yet. Look in bin/.
5
+ end
@@ -0,0 +1,3 @@
1
+ module GitMergePr
2
+ VERSION = "0.3.0"
3
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-merge-pr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Parker Moore
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: octokit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rugged
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.19.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.19.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: netrc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.7
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.7
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - parkrmoore@gmail.com
86
+ executables:
87
+ - git-merge-pr
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - History.markdown
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/git-merge-pr
98
+ - git-merge-pr.gemspec
99
+ - lib/git-merge-pr.rb
100
+ - lib/git-merge-pr/version.rb
101
+ homepage: https://github.com/parkr/git-merge-pr
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.2.2
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Merge a pull request on GitHub.com from the command-line.
125
+ test_files: []