first integration of the models gem

did committed Apr 28, 2014
commit abeb7721d6af8746729dce5872b523d8429e1858
Showing 4 changed files with 18 additions and 13 deletions
example/server.rb +6 -3
@@ @@ -13,10 +13,13 @@ require_relative '../lib/locomotive/steam/server'
require_relative '../lib/locomotive/steam/initializers'
path = ENV['SITE_PATH'] || File.join(File.expand_path(File.dirname(__FILE__)), '../spec/fixtures/default')
- reader = Locomotive::Mounter::Reader::FileSystem.instance
- reader.run!(path: path)
- app = Locomotive::Steam::Server.new(reader, {
+ # reader = Locomotive::Mounter::Reader::FileSystem.instance
+ # reader.run!(path: path)
+
+ datastore = Locomotive::Steam::FileSystemDatastore.new(path: path)
+
+ app = Locomotive::Steam::Server.new(datastore, {
serve_assets: true
})
locomotive/steam/liquid/drops/content_types.rb b/lib/locomotive/steam/liquid/drops/content_types.rb +3 -1
@@ @@ -108,7 +108,9 @@ module Locomotive
@context['with_scope']['order_by'] = @content_type.order_by + '.' + @content_type.order_direction
end
- @collection = apply_scope(@content_type.entries)
+ @collection = @content_type.entries.where(@context['with_scope'])
+
+ # @collection = apply_scope(@content_type.entries)
end
end
end
locomotive/steam/monkey_patches/mounter.rb b/lib/locomotive/steam/monkey_patches/mounter.rb +1 -1
@@ @@ -35,7 +35,7 @@ module Locomotive
module FileSystem
class Runner
- def new_mounting_point(host)
+ def build_mounting_point(host)
self.mounting_point
end
locomotive/steam/server.rb b/lib/locomotive/steam/server.rb +8 -8
@@ @@ -7,14 +7,14 @@ require_relative 'middlewares'
module Locomotive::Steam
class Server
- attr_reader :reader, :app, :options
+ attr_reader :datastore, :app, :options
- def initialize(reader, options = {})
- @reader = reader
- @options = options
+ def initialize(datastore, options = {})
+ @datastore = datastore
+ @options = options
- stack = Middlewares::Stack.new(options)
- @app = stack.create
+ stack = Middlewares::Stack.new(options)
+ @app = stack.create
end
def call(env)
@@ @@ -40,8 +40,8 @@ module Locomotive::Steam
def set_mounting_point(env)
# one single mounting point per site
- @mounting_point = @reader.new_mounting_point(@request.host)
- env['steam.mounting_point'] = @reader.mounting_point
+ @mounting_point = @datastore.build_mounting_point(@request.host)
+ env['steam.mounting_point'] = @mounting_point
end
def set_services(env)