Class: CIJoe::Server

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Server

Returns a new instance of Server.



56
57
58
59
60
61
62
# File 'lib/cijoe/server.rb', line 56

def initialize(*args)
  super
  check_project
  @joe = CIJoe.new(options.project_path)

  CIJoe::Email.activate
end

Class Method Details

.start(host, port, project_path) ⇒ Object



64
65
66
67
# File 'lib/cijoe/server.rb', line 64

def self.start(host, port, project_path)
  set :project_path, project_path
  CIJoe::Server.run! :host => host, :port => port
end

Instance Method Details

#check_projectObject



69
70
71
72
73
74
75
# File 'lib/cijoe/server.rb', line 69

def check_project
  if options.project_path.nil? || !File.exists?(File.expand_path(options.project_path))
    puts "Whoops! I need the path to a Git repo."
    puts "  $ git clone [email protected]:username/project.git project"
    abort "  $ cijoe project"
  end
end