Class: Spectra::Command::Generate
- Inherits:
-
Spectra::Command
- Object
- CLAide::Command
- Spectra::Command
- Spectra::Command::Generate
- Defined in:
- lib/spectra/commands.rb
Overview
Subcommands
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Generate
constructor
A new instance of Generate.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
Class Method Details
.options ⇒ Object
36 37 38 39 40 |
# File 'lib/spectra/commands.rb', line 36 def self. [[ '--dry-run', 'Prints the would-be output file rather than generating anything' ]].concat(super) end |
Instance Method Details
#run ⇒ Object
57 58 59 60 61 |
# 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! ⇒ Object
48 49 50 51 52 53 54 55 |
# 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 |