Class: ReleaseNotes::Generators::ReleaseNote
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- ReleaseNotes::Generators::ReleaseNote
- Includes:
- Thor::Actions
- Defined in:
- lib/release_notes/generators/release_note.rb
Instance Method Summary collapse
- #check_version ⇒ Object
- #copy_release_note ⇒ Object
- #create_directory ⇒ Object
- #set_local_assigns ⇒ Object
Instance Method Details
#check_version ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/release_notes/generators/release_note.rb', line 35 def check_version destination = version_exists?(@destination, @release_version) if destination if .force? remove_file(destination) else raise Thor::Error, <<-ERROR Another update was found using the version number #{@release_version.gsub('_', '.')}. Use --force to remove the old update file and replace it. ERROR end end end |
#copy_release_note ⇒ Object
51 52 53 54 55 |
# File 'lib/release_notes/generators/release_note.rb', line 51 def copy_release_note update_number = next_update_number(destination) @filename = "#{destination}/#{update_number}_#{@release_version}.md" template(@update_template, @filename) end |
#create_directory ⇒ Object
31 32 33 |
# File 'lib/release_notes/generators/release_note.rb', line 31 def create_directory empty_directory(@destination) end |
#set_local_assigns ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/release_notes/generators/release_note.rb', line 16 def set_local_assigns @app_name = ReleaseNotes.app_name @update_template = 'update_blank.md' @destination = File.(destination) @release_version = release_version.gsub('.', '_') @message = .each do |k,v| if v.length > 0 @update_template = 'update.md' break end end end |