bitbucket-api-extension 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +10 -0
- data/VERSION +1 -1
- data/bitbucket-api-extension.gemspec +3 -2
- data/lib/bitbucket-api-extension.rb +1 -0
- data/lib/bitbucket-api-extension/api.rb +19 -0
- data/lib/bitbucket-api-extension/pull_request_detail.rb +14 -0
- metadata +4 -3
data/README.rdoc
CHANGED
@@ -6,6 +6,16 @@
|
|
6
6
|
* fetch bitbucket pull request comment
|
7
7
|
* post comment to bitbucket easily
|
8
8
|
|
9
|
+
== Installation
|
10
|
+
|
11
|
+
Add the following line to your Gemfile
|
12
|
+
|
13
|
+
gem 'bitbucket-api-extension'
|
14
|
+
|
15
|
+
and then execute
|
16
|
+
|
17
|
+
bundle install
|
18
|
+
|
9
19
|
== Usage
|
10
20
|
|
11
21
|
# initialize
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "bitbucket-api-extension"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["S.nishio"]
|
12
|
-
s.date = "2013-05-
|
12
|
+
s.date = "2013-05-14"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "nishio@densan-labs.net"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/bitbucket-api-extension/comment.rb",
|
33
33
|
"lib/bitbucket-api-extension/project.rb",
|
34
34
|
"lib/bitbucket-api-extension/pull_request.rb",
|
35
|
+
"lib/bitbucket-api-extension/pull_request_detail.rb",
|
35
36
|
"spec/bitbucket-api-extension_spec.rb",
|
36
37
|
"spec/spec_helper.rb"
|
37
38
|
]
|
@@ -38,6 +38,25 @@ class BitbucketApiExtension::Api
|
|
38
38
|
list
|
39
39
|
end
|
40
40
|
|
41
|
+
# プルリクエストの詳細情報を取得する
|
42
|
+
def pull_request_detail(pull_request)
|
43
|
+
detail = BitbucketApiExtension::PullRequestDetail.new(pull_request.attributes)
|
44
|
+
open(pull_request.request_page_url, auth_option) do |f|
|
45
|
+
html = Nokogiri::HTML(f.read)
|
46
|
+
from_to_elements = html.css('div.clearfix div.compare-widget-container div.compare-widget')
|
47
|
+
from = from_to_elements.first
|
48
|
+
push = from_to_elements.last
|
49
|
+
detail.from_user_or_team_name = from.attributes['data-user-name'].try(:value)
|
50
|
+
detail.from_repository_name = from.attributes['data-repo-name'].try(:value)
|
51
|
+
detail.from_branch_name = from.attributes['data-branch-name'].try(:value)
|
52
|
+
detail.from_commit_id = from.attributes['data-commit-id'].try(:value)
|
53
|
+
detail.to_user_or_team_name = push.attributes['data-user-name'].try(:value)
|
54
|
+
detail.to_repository_name = push.attributes['data-repo-name'].try(:value)
|
55
|
+
detail.to_branch_name = push.attributes['data-branch-name'].try(:value)
|
56
|
+
end
|
57
|
+
detail
|
58
|
+
end
|
59
|
+
|
41
60
|
# 指定したプルリクエストのマージコマンドを取得する
|
42
61
|
def merge_commands(pull_request)
|
43
62
|
commands = []
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module BitbucketApiExtension
|
4
|
+
class PullRequestDetail < BitbucketApiExtension::PullRequest
|
5
|
+
|
6
|
+
attribute :from_user_or_team_name, String
|
7
|
+
attribute :from_repository_name, String
|
8
|
+
attribute :from_branch_name, String
|
9
|
+
attribute :from_commit_id, String
|
10
|
+
attribute :to_user_or_team_name, String
|
11
|
+
attribute :to_repository_name, String
|
12
|
+
attribute :to_branch_name, String
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitbucket-api-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/bitbucket-api-extension/comment.rb
|
147
147
|
- lib/bitbucket-api-extension/project.rb
|
148
148
|
- lib/bitbucket-api-extension/pull_request.rb
|
149
|
+
- lib/bitbucket-api-extension/pull_request_detail.rb
|
149
150
|
- spec/bitbucket-api-extension_spec.rb
|
150
151
|
- spec/spec_helper.rb
|
151
152
|
homepage: http://github.com/nishio-dens/bitbucket-api-extension
|
@@ -163,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
164
|
version: '0'
|
164
165
|
segments:
|
165
166
|
- 0
|
166
|
-
hash:
|
167
|
+
hash: 1045761370310386153
|
167
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
169
|
none: false
|
169
170
|
requirements:
|