Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Update whastnew template and rake task (#8393)
Browse files Browse the repository at this point in the history
* Update rake whatsnew

Exit with error when 'Missing whatsnew' appears to fail a Jenkins build

* Update whatsnew template

Add grouping by moth and by date
  • Loading branch information
dshevtsov authored Dec 16, 2020
1 parent db97beb commit 456153f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
18 changes: 11 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ task :whatsnew do
print 'Generating data for the What\'s New digest: $ '.magenta

# Generate tmp/whats-new.yml
if since.nil? || since.empty?
sh 'bin/whatsup_github', 'since', last_update
elsif since.is_a? String
sh 'bin/whatsup_github', 'since', since
else
abort 'The "since" argument must be a string. Example: "jul 4"'
end
report =
if since.nil? || since.empty?
`bin/whatsup_github since '#{last_update}'`
elsif since.is_a? String
`bin/whatsup_github since #{since}`
else
abort 'The "since" argument must be a string. Example: "jul 4"'
end

# Merge generated tmp/whats-new.yml with existing src/_data/whats-new.yml
generated_data = YAML.load_file generated_file
Expand All @@ -94,6 +95,9 @@ task :whatsnew do

puts "Writing updates to #{current_file}"
File.write current_file, current_data.to_yaml

abort report if report.include? 'MISSING whatsnew'
puts report
end

desc 'Generate index for Algolia'
Expand Down
29 changes: 17 additions & 12 deletions src/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,40 @@ title: What's new on DevDocs

{% assign grouped_by_year = entries | group_by_exp: "entry", "entry.date | date: '%Y'" %}

{% for group in grouped_by_year limit:2 %}
{% for year_group in grouped_by_year limit:2 %}

## {{ group.name }}
{% assign grouped_by_month = year_group.items | group_by_exp: "entry", "entry.date | date: '%B'" %}
## {{ year_group.name }}

{% for month_group in grouped_by_month %}
### {{ month_group.name }}

{% assign grouped_by_date = month_group.items | group_by: "date" %}

{% for date_group in grouped_by_date %}
#### {{ date_group.name }}

<table>
<thead>
<tr>
<th>Description</th>
<th>Versions</th>
<th>Type</th>
<th>Date</th>
<th>Pull request</th>
</tr>
</thead>
<tbody>
{% for item in group.items %}
{% for item in date_group.items %}
<tr>
<td>{{ item.description | markdownify }}</td>
<td>{{ item.versions }}</td>
<td>{{ item.type }}</td>
<td>
{%- if item.link -%}
<a href="{{ item.link }}">{{ item.date | date: "%B&nbsp;%e" }}</a>
{%- else -%}
{{ item.date | date: "%B&nbsp;%e" }}
{%- endif -%}
</td>
<td><a href="{{ item.link }}">{{ item.link | split: "/" | last }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}<!-- date_group -->
{% endfor %}<!-- month_group -->

{% endfor %}
{% endfor %}<!-- year_group -->

0 comments on commit 456153f

Please sign in to comment.