Module: Astromapper

Defined in:
lib/astromapper.rb,
lib/astromapper/cli.rb,
lib/astromapper/svg.rb,
lib/astromapper/about.rb,
lib/astromapper/astro.rb,
lib/astromapper/builder.rb,
lib/astromapper/version.rb,
lib/astromapper/exporter.rb,
lib/astromapper/astro/gas.rb,
lib/astromapper/generator.rb,
lib/astromapper/astro/star.rb,
lib/astromapper/astro/orbit.rb,
lib/astromapper/astro/world.rb,
lib/astromapper/astro/volume.rb,
lib/astromapper/builder/star.rb,
lib/astromapper/builder/orbit.rb,
lib/astromapper/builder/sector.rb,
lib/astromapper/builder/volume.rb,
lib/astromapper/astro/terrestrial.rb

Defined Under Namespace

Modules: Astro, Builder Classes: About, Cli, Exporter, Generator, Svg

Constant Summary collapse

VERSION =
"1.1.0"

Class Method Summary collapse

Class Method Details

.config(root_dir = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/astromapper.rb', line 31

def self.config(root_dir = nil)
  root_dir ||= Pathname.new(Dir.pwd)
  path = root_dir.join("_astromapper.yml")

  raise "Invalid Bookmaker directory; couldn't found #{path} file." unless File.file?(path)
  content = File.read(path)
  erb = ERB.new(content).result

  YAML.load(erb).to_hash.with_indifferent_access
end

.loggerObject



54
55
56
# File 'lib/astromapper.rb', line 54

def self.logger
   @logger ||= Logger.new(File.open("/tmp/astromapper.log", "a"))
end

.names(root_dir = nil) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/astromapper.rb', line 44

def self.names(root_dir = nil)
  root_dir ||= Pathname.new(Dir.pwd)
  path = root_dir.join("templates/names.yml")

  raise "Invalid Bookmaker directory; couldn't found #{path} file." unless File.file?(path)
  content = File.read(path)
  erb = ERB.new(content).result

  @names = YAML.load(erb)
end

.output_file(ext = "txt") ⇒ Object



41
42
43
# File 'lib/astromapper.rb', line 41

def self.output_file(ext="txt")
  "output/#{config['name'].to_permalink}.#{ext}"
end