auto_release_note 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9cb49ef624270c4532c84a11031a8aa4287cbbede5a14d9cd4309c497e65d94
4
- data.tar.gz: 8f7231e12c11efd16cc97aa1026f21d6e235489696c5cb1fb6be5733606471bb
3
+ metadata.gz: 666a074efb83c43d9b021a68026aba78d98d81ba27ab82d81cff03a45ba28930
4
+ data.tar.gz: ea70d33b147fad86bd7d5e453950e82b60d6002647ebe73cb7bdae77063eea0d
5
5
  SHA512:
6
- metadata.gz: 86f0e5746c87c6613ec2bd52c52b760ed3a267d86f09bcb46097a12a647035aa5fdaba6db46c004315bb0d60bf0971337ee8829f6e1140e1bb3c6e4b664a0abb
7
- data.tar.gz: 14e5c35020179f3c90ef803e486ea27d1989e0f036185e69b5b26f3f6e3a72e31de70947ddacb1f4e9bbe23848746ef1c003224179e0451fca15cbd8cc6f1673
6
+ metadata.gz: 26c181b7e3a66860ba4f5e900c5529f63f27542e20f5dd14ed4aa1d87a6c30565a75cd892928910ab677b3688f2625ad644e2a4fe7123ed22bb2f78950197b9f
7
+ data.tar.gz: c83341accaf70bfc347c2bd614569dcc1135c10dd409f71bec650828b9c1c013f06df3136563b5dbf7b990435ddc3a027d48a5c7fdd92fd69af6563e37bfcf53
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
6
  gemspec
7
7
 
8
8
  gem 'thor'
9
+ gem 'git'
9
10
 
10
11
  group :development do
11
12
  gem 'rspec'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auto_release_note (0.1.0)
4
+ auto_release_note (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -10,6 +10,7 @@ GEM
10
10
  diff-lcs (1.3)
11
11
  ffi (1.10.0)
12
12
  formatador (0.2.5)
13
+ git (1.5.0)
13
14
  guard (2.15.0)
14
15
  formatador (>= 0.2.4)
15
16
  listen (>= 2.7, < 4.0)
@@ -64,6 +65,7 @@ PLATFORMS
64
65
  DEPENDENCIES
65
66
  auto_release_note!
66
67
  bundler (~> 1.16)
68
+ git
67
69
  guard-rspec
68
70
  rake (~> 10.0)
69
71
  rspec
@@ -1,16 +1,26 @@
1
+ require 'git'
2
+
1
3
  module AutoReleaseNote
2
4
  class GitLog
3
5
  attr_reader :issues, :logs
4
6
 
5
- def initialize(merge_log: nil, tag_query: nil)
7
+ def initialize(tag_query)
6
8
  @logs = []
7
9
  @issues = []
8
- merge_log = `git log --merges --oneline #{tag_query} | grep 'Merge pull request #'` unless merge_log
9
- parse_merge_log(merge_log)
10
+ @git = Git.open(Dir.pwd)
11
+ parse_merge_log(get_merge_log(tag_query))
10
12
  get_issue
11
13
  end
12
14
 
15
+ def repositories
16
+ @git.remotes.map {|remote| remote.url.gsub(/.git$/, '') }
17
+ end
18
+
13
19
  private
20
+ def get_merge_log(tag_query)
21
+ merge_log ||= @git.log.between(tag_query.split("..")[0], tag_query.split("..")[1]) # `git log --merges --oneline #{tag_query} | grep 'Merge pull request #'`
22
+ end
23
+
14
24
  def parse_merge_log(merge_log)
15
25
  merge_log.each_line do |line|
16
26
  logs << { pull_req_id: get_pull_req_id(line), branch: get_branch_name(line), issue: nil }
@@ -1,3 +1,3 @@
1
1
  module AutoReleaseNote
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -4,10 +4,11 @@ require "auto_release_note/cli"
4
4
 
5
5
  module AutoReleaseNote
6
6
  class << self
7
- def execute(username:, merge_log: nil, tag_query: nil)
8
- log = AutoReleaseNote::GitLog.new(merge_log: merge_log, tag_query: tag_query)
7
+ def execute(username:, tag_query: nil)
8
+ log = AutoReleaseNote::GitLog.new(tag_query: tag_query)
9
+ repository = log.repositories.first
9
10
  links = log.logs.map {|l| l[:issue].to_i }.sort.map do |issue|
10
- "https://github.com/#{username}/#{issue}"
11
+ "#{repository}/#{issue}"
11
12
  end
12
13
  end
13
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_release_note
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iaia