Sha256: 8e1fcd693557e9d5c64270c9880f9c7e836e206aff96fcde5ae74bf1f42b8947

Contents?: true

Size: 1.51 KB

Versions: 42

Compression:

Stored size: 1.51 KB

Contents

## for use to run with interactive ruby (irb)
##  e.g.  irb -r sportdb/console

require 'beerdb'

# some ruby stdlibs

require 'logger'
require 'pp'   # pretty printer
require 'uri'
require 'json'
require 'yaml'


## shortcuts for models

Beer    = BeerDb::Models::Beer
Brewery = BeerDb::Models::Brewery

Tag       = WorldDb::Models::Tag
Tagging   = WorldDb::Models::Tagging
Continent = WorldDb::Models::Continent
Country   = WorldDb::Models::Country
Region    = WorldDb::Models::Region
City      = WorldDb::Models::City
Prop      = WorldDb::Models::Prop

## connect to db

DB_CONFIG = {
  adapter:  'sqlite3',
  database: 'beer.db'
}

pp DB_CONFIG
ActiveRecord::Base.establish_connection( DB_CONFIG )

## test drive

puts "Welcome to beer.db, version #{BeerDb::VERSION} (world.db, version #{WorldDb::VERSION})!"

BeerDb.tables

puts "Ready."

## add some predefined shortcuts

##### some countries

AT = Country.find_by_key( 'at' )
DE = Country.find_by_key( 'de' )
EN = Country.find_by_key( 'en' )

US = Country.find_by_key( 'us' )
MX = Country.find_by_key( 'mx' )

### some cities

WIEN = City.find_by_key( 'wien' )

### some regions

NO = Region.find_by_key_and_country_id( 'no', AT.id )  # at - niederoesterreich
OO = Region.find_by_key_and_country_id( 'oo', AT.id )  # at - oberoesterreich

#### some beers

## to be done


### some breweries

OTTAKRINGER = Brewery.find_by_key( 'ottakringer' )
SCHWECHAT   = Brewery.find_by_key( 'schwechat' )


## turn on activerecord logging to console

ActiveRecord::Base.logger = Logger.new( STDOUT )

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
beerdb-0.6.15 lib/beerdb/console.rb
beerdb-0.6.14 lib/beerdb/console.rb
beerdb-0.6.13 lib/beerdb/console.rb
beerdb-0.6.12 lib/beerdb/console.rb
beerdb-0.6.11 lib/beerdb/console.rb
beerdb-0.6.10 lib/beerdb/console.rb
beerdb-0.6.9 lib/beerdb/console.rb
beerdb-0.6.8 lib/beerdb/console.rb
beerdb-0.6.7 lib/beerdb/console.rb
beerdb-0.6.6 lib/beerdb/console.rb
beerdb-0.6.5 lib/beerdb/console.rb
beerdb-0.6.4 lib/beerdb/console.rb
beerdb-0.6.3 lib/beerdb/console.rb
beerdb-0.6.2 lib/beerdb/console.rb
beerdb-0.6.1 lib/beerdb/console.rb
beerdb-0.6.0 lib/beerdb/console.rb
beerdb-0.5.2 lib/beerdb/console.rb
beerdb-0.5.1 lib/beerdb/console.rb
beerdb-0.5.0 lib/beerdb/console.rb
beerdb-0.4.0 lib/beerdb/console.rb