open-pull-request 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cf1ae049db699da91eba631f34074fb7f31fa8b8
4
+ data.tar.gz: fcab0d3c30f78e8dcc38c72edd08af0e506777d5
5
+ SHA512:
6
+ metadata.gz: cf36027fbbb0049b53ec361b060d3cfebbd5f8f0a712857f3ae9cf3cea6996c8ab06d2eb58e46e01bb745fbf510625927663f648a20a8bd0d30b503796187aff
7
+ data.tar.gz: 7f6a4f696a2a419b53cf371832462d18f372f048bd8e035cf69ffa9041ea3e174ceea4f0fc888d01df8e8264271a321e7278d57814163d7e7f1b5615039af9e0
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-pull-request.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Dragos Miron
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,33 @@
1
+ # Open::PullRequest
2
+
3
+ A utility that allows you to open a *Pull Request* inside the browser.
4
+ For the moment all pull requests will be made against master branch.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'open-pull-request'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install open-pull-request
19
+
20
+ ## Usage
21
+
22
+ To use it go to a git repository on a separate branch than master and type
23
+ `git pr`
24
+ This will open a internet browser window with the comparison betwwen the branch you are currently on and master.
25
+
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it ( http://github.com/<my-github-username>/open-pull-request/fork )
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/git-pr ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require 'rubygems'
5
+ require 'cgi'
6
+ require 'open3'
7
+ require 'open-pull-request'
8
+
9
+ Open::PullRequest.request!
@@ -0,0 +1,39 @@
1
+ require "open-pull-request/version"
2
+ require 'cgi'
3
+
4
+ module Open
5
+ module PullRequest
6
+ extend self
7
+ def request!
8
+ branch = get_branch_name
9
+ abort unless $?.success?
10
+
11
+ root_url = "https://www.github.com/#{repo_url}/compare/"
12
+ compared_branches = "master...#{CGI.escape(branch.strip)}"
13
+ options = [
14
+ ["pull_request[title]", pr_title],
15
+ ["pull_request[body]", "Please give a description"]
16
+ ].map{|pair|
17
+ pair.map{ |el| CGI.escape(el) }.join("=")
18
+ }.join("&")
19
+
20
+ system("open", "#{root_url}#{compared_branches}?#{options}")
21
+ end
22
+
23
+ private
24
+
25
+ def get_branch_name
26
+ @branch_name ||= `git rev-parse --abbrev-ref HEAD`
27
+ end
28
+
29
+ def repo_url
30
+ @repo_url ||= `git config --get remote.origin.url`
31
+ .sub(/.*github\.com[\/:]/,'').sub(/\.git$/,'').strip
32
+ end
33
+
34
+ def pr_title
35
+ get_branch_name.gsub(/[^\w]+/, " ").strip.capitalize
36
+ end
37
+
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ module Open
2
+ module PullRequest
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'open-pull-request/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "open-pull-request"
8
+ spec.version = Open::PullRequest::VERSION
9
+ spec.authors = ["Dragos Miron"]
10
+ spec.email = ["dragosmr@gmail.com"]
11
+ spec.summary = %q{Open a pull request in browser with current branch}
12
+ spec.homepage = "http://github.com/dragosmiron/git-pull-request"
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_development_dependency "bundler", "~> 1.5"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "pry"
23
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: open-pull-request
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dragos Miron
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - dragosmr@gmail.com
58
+ executables:
59
+ - git-pr
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/git-pr
69
+ - lib/open-pull-request.rb
70
+ - lib/open-pull-request/version.rb
71
+ - open-pull-request.gemspec
72
+ homepage: http://github.com/dragosmiron/git-pull-request
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.0.14
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Open a pull request in browser with current branch
96
+ test_files: []