massimo 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. data/.document +5 -0
  2. data/.gitignore +25 -0
  3. data/LICENSE +20 -0
  4. data/README.md +108 -0
  5. data/Rakefile +62 -0
  6. data/VERSION +1 -0
  7. data/bin/massimo +6 -0
  8. data/lib/massimo/command.rb +242 -0
  9. data/lib/massimo/helpers.rb +26 -0
  10. data/lib/massimo/javascript.rb +38 -0
  11. data/lib/massimo/page.rb +113 -0
  12. data/lib/massimo/resource.rb +52 -0
  13. data/lib/massimo/site.rb +186 -0
  14. data/lib/massimo/stylesheet.rb +46 -0
  15. data/lib/massimo/templates.rb +20 -0
  16. data/lib/massimo/view.rb +30 -0
  17. data/lib/massimo.rb +38 -0
  18. data/massimo.gemspec +130 -0
  19. data/test/assertions.rb +8 -0
  20. data/test/helper.rb +54 -0
  21. data/test/source/config.yml +4 -0
  22. data/test/source/helpers/test_helper.rb +5 -0
  23. data/test/source/javascripts/_plugin.js +1 -0
  24. data/test/source/javascripts/application.js +3 -0
  25. data/test/source/javascripts/lib.js +1 -0
  26. data/test/source/lib/site.rb +5 -0
  27. data/test/source/pages/_skipped_page.haml +0 -0
  28. data/test/source/pages/about_us.erb +5 -0
  29. data/test/source/pages/erb.erb +5 -0
  30. data/test/source/pages/erb_with_layout.erb +4 -0
  31. data/test/source/pages/feed.haml +6 -0
  32. data/test/source/pages/haml.haml +5 -0
  33. data/test/source/pages/html.html +4 -0
  34. data/test/source/pages/index.erb +4 -0
  35. data/test/source/pages/markdown.markdown +5 -0
  36. data/test/source/pages/posts/first-post.haml +1 -0
  37. data/test/source/pages/with_extension.haml +4 -0
  38. data/test/source/pages/with_meta_data.haml +7 -0
  39. data/test/source/pages/with_title.haml +4 -0
  40. data/test/source/pages/with_url.haml +4 -0
  41. data/test/source/pages/without_extension.haml +0 -0
  42. data/test/source/pages/without_meta_data.haml +1 -0
  43. data/test/source/pages/without_title.haml +1 -0
  44. data/test/source/pages/without_url.haml +1 -0
  45. data/test/source/stylesheets/_base.sass +2 -0
  46. data/test/source/stylesheets/application.sass +4 -0
  47. data/test/source/stylesheets/basic.css +3 -0
  48. data/test/source/stylesheets/less_file.less +5 -0
  49. data/test/source/views/layouts/application.haml +2 -0
  50. data/test/source/views/with_helper.haml +1 -0
  51. data/test/source/views/with_locals.haml +1 -0
  52. data/test/source/views/without_locals.haml +1 -0
  53. data/test/test_javascript.rb +30 -0
  54. data/test/test_page.rb +136 -0
  55. data/test/test_resource.rb +27 -0
  56. data/test/test_site.rb +126 -0
  57. data/test/test_stylesheet.rb +40 -0
  58. data/test/test_view.rb +46 -0
  59. metadata +191 -0
