Sha256: 1543260b42c173b5473ea1e51e97c7a7baef69a9311c03298c48b36ec0bce848

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

require 'rubygems'
require 'irb'

# ensure we use local gem
$LOAD_PATH.unshift('lib')

def consolize &block

  yield

  IRB.setup(nil)
  irb = IRB::Irb.new
  IRB.conf[:MAIN_CONTEXT] = irb.context
  irb.context.evaluate("require 'irb/completion'", 0)

  trap("SIGINT") do
    irb.signal_handle
  end
  catch(:IRB_EXIT) do
    irb.eval_input
  end
end

consolize do
  require 'echonest'

  key = nil

  locations = ["~/.mreko/echonest_api.key", "~/.echonest/api_key"]
  locations.each do |config|
    if File.exists?(File.expand_path(config))
      key = File.read(File.expand_path(config))
      break
    end
  end

  raise "Need an EN key in one of these locations: #{locations.inspect}" unless key

  @en = Echonest(key)

  def en; @en; end
end



Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bassnode-ruby-echonest-0.1.3 console