git_pr_release_parser 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +11 -0
- data/Gemfile +6 -0
- data/README.md +48 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/git_pr_release_parser.gemspec +24 -0
- data/lib/git_pr_release_parser.rb +33 -0
- data/lib/git_pr_release_parser/result.rb +18 -0
- data/lib/git_pr_release_parser/version.rb +3 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d36a98eb091147770331bbf6dad64b42fa53bf987f01afa6edd24c555a2d34fa
|
4
|
+
data.tar.gz: 93dc835ad8e8adfd62d0ec39a3d1c9e0061ffd63162892e36d7ba94f066ea1ca
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 504c799b057f975dac58cc1eac0136a8035982c251f7b1c2a99e64413e263f0c7a385497e61d6da7a9df5935f83b7ecd14e281d86264fd5923692a5297967633
|
7
|
+
data.tar.gz: 57cb6e8e4daa7ccd919900feb68c069cc46b6baf4abd1918cff9fbc1634e7fe3e8defb59424dc509a2adddf7da474fd95ecbfe827f72e9b96c443b9eadff0790
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# GitPrReleaseParser
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/a2ikm/git_pr_release_parser.svg?branch=master)](https://travis-ci.org/a2ikm/git_pr_release_parser)
|
4
|
+
|
5
|
+
Parse [git-pr-release](https://github.com/motemen/git-pr-release)'s output in Ruby.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'git_pr_release_parser'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install git_pr_release_parser
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require "open3"
|
27
|
+
require "git_pr_release_parser"
|
28
|
+
|
29
|
+
output, status = Open3.capture2e("git-pr-release")
|
30
|
+
result = GitPrReleaseParser.parse(output)
|
31
|
+
|
32
|
+
if result
|
33
|
+
puts result.release_pull_request
|
34
|
+
result.merged_pull_requests.each do |merged|
|
35
|
+
puts merged
|
36
|
+
end
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
43
|
+
|
44
|
+
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).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/a2ikm/git_pr_release_parser.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "git_pr_release_parser"
|
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,24 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "git_pr_release_parser/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "git_pr_release_parser"
|
8
|
+
spec.version = GitPrReleaseParser::VERSION
|
9
|
+
spec.authors = ["Masato Ikeda"]
|
10
|
+
spec.email = ["masato.ikeda@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Parse git-pr-release output.}
|
13
|
+
spec.description = %q{Parse git-pr-release output.}
|
14
|
+
spec.homepage = "https://github.com/a2ikm/git_pr_release_parser"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
24
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "git_pr_release_parser/result"
|
2
|
+
require "git_pr_release_parser/version"
|
3
|
+
|
4
|
+
class GitPrReleaseParser
|
5
|
+
class <<self
|
6
|
+
def parse(source)
|
7
|
+
new.parse(source)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
MERGE_REGEXP = /To be released: (.+)\n/
|
12
|
+
RELEASE_REGEXP = /(?:Created|Updated) pull request: (.+)\n/
|
13
|
+
|
14
|
+
def parse(source)
|
15
|
+
merged = []
|
16
|
+
release = nil
|
17
|
+
|
18
|
+
clean(source).each_line do |line|
|
19
|
+
case line
|
20
|
+
when MERGE_REGEXP
|
21
|
+
merged << $1
|
22
|
+
when RELEASE_REGEXP
|
23
|
+
release = $1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
Result.new(release, merged).verify
|
28
|
+
end
|
29
|
+
|
30
|
+
def clean(source)
|
31
|
+
source.gsub(/\^\[\[[0-9;]+m/, "")
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class GitPrReleaseParser
|
2
|
+
class Result
|
3
|
+
attr_reader :release_pull_request, :merged_pull_requests
|
4
|
+
|
5
|
+
def initialize(release_pull_request, merged_pull_requests)
|
6
|
+
@release_pull_request = release_pull_request.freeze
|
7
|
+
@merged_pull_requests = merged_pull_requests.freeze
|
8
|
+
end
|
9
|
+
|
10
|
+
def verify
|
11
|
+
if release_pull_request && merged_pull_requests.length > 0
|
12
|
+
self
|
13
|
+
else
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git_pr_release_parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masato Ikeda
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-22 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: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description: Parse git-pr-release output.
|
56
|
+
email:
|
57
|
+
- masato.ikeda@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- Gemfile
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- bin/console
|
68
|
+
- bin/setup
|
69
|
+
- git_pr_release_parser.gemspec
|
70
|
+
- lib/git_pr_release_parser.rb
|
71
|
+
- lib/git_pr_release_parser/result.rb
|
72
|
+
- lib/git_pr_release_parser/version.rb
|
73
|
+
homepage: https://github.com/a2ikm/git_pr_release_parser
|
74
|
+
licenses: []
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.7.3
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Parse git-pr-release output.
|
96
|
+
test_files: []
|