gitbc 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6adf83591c23faed7401a40dd2a608dfb5e2e173
4
- data.tar.gz: 8b434cf71eaa42a7cb143386cee8b8e4858b44de
3
+ metadata.gz: a7f2331adda5c1aee8de2019e7844df5d32c13ef
4
+ data.tar.gz: 92f5e1cd5635fefd9c07e05a242ca0aad83c78b4
5
5
  SHA512:
6
- metadata.gz: cb69df4ab6c43414625bd51b9923121fbb327cde9154389d71503ba3cbcabd89691e54820f33ef1cbff388603aa66a55cb6e74dd65ca04ff3337121a7397ef65
7
- data.tar.gz: 9d53b92fc602b07252f2bd32b12fd244ca463955a4bb53354a27bd2ab6607e0f89736bf3e64a5ff51f8346f7eec4722b843cd0d6aa112ad99001759fc4ff6d48
6
+ metadata.gz: a914e4bdbb83d3beff66ccdebc9a8695ca3e9bd2be5244a9a6cecb7fa031893edcdadfcfde315956a50a437ae2fb183619cf1495fe1afb7029e2cc1a748cf648
7
+ data.tar.gz: 0b8adae036400266e44d3a04eda31b1d662e9db7f6ddbd913f4b51307ad0554f86c4bfa748e9f17c5088d6bcf64111a325f2d9589088b13e3994aebfc4c67b89
data/README.md CHANGED
@@ -26,15 +26,15 @@ The only required parameter is start tag. All other parameters, such as branch a
26
26
 
27
27
  ```bash
28
28
  Usage: git-bc <start_tag> [end_tag] [options]
29
- -f, --config-file FILE Use specific configurations file (default is ~/.gitbc)
30
- -a, --github-token TOKEN Use specific GitHub access token
31
- -u, --basecamp-user USER Use specific Basecamp user
32
- -p, --basecamp-password PASSWORD Use specific Basecamp password
33
- -b, --branch BRANCH Use specific git branch
34
- -r, --repository REPO Query specific GitHub repository
35
- -q, --quiet Quiet tool output
36
- -c, --basecamp-content Include content of the related Basecamp TODO
37
- -h, --help Show this message
29
+ -f, --config-file [FILE] Use specific configurations file (default is ~/.gitbc)
30
+ -a, --github-token [TOKEN] Use specific GitHub access token
31
+ -u, --bc-user [USER] Use specific Basecamp user
32
+ -p, --bc-password [PASSWORD] Use specific Basecamp password
33
+ -b, --branch [BRANCH] Use specific git branch
34
+ -r, --repository [REPO] Query specific GitHub repository
35
+ -q, --quiet Quiet tool output
36
+ -c, --basecamp-content Include content of the related Basecamp TODO
37
+ -h, --help Show this message
38
38
  ```
39
39
 
40
40
  GitHub and Basecamp credentials can be provided using CLI parameters or by creating a configuration file (default one used is ~/.gitbc).
data/bin/gitbc CHANGED
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'bundler/setup'
3
4
  require 'gitbc'
4
5
 
6
+ require 'optionparser'
7
+
5
8
  trap('SIGINT') {puts ''; exit!}
6
9
 
7
10
  options = {}
@@ -11,27 +14,27 @@ options[:quiet] = false
11
14
  opt_parser = OptionParser.new do |opts|
12
15
  opts.banner = 'Usage: git-bc <start_tag> [end_tag] [options]'
13
16
 
14
- opts.on('-f FILE', '--config-file FILE', 'Use specific configurations file (default is ~/.gitbc)') do |f|
17
+ opts.on('-f', '--config-file [FILE]', 'Use specific configurations file (default is ~/.gitbc)') do |f|
15
18
  options[:config_file] = f
16
19
  end
17
20
 
18
- opts.on('-a TOKEN', '--github-token TOKEN', 'Use specific GitHub access token') do |a|
21
+ opts.on('-a', '--github-token [TOKEN]', 'Use specific GitHub access token') do |a|
19
22
  options[:github_access_token] = a
20
23
  end
21
24
 
22
- opts.on('-u USER', '--basecamp-user USER', 'Use specific Basecamp user') do |u|
25
+ opts.on('-u', '--bc-user [USER]', 'Use specific Basecamp user') do |u|
23
26
  options[:basecamp_user] = u
24
27
  end
25
28
 
26
- opts.on('-p PASSWORD', '--basecamp-password PASSWORD', 'Use specific Basecamp password') do |p|
29
+ opts.on('-p', '--bc-password [PASSWORD]', 'Use specific Basecamp password') do |p|
27
30
  options[:basecamp_password] = p
28
31
  end
29
32
 
30
- opts.on('-b BRANCH', '--branch BRANCH', 'Use specific git branch') do |b|
33
+ opts.on('-b', '--branch [BRANCH]', 'Use specific git branch') do |b|
31
34
  options[:branch] = b
32
35
  end
33
36
 
34
- opts.on('-r REPO', '--repository REPO', 'Query specific GitHub repository') do |r|
37
+ opts.on('-r', '--repository [REPO]', 'Query specific GitHub repository') do |r|
35
38
  options[:repository] = r
36
39
  end
37
40
 
@@ -39,7 +42,7 @@ opt_parser = OptionParser.new do |opts|
39
42
  options[:quiet] = q
40
43
  end
41
44
 
42
- opts.on('-c', '--basecamp-content', 'Include content of the related Basecamp TODO') do |c|
45
+ opts.on('-c', '--basecamp-content', 'Include content of the related Basecamp to-do') do |c|
43
46
  options[:basecamp_content] = c
44
47
  end
45
48
 
data/lib/gitbc.rb CHANGED
@@ -1,8 +1,9 @@
1
+ require 'gitbc/version'
2
+
1
3
  require 'httparty'
2
4
  require 'colorize'
3
5
  require 'octokit'
4
6
 
5
- require 'optparse'
6
7
  require 'json'
7
8
  require 'yaml'
8
9
  require 'open3'
@@ -75,8 +76,13 @@ class GitHubBasecampExtractor
75
76
  def get_basecamp_todos(pull_requests)
76
77
  basecamp_todos = pull_requests.inject({}) do |memo, pull_request_id|
77
78
  pr = @github_client.pull_request(@params[:repository], pull_request_id)
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: []}
79
+ if pr.attrs[:body]
80
+ basecamp_lines = pr.attrs[:body].split("\r\n").grep(/.*https\:\/\/basecamp\.com.*/)
81
+ memo[pull_request_id] = {body: pr.attrs[:body][0..MAX_PR_BODY_LENGTH].strip, lines: []}
82
+ else
83
+ basecamp_lines = []
84
+ memo[pull_request_id] = {body: '', lines: []}
85
+ end
80
86
  if basecamp_lines.count > 0
81
87
  memo[pull_request_id][:lines] = basecamp_lines.map { |line| {url: line[/.*(https\:\/\/basecamp\.com[^!?#:;,.\s]*)/, 1]} }.uniq
82
88
  if @params[:basecamp_content]
data/lib/gitbc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gitbc
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
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.1
4
+ version: 1.0.2
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-24 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit