class Spectra::Command::Generate

Subcommands

Public Class Methods

new(argv) click to toggle source
Calls superclass method Spectra::Command::new
# File lib/spectra/commands.rb, line 42
def initialize(argv)
  # update config from options
  Config.dry_run = argv.flag?('dry-run', false)
  super
end
options() click to toggle source
Calls superclass method
# File lib/spectra/commands.rb, line 36
def self.options
  [[
    '--dry-run', 'Prints the would-be output file rather than generating anything' 
  ]].concat(super)
end

Public Instance Methods

run() click to toggle source
# File lib/spectra/commands.rb, line 57
def run
  # generate the views from the user's spectrum.rb
  spectrum = Spectra::Spectrum.new
  spectrum.generate(@definition)
end
validate!() click to toggle source
Calls superclass method
# File lib/spectra/commands.rb, line 48
def validate!
  super
  begin
    @definition = IO.read('spectrum.rb')
  rescue Exception
    raise Informative, 'Failed to find a spectrum.rb file in the current directory'
  end 
end