Skip to content

Commit

Permalink
Merge pull request #5513 from galaxyproject/java-mixolydian
Browse files Browse the repository at this point in the history
misc framework
  • Loading branch information
hexylena authored Nov 7, 2024
2 parents d13364a + 724cecb commit d7df185
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 26 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/monthly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
${{ runner.os }}-gems-
- name: Install dependencies
run: |
sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev pkg-config # for node
sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev pkg-config pandoc # for node, release notes
gem install bundler
pip install pyyaml
bundle config path vendor/bundle
Expand Down Expand Up @@ -103,4 +103,9 @@ jobs:
RELEASE_TAG: ${{ env.release_tag }}
RELEASE_TITLE: ${{ env.release_title }}
run: |
gh release create "$RELEASE_TAG" --title "Release $RELEASE_TITLE" --notes "Monthly release of the GTN materials is now [available on the archive](https://training.galaxyproject.org/archive/$RELEASE_TAG/)." --target main --latest
# Compile release notes
echo "Monthly release of the GTN materials is now [available on the archive](https://training.galaxyproject.org/archive/$RELEASE_TAG/)." > /tmp/last-month-on.md
echo >> /tmp/last-month-on.md
bundle exec ruby bin/last-month-on.rb | pandoc --wrap none -t markdown -f html >> /tmp/last-month-on.md
# Create the release
gh release create "$RELEASE_TAG" --title "Release $RELEASE_TITLE" --notes-file /tmp/last-month-on.md --target main --latest
2 changes: 1 addition & 1 deletion _layouts/recordings.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 data-toc-skip>Recordings - {{ material.title }} </h1>

<p><b>Want to add your own recording?</b> We would love to have it to our library!</p>

<a href="{% link faqs/gtn/recordings_add.md %}" class="btn btn-info">Add your recordings!</a>
<a class="btn btn-info" href="{% link faqs/gtn/recordings_add.md %}">Add your Recording!</a>

</div>

Expand Down
67 changes: 55 additions & 12 deletions _plugins/feeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,27 @@ def to_euro_lunch
PRIO = [
'news',
'events',
'learning-pathways',
'tutorials',
'slides',
'recordings',
'faqs',
'workflows',
'contributors',
'grants',
'organisations'
].map.with_index { |x, i| [x, i] }.to_h

def track(url)
if url =~ /utm_source/
url
elsif url.include? '#'
url.gsub(/#/, TRACKING + '#')
else
url + TRACKING
end
end

def objectify(attrs, url, path)
obj = attrs.clone
obj['__path'] = path
Expand Down Expand Up @@ -96,6 +108,8 @@ def markdownify(site, text)
'news' => '📰',
'faqs' => '❓',
'workflows' => '🛠️',
'learning-pathways' => '🛤️',
'recordings' => '🎥',
}

def generate_opml(site, groups)
Expand Down Expand Up @@ -146,7 +160,7 @@ def generate_topic_feeds(site, topic, bucket)

mats.each do |time, group, page, tags|
xml.entry do
xml.title(ICON_FOR[group] + " " +page.data['title'])
xml.title(ICON_FOR[group] + " " + page.data['title'])
link = "#{site.config['url']}#{site.baseurl}#{page.url}"
xml.link(href: link)
# Our links are (mostly) stable
Expand Down Expand Up @@ -206,6 +220,7 @@ def all_date_sorted_materials(site)
materials = TopicFilter.list_all_materials(site).reject { |k, _v| k['draft'] }
news = site.posts.select { |x| x['layout'] == 'news' }
faqs = site.pages.select { |x| x['layout'] == 'faq' }
pathways = site.pages.select { |x| x['layout'] == 'learning-pathway' }
workflows = Dir.glob('topics/**/*.ga')

bucket = events.map do |e|
Expand All @@ -214,12 +229,35 @@ def all_date_sorted_materials(site)

materials.each do |m|
tags = [m['topic_name']] + (m['tags'] || [])
bucket += m.fetch('ref_tutorials', []).map do |t|
[Gtn::PublicationTimes.obtain_time(t.path).to_datetime, 'tutorials', t, tags]
m.fetch('ref_tutorials', []).map do |t|
bucket << [Gtn::PublicationTimes.obtain_time(t.path).to_datetime, 'tutorials', t, tags]

(t['recordings'] || []).map do |r|
url = '/' + t.path.gsub(/tutorial(_[A_Z_]*)?.(html|md)$/, 'recordings/')
url += "#tutorial-recording-#{Date.parse(r['date']).strftime('%-d-%B-%Y').downcase}"
attr = {'title' => "Recording of " + t['title'],
'contributors' => r['speakers'] + (r['captions'] || []),
'content' => "A #{r['length']} long recording is now available."}

