From 9c2ada8ad69075a8ace7e61a33b31dd70ee0d3f2 Mon Sep 17 00:00:00 2001 From: Rachael Wright-Munn Date: Sun, 6 Sep 2026 23:36:32 +0000 Subject: [PATCH] Add track and slides_url to talk generator --- lib/generators/talk/talk_generator.rb | 5 ++++- lib/generators/talk/templates/lightning_talks.yml.tt | 3 +++ lib/generators/talk/templates/talk.yml.tt | 6 ++++++ test/lib/generators/talk_generator_test.rb | 8 +++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/generators/talk/talk_generator.rb b/lib/generators/talk/talk_generator.rb index a69e81fb71..f6a2447ee6 100644 --- a/lib/generators/talk/talk_generator.rb +++ b/lib/generators/talk/talk_generator.rb @@ -8,6 +8,7 @@ class TalkGenerator < Generators::EventBase TOOL_DESC = "Create or update a new talk entry in the videos.yml file of a given event." class_option :id, type: :string, desc: "ID of an existing talk to update. New talks always get a generated id, so omit this to append one.", required: false, group: "Fields" + # New talks released class_option :title, type: :string, desc: VideoSchema.properties[:title][:description], group: "Fields" class_option :speakers, type: :array, desc: "Speaker names", group: "Fields" class_option :description, type: :string, desc: VideoSchema.properties[:description][:description], group: "Fields" @@ -22,6 +23,8 @@ class TalkGenerator < Generators::EventBase class_option :date, type: :string, desc: VideoSchema.properties[:date][:description], required: false, group: "Fields" class_option :start_time, type: :string, desc: VideoSchema.properties[:start_time][:description], required: false, group: "Fields" class_option :end_time, type: :string, desc: VideoSchema.properties[:end_time][:description], required: false, group: "Fields" + class_option :track, type: :string, desc: VideoSchema.properties[:track][:description], required: false, group: "Fields" + class_option :slides_url, type: :string, desc: VideoSchema.properties[:slides_url][:description], required: false, group: "Fields" # Options class_option :lightning_talks, type: :boolean, default: false, desc: "Add empty group of lightning talks", group: "Options" @@ -33,7 +36,7 @@ class Talk "kind" => "lightning_talk" }.freeze - attr_accessor :event_slug, :event, :announced_at, :description, :original_title, :start_time, :end_time + attr_accessor :event_slug, :event, :announced_at, :description, :original_title, :start_time, :end_time, :track, :slides_url attr_writer :id, :date, :language, :speakers, :title, :kind, :existing_ids def initialize(**attributes) diff --git a/lib/generators/talk/templates/lightning_talks.yml.tt b/lib/generators/talk/templates/lightning_talks.yml.tt index 2049282341..7ba36164bd 100644 --- a/lib/generators/talk/templates/lightning_talks.yml.tt +++ b/lib/generators/talk/templates/lightning_talks.yml.tt @@ -6,6 +6,9 @@ kind: "lightning_talk" language: "<%= @talk.language %>" date: "<%= @talk.date %>" +<%- if @talk.track.present? -%> + track: "<%= @talk.track %>" +<%- end -%> talks: [] video_provider: "scheduled" video_id: "<%= @talk.id %>" diff --git a/lib/generators/talk/templates/talk.yml.tt b/lib/generators/talk/templates/talk.yml.tt index 38d8cb300a..d32767e9b5 100644 --- a/lib/generators/talk/templates/talk.yml.tt +++ b/lib/generators/talk/templates/talk.yml.tt @@ -17,6 +17,12 @@ <%- end -%> <%- if options[:announced_at] -%> announced_at: "<%= @talk.announced_at %>" +<%- end -%> +<%- if @talk.track.present? -%> + track: "<%= @talk.track %>" +<%- end -%> +<%- if @talk.slides_url.present? -%> + slides_url: "<%= @talk.slides_url %>" <%- end -%> video_provider: "scheduled" video_id: "<%= @talk.id %>" diff --git a/test/lib/generators/talk_generator_test.rb b/test/lib/generators/talk_generator_test.rb index 21efba7a02..1f07c6b764 100644 --- a/test/lib/generators/talk_generator_test.rb +++ b/test/lib/generators/talk_generator_test.rb @@ -38,6 +38,8 @@ class TalkGeneratorTest < Rails::Generators::TestCase "--kind", "keynote", "--language", "Japanese", "--date", "2025-09-15", + "--track", "Main Stage", + "--slides-url", "https://speakerdeck.com/jane/doe", "--speakers", "Jane Doe" ] @@ -47,6 +49,8 @@ class TalkGeneratorTest < Rails::Generators::TestCase assert_match(/kind: "keynote"/, content) assert_match(/language: "Japanese"/, content) assert_match(/date: "2025-09-15"/, content) + assert_match(/track: "Main Stage"/, content) + assert_match(/slides_url: "https:\/\/speakerdeck.com\/jane\/doe"/, content) assert_match(/- Jane Doe/, content) end end @@ -361,7 +365,8 @@ class TalkGeneratorTest < Rails::Generators::TestCase "--id", "andy-andrea-2026", "--date", "2026-07-14", "--start-time", "16:15", - "--end-time", "17:00" + "--end-time", "17:00", + "--track", "Workshop Studio" ] assert_valid_file videos_file_path do |content| @@ -369,6 +374,7 @@ class TalkGeneratorTest < Rails::Generators::TestCase assert_match(/date: "2026-07-14"/, content) assert_match(/start_time: 16:15/, content) assert_match(/end_time: 17:00/, content) + assert_match(/track: Workshop Studio/, content) end end