Module: Susanoo::CLI::Commands::Server
- Extended by:
- ActiveSupport::Concern
- Included in:
- ProjectInterface
- Defined in:
- lib/susanoo/cli/project_interface/server.rb
Overview
Provide the server command for project wide usage.
Instance Method Summary collapse
-
#built? ⇒ Boolean
private
Does project is built?.
- #not_built ⇒ Object private
-
#static_server_for(platform) ⇒ Object
private
Return a
Rackapplciation which will serve the already built project under specific platform path.
Instance Method Details
#built? ⇒ Boolean (private)
Does project is built?
37 38 39 40 |
# File 'lib/susanoo/cli/project_interface/server.rb', line 37 def built? return false unless File.directory? File.join(project_root, 'www') true end |
#not_built ⇒ Object (private)
42 43 44 |
# File 'lib/susanoo/cli/project_interface/server.rb', line 42 def not_built error "'www' directory is not present. Build you app first." end |
#static_server_for(platform) ⇒ Object (private)
Return a Rack applciation which will serve the
already built project under specific platform path
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/susanoo/cli/project_interface/server.rb', line 48 def static_server_for(platform) require 'rack/rewrite' root = project_root app = Rack::Builder.new do use Rack::Rewrite do rewrite '/', "/#{platform}_asset/www" end map "/#{platform}_asset/www/" do run Rack::Directory.new File.join(root, 'www') end end end |