Class: Heroku::Bartender::Server

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/heroku/bartender/server.rb

Constant Summary collapse

@@options =
{}

Class Method Summary collapse

Class Method Details

.authorize(user, password) ⇒ Object



86
87
88
89
90
91
92
# File 'lib/heroku/bartender/server.rb', line 86

def self.authorize(user, password)
  if ! user.nil?
    use Rack::Auth::Basic, "Restricted Area" do |u, p|
      [u, p] == [user, password]
    end
  end
end

.configObject



41
42
43
# File 'lib/heroku/bartender/server.rb', line 41

def self.config
  Config.send("remote.#{Server.target}")
end

.hostObject



33
34
35
# File 'lib/heroku/bartender/server.rb', line 33

def self.host
  @@options[:host]
end

.max_per_pageObject



17
18
19
# File 'lib/heroku/bartender/server.rb', line 17

def self.max_per_page
  @@options[:commits_per_page]
end

.passwordObject



25
26
27
# File 'lib/heroku/bartender/server.rb', line 25

def self.password
 @@options[:password]
end

.portObject



37
38
39
# File 'lib/heroku/bartender/server.rb', line 37

def self.port
  @@options[:port]
end

.predeployObject



45
46
47
# File 'lib/heroku/bartender/server.rb', line 45

def self.predeploy
  config.predeploy.to_s
end

.start(options = {}) ⇒ Object



79
80
81
82
83
84
# File 'lib/heroku/bartender/server.rb', line 79

def self.start(options = {})
  @@options = options
  @@deploying = false
  authorize(user, password)
  run!(:host => host, :port => port)
end

.targetObject



29
30
31
# File 'lib/heroku/bartender/server.rb', line 29

def self.target
  @@options[:target] || 'heroku'
end

.userObject



21
22
23
# File 'lib/heroku/bartender/server.rb', line 21

def self.user
  @@options[:user]
end