Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/generators/talk/talk_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions lib/generators/talk/templates/lightning_talks.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>"
6 changes: 6 additions & 0 deletions lib/generators/talk/templates/talk.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>"
Expand Down
8 changes: 7 additions & 1 deletion test/lib/generators/talk_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]

Expand All @@ -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
Expand Down Expand Up @@ -361,14 +365,16 @@ 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|
assert_match(/id: "andy-andrea-2026"/, content)
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

Expand Down
Loading