open-pull-request 0.0.1 → 0.0.3
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/Gemfile +0 -1
- data/README.md +8 -8
- data/bin/git-pr +2 -2
- data/lib/open-pull-request.rb +34 -5
- data/lib/open-pull-request/trello_details.rb +45 -0
- data/lib/open-pull-request/version.rb +3 -3
- data/open-pull-request.gemspec +3 -0
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de6584c8cdb9b19bfed8f76fa0aaa991ae355844
|
4
|
+
data.tar.gz: c34eace200a5c187386ecfe54f770f807bdefebc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99d19d4cf73294355601bb9f3fd7b94da9702a6d794c00a06722841610881c9991b6947354e602f4b77bd757e0d899e67e8e4e811898e1813cf720b4f2383dcc
|
7
|
+
data.tar.gz: f2fafe6225d10d145d686622cbf9060868f553f731bcdc739630ce92b96a6d0ea4bc8b43406c292c7194aaaa0239662d59dabacfc6f8834ad2afd3ffcbcdc16e
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -5,24 +5,24 @@ For the moment all pull requests will be made against master branch.
|
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
|
8
|
+
`$ gem install open-pull-request`
|
9
9
|
|
10
|
-
|
10
|
+
Optional:
|
11
|
+
Set-up the following in git config if you want Trello integration:
|
12
|
+
* `git config trello.developer-public-key`
|
13
|
+
* `git config trello.member-token`
|
11
14
|
|
12
|
-
And then execute:
|
13
15
|
|
14
|
-
$ bundle
|
15
16
|
|
16
|
-
Or install it yourself as:
|
17
|
-
|
18
|
-
$ gem install open-pull-request
|
19
17
|
|
20
18
|
## Usage
|
21
19
|
|
22
20
|
To use it go to a git repository on a separate branch than master and type
|
23
21
|
`git pr`
|
24
|
-
This will open a internet browser window with the comparison betwwen the branch you are currently on and master.
|
25
22
|
|
23
|
+
This will open a internet browser window with the comparison between the branch you are currently on and master.
|
24
|
+
|
25
|
+
If you want to populate the body of the pull-request with the Trello details, pass a `-t CARD_ID` parameter, with CARD_ID being the id of the Trello card
|
26
26
|
|
27
27
|
## Contributing
|
28
28
|
|
data/bin/git-pr
CHANGED
data/lib/open-pull-request.rb
CHANGED
@@ -1,18 +1,37 @@
|
|
1
|
-
|
1
|
+
require_relative "open-pull-request/version"
|
2
|
+
require_relative "open-pull-request/trello_details"
|
2
3
|
require 'cgi'
|
4
|
+
require 'optparse'
|
5
|
+
require 'ostruct'
|
6
|
+
require 'pry'
|
3
7
|
|
4
8
|
module Open
|
5
|
-
|
6
|
-
|
9
|
+
class PullRequest
|
10
|
+
attr_reader :options
|
11
|
+
def initialize
|
12
|
+
@options = OpenStruct.new
|
13
|
+
end
|
14
|
+
|
7
15
|
def request!
|
16
|
+
option_parser.parse!(ARGV)
|
8
17
|
branch = get_branch_name
|
9
18
|
abort unless $?.success?
|
10
|
-
|
19
|
+
pr_description = "Please give a description"
|
20
|
+
if options.trello_card_id
|
21
|
+
developer_public_key = `git config trello.developer-public-key`.strip
|
22
|
+
member_token = `git config trello.member-token`.strip
|
23
|
+
trello_details = TrelloDetails.new(
|
24
|
+
options.trello_card_id,
|
25
|
+
developer_public_key,
|
26
|
+
member_token
|
27
|
+
)
|
28
|
+
pr_description = trello_details.pull_request_description
|
29
|
+
end
|
11
30
|
root_url = "https://www.github.com/#{repo_url}/compare/"
|
12
31
|
compared_branches = "master...#{CGI.escape(branch.strip)}"
|
13
32
|
options = [
|
14
33
|
["pull_request[title]", pr_title],
|
15
|
-
["pull_request[body]",
|
34
|
+
["pull_request[body]", pr_description]
|
16
35
|
].map{|pair|
|
17
36
|
pair.map{ |el| CGI.escape(el) }.join("=")
|
18
37
|
}.join("&")
|
@@ -35,5 +54,15 @@ module Open
|
|
35
54
|
get_branch_name.gsub(/[^\w]+/, " ").strip.capitalize
|
36
55
|
end
|
37
56
|
|
57
|
+
def option_parser
|
58
|
+
@option_parser ||= OptionParser.new do |op|
|
59
|
+
|
60
|
+
op.on("-t", "--trello CARD_ID", "Trello card id to pull info from") do |v|
|
61
|
+
options.trello_card_id = v
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
38
67
|
end
|
39
68
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'trello'
|
2
|
+
require 'active_support/core_ext/string'
|
3
|
+
require 'term/ansicolor'
|
4
|
+
|
5
|
+
class TrelloDetails
|
6
|
+
def initialize(card_id, developer_public_key, member_token)
|
7
|
+
@trello_client = ::Trello::Client.new(
|
8
|
+
developer_public_key: developer_public_key,
|
9
|
+
member_token: member_token
|
10
|
+
)
|
11
|
+
@card = @trello_client.find(:card, card_id)
|
12
|
+
end
|
13
|
+
|
14
|
+
def pull_request_description
|
15
|
+
log "Finding your project and story "
|
16
|
+
desc = "##### Trello card\n"
|
17
|
+
desc << "**#{@card.name}** - #{@card.url}\n"
|
18
|
+
log "."
|
19
|
+
desc << "#{@card.desc}\n"
|
20
|
+
log "."
|
21
|
+
desc << "\n"
|
22
|
+
desc << "##### Members\n"
|
23
|
+
log "."
|
24
|
+
desc << @card.members.map{ |m| "- #{m.full_name}" }.join("\n")
|
25
|
+
desc << "\n\n"
|
26
|
+
log "."
|
27
|
+
@card.checklists.each do |checklist|
|
28
|
+
desc << build_checklist_description(checklist)
|
29
|
+
log "."
|
30
|
+
desc << "\n"
|
31
|
+
end
|
32
|
+
desc
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def build_checklist_description(checklist)
|
37
|
+
desc = "##### #{checklist.name}\n"
|
38
|
+
desc << checklist.check_items.map{|c|"- #{c["name"]}"}.join("\n")
|
39
|
+
end
|
40
|
+
|
41
|
+
def log(msg)
|
42
|
+
m = Term::ANSIColor.green(msg)
|
43
|
+
print m
|
44
|
+
end
|
45
|
+
end
|
data/open-pull-request.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open-pull-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dragos Miron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ruby-trello
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: term-ansicolor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description:
|
56
84
|
email:
|
57
85
|
- dragosmr@gmail.com
|
@@ -67,6 +95,7 @@ files:
|
|
67
95
|
- Rakefile
|
68
96
|
- bin/git-pr
|
69
97
|
- lib/open-pull-request.rb
|
98
|
+
- lib/open-pull-request/trello_details.rb
|
70
99
|
- lib/open-pull-request/version.rb
|
71
100
|
- open-pull-request.gemspec
|
72
101
|
homepage: http://github.com/dragosmiron/git-pull-request
|