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.



53
54
55
56
57
58
59
# File 'lib/cijoe/server.rb', line 53

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



61
62
63
64
# File 'lib/cijoe/server.rb', line 61

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



66
67
68
69
70
71
72
# File 'lib/cijoe/server.rb', line 66

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