obj = objectify(attr, url, t.path)
bucket << [DateTime.parse(r['date'].to_s), 'recordings', obj, tags]
end
end

bucket += m.fetch('ref_slides', []).reject { |s| s.url =~ /-plain.html/ }.map do |s|
[Gtn::PublicationTimes.obtain_time(s.path).to_datetime, 'slides', s, tags]


m.fetch('ref_slides', []).reject { |s| s.url =~ /-plain.html/ }.map do |s|
bucket << [Gtn::PublicationTimes.obtain_time(s.path).to_datetime, 'slides', s, tags]

(s['recordings'] || []).map do |r|
url = '/' + s.path.gsub(/slides(_[A_Z_]*)?.(html|md)$/, 'recordings/')
url += "#tutorial-recording-#{Date.parse(r['date']).strftime('%-d-%B-%Y').downcase}"
attr = {'title' => "Recording of " + s['title'],
'contributors' => r['speakers'] + (r['captions'] || []),
'content' => "A #{r['length']} long recording is now available."}
obj = objectify(attr, url, s.path)
bucket << [DateTime.parse(r['date'].to_s), 'recordings', obj, tags]
end
end
end

Expand All @@ -232,6 +270,11 @@ def all_date_sorted_materials(site)
[Gtn::PublicationTimes.obtain_time(n.path).to_datetime, 'faqs', n, ['faqs', tag]]
end

bucket += pathways.map do |n|
tags = ['learning-pathway'] + (n['tags'] || [])
[Gtn::PublicationTimes.obtain_time(n.path).to_datetime, 'learning-pathways', n, tags]
end

bucket += workflows.map do |n|
tag = Gtn::PublicationTimes.clean_path(n).split('/')[1]
wf_data = JSON.parse(File.read(n))
Expand All @@ -241,7 +284,6 @@ def all_date_sorted_materials(site)
'description' => wf_data['annotation'],
'tags' => wf_data['tags'],
'contributors' => wf_data.fetch('creator', []).map do |c|
p ">> #{c}"
matched = site.data['contributors'].select{|k, v|
v.fetch('orcid', "does-not-exist") == c.fetch('identifier', "").gsub('https://orcid.org/', '')
}.first
Expand Down Expand Up @@ -297,6 +339,7 @@ def all_date_sorted_materials(site)

bucket
.reject{|x| x[0] > DateTime.now } # Remove future-dated materials
.reject{|x| x[2]['draft'] == true } # Remove drafts
.sort_by {|x| x[0] } # Date-sorted, not strictly necessary since will be grouped.
.reverse
end
Expand Down Expand Up @@ -407,7 +450,7 @@ def generate_matrix_feed_itemized(site, mats, group_by: 'day', filter_by: nil)
href = "#{site.config['url']}#{site.config['baseurl']}#{page.url}"

xml.id(href)
xml.link(href: href + TRACKING)
xml.link(href: track(href))

tags.uniq.each do |tag|
xml.category(term: tag)
Expand All @@ -423,7 +466,7 @@ def generate_matrix_feed_itemized(site, mats, group_by: 'day', filter_by: nil)
xml.summary(text)
end

prefix = type.gsub(/s$/, '').capitalize.gsub(/Faq/, 'FAQ').gsub(/New$/, 'Post')
prefix = type.gsub(/s$/, '').gsub(/-/, ' ').capitalize.gsub(/Faq/, 'FAQ').gsub(/New$/, 'Post')
title = "#{ICON_FOR[type]} New #{prefix}: #{page.data['title']}"

xml.title(title)
Expand Down Expand Up @@ -527,7 +570,7 @@ def generate_matrix_feed(site, mats, group_by: 'day', filter_by: nil)
xml.id("#{site.config['url']}#{site.baseurl}/#{path}")
title_parts = [filter_title, "#{lookup[group_by]} Updates"].compact
xml.title(title_parts.join(' — '))
xml.subtitle('The latest events, tutorials, slides, blog posts, FAQs, workflows, and contributors in the GTN.')
xml.subtitle('The latest events, tutorials, slides, blog posts, FAQs, workflows, learning paths, recordings, and contributors in the GTN.')
xml.logo("#{site.config['url']}#{site.baseurl}/assets/images/GTN-60px.png")

bucket.each do |date, parts|
Expand All @@ -554,17 +597,17 @@ def generate_matrix_feed(site, mats, group_by: 'day', filter_by: nil)
# xml.h4 title

