Top Level Namespace
- Includes:
- GLI::App
Defined Under Namespace
Constant Summary collapse
- Badge =
shortcuts for models
SportDb::Models::Badge
- Event =
SportDb::Models::Event
- Game =
SportDb::Models::Game
- Goal =
SportDb::Models::Goal
- Group =
SportDb::Models::Group
- League =
SportDb::Models::League
- Person =
SportDb::Models::Person
- Race =
SportDb::Models::Race
- Record =
SportDb::Models::Record
- Roster =
SportDb::Models::Roster
- Round =
SportDb::Models::Round
- Run =
SportDb::Models::Run
- Season =
SportDb::Models::Season
- Team =
SportDb::Models::Team
- Track =
SportDb::Models::Track
- 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
- DB_CONFIG =
connect to db
{ adapter: 'sqlite3', database: 'sport.db' }
- AT =
some countries
Country.find_by_key( 'at' )
- DE =
Country.find_by_key( 'de' )
- EN =
Country.find_by_key( 'en' )
- US =
Country.find_by_key( 'us' )
- CA =
Country.find_by_key( 'ca' )
- MX =
Country.find_by_key( 'mx' )
- EURO2008 =
some events
Event.find_by_key( 'euro.2008' )
- EURO2012 =
Event.find_by_key( 'euro.2012' )
- EURO =
add alias
EURO2012
- BL =
Event.find_by_key( 'de.2013/14' )
- PL =
Event.find_by_key( 'en.2013/14' )
- BARCA =
some club teams
Team.find_by_key( 'barcelona' )
- MANU =
Team.find_by_key( 'manunited' )
- MUN =
add alias
MANUNITED = MANU
- BAYERN =
Team.find_by_key( 'bayern' )
- AUSTRIA =
Team.find_by_key( 'austria' )
- ESP =
some national teams (three letter fifa codes)
Team.find_by_key( 'esp' )
- GER =
Team.find_by_key( 'ger' )
- AUT =
Team.find_by_key( 'aut' )
- MEX =
Team.find_by_key( 'mex' )
- ARG =
Team.find_by_key( 'arg' )
- SportDB =
fix: remove old alias for SportDb
SportDb
Instance Method Summary collapse
-
#banner ⇒ Object
say hello.
- #connect_to_db(options) ⇒ Object
- #find_football_db_path_from_gemfile_gitref! ⇒ Object
-
#logger ⇒ Object
todo/fix: no longer needed - replaced by logutils??.
-
#sportdb ⇒ Object
for use to run with interactive ruby (irb) e.g.
-
#verbose ⇒ Object
todo: use -w for short form? check ruby interpreter if in use too?.
Instance Method Details
#connect_to_db(options) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/sportdb/cli/main.rb', line 72 def connect_to_db( ) puts SportDb. puts "working directory: #{Dir.pwd}" db_config = { :adapter => 'sqlite3', :database => "#{.db_path}/#{.db_name}" } puts "Connecting to db using settings: " pp db_config ActiveRecord::Base.establish_connection( db_config ) LogDb.setup # start logging to db end |
#find_football_db_path_from_gemfile_gitref! ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sportdb/data/fixtures.rb', line 3 def find_football_db_path_from_gemfile_gitref! puts "[debug] find_football_db_path..." puts "load path:" pp $LOAD_PATH candidates = [] $LOAD_PATH.each do |path| if path =~ /\/(football\.db-[a-z0-9]+)|(football\.db)\// candidates << path.dup end end puts "found candidates:" pp candidates ## cut-off everything after /football.db # e.g. lib/ruby/gems/1.9.1/bundler/gems/football.db-38279c414449/lib becomes # lib/ruby/gems/1.9.1/bundler/gems/football.db-38279c414449 cand = candidates[0] puts "cand before: #{cand}" ## nb: *? is non-greedy many operator ## todo: why not just cut off trailing /lib - is it good enough?? # it's easier regex = /(\/football\.db.*?)(\/.*)/ cand = cand.sub( regex ) do |_| puts "cutting off >>#{$2}<<" $1 end puts "cand after: #{cand}" ## todo:exit with error if not found!!! cand end |
#logger ⇒ Object
todo/fix: no longer needed - replaced by logutils??
13 |
# File 'lib/sportdb.rb', line 13 require 'logger' |
#sportdb ⇒ Object
for use to run with interactive ruby (irb)
e.g. irb -r sportdb/console
4 |
# File 'lib/sportdb/console.rb', line 4 require 'sportdb' |
#verbose ⇒ Object
todo: use -w for short form? check ruby interpreter if in use too?
65 |
# File 'lib/sportdb/cli/main.rb', line 65 switch [:verbose], negatable: false |