class Amanuensis::CLI

Constants

VIA_OPTIONS

Public Instance Methods

generate() click to toggle source
# File lib/amanuensis/cli.rb, line 16
def generate
  Amanuensis.push         = options.push
  Amanuensis.tracker      = options.tracker
  Amanuensis.code_manager = options.code_manager
  Amanuensis.version      = options.version
  Amanuensis.verbose      = options.verbose
  Amanuensis.release      = options.release

  if options.github.present?
    options.github.each do |key, value|
      Amanuensis::Github.send "#{key}=", value
    end
  end

  if options.file.present?
    options.file.each do |key, value|
      Amanuensis::File.send "#{key}=", value
    end
  end

  if options.trello.present?
    options.trello.each do |key, value|
      Amanuensis::Trello.send "#{key}=", value
    end
  end

  if options.pivotal.present?
    options.pivotal.each do |key, value|
      Amanuensis::Pivotal.send "#{key}=", value
    end
  end

  if options.mail.present?
    pony = extract_pony_options!(options.mail)
    Amanuensis::Mail.pony = pony
  end

  Amanuensis.generate
rescue ValidationError => e
  puts e.message
end

Private Instance Methods

extract_pony_options!(options = {}) click to toggle source
# File lib/amanuensis/cli.rb, line 62
def extract_pony_options!(options = {})
  via_options = options[VIA_OPTIONS] ||= {}

  options.each do |key, value|
    if key != VIA_OPTIONS && key.start_with?(VIA_OPTIONS)
      sub_key = key.gsub("#{VIA_OPTIONS}_", '')
      via_options[sub_key.to_sym] = value
      options.delete(key)
    end
  end

  options
end