parts.group_by { |x| x[1] }.sort_by { |x| PRIO[x[0]] }.each do |type, items|
xml.h4 "#{ICON_FOR[type]} #{type.capitalize}"
xml.h4 "#{ICON_FOR[type]} #{type.gsub(/-/, ' ').capitalize}"
if items.length.positive?
xml.ul do
items.each do |date, _type, page, _tags|
xml.li do
if page.is_a?(String)
href = "#{site.config['url']}#{site.config['baseurl']}/hall-of-fame/#{page}/#{TRACKING}"
href = track("#{site.config['url']}#{site.config['baseurl']}/hall-of-fame/#{page}/")
text = "@#{page}"
else
text = page.data['title']
href = "#{site.config['url']}#{site.config['baseurl']}#{page.url}#{TRACKING}"
href = track("#{site.config['url']}#{site.config['baseurl']}#{page.url}")
end
if group_by != 'day'
text += " (#{date.strftime('%B %d, %Y')})"
Expand Down
17 changes: 12 additions & 5 deletions _plugins/jekyll-jsonld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +691,18 @@ def generate_material_jsonld(material, topic, site)
# "award":,
# "author" described below
# "character":,
citation: {
'@type': 'CreativeWork',
name: 'Community-Driven Data Analysis Training for Biology',
url: 'https://doi.org/10.1016/j.cels.2018.05.012'
},
citation: [
{
'@type': 'CreativeWork',
name: 'Galaxy Training: A Powerful Framework for Teaching!',
url: 'https://doi.org/10.1371/journal.pcbi.1010752'
},
{
'@type': 'CreativeWork',
name: 'Community-Driven Data Analysis Training for Biology',
url: 'https://doi.org/10.1016/j.cels.2018.05.012'
}
],
# "comment":,
# "commentCount":,
# "contentLocation":,
Expand Down
7 changes: 6 additions & 1 deletion _plugins/sitemap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ def _build(site)
'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" ' \
'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'

site.pages.reject { |t| t.path =~ /ipynb$/ || t.path =~ /api\/ga4gh\/trs\/v2/}.each do |t|
subset_pages = site.pages
.reject { |t| t.path =~ /ipynb$/ || t.path =~ /api\/ga4gh\/trs\/v2/}
.reject { |t| t.data.fetch('layout', 'page') =~ /external/}
.reject { |t| t.data.fetch('hands_on', '') == 'external'}

subset_pages.each do |t|
begin
d = Gtn::ModificationTimes.obtain_time(t.path)
d.format = '%FT%T%:z'
Expand Down
10 changes: 8 additions & 2 deletions _plugins_dev/sitemap-fake.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Jekyll
# Fake sitemap generator.
class SitemapGenerator < Generator
class SitemapGenerator2 < Generator
safe true

def generate(site)
Expand All @@ -11,7 +11,13 @@ def generate(site)
'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" ' \
'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'

site.pages.each do |t|

subset_pages = site.pages
.reject { |t| t.path =~ /ipynb$/ || t.path =~ /api\/ga4gh\/trs\/v2/}
.reject { |t| t.data.fetch('layout', 'page') =~ /external/}
.reject { |t| t.data.fetch('hands_on', '') == 'external'}

subset_pages.each do |t|
result += "<url><loc>#{site.config['url'] + site.config['baseurl'] + t.url}</loc>" \
'<lastmod>2016-06-30T18:00:00-07:00</lastmod></url>'
end
Expand Down
7 changes: 7 additions & 0 deletions bin/last-month-on.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'nokogiri'

data = File.read('_site/training-material/feeds/matrix-month.xml')
doc = Nokogiri::XML(data)
res = doc.css('entry content')[0].children[1].children.to_s
res.gsub!(/utm_source=matrix.*utm_campaign=matrix-news/, 'utm_source=github&utm_medium=release&utm_campaign=release-notes')
puts res
2 changes: 1 addition & 1 deletion faqs/gtn/recordings_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contributors: [shiltemann]

**We welcome anybody to submit their recordings!** Your videos can be used in (online) training events, or for self-study by learners on the GTN.

For some tips and tricks about recording the video itself, please see
For some tips and tricks about recording the video itself, please ensure your recording conforms to our recommendations:

[Recording Tips & Tricks]({% link faqs/gtn/recordings_create.md %}){: .btn.btn-info}
[Submit a Recording](https://forms.gle/qNG8FkTN1yRZPNZY6){: .btn.btn-info}
Expand Down
2 changes: 1 addition & 1 deletion learning-pathways/beyond_single_cell.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: learning-pathway
tags: [intermediate]
tags: [intermediate, single-cell]
cover-image: assets/images/wab-annotatedcells-2.png
cover-image-alt: "Image of cells in different coloured clusters"
type: use
Expand Down
2 changes: 1 addition & 1 deletion learning-pathways/intro_single_cell.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: learning-pathway
tags: [beginner]
tags: [beginner, single-cell]
cover-image: assets/images/wab-annotatedcells-2.png
cover-image-alt: "Image of cells in different coloured clusters"
type: use
Expand Down

0 comments on commit d7df185

Please sign in to comment.