gitbc 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gitbc +5 -4
- data/lib/gitbc/version.rb +1 -1
- data/lib/gitbc.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6adf83591c23faed7401a40dd2a608dfb5e2e173
|
4
|
+
data.tar.gz: 8b434cf71eaa42a7cb143386cee8b8e4858b44de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb69df4ab6c43414625bd51b9923121fbb327cde9154389d71503ba3cbcabd89691e54820f33ef1cbff388603aa66a55cb6e74dd65ca04ff3337121a7397ef65
|
7
|
+
data.tar.gz: 9d53b92fc602b07252f2bd32b12fd244ca463955a4bb53354a27bd2ab6607e0f89736bf3e64a5ff51f8346f7eec4722b843cd0d6aa112ad99001759fc4ff6d48
|
data/bin/gitbc
CHANGED
@@ -154,11 +154,12 @@ if basecamp_todos.count > 0
|
|
154
154
|
puts "end tag: #{options[:end_tag]}"
|
155
155
|
puts "branch: #{options[:branch]}"
|
156
156
|
puts "repository: #{options[:repository]}"
|
157
|
-
puts
|
157
|
+
puts ''
|
158
158
|
basecamp_todos.each do |pr, todos|
|
159
|
-
|
160
|
-
todos.
|
161
|
-
|
159
|
+
body = todos[:body].gsub("\r\n", '')
|
160
|
+
puts "* PR #{pr}" + (todos[:lines].length == 0 && body.length > 0 ? ", #{body}" : '')
|
161
|
+
todos[:lines].each do |line|
|
162
|
+
puts " --#{line[:url]}" + (line[:content] ? ", #{line[:content]}" : '')
|
162
163
|
end
|
163
164
|
end
|
164
165
|
end
|
data/lib/gitbc/version.rb
CHANGED
data/lib/gitbc.rb
CHANGED
@@ -10,6 +10,7 @@ require 'open3'
|
|
10
10
|
class GitHubBasecampExtractor
|
11
11
|
DEFAULT_CONFIG_FILE = File.expand_path('~/.gitbc')
|
12
12
|
DEFAULT_END_TAG = 'HEAD'
|
13
|
+
MAX_PR_BODY_LENGTH = 235
|
13
14
|
|
14
15
|
def initialize(params)
|
15
16
|
@params = params
|
@@ -75,10 +76,11 @@ class GitHubBasecampExtractor
|
|
75
76
|
basecamp_todos = pull_requests.inject({}) do |memo, pull_request_id|
|
76
77
|
pr = @github_client.pull_request(@params[:repository], pull_request_id)
|
77
78
|
basecamp_lines = pr.attrs[:body].split("\r\n").grep(/.*https\:\/\/basecamp\.com.*/)
|
79
|
+
memo[pull_request_id] = {body: pr.attrs[:body][0..MAX_PR_BODY_LENGTH].strip, lines: []}
|
78
80
|
if basecamp_lines.count > 0
|
79
|
-
memo[pull_request_id] = basecamp_lines.map { |line| {url: line[/.*(https\:\/\/basecamp\.com[^!?#:;,.\s]*)/, 1]} }.uniq
|
81
|
+
memo[pull_request_id][:lines] = basecamp_lines.map { |line| {url: line[/.*(https\:\/\/basecamp\.com[^!?#:;,.\s]*)/, 1]} }.uniq
|
80
82
|
if @params[:basecamp_content]
|
81
|
-
memo[pull_request_id].each do |line|
|
83
|
+
memo[pull_request_id][:lines].each do |line|
|
82
84
|
line[:url].match /(https\:\/\/basecamp\.com\/\d+\/)(.*)/ do |match|
|
83
85
|
begin
|
84
86
|
ret = HTTParty.get "#{match[1]}api/v1/#{match[2]}.json", {basic_auth: {username: @params[:basecamp_user], password: @params[:basecamp_password]}, headers: {'Content-Type' => 'application/json', 'User-Agent' => "gitbc API (#{@params[:basecamp_user]})"}}
|
@@ -89,8 +91,7 @@ class GitHubBasecampExtractor
|
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
92
|
-
memo[pull_request_id]
|
93
|
-
yield(pull_request_id, memo[pull_request_id])
|
94
|
+
yield(pull_request_id, memo[pull_request_id]) if block_given?
|
94
95
|
memo
|
95
96
|
end
|
96
97
|
basecamp_todos
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitbc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orest Kulik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|