-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Framework / spec: refactored author info
* Improved the API. * Extracted `Gem::Author` into Magic Support. * Replaced `Magic::Presenter::AUTHORS` with `Magic::Presenter::Author`.
- Loading branch information
1 parent
98b901e
commit 42dcb14
Showing
5 changed files
with
33 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
## [1.1.0] — UNRELEASED | ||
|
||
|
||
## [1.0.0] — 2024-11-23 | ||
|
||
This release marks the gem to be stable enough. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
Gem::Author ||= Struct.new( | ||
:name, | ||
:email, | ||
:github, | ||
) do | ||
def github_url = github && "https://github.com/#{github}" | ||
begin | ||
require 'rubygems/author' | ||
rescue LoadError # HACK: install magic-support | ||
`gem install magic-support --no-lock --ignore-dependencies --no-document` | ||
.scan(/^Successfully installed (?<full_name>.*)$/) | ||
.first[:full_name] | ||
.then { Bundler.bundle_path.join 'gems', *_1, 'lib' } | ||
.then { $LOAD_PATH << _1 } | ||
|
||
require 'rubygems/author' # retry | ||
end | ||
|
||
module Magic | ||
module Presenter # :nodoc: | ||
AUTHORS = [ # rubocop:disable Style/MutableConstant | ||
Gem::Author.new( | ||
name: 'Alexander Senko', | ||
email: 'Alexander.Senko@gmail.com', | ||
github: 'Alexander-Senko', | ||
), | ||
] | ||
|
||
class << AUTHORS | ||
def names = filter_map &:name | ||
def emails = filter_map &:email | ||
def github_url = filter_map(&:github_url).first | ||
module Presenter | ||
class Author < Gem::Author # :nodoc: | ||
new( | ||
name: 'Alexander Senko', | ||
email: 'Alexander.Senko@gmail.com', | ||
github: 'Alexander-Senko', | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Magic | ||
module Presenter | ||
VERSION = '1.0.0' | ||
VERSION = '1.1.0.alpha' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Magic | ||
module Presenter | ||
class Author < Gem::Author | ||
extend Gem::Author::ClassMethods | ||
|
||
attr_reader self.all: Array[self] | ||
end | ||
end | ||
end |