ruby-deb-changelog 0.1.0
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 +7 -0
- data/.github/workflows/cd.yml +17 -0
- data/.github/workflows/ci.yml +20 -0
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/lib/deb-changelog.rb +36 -0
- data/ruby-deb-changelog.gemspec +17 -0
- data/spec/deb-changelog_spec.rb +85 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5080729030a8f75c0e160f4ae9bd87ad033efceb14fbb7a0670f041090cf4dbe
|
4
|
+
data.tar.gz: 430125f8447fed87811b548c8df48ae01415beb87137ac3d32e24fe58c5464a9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ef5479741941f0ac393f861ec3aea59560a6eaea25b836e8cb0fe6fc4495bb8a1cc8e6d8fa1aff7f1f2853a52ea9686a3a6e586e32231d5aeeacbd05980c0d5a
|
7
|
+
data.tar.gz: c9bce2d5e32fce867e402aa2d69304e76b4345dc63a3499426bb42bc71aaa5227fad11d8e0090ec57902abb7d400baa55b1ef3f897c9b98ed7f56aaf845d5763
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: CD
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
cd:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- name: Checkout code
|
13
|
+
uses: actions/checkout@v2
|
14
|
+
- name: Publish to RubyGems
|
15
|
+
uses: dawidd6/action-publish-gem@v1
|
16
|
+
with:
|
17
|
+
api_key: ${{secrets.RUBYGEMS_API_KEY}}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
ci:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- name: Checkout code
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
- name: Setup Ruby
|
16
|
+
uses: actions/setup-ruby@v1
|
17
|
+
- name: Install deps
|
18
|
+
run: bundle install
|
19
|
+
- name: Run tests
|
20
|
+
run: rake
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Dawid Dziurla
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# ruby-deb-changelog
|
2
|
+
|
3
|
+
A Ruby gem for parsing Debian changelog files.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'ruby-deb-changelog'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install ruby-deb-changelog
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require "deb-changelog"
|
25
|
+
|
26
|
+
changelog = DebChangelog.parse_file("./debian/changelog")
|
27
|
+
puts changelog.methods
|
28
|
+
```
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dawidd6/ruby-deb-changelog.
|
33
|
+
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
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,36 @@
|
|
1
|
+
class DebChangelog
|
2
|
+
METADATA_REGEX = /^(?<package>.+) \(((?<epoch>[0-9]+):)?(?<version>[^:-]+)(-(?<revision>[^:-]+))?\) (?<distribution>.+); (?<params>.+)$/.freeze
|
3
|
+
CHANGE_REGEX = /^ \* (?<message>.+)$/.freeze
|
4
|
+
AUTHOR_REGEX = /^ -- (?<author_name>.*) <(?<author_email>.+@.+\..+)> (?<timestamp>.+)$/.freeze
|
5
|
+
|
6
|
+
def self.parse_file(file)
|
7
|
+
contents = File.read file
|
8
|
+
parse contents
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.parse(contents)
|
12
|
+
entries = []
|
13
|
+
|
14
|
+
contents.each_line do |line|
|
15
|
+
line.chomp!
|
16
|
+
|
17
|
+
if (metadata = line.match(METADATA_REGEX)&.named_captures)
|
18
|
+
entries << metadata
|
19
|
+
next
|
20
|
+
end
|
21
|
+
|
22
|
+
if (change = line.match(CHANGE_REGEX)&.named_captures)
|
23
|
+
entries.last["changes"] ||= []
|
24
|
+
entries.last["changes"] << change["message"]
|
25
|
+
next
|
26
|
+
end
|
27
|
+
|
28
|
+
if (author = line.match(AUTHOR_REGEX)&.named_captures)
|
29
|
+
entries.last.merge! author
|
30
|
+
next
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
entries
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "ruby-deb-changelog"
|
3
|
+
spec.version = "0.1.0"
|
4
|
+
spec.authors = ["Dawid Dziurla"]
|
5
|
+
spec.email = ["dawidd0811@gmail.com"]
|
6
|
+
|
7
|
+
spec.summary = "Debian changelog file parser"
|
8
|
+
spec.homepage = "https://github.com/dawidd6/ruby-deb-changelog"
|
9
|
+
spec.license = "MIT"
|
10
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split("\n")
|
13
|
+
spec.require_paths = ["lib"]
|
14
|
+
|
15
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
16
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
17
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require "deb-changelog"
|
2
|
+
|
3
|
+
RSpec.describe DebChangelog do
|
4
|
+
describe ".parse" do
|
5
|
+
it "parses one changelog entry" do
|
6
|
+
contents = <<~EOCH
|
7
|
+
lazygit (0.23.6-1) xenial; urgency=medium
|
8
|
+
|
9
|
+
* gui: fix go-1.10 compatibility
|
10
|
+
|
11
|
+
-- Dawid Dziurla <dawidd0811@gmail.com> Wed, 14 Oct 2020 14:52:51 +0200
|
12
|
+
EOCH
|
13
|
+
|
14
|
+
changelog = DebChangelog.parse contents
|
15
|
+
|
16
|
+
p changelog
|
17
|
+
expect(changelog).not_to eq nil
|
18
|
+
|
19
|
+
expect(changelog.last["package"]).to eq "lazygit"
|
20
|
+
expect(changelog.last["epoch"]).to eq nil
|
21
|
+
expect(changelog.last["version"]).to eq "0.23.6"
|
22
|
+
expect(changelog.last["revision"]).to eq "1"
|
23
|
+
expect(changelog.last["distribution"]).to eq "xenial"
|
24
|
+
expect(changelog.last["params"]).to eq "urgency=medium"
|
25
|
+
expect(changelog.last["changes"]).to eq ["gui: fix go-1.10 compatibility"]
|
26
|
+
expect(changelog.last["author_name"]).to eq "Dawid Dziurla"
|
27
|
+
expect(changelog.last["author_email"]).to eq "dawidd0811@gmail.com"
|
28
|
+
expect(changelog.last["timestamp"]).to eq "Wed, 14 Oct 2020 14:52:51 +0200"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "parses multiple changelog entries" do
|
32
|
+
contents = <<~EOCH
|
33
|
+
lazygit (0.23.6-1) xenial; urgency=medium
|
34
|
+
|
35
|
+
* gui: fix go-1.10 compatibility
|
36
|
+
|
37
|
+
-- Dawid Dziurla <dawidd0811@gmail.com> Wed, 14 Oct 2020 14:52:51 +0200
|
38
|
+
|
39
|
+
lazygit (0.23.5-1) xenial; urgency=medium
|
40
|
+
|
41
|
+
* more password checks on commands that talk to the remote
|
42
|
+
|
43
|
+
[ nullawhale ]
|
44
|
+
* Copy a commit message to clipboard: Changes to latest version
|
45
|
+
|
46
|
+
* preserve width of side panel when main view split unless window is wide enough
|
47
|
+
* support rebinding confirm/newline keys in editor
|
48
|
+
|
49
|
+
[ Dawid Dziurla ]
|
50
|
+
* workflows: update PPA repo as part of CD process
|
51
|
+
* utils: ReplaceAll -> Replace
|
52
|
+
* workflows: run CD on Ubuntu 20.04
|
53
|
+
* workflows: don't sign commit
|
54
|
+
|
55
|
+
-- <runner@fv-az193.3pvolxcpcztu3ic5y2mhkwl54d.bx.internal.cloudapp.net> Tue, 13 Oct 2020 22:07:59 +0000
|
56
|
+
EOCH
|
57
|
+
|
58
|
+
changelog = DebChangelog.parse contents
|
59
|
+
|
60
|
+
expect(changelog).not_to eq nil
|
61
|
+
|
62
|
+
expect(changelog.first["package"]).to eq "lazygit"
|
63
|
+
expect(changelog.first["epoch"]).to eq nil
|
64
|
+
expect(changelog.first["version"]).to eq "0.23.6"
|
65
|
+
expect(changelog.first["revision"]).to eq "1"
|
66
|
+
expect(changelog.first["distribution"]).to eq "xenial"
|
67
|
+
expect(changelog.first["params"]).to eq "urgency=medium"
|
68
|
+
expect(changelog.first["changes"]).to eq ["gui: fix go-1.10 compatibility"]
|
69
|
+
expect(changelog.first["author_name"]).to eq "Dawid Dziurla"
|
70
|
+
expect(changelog.first["author_email"]).to eq "dawidd0811@gmail.com"
|
71
|
+
expect(changelog.first["timestamp"]).to eq "Wed, 14 Oct 2020 14:52:51 +0200"
|
72
|
+
|
73
|
+
expect(changelog.last["package"]).to eq "lazygit"
|
74
|
+
expect(changelog.last["epoch"]).to eq nil
|
75
|
+
expect(changelog.last["version"]).to eq "0.23.5"
|
76
|
+
expect(changelog.last["revision"]).to eq "1"
|
77
|
+
expect(changelog.last["distribution"]).to eq "xenial"
|
78
|
+
expect(changelog.last["params"]).to eq "urgency=medium"
|
79
|
+
expect(changelog.last["changes"].length).to eq 8
|
80
|
+
expect(changelog.last["author_name"]).to eq ""
|
81
|
+
expect(changelog.last["author_email"]).to eq "runner@fv-az193.3pvolxcpcztu3ic5y2mhkwl54d.bx.internal.cloudapp.net"
|
82
|
+
expect(changelog.last["timestamp"]).to eq "Tue, 13 Oct 2020 22:07:59 +0000"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-deb-changelog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dawid Dziurla
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '12.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '12.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- dawidd0811@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".github/workflows/cd.yml"
|
49
|
+
- ".github/workflows/ci.yml"
|
50
|
+
- ".gitignore"
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- lib/deb-changelog.rb
|
56
|
+
- ruby-deb-changelog.gemspec
|
57
|
+
- spec/deb-changelog_spec.rb
|
58
|
+
homepage: https://github.com/dawidd6/ruby-deb-changelog
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 2.3.0
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.7.6
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Debian changelog file parser
|
82
|
+
test_files: []
|