Class: CIQuantum::Server
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- CIQuantum::Server
- Defined in:
- lib/ciquantum/server.rb
Instance Attribute Summary collapse
-
#quantum ⇒ Object
readonly
Returns the value of attribute quantum.
Class Method Summary collapse
- .project_path=(project_path) ⇒ Object
- .rack_start(project_path) ⇒ Object
- .start(host, port, project_path) ⇒ Object
Instance Method Summary collapse
- #check_project ⇒ Object
-
#initialize(*args) ⇒ Server
constructor
A new instance of Server.
Constructor Details
Instance Attribute Details
#quantum ⇒ Object (readonly)
Returns the value of attribute quantum.
15 16 17 |
# File 'lib/ciquantum/server.rb', line 15 def quantum @quantum end |
Class Method Details
.project_path=(project_path) ⇒ Object
139 140 141 |
# File 'lib/ciquantum/server.rb', line 139 def self.project_path=(project_path) set :project_path, Proc.new{project_path}, true end |
.rack_start(project_path) ⇒ Object
134 135 136 137 |
# File 'lib/ciquantum/server.rb', line 134 def self.rack_start(project_path) set :project_path, project_path self.new end |
.start(host, port, project_path) ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/ciquantum/server.rb', line 126 def self.start(host, port, project_path) git_path = File.join(project_path, ".git") FileUtils.cp_r settings.public_folder, git_path set :project_path, project_path set :public_folder, "#{git_path}/public" CIQuantum::Server.run! :host => host, :port => port end |
Instance Method Details
#check_project ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/ciquantum/server.rb', line 143 def check_project if settings.project_path.nil? || !File.exists?(File.(settings.project_path)) puts "Whoops! I need the path to a Git repo." puts " $ git clone [email protected]:username/project.git project" abort " $ ciquantum project" end end |