auto_release_note 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e9cb49ef624270c4532c84a11031a8aa4287cbbede5a14d9cd4309c497e65d94
4
+ data.tar.gz: 8f7231e12c11efd16cc97aa1026f21d6e235489696c5cb1fb6be5733606471bb
5
+ SHA512:
6
+ metadata.gz: 86f0e5746c87c6613ec2bd52c52b760ed3a267d86f09bcb46097a12a647035aa5fdaba6db46c004315bb0d60bf0971337ee8829f6e1140e1bb3c6e4b664a0abb
7
+ data.tar.gz: 14e5c35020179f3c90ef803e486ea27d1989e0f036185e69b5b26f3f6e3a72e31de70947ddacb1f4e9bbe23848746ef1c003224179e0451fca15cbd8cc6f1673
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 1.16.3
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in auto_release_note.gemspec
6
+ gemspec
7
+
8
+ gem 'thor'
9
+
10
+ group :development do
11
+ gem 'rspec'
12
+ gem 'guard-rspec'
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,73 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ auto_release_note (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ diff-lcs (1.3)
11
+ ffi (1.10.0)
12
+ formatador (0.2.5)
13
+ guard (2.15.0)
14
+ formatador (>= 0.2.4)
15
+ listen (>= 2.7, < 4.0)
16
+ lumberjack (>= 1.0.12, < 2.0)
17
+ nenv (~> 0.1)
18
+ notiffany (~> 0.0)
19
+ pry (>= 0.9.12)
20
+ shellany (~> 0.0)
21
+ thor (>= 0.18.1)
22
+ guard-compat (1.2.1)
23
+ guard-rspec (4.7.3)
24
+ guard (~> 2.1)
25
+ guard-compat (~> 1.1)
26
+ rspec (>= 2.99.0, < 4.0)
27
+ listen (3.1.5)
28
+ rb-fsevent (~> 0.9, >= 0.9.4)
29
+ rb-inotify (~> 0.9, >= 0.9.7)
30
+ ruby_dep (~> 1.2)
31
+ lumberjack (1.0.13)
32
+ method_source (0.9.2)
33
+ nenv (0.3.0)
34
+ notiffany (0.1.1)
35
+ nenv (~> 0.1)
36
+ shellany (~> 0.0)
37
+ pry (0.12.2)
38
+ coderay (~> 1.1.0)
39
+ method_source (~> 0.9.0)
40
+ rake (10.5.0)
41
+ rb-fsevent (0.10.3)
42
+ rb-inotify (0.10.0)
43
+ ffi (~> 1.0)
44
+ rspec (3.8.0)
45
+ rspec-core (~> 3.8.0)
46
+ rspec-expectations (~> 3.8.0)
47
+ rspec-mocks (~> 3.8.0)
48
+ rspec-core (3.8.0)
49
+ rspec-support (~> 3.8.0)
50
+ rspec-expectations (3.8.2)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.8.0)
53
+ rspec-mocks (3.8.0)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-support (3.8.0)
57
+ ruby_dep (1.5.0)
58
+ shellany (0.0.1)
59
+ thor (0.20.3)
60
+
61
+ PLATFORMS
62
+ ruby
63
+
64
+ DEPENDENCIES
65
+ auto_release_note!
66
+ bundler (~> 1.16)
67
+ guard-rspec
68
+ rake (~> 10.0)
69
+ rspec
70
+ thor
71
+
72
+ BUNDLED WITH
73
+ 1.16.3
data/Guardfile ADDED
@@ -0,0 +1,70 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.call("routing/#{m[1]}_routing"),
51
+ rspec.spec.call("controllers/#{m[1]}_controller"),
52
+ rspec.spec.call("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 iaia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # AutoReleaseNote
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/auto_release_note`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'auto_release_note'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install auto_release_note
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/auto_release_note.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,29 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "auto_release_note/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "auto_release_note"
8
+ spec.version = AutoReleaseNote::VERSION
9
+ spec.authors = ["iaia"]
10
+ spec.email = ["iaia72160@gmail.com"]
11
+
12
+ spec.summary = "Auto generate release notes"
13
+ spec.description = "Auto generate release notes"
14
+ spec.homepage = "https://github.com/iaia"
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.16"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "auto_release_note"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'auto_release_note'
4
+
5
+ AutoReleaseNote::CLI.start(ARGV)
@@ -0,0 +1,14 @@
1
+ require "auto_release_note/version"
2
+ require "auto_release_note/git_log"
3
+ require "auto_release_note/cli"
4
+
5
+ module AutoReleaseNote
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)
9
+ links = log.logs.map {|l| l[:issue].to_i }.sort.map do |issue|
10
+ "https://github.com/#{username}/#{issue}"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ require 'auto_release_note'
2
+ require 'thor'
3
+
4
+ module AutoReleaseNote
5
+ class CLI < Thor
6
+ default_task :execute
7
+
8
+ desc 'execute username tagquery', 'execute desc'
9
+ def execute(username, tag_query)
10
+ puts AutoReleaseNote.execute(username: username, tag_query: tag_query)
11
+ end
12
+
13
+ desc 'version', 'version'
14
+ def version
15
+ puts AutoReleaseNote::VERSION
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,48 @@
1
+ module AutoReleaseNote
2
+ class GitLog
3
+ attr_reader :issues, :logs
4
+
5
+ def initialize(merge_log: nil, tag_query: nil)
6
+ @logs = []
7
+ @issues = []
8
+ merge_log = `git log --merges --oneline #{tag_query} | grep 'Merge pull request #'` unless merge_log
9
+ parse_merge_log(merge_log)
10
+ get_issue
11
+ end
12
+
13
+ private
14
+ def parse_merge_log(merge_log)
15
+ merge_log.each_line do |line|
16
+ logs << { pull_req_id: get_pull_req_id(line), branch: get_branch_name(line), issue: nil }
17
+ end
18
+ logs.compact!
19
+ end
20
+
21
+ def get_pull_req_id(log)
22
+ log.match(/Merge pull request #(.+) from .*/)[1]
23
+ end
24
+
25
+ def get_branch_name(log)
26
+ log.match(/Merge pull request .+ from (.+)/)[1]
27
+ end
28
+
29
+ def get_issue
30
+ get_issue_id_by_branch_name
31
+ substitute_pull_req_for_issue
32
+ end
33
+
34
+ def get_issue_id_by_branch_name
35
+ @logs.each do |log|
36
+ id = log[:branch].match(/\D*(\d+)\D*/)
37
+ log[:issue] = id[1] if id
38
+ end
39
+ end
40
+
41
+ def substitute_pull_req_for_issue
42
+ @logs.each do |log|
43
+ log[:issue] = log[:pull_req_id] unless log[:issue]
44
+ end
45
+ end
46
+ end
47
+ end
48
+
@@ -0,0 +1,3 @@
1
+ module AutoReleaseNote
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: auto_release_note
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - iaia
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Auto generate release notes
56
+ email:
57
+ - iaia72160@gmail.com
58
+ executables:
59
+ - auto_release_note
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - Guardfile
69
+ - LICENSE.txt
70
+ - README.md
71
+ - Rakefile
72
+ - auto_release_note.gemspec
73
+ - bin/console
74
+ - bin/setup
75
+ - exe/auto_release_note
76
+ - lib/auto_release_note.rb
77
+ - lib/auto_release_note/cli.rb
78
+ - lib/auto_release_note/git_log.rb
79
+ - lib/auto_release_note/version.rb
80
+ homepage: https://github.com/iaia
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.7.6
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Auto generate release notes
104
+ test_files: []