module GirlsBar
Constants
- DEFAULT_SETTINGS
- DISPLAY_COLORS
- TEMPLATE
- VERSION
Public Class Methods
generate(format)
click to toggle source
# File lib/girls_bar.rb, line 26 def self.generate(format) dump_resource(format) end
run(path)
click to toggle source
# File lib/girls_bar.rb, line 18 def self.run(path) resource = load_resource(path) GirlsBar::Settings.setup resource["config"] GirlsBar::Entry.setup resource["entry"] GirlsBar::Data.setup GirlsBar::Router.start end
Private Class Methods
dump_resource(format=nil)
click to toggle source
# File lib/girls_bar.rb, line 47 def self.dump_resource(format=nil) data = YAML.load GirlsBar::TEMPLATE if format == "json" filename = "tequila.json" open(filename, "w") {|io| io.write JSON.pretty_generate data } else filename = "tequila.yml" open(filename, "w") {|io| io.write YAML.dump data } end GirlsBar::Helper.set_color(:blue) { puts "...Generated #{filename}" } end
load_resource(path)
click to toggle source
# File lib/girls_bar.rb, line 31 def self.load_resource(path) begin raise "File Does Not Exist" unless FileTest.exist?(path) case File.extname(path) when ".yml" resource = YAML.load_file path when ".json" resource = JSON.load open(path) else raise "Invalid File Extension" end rescue => e GirlsBar::Helper.set_color(:white, :on_red) { puts e.message } end end