Sha256: 677563c4b39469bd4a84211f613cb675c473264e40cf8390cf09802192b353dd

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

#!/usr/bin/env jruby #--jdb -J-sourcepath -J/Users/jan/projects/jotify/src
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))

require 'rubygems'
require 'jotify'
require 'jotify/api'

DEFAULT_PORT = port = 3000

def usage
  STDERR.puts "#{File.basename($0)} [-p <port>] [--account <login>:<password>]"
  exit(1)
end

while arg = ARGV.shift do
    case arg
      when '-p', '--port': port = ARGV.shift
      when '--account':
        login, password = ARGV.shift.to_s.split(':')
        raise ArgumentError, "you need to specify both login and password!" unless login and password
        Jotify.credentials = { :username=>login, :password=>password }
      when '-h', '--help': usage
    end
end

# Taken mostly from
# http://groups.google.com/group/sinatrarb/t/a5cfc2b77a013a86
class Sinatra::Reloader < Rack::Reloader
  def safe_load(file, mtime, stderr = $stderr)
#    ::Sinatra::Application.reset!
#    stderr.puts "#{self.class}: reseting routes"
    super
  end
end

#Sinatra::Application.set :environment, :production
Sinatra::Application.configure(:development) do |app|
  #app.use Sinatra::Reloader
end
Sinatra::Application.run! :port=> (port || DEFAULT_PORT).to_i

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spotify-api-0.0.7 bin/spotify-api-server
spotify-api-0.0.6 bin/spotify-api-server
spotify-api-0.0.5 bin/spotify-api-server