Class: CIJoe::Server

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Server

Returns a new instance of Server.



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

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

  CIJoe::Talker.activate
end

Instance Attribute Details

#joeObject (readonly)

Returns the value of attribute joe.



6
7
8
# File 'lib/cijoe/server.rb', line 6

def joe
  @joe
end

Class Method Details

.start(host, port, project_path) ⇒ Object



74
75
76
77
# File 'lib/cijoe/server.rb', line 74

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



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

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