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.



84
85
86
87
88
89
90
# File 'lib/cijoe/server.rb', line 84

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

  CIJoe::Email.activate
end

Class Method Details

.start(host, port, runner, project_path) ⇒ Object



92
93
94
95
96
# File 'lib/cijoe/server.rb', line 92

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

Instance Method Details

#check_projectObject



98
99
100
101
102
103
104
# File 'lib/cijoe/server.rb', line 98

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