@@ -0,0 +1,52 @@
1
+ module Massimo
2
+ class Resource
3
+ attr_reader :source_path, :body
4
+
5
+ # Creates a new page associated with the given file path.
6
+ def initialize(source_path)
7
+ @source_path = ::Pathname.new(source_path)
8
+ # read and parse the source file
9
+ self.read_source!
10
+ end
11
+
12
+ # Renders the page using the registered filters.
13
+ def render(locals = {})
14
+ @body
15
+ end
16
+
17
+ # Gets the resource's file name.
18
+ def file_name
19
+ @source_path.basename.to_s
20
+ end
21
+
22
+ # Gets the resource type, based on the file's extension
23
+ def resource_type
24
+ @source_path.extname.to_s[1..-1]
25
+ end
26
+
27
+ # Gets the site instance
28
+ def site
29
+ ::Massimo::Site()
30
+ end
31
+
32
+ protected
33
+
34
+ # Reads the source page file, and populates the meta_data and
35
+ # body attributes.
36
+ def read_source!
37
+ raise ::Massimo::MissingResource unless @source_path.exist?
38
+ # try to read it now
39
+ begin
40
+ @line = 1
41
+ @body = @source_path.read
42
+ rescue
43
+ raise ::Massimo::InvalidResource
44
+ end
45
+ end
46
+
47
+ # Get the options from the Site's config for the current resource type.
48
+ def options_for_resource_type
49
+ self.site.options[self.resource_type.to_sym]
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,186 @@
1
+ module Massimo
2
+ class Site
3
+ include Singleton
4
+
5
+ # Default options. Overriden by values given when creating a Site.
6
+ DEFAULT_OPTIONS = {
7
+ :source => ".",
8
+ :output => ::File.join(".", "public"),
9
+ :server_port => "1984"
10
+ }.freeze
11
+
12
+ SOURCE_DIRS = [ :pages, :views, :stylesheets, :javascripts, :helpers, :lib ].freeze # :nodoc:
13
+
14
+ attr_accessor :options, :helpers
15
+
16
+ # Setup the Site with the given options. These options may be overridden by the config file.
17
+ def setup(options = {})
18
+ @options = DEFAULT_OPTIONS.dup.merge(options.symbolize_keys)
19
+ self
20
+ end
21
+
22
+ # Processes all the Pages, Stylesheets, and Javascripts and outputs
23
+ # them to the output dir.
24
+ def process!
25
+ reload_helpers
26
+ reload_libs
27
+ pages(true).each(&:process!)
28
+ stylesheets(true).each(&:process!)
29
+ javascripts(true).each(&:process!)
30
+ end
31
+
32
+ # Get all the Pages in the pages dir.
33
+ def pages(reload = false)
34
+ return @pages if defined?(@pages) && !reload
35
+ page_paths = self.find_files_in(:pages)
36
+ @pages = page_paths.collect { |path| ::Massimo::Page.new(path) }
37
+ end
38
+
39
+ # Get all the Stylesheets in the stylesheets dir.
40
+ def stylesheets(reload = false)
41
+ return @stylesheets if defined?(@stylesheets) && !reload
42
+ stylesheet_paths = self.find_files_in(:stylesheets, [ :css, :sass, :less ])
43
+ @stylesheets = stylesheet_paths.collect { |path| ::Massimo::Stylesheet.new(path) }
44
+ end
45
+
46
+ # Get all the Javascripts in the javascripts dir.
47
+ def javascripts(reload = false)
48
+ return @javascripts if defined?(@javascripts) && !reload
49
+ javascript_paths = self.find_files_in(:javascripts, [ :js ])
50
+ @javascripts = javascript_paths.collect { |path| ::Massimo::Javascript.new(path) }
51
+ end
52
+
53
+ # Finds a view by the given name
54
+ def find_view(name, meta_data = {})
55
+ view_path = Dir.glob(self.views_dir("#{name}.*")).first
56
+ view_path && ::Massimo::View.new(view_path, meta_data)
57
+ end
58
+
59
+ # Finds a view then renders it with the given locals
60
+ def render_view(name, locals = {}, &block)
61
+ view = self.find_view(name)
62
+ view && view.render(locals, &block)
63
+ end
64
+
65
+ # Determines if the Site is in development mode.
66
+ def development?
67
+ @options[:environment].nil? || @options[:environment].to_sym == :development || @options[:development]
68
+ end
69
+
70
+ # Determines if the Site is in production mode.
71
+ def production?
72
+ (@options[:environment] && @options[:environment].to_sym == :production) || @options[:production]
73
+ end
74
+
75
+ #------------------------------------
76
+ # Directory Path Methods
77
+ #------------------------------------
78
+
79
+ # The path to the source dir
80
+ def source_dir(*path)
81
+ ::File.join(@options[:source], *path)
82
+ end
83
+
84
+ # Get all the source directories as an array.
85
+ def all_source_dirs
86
+ SOURCE_DIRS.collect { |d| dir_for(d) }
87
+ end
88
+
89
+ SOURCE_DIRS.each do |d|
90
+ define_method("#{d}_dir") do |*path|
91
+ dir_for(d, *path)
92
+ end
93
+ end
94
+
95
+ # The path to the output dir
96
+ def output_dir(*path)
97
+ ::File.join(@options[:output], *path)
98
+ end
99
+
100
+ protected
101
+
102
+ # Get the directory to the given resource type (pages, views, etc.).
103
+ # If the path has been manually set in the options, you will get that
104
+ # path. Otherwise you will get the path relative to the source directory.
105
+ def dir_for(type, *path)
106
+ if type_path = @options["#{type}_path".to_sym]
107
+ ::File.join(type_path, *path)
108
+ else
109
+ self.source_dir(type.to_s, *path)
110
+ end
111
+ end
112
+
113
+ # Find all the files in the given resouce type's directory, optionally
114
+ # selecting only those with the given extensions. This will return
115
+ # an array with the full path to the files.
116
+ def find_files_in(type, extensions = nil)
117
+ # the directory where these files will be found
118
+ type_dir = self.dir_for(type)
119
+
120
+ # By default get the file list from the options
121
+ files = @options[type] && @options[type].dup
122
+
123
+ unless files && files.is_a?(::Array)
124
+ # If files aren't listed in the options, get them
125
+ # from the given block
126
+ glob = (extensions.nil? || extensions.empty?) ? "*" : "*.{#{extensions.join(",")}}"
127
+ files = ::Dir.glob(::File.join(type_dir, "**", glob))
128
+
129
+ # normalize the files by removing the directory from the path
130
+ files.collect! { |file| file.gsub("#{type_dir}/", "") }
131
+
132
+ # reject the files in the skip_files option, which can
133
+ # either be an array or a Proc.
134
+ if skip_files = @options["skip_#{type}".to_sym]
135
+ files.reject! do |file|
136
+ case skip_files
137
+ when ::Array
138
+ skip_files.include?(file)
139
+ else ::Proc
140
+ skip_files.call(file)
141
+ end
142
+ end
143
+ end
144
+ end
145
+
146
+ # Reject all files that begin with _ (like partials) and directories
147
+ files.reject! { |file| ::File.basename(file) =~ /^_/ }
148
+
149
+ # now add the directory back to the path
150
+ files.collect! { |file| ::File.join(type_dir, file) }
151
+
152
+ # And make sure we don't find directories
153
+ files.reject! { |file| ::File.directory?(file) }
154
+ files
155
+ end
156
+
157
+ # Reload the Helpers instance with the helper modules
158
+ def reload_helpers
159
+ @helpers = ::Massimo::Helpers.new(self.helper_modules.compact)
160
+ end
161
+
162
+ # Reload all the files in the source lib dir.
163
+ def reload_libs
164
+ reload_files ::Dir.glob(lib_dir("**", "*.rb"))
165
+ end
166
+
167
+ # Find all the helper modules
168
+ def helper_modules
169
+ reload_files ::Dir.glob(helpers_dir("*.rb"))
170
+ end
171
+
172
+ # Relod the given file by removing their constants and loading the file again.
173
+ # Return an Array of the reloaded Constants.
174
+ def reload_files(files)
175
+ files.collect do |file|
176
+ class_name = ::File.basename(file).gsub(::File.extname(file), "").classify
177
+ # Unload the constant if it already exists
178
+ ::Object.class_eval { remove_const(class_name) if const_defined?(class_name) }
179
+ # Load the constant
180
+ load(file)
181
+ # return the constant
182
+ class_name.constantize rescue nil
183
+ end
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,46 @@
1
+ module Massimo
2
+ class Stylesheet < Resource
3
+ # Render the css based on the type of resource
4
+ def render
5
+ case resource_type.to_sym
6
+ when :css
7
+ @body.to_s
8
+ when :sass
9
+ require "sass" unless defined? ::Sass
10
+ ::Sass::Files.tree_for(@source_path, sass_options).render
11
+ when :less
12
+ require "less" unless defined? ::Less
13
+ ::Less.parse(@body)
14
+ end
15
+ end
16
+
17
+ # Writes the rendered css to the output file.
18
+ def process!
19
+ # Make the full path to the directory of the output file
20
+ ::FileUtils.mkdir_p(self.output_path.dirname)
21
+ # write the filtered data to the output file
22
+ self.output_path.open("w") do |file|
23
+ file.write self.render
24
+ end
25
+ end
26
+
27
+ protected
28
+
29
+ # Determine the output file path
30
+ def output_path
31
+ @output_path ||= ::Pathname.new(@source_path.to_s.
32
+ sub(self.site.source_dir, self.site.output_dir). # move to output dir
33
+ sub(/#{@source_path.extname}$/, ".css")) # replace extension with .css
34
+ end
35
+
36
+ # Gets the Sass options, with Site options merged in.
37
+ def sass_options
38
+ options = {
39
+ :style => site.production? ? :compressed : :nested
40
+ }
41
+ options.merge!(self.site.options[:sass]) if self.site.options[:sass].is_a?(Hash)
42
+ options.merge(:css_filename => self.output_path)
43
+ end
44
+
45
+ end
46
+ end
@@ -0,0 +1,20 @@
1
+ module Tilt
2
+ register :html, ::Tilt::ERBTemplate
3
+ register :php, ::Tilt::ERBTemplate
4
+
5
+ # My Markdown implementation.
6
+ class MarkdownTemplate < Template
7
+ def compile!
8
+ @erb_engine = ::Tilt::ERBTemplate.new { data }
9
+ end
10
+
11
+ def evaluate(scope, locals, &block)
12
+ # First evaluate the code using ERB
13
+ erb_output = @erb_engine.render(scope, locals, &block)
14
+ # Then evaluate the code using the RDiscountTemplate
15
+ ::Tilt::RDiscountTemplate.new { erb_output }.render
16
+ end
17
+ end
18
+ register :markdown, MarkdownTemplate
19
+ register :md, MarkdownTemplate
20
+ end
@@ -0,0 +1,30 @@
1
+ module Massimo
2
+ class View < Resource
3
+ attr_reader :meta_data
4
+
5
+ # Creates a new page associated with the given file path.
6
+ def initialize(source_path, meta_data = {})
7
+ @meta_data = meta_data
8
+ super(source_path)
9
+ end
10
+
11
+ # Renders the page using the registered filters.
12
+ def render(locals = {}, &block)
13
+ template = ::Tilt.new(self.file_name, @line || 1, self.options_for_resource_type) { @body }
14
+ template.render(self.site.helpers, @meta_data.merge(locals), &block)
15
+ end
16
+
17
+ protected
18
+
19
+ # All undefined methods are sent to the meta_data hash.
20
+ def method_missing(method, *args, &block)
21
+ if method.to_s.match(/(.*)\=$/) && args.length == 1
22
+ @meta_data[$1.to_sym] = args.first
23
+ elsif args.empty? && @meta_data.key?(method)
24
+ @meta_data[method]
25
+ else
26
+ super
27
+ end
28
+ end
29
+ end
30
+ end
data/lib/massimo.rb ADDED
@@ -0,0 +1,38 @@
1
+ libdir = ::File.dirname(__FILE__)
2
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
3
+
4
+ # Rubygems
5
+ require "rubygems"
6
+
7
+ # External
8
+ require "pathname"
9
+ require "fileutils"
10
+ require "singleton"
11
+ require "active_support"
12
+ require "sinatra_more"
13
+ require "sprockets"
14
+ require "jsmin"
15
+ require "tilt"
16
+
17
+ # Internal
18
+ require "massimo/helpers"
19
+ require "massimo/templates"
20
+ require "massimo/site"
21
+ require "massimo/resource"
22
+ require "massimo/view"
23
+ require "massimo/page"
24
+ require "massimo/stylesheet"
25
+ require "massimo/javascript"
26
+
27
+ module Massimo
28
+ VERSION = ::File.read(::File.join(::File.dirname(__FILE__), *%w{.. VERSION})) # :nodoc:
29
+
30
+ MissingResource = ::Class.new(StandardError) # :nodoc:
31
+ InvalidResource = ::Class.new(StandardError) # :nodoc:
32
+
33
+ #
34
+ def self.Site(options = {})
35
+ return @site if defined?(@site) && options.empty?
36
+ @site = ::Massimo::Site.instance.setup(options)
37
+ end
38
+ end
data/massimo.gemspec ADDED
@@ -0,0 +1,130 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{massimo}
8
+ s.version = "0.3.9"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Peter Browne"]
12
+ s.date = %q{2009-12-24}
13
+ s.default_executable = %q{massimo}
14
+ s.description = %q{Massimo builds HTML, Javascript, and CSS Files from your source.}
15
+ s.email = %q{peter@peterbrowne.net}
16
+ s.executables = ["massimo"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ ".gitignore",
24
+ "LICENSE",
25
+ "README.md",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/massimo",
29
+ "lib/massimo.rb",
30
+ "lib/massimo/command.rb",
31
+ "lib/massimo/helpers.rb",
32
+ "lib/massimo/javascript.rb",
33
+ "lib/massimo/page.rb",
34
+ "lib/massimo/resource.rb",
35
+ "lib/massimo/site.rb",
36
+ "lib/massimo/stylesheet.rb",
37
+ "lib/massimo/templates.rb",
38
+ "lib/massimo/view.rb",
39
+ "massimo.gemspec",
40
+ "test/assertions.rb",
41
+ "test/helper.rb",
42
+ "test/source/config.yml",
43
+ "test/source/helpers/test_helper.rb",
44
+ "test/source/javascripts/_plugin.js",
45
+ "test/source/javascripts/application.js",
46
+ "test/source/javascripts/lib.js",
47
+ "test/source/lib/site.rb",
48
+ "test/source/pages/_skipped_page.haml",
49
+ "test/source/pages/about_us.erb",
50
+ "test/source/pages/erb.erb",
51
+ "test/source/pages/erb_with_layout.erb",
52
+ "test/source/pages/feed.haml",
53
+ "test/source/pages/haml.haml",
54
+ "test/source/pages/html.html",
55
+ "test/source/pages/index.erb",
56
+ "test/source/pages/markdown.markdown",
57
+ "test/source/pages/posts/first-post.haml",
58
+ "test/source/pages/with_extension.haml",
59
+ "test/source/pages/with_meta_data.haml",
60
+ "test/source/pages/with_title.haml",
61
+ "test/source/pages/with_url.haml",
62
+ "test/source/pages/without_extension.haml",
63
+ "test/source/pages/without_meta_data.haml",
64
+ "test/source/pages/without_title.haml",
65
+ "test/source/pages/without_url.haml",
66
+ "test/source/stylesheets/_base.sass",
67
+ "test/source/stylesheets/application.sass",
68
+ "test/source/stylesheets/basic.css",
69
+ "test/source/stylesheets/less_file.less",
70
+ "test/source/views/layouts/application.haml",
71
+ "test/source/views/with_helper.haml",
72
+ "test/source/views/with_locals.haml",
73
+ "test/source/views/without_locals.haml",
74
+ "test/test_javascript.rb",
75
+ "test/test_page.rb",
76
+ "test/test_resource.rb",
77
+ "test/test_site.rb",
78
+ "test/test_stylesheet.rb",
79
+ "test/test_view.rb"
80
+ ]
81
+ s.homepage = %q{http://github.com/peterbrowne/massimo}
82
+ s.rdoc_options = ["--charset=UTF-8"]
83
+ s.require_paths = ["lib"]
84
+ s.rubygems_version = %q{1.3.5}
85
+ s.summary = %q{Massimo is a static website builder.}
86
+ s.test_files = [
87
+ "test/assertions.rb",
88
+ "test/helper.rb",
89
+ "test/source/helpers/test_helper.rb",
90
+ "test/source/lib/site.rb",
91
+ "test/test_javascript.rb",
92
+ "test/test_page.rb",
93
+ "test/test_resource.rb",
94
+ "test/test_site.rb",
95
+ "test/test_stylesheet.rb",
96
+ "test/test_view.rb"
97
+ ]
98
+
99
+ if s.respond_to? :specification_version then
100
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
101
+ s.specification_version = 3
102
+
103
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
104
+ s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
105
+ s.add_development_dependency(%q<yard>, [">= 0.5.2"])
106
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
107
+ s.add_runtime_dependency(%q<sinatra_more>, [">= 0.3.26"])
108
+ s.add_runtime_dependency(%q<directory_watcher>, [">= 1.3.1"])
109
+ s.add_runtime_dependency(%q<sprockets>, [">= 1.0.2"])
110
+ s.add_runtime_dependency(%q<jsmin>, [">= 1.0.1"])
111
+ else
112
+ s.add_dependency(%q<shoulda>, [">= 2.10.2"])
113
+ s.add_dependency(%q<yard>, [">= 0.5.2"])
114
+ s.add_dependency(%q<activesupport>, [">= 2.3.5"])
115
+ s.add_dependency(%q<sinatra_more>, [">= 0.3.26"])
116
+ s.add_dependency(%q<directory_watcher>, [">= 1.3.1"])
117
+ s.add_dependency(%q<sprockets>, [">= 1.0.2"])
118
+ s.add_dependency(%q<jsmin>, [">= 1.0.1"])
119
+ end
120
+ else
121
+ s.add_dependency(%q<shoulda>, [">= 2.10.2"])
122
+ s.add_dependency(%q<yard>, [">= 0.5.2"])
123
+ s.add_dependency(%q<activesupport>, [">= 2.3.5"])
124
+ s.add_dependency(%q<sinatra_more>, [">= 0.3.26"])
125
+ s.add_dependency(%q<directory_watcher>, [">= 1.3.1"])
126
+ s.add_dependency(%q<sprockets>, [">= 1.0.2"])
127
+ s.add_dependency(%q<jsmin>, [">= 1.0.1"])
128
+ end
129
+ end
130
+
@@ -0,0 +1,8 @@
1
+ module Assertions
2
+
3
+ # Assert that the two Arrays contain the same Strings or Symbols
4
+ def assert_equal_arrays(expected_array, actual_array)
5
+ assert_equal expected_array.map(&:to_s).sort, actual_array.map(&:to_s).sort
6
+ end
7
+
8
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,54 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+
3
+ require "rubygems"
4
+ require "test/unit"
5
+ require "shoulda"
6
+ # begin require "redgreen"; rescue LoadError; end
7
+ begin require "turn"; rescue LoadError; end
8
+ require "assertions"
9
+ require "rr"
10
+
11
+ # Load Massimo
12
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
13
+ require "massimo"
14
+
15
+ class Test::Unit::TestCase
16
+ include Assertions
17
+ include RR::Adapters::TestUnit
18
+
19
+ #
20
+ def source_dir(*subdirs)
21
+ File.join(File.dirname(__FILE__), "source", *subdirs)
22
+ end
23
+
24
+ #
25
+ def output_dir(*subdirs)
26
+ File.join(File.dirname(__FILE__), "output", *subdirs)
27
+ end
28
+
29
+ #
30
+ def clear_output
31
+ FileUtils.rm_rf(output_dir)
32
+ end
33
+
34
+ #
35
+ def site(options = {})
36
+ @site = Massimo::Site({
37
+ :source => source_dir,
38
+ :output => output_dir,
39
+ :sass => { :cache => false }
40
+ }.merge(options))
41
+ end
42
+
43
+ #
44
+ def page(*path)
45
+ @page ||= Massimo::Page.new(source_dir("pages", *path))
46
+ end
47
+
48
+ #
49
+ def view(*path)
50
+ return @view if defined?(@view)
51
+ meta_data = path.extract_options!
52
+ @view = Massimo::View.new(source_dir("views", *path), meta_data)
53
+ end
54
+ end
@@ -0,0 +1,4 @@
1
+ ---
2
+ :config: "working"
3
+ :sass:
4
+ :cache: false
@@ -0,0 +1,5 @@
1
+ module TestHelper
2
+ def test_method
3
+ "working"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ var plugin = "plugin";
@@ -0,0 +1,3 @@
1
+ //= require "_plugin"
2
+
3
+ var application = "application";
@@ -0,0 +1 @@
1
+ var lib = "lib";
@@ -0,0 +1,5 @@
1
+ class Massimo::Site
2
+ def new_method
3
+ "working"
4
+ end
5
+ end
File without changes
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: About
3
+ layout: false
4
+ ---
5
+ <h1>An <%= "HTML" %> Page</h1>
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: ERB
3
+ layout: false
4
+ ---
5
+ <h1><%= title %></h1>
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: ERB With Layout
3
+ ---
4
+ <h1><%= title %></h1>
@@ -0,0 +1,6 @@
1
+ ---
2
+ extension: .rss
3
+ layout: false
4
+ ---
5
+ %rss
6
+ %title RSS Feed
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: Haml
3
+ layout: false
4
+ ---
5
+ %h1= title
@@ -0,0 +1,4 @@
1
+ ---
2
+ layout: false
3
+ ---
4
+ <h1>HTML</h1>
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Home
3
+ ---
4
+ <h1><%= title %></h1>
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: Markdown
3
+ layout: false
4
+ ---
5
+ # <%= title %>
@@ -0,0 +1 @@
1
+ %h1 First Post
@@ -0,0 +1,4 @@
1
+ ---
2
+ extension: .rss
3
+ ---
4
+ %h1 A Page with filter extension.
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: A Page with a title
3
+ tags:
4
+ - tag_1
5
+ - tag_2
6
+ ---
7
+ %h1 A Page with a title
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: A Title
3
+ ---
4
+ %h1 A Page with a title