Sha256: f48ad0c0feed309d81c2abd0ce305afd29f5fa2e0d068f434b7c7f86f81a182e
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
require 'thor/group' module ReleaseNotes module Generators class Broadcast < Thor::Group include Thor::Actions argument :destination, :type => :string argument :subject, :type => :string argument :body, :type => :string argument :release_note_version, :type => :string source_root File.expand_path('../../../generators/templates', __FILE__) def set_local_assigns @subject = subject @body = body @release_note_version = release_note_version.gsub('.', '_') @broadcast_template = 'broadcast_blank.md' @destination = File.expand_path(destination) end def create_directory empty_directory(@destination) end def get_broadcast_number @broadcast_number = next_broadcast_number(@destination) end def copy_broadcast @filename = "#{destination}/broadcast_#{@broadcast_number}.md" template(@broadcast_template, @filename) end protected def next_broadcast_number(dirname) current_broadcast_number(dirname) + 1 end def current_broadcast_number(dirname) broadcast_lookup_at(dirname).collect do |file| File.basename(file).split('_').last.to_i end.max.to_i end def broadcast_lookup_at(dirname) Dir.glob("#{dirname}/*_[0-9]*.md") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
release_notes-0.2.1 | lib/release_notes/generators/broadcast.rb |
release_notes-0.2.0 | lib/release_notes/generators/broadcast.rb |