milestoner 18.12.0 → 19.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +82 -68
- data/lib/milestoner/builders/adoc/container.rb +15 -0
- data/lib/milestoner/builders/adoc/dependencies.rb +9 -0
- data/lib/milestoner/builders/adoc/indexer.rb +28 -0
- data/lib/milestoner/builders/adoc/pager.rb +35 -0
- data/lib/milestoner/builders/ascii_doc.rb +10 -18
- data/lib/milestoner/builders/{import.rb → dependencies.rb} +1 -1
- data/lib/milestoner/builders/feed.rb +6 -15
- data/lib/milestoner/builders/markdown.rb +10 -18
- data/lib/milestoner/builders/md/container.rb +15 -0
- data/lib/milestoner/builders/md/dependencies.rb +9 -0
- data/lib/milestoner/builders/md/indexer.rb +28 -0
- data/lib/milestoner/builders/md/pager.rb +35 -0
- data/lib/milestoner/builders/path_resolver.rb +23 -0
- data/lib/milestoner/builders/site/container.rb +16 -0
- data/lib/milestoner/builders/site/dependencies.rb +9 -0
- data/lib/milestoner/builders/site/indexer.rb +33 -0
- data/lib/milestoner/builders/site/pager.rb +35 -0
- data/lib/milestoner/builders/site/styler.rb +47 -0
- data/lib/milestoner/builders/stream.rb +3 -3
- data/lib/milestoner/builders/syndication/builder.rb +125 -0
- data/lib/milestoner/builders/syndication/indexer.rb +29 -0
- data/lib/milestoner/builders/syndication/refine.rb +27 -0
- data/lib/milestoner/builders/syndication/shared.rb +27 -0
- data/lib/milestoner/builders/web.rb +11 -43
- data/lib/milestoner/cli/actions/build/basename.rb +1 -1
- data/lib/milestoner/cli/actions/build/format.rb +1 -1
- data/lib/milestoner/cli/actions/build/index.rb +26 -0
- data/lib/milestoner/cli/actions/build/label.rb +1 -1
- data/lib/milestoner/cli/actions/build/layout.rb +1 -1
- data/lib/milestoner/cli/actions/build/max.rb +1 -1
- data/lib/milestoner/cli/actions/build/output.rb +25 -0
- data/lib/milestoner/cli/actions/build/stylesheet.rb +5 -7
- data/lib/milestoner/cli/actions/build/tail.rb +1 -1
- data/lib/milestoner/cli/actions/build/version.rb +1 -1
- data/lib/milestoner/cli/actions/cache/create.rb +1 -1
- data/lib/milestoner/cli/actions/cache/delete.rb +1 -1
- data/lib/milestoner/cli/actions/cache/find.rb +1 -1
- data/lib/milestoner/cli/actions/cache/info.rb +1 -1
- data/lib/milestoner/cli/actions/cache/list.rb +1 -1
- data/lib/milestoner/cli/actions/next.rb +1 -1
- data/lib/milestoner/cli/actions/publish.rb +1 -1
- data/lib/milestoner/cli/commands/build.rb +4 -3
- data/lib/milestoner/cli/commands/cache.rb +1 -1
- data/lib/milestoner/cli/shell.rb +1 -1
- data/lib/milestoner/commits/categorizer.rb +7 -5
- data/lib/milestoner/commits/collector.rb +1 -1
- data/lib/milestoner/commits/enricher.rb +7 -5
- data/lib/milestoner/commits/enrichers/author.rb +1 -1
- data/lib/milestoner/commits/enrichers/body.rb +1 -1
- data/lib/milestoner/commits/enrichers/colleague.rb +1 -1
- data/lib/milestoner/commits/enrichers/container.rb +2 -2
- data/lib/milestoner/commits/enrichers/{import.rb → dependencies.rb} +1 -1
- data/lib/milestoner/commits/enrichers/format.rb +1 -1
- data/lib/milestoner/commits/enrichers/issue.rb +1 -1
- data/lib/milestoner/commits/enrichers/milestone.rb +1 -1
- data/lib/milestoner/commits/enrichers/note.rb +1 -1
- data/lib/milestoner/commits/enrichers/review.rb +1 -1
- data/lib/milestoner/commits/enrichers/uri.rb +1 -1
- data/lib/milestoner/commits/versioner.rb +1 -1
- data/lib/milestoner/configuration/contract.rb +6 -2
- data/lib/milestoner/configuration/defaults.yml +10 -4
- data/lib/milestoner/configuration/model.rb +5 -1
- data/lib/milestoner/configuration/transformers/gems/description.rb +1 -1
- data/lib/milestoner/configuration/transformers/gems/label.rb +2 -2
- data/lib/milestoner/configuration/transformers/gems/name.rb +1 -1
- data/lib/milestoner/configuration/transformers/gems/uri.rb +1 -1
- data/lib/milestoner/configuration/transformers/generator/label.rb +1 -1
- data/lib/milestoner/configuration/transformers/generator/uri.rb +1 -1
- data/lib/milestoner/configuration/transformers/generator/version.rb +1 -1
- data/lib/milestoner/configuration/transformers/project/author.rb +1 -1
- data/lib/milestoner/container.rb +2 -1
- data/lib/milestoner/{import.rb → dependencies.rb} +1 -1
- data/lib/milestoner/durationer.rb +25 -0
- data/lib/milestoner/models/commit.rb +2 -1
- data/lib/milestoner/renderers/universal.rb +1 -1
- data/lib/milestoner/tags/builder.rb +40 -0
- data/lib/milestoner/tags/creator.rb +7 -9
- data/lib/milestoner/{commits/tagger.rb → tags/enricher.rb} +27 -15
- data/lib/milestoner/tags/publisher.rb +1 -1
- data/lib/milestoner/tags/pusher.rb +1 -1
- data/lib/milestoner/templates/layouts/page.adoc.erb +4 -0
- data/lib/milestoner/templates/layouts/page.git.erb +1 -0
- data/lib/milestoner/templates/layouts/page.html.erb +17 -10
- data/lib/milestoner/templates/layouts/page.md.erb +3 -0
- data/lib/milestoner/templates/layouts/page.stream.erb +2 -1
- data/lib/milestoner/templates/layouts/page.xml.erb +4 -0
- data/lib/milestoner/templates/milestones/_commit.adoc.erb +4 -4
- data/lib/milestoner/templates/milestones/_commit.html.erb +7 -4
- data/lib/milestoner/templates/milestones/_commit.stream.erb +1 -1
- data/lib/milestoner/templates/milestones/_commit.xml.erb +2 -6
- data/lib/milestoner/templates/milestones/_logo.adoc.erb +1 -1
- data/lib/milestoner/templates/milestones/_logo.html.erb +1 -1
- data/lib/milestoner/templates/milestones/index.adoc.erb +13 -0
- data/lib/milestoner/templates/milestones/index.html.erb +31 -0
- data/lib/milestoner/templates/milestones/index.md.erb +13 -0
- data/lib/milestoner/templates/milestones/show.adoc.erb +17 -1
- data/lib/milestoner/templates/milestones/show.git.erb +8 -0
- data/lib/milestoner/templates/milestones/show.html.erb +119 -1
- data/lib/milestoner/templates/milestones/show.md.erb +16 -1
- data/lib/milestoner/templates/milestones/show.stream.erb +17 -1
- data/lib/milestoner/templates/milestones/show.xml.erb +22 -1
- data/lib/milestoner/templates/public/page.css.erb +402 -299
- data/lib/milestoner/views/context.rb +2 -1
- data/lib/milestoner/views/milestones/index.rb +23 -0
- data/lib/milestoner/views/milestones/show.rb +2 -2
- data/lib/milestoner/views/parts/commit.rb +47 -37
- data/lib/milestoner/views/parts/tag.rb +25 -17
- data/lib/milestoner/views/parts/user.rb +1 -1
- data/lib/milestoner.rb +5 -1
- data/milestoner.gemspec +18 -18
- data.tar.gz.sig +0 -0
- metadata +68 -57
- metadata.gz.sig +0 -0
- data/lib/milestoner/cli/actions/build/root.rb +0 -25
- data/lib/milestoner/configuration/transformers/build/root.rb +0 -21
- data/lib/milestoner/syndication/builder.rb +0 -123
- data/lib/milestoner/syndication/refine.rb +0 -25
- data/lib/milestoner/syndication/shared.rb +0 -25
- data/lib/milestoner/templates/milestones/_tag.adoc.erb +0 -13
- data/lib/milestoner/templates/milestones/_tag.html.erb +0 -56
- data/lib/milestoner/templates/milestones/_tag.md.erb +0 -14
- data/lib/milestoner/templates/milestones/_tag.stream.erb +0 -15
- data/lib/milestoner/templates/milestones/_tag.xml.erb +0 -22
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Milestoner
|
4
|
+
module Builders
|
5
|
+
module Site
|
6
|
+
# Defines web dependencies.
|
7
|
+
module Container
|
8
|
+
extend Containable
|
9
|
+
|
10
|
+
register(:indexer) { Indexer.new }
|
11
|
+
register(:pager) { Pager.new }
|
12
|
+
register(:styler) { Styler.new }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/monads"
|
4
|
+
|
5
|
+
module Milestoner
|
6
|
+
module Builders
|
7
|
+
module Site
|
8
|
+
# Builds web index.
|
9
|
+
class Indexer
|
10
|
+
include Dry::Monads[:result]
|
11
|
+
include Milestoner::Dependencies[:settings, :logger]
|
12
|
+
|
13
|
+
def initialize(path_resolver: PathResolver, view: Views::Milestones::Index.new, **)
|
14
|
+
super(**)
|
15
|
+
@path_resolver = path_resolver
|
16
|
+
@view = view
|
17
|
+
end
|
18
|
+
|
19
|
+
def call tags
|
20
|
+
return Success() unless settings.build_index
|
21
|
+
|
22
|
+
path_resolver.call settings.build_output.join("index.html"), logger: do |path|
|
23
|
+
path.write view.call(tags:, layout: settings.build_layout)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_reader :path_resolver, :view
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Milestoner
|
4
|
+
module Builders
|
5
|
+
module Site
|
6
|
+
# Builds web version.
|
7
|
+
class Pager
|
8
|
+
include Milestoner::Dependencies[:settings, :logger]
|
9
|
+
|
10
|
+
def initialize(path_resolver: PathResolver, view: Views::Milestones::Show.new, **)
|
11
|
+
super(**)
|
12
|
+
@path_resolver = path_resolver
|
13
|
+
@view = view
|
14
|
+
end
|
15
|
+
|
16
|
+
def call past, tag, future
|
17
|
+
settings.project_version = tag.version
|
18
|
+
write past, tag, future
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :path_resolver, :view
|
24
|
+
|
25
|
+
def write past, tag, future
|
26
|
+
path = settings.build_output.join(tag.version, settings.build_basename).sub_ext ".html"
|
27
|
+
|
28
|
+
path_resolver.call path, logger: do
|
29
|
+
path.write view.call(past:, tag:, future:, layout: settings.build_layout)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/monads"
|
4
|
+
require "refinements/pathname"
|
5
|
+
|
6
|
+
module Milestoner
|
7
|
+
module Builders
|
8
|
+
module Site
|
9
|
+
# Builds web stylesheet.
|
10
|
+
class Styler
|
11
|
+
include Milestoner::Dependencies[:settings, :logger]
|
12
|
+
include Dry::Monads[:result]
|
13
|
+
|
14
|
+
using Refinements::Pathname
|
15
|
+
|
16
|
+
def initialize(path_resolver: PathResolver, **)
|
17
|
+
super(**)
|
18
|
+
@path_resolver = path_resolver
|
19
|
+
end
|
20
|
+
|
21
|
+
def call
|
22
|
+
return Success() unless settings.build_stylesheet
|
23
|
+
|
24
|
+
path = build_path
|
25
|
+
|
26
|
+
path_resolver.call(path, logger:) { copy path }
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :path_resolver
|
32
|
+
|
33
|
+
def build_path
|
34
|
+
path = Pathname settings.stylesheet_path
|
35
|
+
path.absolute? ? path : settings.build_output.join(path)
|
36
|
+
end
|
37
|
+
|
38
|
+
def copy build_path
|
39
|
+
settings.build_template_paths
|
40
|
+
.map { |template| template.join "public/page.css.erb" }
|
41
|
+
.find(&:exist?)
|
42
|
+
.copy build_path.make_ancestors
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -4,12 +4,12 @@ module Milestoner
|
|
4
4
|
module Builders
|
5
5
|
# Builds I/O stream output.
|
6
6
|
class Stream
|
7
|
-
include Milestoner::
|
7
|
+
include Milestoner::Dependencies[:settings, :logger, :io]
|
8
8
|
|
9
|
-
def initialize(tagger:
|
9
|
+
def initialize(tagger: Tags::Enricher.new, view: Views::Milestones::Show.new, **)
|
10
|
+
super(**)
|
10
11
|
@tagger = tagger
|
11
12
|
@view = view
|
12
|
-
super(**)
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "core"
|
4
|
+
require "dry/monads"
|
5
|
+
require "rss"
|
6
|
+
|
7
|
+
module Milestoner
|
8
|
+
module Builders
|
9
|
+
module Syndication
|
10
|
+
# Builds feed in Atom format.
|
11
|
+
# :reek:DataClump
|
12
|
+
class Builder
|
13
|
+
include Milestoner::Dependencies[:settings]
|
14
|
+
include Dry::Monads[:result]
|
15
|
+
|
16
|
+
using Refine
|
17
|
+
|
18
|
+
def self.authors_for tags
|
19
|
+
tags.flat_map { |tag| tag.commits.map(&:author) }
|
20
|
+
.then { |users| users.any? ? users : tags.map(&:author) }
|
21
|
+
.uniq
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(client: RSS::Maker, view: Views::Milestones::Show.new, **)
|
25
|
+
super(**)
|
26
|
+
@client = client
|
27
|
+
@view = view
|
28
|
+
end
|
29
|
+
|
30
|
+
def call tags
|
31
|
+
return Failure "No tags or commits." if tags.empty?
|
32
|
+
|
33
|
+
Success build_feed(tags).to_s
|
34
|
+
rescue NoMethodError, RSS::Error => error
|
35
|
+
Failure "#{self.class}: #{error.message.capitalize}."
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
attr_reader :client, :view
|
41
|
+
|
42
|
+
def build_feed tags
|
43
|
+
client.make "atom" do |node|
|
44
|
+
build_channel node.channel, tags
|
45
|
+
build_tags node, tags
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def build_channel node, tags
|
50
|
+
at = tags.first.committed_at
|
51
|
+
|
52
|
+
node.merge id: settings.project_uri_home,
|
53
|
+
title: settings.syndication_label,
|
54
|
+
subtitle: settings.project_description,
|
55
|
+
icon: settings.project_uri_icon,
|
56
|
+
logo: settings.project_uri_logo,
|
57
|
+
rights: at.strftime("%Y"),
|
58
|
+
updated: at
|
59
|
+
|
60
|
+
build_channel_elements node, tags
|
61
|
+
end
|
62
|
+
|
63
|
+
def build_channel_elements node, tags
|
64
|
+
build_links node
|
65
|
+
build_generator node
|
66
|
+
build_authors node, self.class.authors_for(tags)
|
67
|
+
|
68
|
+
node.categories.build label: settings.project_label, term: settings.project_name
|
69
|
+
end
|
70
|
+
|
71
|
+
def build_links node
|
72
|
+
node.links.build_for settings.syndication_links,
|
73
|
+
label: :title,
|
74
|
+
uri: :href,
|
75
|
+
relation: :rel,
|
76
|
+
mime: :type
|
77
|
+
end
|
78
|
+
|
79
|
+
def build_generator node
|
80
|
+
node.generator do |generator|
|
81
|
+
generator.merge content: settings.generator_label,
|
82
|
+
version: settings.generator_version,
|
83
|
+
uri: settings.generator_uri
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def build_tags node, tags = Core::EMPTY_ARRAY
|
88
|
+
tags.each { |tag| build_item node.items, tag }
|
89
|
+
end
|
90
|
+
|
91
|
+
def build_item node, tag
|
92
|
+
node.new_item do |item|
|
93
|
+
build_item_metadata item, tag
|
94
|
+
build_item_content item.content, tag
|
95
|
+
build_authors item, tag.commits.map(&:author).uniq.select(&:name)
|
96
|
+
item.categories.build_for settings.syndication_categories, label: :label, name: :term
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def build_item_metadata node, tag
|
101
|
+
committed_at = tag.committed_at
|
102
|
+
version = tag.version
|
103
|
+
|
104
|
+
node.merge id: format(settings.syndication_id, id: version),
|
105
|
+
title: format(settings.syndication_entry_label, id: version),
|
106
|
+
link: format(settings.syndication_entry_uri, id: version),
|
107
|
+
rights: committed_at.strftime("%Y"),
|
108
|
+
published: committed_at,
|
109
|
+
updated: committed_at
|
110
|
+
end
|
111
|
+
|
112
|
+
def build_item_content node, tag
|
113
|
+
content = view.call tag:, layout: settings.build_layout, format: :xml
|
114
|
+
node.merge content:, type: :html
|
115
|
+
end
|
116
|
+
|
117
|
+
def build_authors node, users = Core::EMPTY_ARRAY
|
118
|
+
users.each do |user|
|
119
|
+
node.authors.build name: user.name, uri: format(settings.profile_uri, id: user.handle)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Milestoner
|
4
|
+
module Builders
|
5
|
+
module Syndication
|
6
|
+
# Builds syndicated feed output.
|
7
|
+
class Indexer
|
8
|
+
include Milestoner::Dependencies[:settings, :logger]
|
9
|
+
|
10
|
+
def initialize(path_resolver: PathResolver, syndicator: Syndication::Builder.new, **)
|
11
|
+
super(**)
|
12
|
+
@path_resolver = path_resolver
|
13
|
+
@syndicator = syndicator
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(tags) = syndicator.call(tags).bind { |body| write body }
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_reader :path_resolver, :syndicator
|
21
|
+
|
22
|
+
def write body
|
23
|
+
path = settings.build_output.join(settings.build_basename).sub_ext(".xml")
|
24
|
+
path_resolver.call(path, logger:) { path.write body }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rss"
|
4
|
+
|
5
|
+
module Milestoner
|
6
|
+
module Builders
|
7
|
+
module Syndication
|
8
|
+
# Smooths out the rough edges of the RSS gem object which are harder to work with.
|
9
|
+
module Refine
|
10
|
+
refine(RSS::Maker::Atom::Feed::Channel) { import_methods Shared }
|
11
|
+
refine(RSS::Maker::Atom::Feed::Channel::Authors) { import_methods Shared }
|
12
|
+
refine(RSS::Maker::Atom::Feed::Channel::Authors::Author) { import_methods Shared }
|
13
|
+
refine(RSS::Maker::Atom::Feed::Channel::Categories) { import_methods Shared }
|
14
|
+
refine(RSS::Maker::Atom::Feed::Channel::Categories::Category) { import_methods Shared }
|
15
|
+
refine(RSS::Maker::Atom::Feed::Channel::Generator) { import_methods Shared }
|
16
|
+
refine(RSS::Maker::Atom::Feed::Channel::Links::Link) { import_methods Shared }
|
17
|
+
refine(RSS::Maker::Atom::Feed::Items::Item) { import_methods Shared }
|
18
|
+
refine(RSS::Maker::Atom::Feed::Channel::Links) { import_methods Shared }
|
19
|
+
refine(RSS::Maker::Atom::Feed::Items::Item::Authors) { import_methods Shared }
|
20
|
+
refine(RSS::Maker::Atom::Feed::Items::Item::Authors::Author) { import_methods Shared }
|
21
|
+
refine(RSS::Maker::Atom::Feed::Items::Item::Categories) { import_methods Shared }
|
22
|
+
refine(RSS::Maker::Atom::Feed::Items::Item::Categories::Category) { import_methods Shared }
|
23
|
+
refine(RSS::Maker::Atom::Feed::Items::Item::Content) { import_methods Shared }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Milestoner
|
4
|
+
module Builders
|
5
|
+
module Syndication
|
6
|
+
# Provides shared functionality for refinements.
|
7
|
+
module Shared
|
8
|
+
def merge(**attributes) = attributes.each { |key, value| public_send :"#{key}=", value }
|
9
|
+
|
10
|
+
def build_for(collection, **)
|
11
|
+
collection.each { |attributes| build(**attributes.transform_keys(**)) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def build(**attributes)
|
15
|
+
node = public_send :"new_#{kind}"
|
16
|
+
attributes.each { |key, value| node.public_send :"#{key}=", value }
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def kind
|
22
|
+
self.class.name.downcase.split("::").last.sub("categories", "category").delete_suffix("s")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -5,16 +5,17 @@ require "refinements/pathname"
|
|
5
5
|
|
6
6
|
module Milestoner
|
7
7
|
module Builders
|
8
|
-
# Builds web
|
8
|
+
# Builds web files,
|
9
9
|
class Web
|
10
|
-
include Milestoner::
|
10
|
+
include Milestoner::Dependencies[:settings, :logger]
|
11
|
+
include Site::Dependencies[:indexer, :pager, :styler]
|
11
12
|
|
13
|
+
using Refinements::Array
|
12
14
|
using Refinements::Pathname
|
13
15
|
|
14
|
-
def initialize(tagger:
|
15
|
-
@tagger = tagger
|
16
|
-
@view = view
|
16
|
+
def initialize(tagger: Tags::Enricher.new, **)
|
17
17
|
super(**)
|
18
|
+
@tagger = tagger
|
18
19
|
end
|
19
20
|
|
20
21
|
def call
|
@@ -25,46 +26,13 @@ module Milestoner
|
|
25
26
|
|
26
27
|
private
|
27
28
|
|
28
|
-
attr_reader :tagger
|
29
|
+
attr_reader :tagger
|
29
30
|
|
30
31
|
def build tags
|
31
|
-
|
32
|
-
|
33
|
-
tags.
|
34
|
-
settings.
|
35
|
-
end
|
36
|
-
|
37
|
-
def make_root = settings.build_root.make_path
|
38
|
-
|
39
|
-
def copy_stylesheet
|
40
|
-
return unless settings.build_stylesheet
|
41
|
-
|
42
|
-
stylesheet_template.copy stylesheet_path
|
43
|
-
logger.info { "Built: #{stylesheet_path}." }
|
44
|
-
end
|
45
|
-
|
46
|
-
def stylesheet_template
|
47
|
-
settings.build_template_paths
|
48
|
-
.map { |path| path.join "public/page.css.erb" }
|
49
|
-
.find(&:exist?)
|
50
|
-
.copy settings.build_root.make_path.join stylesheet_path
|
51
|
-
end
|
52
|
-
|
53
|
-
def stylesheet_path
|
54
|
-
settings.build_root.join "#{Pathname(settings.build_stylesheet).name}.css"
|
55
|
-
end
|
56
|
-
|
57
|
-
def write tag
|
58
|
-
path = make_path tag
|
59
|
-
settings.project_version = tag.version
|
60
|
-
|
61
|
-
path.write view.call(tag:, layout: settings.build_layout)
|
62
|
-
logger.info { "Built: #{path}." }
|
63
|
-
end
|
64
|
-
|
65
|
-
def make_path tag
|
66
|
-
version = settings.build_max == 1 ? "" : tag.version
|
67
|
-
settings.build_root.join(version, settings.build_basename).make_ancestors.sub_ext ".html"
|
32
|
+
styler.call
|
33
|
+
indexer.call tags
|
34
|
+
tags.ring { |future, present, past| pager.call past, present, future }
|
35
|
+
settings.build_output
|
68
36
|
end
|
69
37
|
|
70
38
|
def failure message
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sod"
|
4
|
+
|
5
|
+
module Milestoner
|
6
|
+
module CLI
|
7
|
+
module Actions
|
8
|
+
module Build
|
9
|
+
# Handles build index.
|
10
|
+
class Index < Sod::Action
|
11
|
+
include Dependencies[:settings]
|
12
|
+
|
13
|
+
description "Enable/disable versions index."
|
14
|
+
|
15
|
+
ancillary "Only used by web format."
|
16
|
+
|
17
|
+
on "--[no-]index"
|
18
|
+
|
19
|
+
default { Container[:settings].build_index }
|
20
|
+
|
21
|
+
def call(boolean) = settings.build_index = boolean
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require "sod"
|
5
|
+
|
6
|
+
module Milestoner
|
7
|
+
module CLI
|
8
|
+
module Actions
|
9
|
+
module Build
|
10
|
+
# Handles build output path.
|
11
|
+
class Output < Sod::Action
|
12
|
+
include Dependencies[:settings]
|
13
|
+
|
14
|
+
description "Set output path."
|
15
|
+
|
16
|
+
on %w[-o --output], argument: "[PATH]"
|
17
|
+
|
18
|
+
default { Container[:settings].build_output }
|
19
|
+
|
20
|
+
def call(path = default) = settings.build_output = Pathname(path).expand_path
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -8,19 +8,17 @@ module Milestoner
|
|
8
8
|
module Build
|
9
9
|
# Handles build stylesheet.
|
10
10
|
class Stylesheet < Sod::Action
|
11
|
-
include
|
11
|
+
include Dependencies[:settings]
|
12
12
|
|
13
|
-
description "
|
13
|
+
description "Enable/disable stylesheet."
|
14
14
|
|
15
|
-
ancillary "Only used by web format.
|
15
|
+
ancillary "Only used by web format."
|
16
16
|
|
17
|
-
on
|
17
|
+
on "--[no-]stylesheet"
|
18
18
|
|
19
19
|
default { Container[:settings].build_stylesheet }
|
20
20
|
|
21
|
-
def call
|
22
|
-
settings.build_stylesheet = name == "false" ? false : name
|
23
|
-
end
|
21
|
+
def call(boolean) = settings.build_stylesheet = boolean
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -9,7 +9,7 @@ module Milestoner
|
|
9
9
|
module Actions
|
10
10
|
# Handles tag creation and pushing of tag to local repository.
|
11
11
|
class Publish < Sod::Action
|
12
|
-
include
|
12
|
+
include Dependencies[:settings, :logger]
|
13
13
|
include Dry::Monads[:result]
|
14
14
|
|
15
15
|
using Versionaire::Cast
|