Module: WineDb

Defined in:
lib/winedb.rb,
lib/winedb/reader.rb,
lib/winedb/schema.rb,
lib/winedb/version.rb,
lib/winedb/models/wine.rb,
lib/winedb/models/winery.rb,
lib/winedb/models/forward.rb

Defined Under Namespace

Modules: Matcher, Model Classes: CreateDb, Reader

Constant Summary collapse

VERSION =
'0.1.2'
Models =

note: for convenciene (and compatibility) add alias Models for Model namespace

e.g lets you use include WineDb::Models
Model

Class Method Summary collapse

Class Method Details



29
30
31
# File 'lib/winedb.rb', line 29

def self.banner
  "winedb/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end

.createObject



37
38
39
40
41
# File 'lib/winedb.rb', line 37

def self.create
  CreateDb.new.up

  WineDb::Model::Prop.create!( key: 'db.schema.wine.version', value: VERSION )
end

.read(ary, include_path) ⇒ Object



44
45
46
47
48
49
# File 'lib/winedb.rb', line 44

def self.read( ary, include_path )
  reader = Reader.new( include_path )
  ary.each do |name|
    reader.load( name )
  end
end

.read_all(include_path, opts = {}) ⇒ Object

load all builtins (using plain text reader); helper for convenience



56
57
58
# File 'lib/winedb.rb', line 56

def self.read_all( include_path, opts={} )  # load all builtins (using plain text reader); helper for convenience
  read_setup( 'setups/all', include_path, opts )
end

.read_setup(setup, include_path, opts = {}) ⇒ Object



51
52
53
54
# File 'lib/winedb.rb', line 51

def self.read_setup( setup, include_path, opts={} )
  reader = Reader.new( include_path, opts )
  reader.load_setup( setup )
end

.rootObject



33
34
35
# File 'lib/winedb.rb', line 33

def self.root
  "#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
end