Module: Yolo::Tools::Ios::ReleaseNotes

Defined in:
lib/yolo/tools/ios/release_notes.rb

Overview

Generates and parses release notes for application releases

Author:

  • Alex Fish

Class Method Summary collapse

Class Method Details

.generate(plist_path) ⇒ Object

Generates a release notes markdown file in the current directory

Parameters:

  • plist_path (String)

    The full path to the applications info.plist



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/yolo/tools/ios/release_notes.rb', line 16

def self.generate(plist_path)
  xcode = Yolo::Tools::Ios::Xcode.new
  xcode.info_plist_path = plist_path
  directory = Dir.pwd
  time = Time.new

  File.open("#{directory}/release_notes.md", 'w') {|f|
    f.write("### Version\n- - -\n")
    f.write("#{xcode.version_number} (#{xcode.build_number})\n\n")
    f.write("### Date\n- - -\n")
    f.write("#{time.day}/#{time.month}/#{time.year} - #{time.hour}:#{time.min}")
  }

  formatter = Yolo::Formatters::ProgressFormatter.new
  formatter.notes_generated("#{directory}/release_notes.md")

  #`open #{directory}/release_notes.md`
end

.htmlString

Uses Redcarpet to parse the release notes markdown file into html.

Returns:

  • (String)

    An html string representation of the current release_notes.md file



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/yolo/tools/ios/release_notes.rb', line 57

def self.html
  notes = "#{Dir.pwd}/release_notes.md"
  unless File.exist?(notes)
    error_formatter = Yolo::Formatters::ErrorFormatter.new
    error_formatter.no_notes(notes)
    return ""
  end

  file = File.open(notes, "r")
  file_content = file.read
  markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
  :autolink => true, :space_after_headers => true)
  content = markdown.render(file_content)
  content.gsub("\n","")
  content
end

.plaintextString

Returns a plaintext string of the release notes file

Returns:

  • (String)

    The release notes as plain text



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/yolo/tools/ios/release_notes.rb', line 39

def self.plaintext
  notes = "#{Dir.pwd}/release_notes.md"
  unless File.exist?(notes)
    error_formatter = Yolo::Formatters::ErrorFormatter.new
    error_formatter.no_notes(notes)
    return ""
  end

  file = File.open(notes, "r")
  file_content = file.read

  file_content
end