Skip to content

Commit

Permalink
update rake tasks:
Browse files Browse the repository at this point in the history
- remove :html task
- rename :md => :readme
  • Loading branch information
kowal committed Sep 19, 2023
1 parent 3c701e1 commit 117788b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 117 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ To rebuild documentation pages from `templates/docs/**`:

$ rake doc
# Writing to mkdocs-material/docs/versions-latest.md .. Done
# Writing to docs/docs/versions-all.md .. Done
# ...

To start documentation app locally:
Expand All @@ -138,9 +139,9 @@ Deployment to github Pages is set up via [github actions](https://squidfunk.gith

#### Readme

To rebuild `README.md` from `templates/README.md.erb`:
To rebuild this `README.md` from `templates/README.md.erb`:

$ rake md
$ rake readme
# Writing to README.MD .. Done

$ yield
Expand Down
11 changes: 3 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
require_relative 'lib/ruby_changelog'

task default: :html

desc 'Generate single html page with changelog'
task :html do
RubyChangelog::Actions.new.generate_html
end
task default: :doc

desc 'Generate README file with changelog'
task :md do
task :readme do
RubyChangelog::Actions.new.generate_readme
end

desc 'Generate full documentation'
task :doc do
RubyChangelog::Actions.new.generate_full_docs
RubyChangelog::Actions.new.generate_docs
end

namespace :fetch do
Expand Down
4 changes: 1 addition & 3 deletions architecture.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ <h2>Overview</h2>
<div class="mermaid">
flowchart LR
A0[(fa:fa-database Data source<br><br>/data/ruby_versions.json<br>/data/ruby_cve.json)] -. uses JSON files as data source .-> B[main Changelog class]
A1[fa:fa-user rake html] --> B[fa:fa-cogs main Changelog class]
A2[fa:fa-user rake md] --> B
A2[fa:fa-user rake readme] --> B
A3[fa:fa-user rake doc] --> B
A4[fa:fa-user rake fetch:cve] --> B

B --> D(fa:fa-bolt Genereate static HTML) --> dd::out[fa:fa-arrow-circle-o-right fa:fa-file-text-o index.html]
B --> E(fa:fa-bolt Genereate readme in Markdown) --> ee::out[fa:fa-arrow-circle-o-right fa:fa-file-text-o README.md]
B --> F(fa:fa-bolt Genereate MkDocs md files) --> ff::out[fa:fa-arrow-circle-o-right fa:fa-file-text-o docs/docs/*.md files]
B --> G(fa:fa-bolt Fetch CVE data) --> A0
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/versions-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,4 +579,4 @@

----

(Last updated on 2023-09-19 22:38:24 +0200)
(Last updated on 2023-09-19 23:11:27 +0200)
2 changes: 1 addition & 1 deletion docs/docs/versions-latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,4 @@ This will be reversed again in Ruby 3.0.0</code>

----

(Last updated on 2023-09-19 22:38:24 +0200)
(Last updated on 2023-09-19 23:11:27 +0200)
30 changes: 6 additions & 24 deletions lib/ruby_changelog/actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,42 @@ module RubyChangelog
CHANGELOG_SOURCE = 'data/ruby_versions.json'.freeze
CVE_SOURCE = 'data/ruby_cve.json'.freeze

OUTPUT_HTML = 'index.html'.freeze
OUTPUT_README_MD = 'README.MD'.freeze

TEMPLATE_BASE = 'lib/templates'.freeze
TEMPLATE_HTML = "#{TEMPLATE_BASE}/index.html.erb".freeze
TEMPLATE_MD = "#{TEMPLATE_BASE}/README.md.erb".freeze
TEMPLATE_DOCS_VERSIONS_LATEST_MD = "#{TEMPLATE_BASE}/docs/versions/LATEST.md.erb".freeze
TEMPLATE_DOCS_VERSIONS_LATEST_MD = "#{TEMPLATE_BASE}/docs/versions/latest.md.erb".freeze
TEMPLATE_DOCS_VERSIONS_ALL_MD = "#{TEMPLATE_BASE}/docs/versions/all.md.erb".freeze
TEMPLATE_DOCS_TIMELINE_JS = "#{TEMPLATE_BASE}/docs/charts/timeline.js.erb".freeze

DOCS_BASE = 'docs'.freeze
DOCS_VERSIONS_LATEST_MD = "#{DOCS_BASE}/docs/versions-latest.md".freeze
DOCS_VERSIONS_ALL_MD = "#{DOCS_BASE}/docs/versions-all.md".freeze
DOCS_CHARTS_TIMELINE_MD = "#{DOCS_BASE}/docs/timeline.md".freeze
DOCS_CHARTS_TIMELINE_JS = "#{DOCS_BASE}/docs/javascripts/charts-timeline.js".freeze

class Actions
def generate_html
save_file(
OUTPUT_HTML,
generate_file(TEMPLATE_HTML, ruby_versions: ruby_versions_data)
)
end

def generate_readme
save_file(
OUTPUT_README_MD,
generate_file(TEMPLATE_MD, ruby_versions: ruby_versions_data)
)
end

def generate_full_docs
def generate_docs
save_file(
DOCS_VERSIONS_LATEST_MD,
generate_file(
TEMPLATE_DOCS_VERSIONS_LATEST_MD,
ruby_versions: ruby_versions_data
)
generate_file(TEMPLATE_DOCS_VERSIONS_LATEST_MD, ruby_versions: ruby_versions_data)
)

save_file(
DOCS_VERSIONS_ALL_MD,
generate_file(
TEMPLATE_DOCS_VERSIONS_ALL_MD,
ruby_versions: ruby_versions_data,
ruby_cve: ruby_cve_data
)
generate_file(TEMPLATE_DOCS_VERSIONS_ALL_MD, ruby_versions: ruby_versions_data, ruby_cve: ruby_cve_data)
)

save_file(
DOCS_CHARTS_TIMELINE_JS,
generate_file(
TEMPLATE_DOCS_TIMELINE_JS,
ruby_versions: ruby_versions_data
)
generate_file(TEMPLATE_DOCS_TIMELINE_JS, ruby_versions: ruby_versions_data)
)
end

Expand Down
5 changes: 3 additions & 2 deletions lib/templates/README.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ To rebuild documentation pages from `templates/docs/**`:

$ rake doc
# Writing to mkdocs-material/docs/versions-latest.md .. Done
# Writing to docs/docs/versions-all.md .. Done
# ...

To start documentation app locally:
Expand All @@ -46,9 +47,9 @@ Deployment to github Pages is set up via [github actions](https://squidfunk.gith

#### Readme

To rebuild `README.md` from `templates/README.md.erb`:
To rebuild this `README.md` from `templates/README.md.erb`:

$ rake md
$ rake readme
# Writing to README.MD .. Done

$ yield
Expand Down
76 changes: 0 additions & 76 deletions lib/templates/index.html.erb

This file was deleted.

0 comments on commit 117788b

Please sign in to comment.