Added standalone server
Rodrigo Alvarez
committed Jan 25, 2013
commit 2051776b5477fe4fade6db72c762f672e3c06045
Showing 6
changed files with
42 additions
and 5 deletions
generators/blank/Gemfile
+2
-2
| @@ | @@ -3,8 +3,8 @@ source 'https://rubygems.org' |
| # gem 'locomotive_builder', require: true | |
| # DEV | |
| - | gem 'locomotivecms_mounter', path: '/Users/didier/Documents/LocomotiveCMS/gems/mounter' |
| - | gem 'locomotivecms_builder', require: true, path: '/Users/didier/Documents/LocomotiveCMS/builder' |
| + | gem 'locomotivecms_mounter', '~> 1.0.0.rc1' |
| + | gem 'locomotivecms_builder', '~> 1.0.0.rc1' |
| # Mac OS X | |
| gem 'rb-fsevent', '~> 0.9.1' | |
generators/blank/app/views/pages/404.liquid
+1
-1
| @@ | @@ -2,7 +2,7 @@ |
| title: Page not found | |
| published: false | |
| --- | |
| - | {% extend index %} |
| + | {% extends index %} |
| {% block 'main' %} | |
generators/blank/config.ru
+2
-0
| @@ | @@ -0,0 +1,2 @@ |
| + | require 'locomotive/builder/standalone_server' |
| + | run Locomotive::Builder::StandaloneServer.new(File.expand_path('.')) |
| \ No newline at end of file | |
generators/bootstrap/Gemfile
+2
-2
| @@ | @@ -1,8 +1,8 @@ |
| # gem 'locomotive_builder', require: true | |
| # DEV | |
| - | gem 'locomotivecms_mounter', path: '/Users/didier/Documents/LocomotiveCMS/gems/mounter' |
| - | gem 'locomotivecms_builder', require: true, path: '/Users/didier/Documents/LocomotiveCMS/builder' |
| + | gem 'locomotivecms_mounter', '~> 1.0.0.rc1' |
| + | gem 'locomotivecms_builder', '~> 1.0.0.rc1' |
| # Mac OS X | |
| gem 'rb-fsevent', '~> 0.9.1' | |
generators/bootstrap/config.ru
+2
-0
| @@ | @@ -0,0 +1,2 @@ |
| + | require 'locomotive/builder/standalone_server' |
| + | run Locomotive::Builder::StandaloneServer.new(File.expand_path('.')) |
| \ No newline at end of file | |
locomotive/builder/standalone_server.rb b/lib/locomotive/builder/standalone_server.rb
+33
-0
| @@ | @@ -0,0 +1,33 @@ |
| + | require "locomotive/builder/server" |
| + | $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../..')) |
| + | |
| + | require 'locomotive/builder/version' |
| + | require 'locomotive/builder/exceptions' |
| + | require 'locomotive/mounter' |
| + | |
| + | module Locomotive |
| + | module Builder |
| + | class StandaloneServer < Server |
| + | |
| + | def initialize(path) |
| + | # setting the logger |
| + | logfile = File.join(path, 'log', 'mounter.log') |
| + | FileUtils.mkdir_p(File.dirname(logfile)) |
| + | |
| + | Locomotive::Mounter.logger = ::Logger.new(logfile).tap do |log| |
| + | log.level = Logger::DEBUG |
| + | end |
| + | |
| + | # get the reader |
| + | reader = Locomotive::Mounter::Reader::FileSystem.instance |
| + | reader.run!(path: path) |
| + | reader |
| + | |
| + | # run the rack app |
| + | Bundler.require 'misc' |
| + | |
| + | super(reader, disable_listen: true) |
| + | end |
| + | end |
| + | end |
| + | end |
| \ No newline at end of file | |