class Astromapper::Cli
Constants
- FORMATS
Public Class Methods
exit_on_failure?()
click to toggle source
# File lib/astromapper/cli.rb, line 8 def self.exit_on_failure? true end
new(args = [], options = {}, config = {})
click to toggle source
Calls superclass method
# File lib/astromapper/cli.rb, line 11 def initialize(args = [], options = {}, config = {}) # if (config[:current_task] || config[:current_command]).name == "new" && args.empty? # raise Error, "The e-Book path is required. For details run: Astromapper help new" # end super end
Public Instance Methods
about(volume_id)
click to toggle source
# File lib/astromapper/cli.rb, line 29 def about(volume_id) say "Searching database on #{volume_id}" source = Astromapper.output_file('sector') if File.exists?(source) # volume = Astromapper::Astro::Volume.new(source, volume_id) # puts volume.inspect @volumes = {} volume = [] id = nil File.open(source,'r').readlines.each do |line| if /^\d{4}/.match(line) @volumes[id.to_s] = volume unless volume.nil? or id.nil? volume = [] id = line[0..3] end volume << line #unless volume.nil? end @volume = Astromapper::Astro::Volume.new(@volumes[volume_id]) puts @volume.summary say @volume.ascii else say "Hey! You need to generate the sector first (try: astromapper build)." end end
build(type='sector')
click to toggle source
# File lib/astromapper/cli.rb, line 57 def build(type='sector') say "Building #{type}: #{config['name'].inspect}" Astromapper::Exporter.run(root_dir, options) end
create(path)
click to toggle source
# File lib/astromapper/cli.rb, line 20 def create(path) say "Voices of billions cry out in terror at the creation of '#{path}'" generator = Generator.new generator.destination_root = path.squish.gsub(' ','-') generator.invoke_all end
svg()
click to toggle source
# File lib/astromapper/cli.rb, line 64 def svg source = Astromapper.output_file('sector') say "Converting #{source} to SVG" s = Svg.new(source) s.convert say "SVG available at #{Astromapper.output_file('svg')}" end
version()
click to toggle source
# File lib/astromapper/cli.rb, line 74 def version say "Astromapper version #{Astromapper::VERSION}" end
Private Instance Methods
config()
click to toggle source
# File lib/astromapper/cli.rb, line 79 def config # YAML.load_file(config_path).with_indifferent_access Astromapper.config end
root_dir()
click to toggle source
# File lib/astromapper/cli.rb, line 83 def root_dir @root ||= Pathname.new(Dir.pwd) end