Skip to content

Commit

Permalink
final 1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Apr 15, 2011
1 parent 4ae03e6 commit 4652de9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 36 deletions.
55 changes: 20 additions & 35 deletions lib/middleman/features/data.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,30 @@
# require "fssm"
require "yaml"

module Middleman::Features::Data
class << self
def registered(app)
@@app = app
@@data_structure = {}

Dir[File.join(app.root, 'data/*.yml')].each do |d|
handle_update(d)
end

# FSSM.monitor(app.root, 'data/*.yml') do
# update do |base, relative|
# handle_update(File.join(base, relative))
# end
#
# create do |base, relative|
# handle_update(File.join(base, relative))
# end
#
# delete do |base, relative|
# handle_delete(File.join(base, relative))
# end
# end
app.helpers Middleman::Features::Data::Helpers
end

def handle_update(path)
data_name = File.basename(path).split(".").first
data = YAML.load_file(path)

@@data_structure[data_name] = data
@@app.set :data, @@data_structure
alias :included :registered
end

module Helpers
def data
@@data ||= Middleman::Features::Data::DataObject.new(self)
end
end

class DataObject
def initialize(app)
@app = app
end

# def handle_delete(path)
# data_name = File.basename(path).split(".").first
# @@data_structure.delete(data_name) if @@data_structure.has_key? data_name
# @@app.set :data, @@data_structure
# end

alias :included :registered
def method_missing(path)
file_path = File.join(@app.class.root, "data", "#{path}.yml")
if File.exists? file_path
return YAML.load_file(file_path)
end
end
end

end
22 changes: 22 additions & 0 deletions lib/middleman/features/lorem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ def lorem

# Adapted from Frank:
# https://github.com/blahed/frank/
# Copyright (c) 2010 Travis Dunn
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
class LoremObject
WORDS = %w(alias consequatur aut perferendis sit voluptatem accusantium doloremque aperiam eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo aspernatur aut odit aut fugit sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt neque dolorem ipsum quia dolor sit amet consectetur adipisci velit sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem ut enim ad minima veniam quis nostrum exercitationem ullam corporis nemo enim ipsam voluptatem quia voluptas sit suscipit laboriosam nisi ut aliquid ex ea commodi consequatur quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae et iusto odio dignissimos ducimus qui blanditiis praesentium laudantium totam rem voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident sed ut perspiciatis unde omnis iste natus error similique sunt in culpa qui officia deserunt mollitia animi id est laborum et dolorum fuga et harum quidem rerum facilis est et expedita distinctio nam libero tempore cum soluta nobis est eligendi optio cumque nihil impedit quo porro quisquam est qui minus id quod maxime placeat facere possimus omnis voluptas assumenda est omnis dolor repellendus temporibus autem quibusdam et aut consequatur vel illum qui dolorem eum fugiat quo voluptas nulla pariatur at vero eos et accusamus officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae itaque earum rerum hic tenetur a sapiente delectus ut aut reiciendis voluptatibus maiores doloribus asperiores repellat)

Expand Down
2 changes: 1 addition & 1 deletion lib/middleman/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Middleman
VERSION = "1.1.0.beta.8"
VERSION = "1.1.0"
end

0 comments on commit 4652de9

Please sign in to comment.