Sha256: 94eb4399701902c1776a2c7bfcfec420170dc75ddc737d5a855d2084800af58f

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

#!/usr/bin/env ruby

require "bundler/setup"
require "birdwatcher"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

begin
  Sequel.extension :migration, :core_extensions
  DB = Sequel.connect(Birdwatcher::Configuration.get!(:database_connection_uri))
  Sequel::Model.db = DB
  Sequel::Model.plugin :timestamps
  Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "models", "*.rb"))].each do |file|
    require file
  end
rescue Birdwatcher::Configuration::UnknownKey
  puts "WARNING: Database connection has not been configured"
  puts "Sequel and models will not work."
rescue => e
  puts "ERROR: An exception was raised when setting up Sequel: #{e.class}: #{e.message}"
  puts "Sequel and models will not work."
end

def twitter_client
  keypair = Birdwatcher::Configuration.get!(:twitter).sample
  Twitter::REST::Client.new do |config|
    config.consumer_key    = keypair["consumer_key"]
    config.consumer_secret = keypair["consumer_secret"]
  end
rescue Birdwatcher::Configuration::UnknownKey
  puts "ERROR: Birdwatcher has not been configured with any Twitter keys"
end

require "irb"
require "awesome_print"
AwesomePrint.irb!
IRB.start

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
birdwatcher-0.4.0 bin/console
birdwatcher-0.3.1 bin/console
birdwatcher-0.1.0 bin/console