massimo 0.4.6 → 0.5.0

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 (66) hide show
  1. data/VERSION +1 -1
  2. data/bin/massimo +5 -3
  3. data/lib/massimo/cli.rb +101 -0
  4. data/lib/massimo/config.rb +56 -0
  5. data/lib/massimo/helpers.rb +12 -19
  6. data/lib/massimo/javascript.rb +18 -19
  7. data/lib/massimo/page.rb +63 -70
  8. data/lib/massimo/resource.rb +92 -0
  9. data/lib/massimo/server.rb +27 -0
  10. data/lib/massimo/site.rb +64 -101
  11. data/lib/massimo/stylesheet.rb +13 -35
  12. data/lib/massimo/view.rb +5 -32
  13. data/lib/massimo/watcher.rb +52 -0
  14. data/lib/massimo.rb +22 -31
  15. metadata +172 -117
  16. data/.document +0 -5
  17. data/.gitignore +0 -25
  18. data/Gemfile +0 -13
  19. data/Rakefile +0 -62
  20. data/lib/massimo/command.rb +0 -243
  21. data/lib/massimo/resource/base.rb +0 -74
  22. data/lib/massimo/resource/collection.rb +0 -56
  23. data/lib/massimo/resource/processing.rb +0 -67
  24. data/lib/massimo/templates.rb +0 -22
  25. data/massimo.gemspec +0 -135
  26. data/test/assertions.rb +0 -8
  27. data/test/helper.rb +0 -64
  28. data/test/source/config.yml +0 -4
  29. data/test/source/helpers/test_helper.rb +0 -5
  30. data/test/source/javascripts/_plugin.js +0 -1
  31. data/test/source/javascripts/application.js +0 -3
  32. data/test/source/javascripts/lib.js +0 -1
  33. data/test/source/lib/site.rb +0 -5
  34. data/test/source/pages/_skipped_page.haml +0 -0
  35. data/test/source/pages/about_us.erb +0 -5
  36. data/test/source/pages/erb.erb +0 -5
  37. data/test/source/pages/erb_with_layout.erb +0 -4
  38. data/test/source/pages/feed.haml +0 -6
  39. data/test/source/pages/haml.haml +0 -5
  40. data/test/source/pages/html.html +0 -4
  41. data/test/source/pages/index.erb +0 -4
  42. data/test/source/pages/markdown.markdown +0 -5
  43. data/test/source/pages/posts/first-post.haml +0 -1
  44. data/test/source/pages/with_extension.haml +0 -4
  45. data/test/source/pages/with_meta_data.haml +0 -7
  46. data/test/source/pages/with_title.haml +0 -4
  47. data/test/source/pages/with_url.haml +0 -4
  48. data/test/source/pages/without_extension.haml +0 -0
  49. data/test/source/pages/without_meta_data.haml +0 -1
  50. data/test/source/pages/without_title.haml +0 -1
  51. data/test/source/pages/without_url.haml +0 -1
  52. data/test/source/stylesheets/_base.sass +0 -2
  53. data/test/source/stylesheets/application.sass +0 -4
  54. data/test/source/stylesheets/basic.css +0 -3
  55. data/test/source/stylesheets/less_file.less +0 -5
  56. data/test/source/views/layouts/application.haml +0 -2
  57. data/test/source/views/with_helper.haml +0 -1
  58. data/test/source/views/with_locals.haml +0 -1
  59. data/test/source/views/without_locals.haml +0 -1
  60. data/test/test_helpers.rb +0 -25
  61. data/test/test_javascript.rb +0 -30
  62. data/test/test_page.rb +0 -142
  63. data/test/test_resource.rb +0 -70
  64. data/test/test_site.rb +0 -125
  65. data/test/test_stylesheet.rb +0 -40
  66. data/test/test_view.rb +0 -50
@@ -1,243 +0,0 @@
1
- require "active_support/backtrace_cleaner"
2
- require "active_support/core_ext/hash/keys"
3
- begin require "growl"; rescue LoadError; end
4
- require "optparse"
5
- require "yaml"
6
-
7
- module Massimo
8
- class Command
9
- attr_accessor :args, :options, :site, :source, :output
10
-
11
- # Default options. Overriden by values in config.yml or command-line opts.
12
- DEFAULT_OPTIONS = {
13
- :config_path => File.join(".", "config.yml")
14
- }.freeze
15
-
16
- #
17
- def initialize(args)
18
- # Parse the command line arguments
19
- self.args = args
20
- self.options = DEFAULT_OPTIONS.dup
21
- self.parse!
22
-
23
- # Load the options from the config file
24
- config = YAML.load_file(self.options[:config_path]) if File.exist?(self.options[:config_path])
25
- self.options.merge!(config.symbolize_keys) if config.is_a?(Hash)
26
-
27
- # Initialize the Site
28
- self.site = Massimo::Site(self.options)
29
- self.options = self.site.options
30
- self.source = self.options[:source]
31
- self.output = self.options[:output]
32
-
33
- # Setup Backtrace Cleaner
34
- @cleaner = ActiveSupport::BacktraceCleaner.new
35
- @cleaner.add_silencer { |line| line =~ /^(\/|\\)/ } # Remove full File path traces
36
- end
37
-
38
- # Run the script, based on the command line options.
39
- def run!
40
- if generate?
41
- generate_layout!
42
- elsif watch?
43
- watch_source!
44
- else
45
- process_site!
46
- end
47
- run_server! if server?
48
- return 0
49
- rescue Interrupt
50
- message "Massimo is done watching you.", :newline => true
51
- return 0
52
- rescue Exception => e
53
- report_error(e)
54
- return 1
55
- end
56
-
57
- protected
58
-
59
- # Generate the default layout of the site.
60
- def generate_layout!
61
- require "fileutils"
62
- message "Massimo is generating the default site layout"
63
- [ site.source_dir, site.all_source_dirs, site.output_dir ].flatten.each do |dir|
64
- full_dir = File.expand_path(dir)
65
- if File.exists?(full_dir)
66
- puts indent_body("exists: #{full_dir}")
67
- else
68
- FileUtils.mkdir_p(full_dir)
69
- puts indent_body("created: #{full_dir}")
70
- end
71
- end
72
- end
73
-
74
- # Watch the source for changes.
75
- def watch_source!
76
- require "directory_watcher"
77
-
78
- message %{Massimo is watching "#{source}" for changes. Press Ctrl-C to Stop.}
79
-
80
- watcher = DirectoryWatcher.new(
81
- ".",
82
- :interval => 1,
83
- :glob => site.all_source_dirs.collect { |dir| File.join(dir, "**/*") }
84
- )
85
-
86
- watcher.add_observer do |*args|
87
- begin
88
- site.process!
89
- time = Time.now.strftime("%l:%M:%S").strip
90
- change = args.size == 1 ? "1 file" : "#{args.size} files"
91
- message "Massimo has rebuilt your site. #{change} changed. (#{time})"
92
- rescue Exception => e
93
- report_error(e)
94
- end
95
- end
96
-
97
- watcher.start
98
-
99
- unless server?
100
- loop { sleep 1000 }
101
- end
102
- end
103
-
104
- # Process the site.
105
- def process_site!
106
- site.process!
107
- message %{Massimo has built your site in "#{site.options[:output]}"}
108
- end
109
-
110
- #
111
- def run_server!
112
- require "webrick"
113
-
114
- # Make sure the output dir exists
115
- FileUtils.mkdir_p(output)
116
-
117
- server = WEBrick::HTTPServer.new(
118
- :Port => options[:server_port],
119
- :DocumentRoot => output
120
- )
121
-
122
- trap(:INT) do
123
- server.shutdown
124
- message "Massimo is shutting down the server.", :newline => true
125
- return 0
126
- end
127
-
128
- server.start
129
- message "Massimo is serving up your site at http://localhost:#{options[:server_port]}/"
130
- end
131
-
132
- # Determine if we should watch the source directory for changes.
133
- def watch?
134
- options[:watch] == true
135
- end
136
-
137
- # Determine if we should generate the default layout of the site.
138
- def generate?
139
- options[:generate] == true
140
- end
141
-
142
- # Determine if the server should be started.
143
- def server?
144
- options[:server] == true
145
- end
146
-
147
- #
148
- def message(string, options = {})
149
- options.reverse_merge!(:growl => true)
150
- puts "\n" if options[:newline]
151
- puts "== #{string}"
152
- Growl.notify(string, :title => "Massimo") if options[:growl] && defined?(Growl)
153
- end
154
-
155
- # Report the given error. This could eventually log the backtrace.
156
- def report_error(error = nil)
157
- error ||= $!
158
-
159
- # Show full backtrace if verbose
160
- backtrace = if options[:verbose]
161
- error.backtrace
162
- else
163
- @cleaner.clean(error.backtrace)
164
- end
165
-
166
- # show the message
167
- message "Massimo Error:", :newline => true, :growl => false
168
- puts indent_body(error.message)
169
- puts indent_body(backtrace)
170
- puts "\n"
171
-
172
- # Format the message differently for growl
173
- Growl.notify(error.message, :title => "Massimo Error") if defined?(Growl)
174
- end
175
-
176
- # Returns the string with each line indented.
177
- def indent_body(string)
178
- string.collect { |line| " #{line}" }
179
- end
180
-
181
- # Parse the options
182
- def parse!
183
- opts = OptionParser.new do |opts|
184
- opts.banner = <<-HELP
185
- Massimo is a static website builder.
186
-
187
- Basic Command Line Usage:
188
- massimo # . -> ./public
189
- massimo <path to output> # . -> <path>
190
- massimo <path to source> <path to output> # <path> -> <path>
191
-
192
- Configuration is read from "./config.yml" but can be overriden
193
- using the following options:
194
-
195
- HELP
196
-
197
- opts.on("--config [PATH]", "The path to the config file.") do |path|
198
- options[:config_path] = path
199
- end
200
-
201
- opts.on("--generate", "Generate the default layout of the site. This will create all the necessary directories needed to generate websites using Massimo.") do
202
- options[:generate] = true
203
- end
204
-
205
- opts.on("--watch", "Auto-regenerate the site as files are changed.") do
206
- options[:watch] = true
207
- end
208
-
209
- opts.on("--server", "Start web server with default port.") do |port|
210
- options[:server] = true
211
- end
212
-
213
- opts.on("--port [PORT]", "Select the port to start the web server on. Defaults to 1984") do |port|
214
- options[:server_port] = port
215
- end
216
-
217
- opts.on("--verbose", "-v", "Show full backtrace on errors. Defaults to false.") do
218
- options[:verbose] = true
219
- end
220
-
221
- opts.on("--version", "-V", "Display current version") do
222
- puts "Massimo #{Massimo::VERSION}"
223
- exit 0
224
- end
225
- end
226
- opts.parse!
227
-
228
- # Get source and destintation from command line
229
- case args.size
230
- when 0
231
- when 1
232
- options[:source] = args[0]
233
- when 2
234
- options[:source] = args[0]
235
- options[:output] = args[1]
236
- else
237
- puts %{Invalid options. Run "massimo --help" for assistance.}
238
- exit 1
239
- end
240
- end
241
-
242
- end
243
- end
@@ -1,74 +0,0 @@
1
- require "active_support/inflector"
2
- require "pathname"
3
- require "massimo/resource/processing"
4
- require "massimo/resource/collection"
5
-
6
- module Massimo
7
- module Resource
8
- class Base
9
- include Processing
10
- extend Collection
11
-
12
- attr_reader :source_path, :body
13
-
14
- # The name of this Resource type.
15
- def self.name
16
- self.to_s.underscore.gsub(/.*\//, "")
17
- end
18
-
19
- # The plural name of this Resource type.
20
- def self.collection_name
21
- name.pluralize
22
- end
23
-
24
- # Gets the site instance
25
- def self.site
26
- Massimo::Site()
27
- end
28
-
29
- # Get the directory to this Resource type.
30
- def self.dir(*path)
31
- site.dir_for(self.collection_name, *path)
32
- end
33
-
34
- # Hook for adding Resource types.
35
- def self.inherited(subclass)
36
- Massimo.resources << subclass
37
- Massimo.resources.uniq!
38
- end
39
-
40
- # Creates a new page associated with the given file path.
41
- def initialize(source_path)
42
- @source_path = Pathname.new(source_path)
43
- read_source!
44
- end
45
-
46
- # Gets the resource's file name.
47
- def file_name
48
- @source_path.basename.to_s
49
- end
50
-
51
- # Gets the resource type, based on the file's extension
52
- def resource_type
53
- @source_path.extname.to_s[1..-1]
54
- end
55
-
56
- # Gets the site instance
57
- def site
58
- self.class.site
59
- end
60
-
61
- # Renders the page using the registered filters.
62
- def render(locals = {})
63
- @body
64
- end
65
-
66
- protected
67
-
68
- # Get the options from the Site's config for the current resource type.
69
- def options_for_resource_type
70
- site.options[resource_type.to_sym]
71
- end
72
- end
73
- end
74
- end
@@ -1,56 +0,0 @@
1
- module Massimo
2
- module Resource
3
- module Collection
4
- # Find all the the Resources in this Resource type's directory.
5
- def all(reload = false)
6
- return @resources if defined?(@resources) && !reload
7
- @resources = find_resource_files.collect { |file| self.new(file) }
8
- end
9
-
10
- protected
11
-
12
- # Returns only the files listed in the options or all the files in this
13
- # Resource type's directory, with certain files filtered out.
14
- def find_resource_files
15
- files = site.options[collection_name.to_sym]
16
- if files && files.is_a?(Array)
17
- files = files.dup
18
- add_full_path!(files)
19
- else
20
- files = Dir.glob(File.join(dir, "**/*"))
21
- reject_partials_and_directories!(files)
22
- reject_skipped_files!(files)
23
- end
24
- files
25
- end
26
-
27
- # Reject all files that begin with "_" (like partials) and directories
28
- def reject_partials_and_directories!(files)
29
- files.reject! { |file| File.basename(file) =~ /^_/ || File.directory?(file) }
30
- end
31
-
32
- # Reject the files in the skip_files option, which can either be an Array of files to skip
33
- # or a Proc that returns true if the file should be skipped.
34
- def reject_skipped_files!(files)
35
- if skip_files = site.options["skip_#{collection_name}".to_sym]
36
- files.reject! do |file|
37
- test_file = file.sub("#{dir}/", "")
38
- case skip_files
39
- when Array
40
- skip_files.include?(test_file)
41
- when Proc
42
- skip_files.call(test_file)
43
- else
44
- false
45
- end
46
- end
47
- end
48
- end
49
-
50
- # Add the full path to each file.
51
- def add_full_path!(files)
52
- files.collect! { |file| dir(file) }
53
- end
54
- end
55
- end
56
- end
@@ -1,67 +0,0 @@
1
- require "fileutils"
2
- require "pathname"
3
-
4
- module Massimo
5
- module Resource
6
- module Processing
7
- def self.included(base) # :nodoc:
8
- base.extend ClassMethods
9
- end
10
-
11
- module ClassMethods
12
- # Determine if this Resource type is processable. By default this is `false`.
13
- def processable?
14
- false
15
- end
16
-
17
- # This will override `processable?` to return `true`.
18
- def processable!
19
- def self.processable?
20
- true
21
- end
22
- end
23
-
24
- # Process all the Resources in this Resource type's directory.
25
- def process!
26
- all(true).each(&:process!)
27
- end
28
- end
29
-
30
- # Writes the rendered body to the output file.
31
- def process!
32
- if self.class.processable?
33
- # Make the full path to the directory of the output file
34
- FileUtils.mkdir_p(output_path.dirname)
35
- # write the filtered data to the output file
36
- output_path.open("w") do |file|
37
- file.write render
38
- end
39
- else
40
- false
41
- end
42
- end
43
-
44
- protected
45
-
46
- # Reads the source page file, and populates the `@meta_data` and
47
- # `@body` attributes.
48
- def read_source!
49
- raise Massimo::MissingResource unless @source_path.exist?
50
- # try to read it now
51
- begin
52
- @line = 1
53
- @body = @source_path.read
54
- rescue
55
- raise Massimo::InvalidResource
56
- end
57
- end
58
-
59
- # Determine the output file path
60
- def output_path
61
- @output_path ||= Pathname.new(
62
- @source_path.to_s.sub(site.source_dir, site.output_dir)
63
- )
64
- end
65
- end
66
- end
67
- end
@@ -1,22 +0,0 @@
1
- require "tilt"
2
-
3
- module Tilt
4
- register :html, Tilt::ERBTemplate
5
- register :php, Tilt::ERBTemplate
6
-
7
- # My Markdown implementation.
8
- class MarkdownTemplate < Template
9
- def prepare
10
- @erb_engine = Tilt::ERBTemplate.new { data }
11
- end
12
-
13
- def evaluate(scope, locals, &block)
14
- # First evaluate the code using ERB
15
- erb_output = @erb_engine.render(scope, locals, &block)
16
- # Then evaluate the code using the RDiscountTemplate
17
- Tilt::RDiscountTemplate.new { erb_output }.render
18
- end
19
- end
20
- register :markdown, MarkdownTemplate
21
- register :md, MarkdownTemplate
22
- end
data/massimo.gemspec DELETED
@@ -1,135 +0,0 @@
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.4.6"
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{2010-03-31}
13
- s.default_executable = %q{massimo}
14
- s.description = %q{Massimo builds HTML, Javascript, and CSS Files from your source.}
15
- s.email = %q{me@petebrowne.com}
16
- s.executables = ["massimo"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.md"
20
- ]
21
- s.files = [
22
- ".document",
23
- ".gitignore",
24
- "Gemfile",
25
- "LICENSE",
26
- "README.md",
27
- "Rakefile",
28
- "VERSION",
29
- "bin/massimo",
30
- "lib/massimo.rb",
31
- "lib/massimo/command.rb",
32
- "lib/massimo/helpers.rb",
33
- "lib/massimo/javascript.rb",
34
- "lib/massimo/page.rb",
35
- "lib/massimo/resource/base.rb",
36
- "lib/massimo/resource/collection.rb",
37
- "lib/massimo/resource/processing.rb",
38
- "lib/massimo/site.rb",
39
- "lib/massimo/stylesheet.rb",
40
- "lib/massimo/templates.rb",
41
- "lib/massimo/view.rb",
42
- "massimo.gemspec",
43
- "test/assertions.rb",
44
- "test/helper.rb",
45
- "test/source/config.yml",
46
- "test/source/helpers/test_helper.rb",
47
- "test/source/javascripts/_plugin.js",
48
- "test/source/javascripts/application.js",
49
- "test/source/javascripts/lib.js",
50
- "test/source/lib/site.rb",
51
- "test/source/pages/_skipped_page.haml",
52
- "test/source/pages/about_us.erb",
53
- "test/source/pages/erb.erb",
54
- "test/source/pages/erb_with_layout.erb",
55
- "test/source/pages/feed.haml",
56
- "test/source/pages/haml.haml",
57
- "test/source/pages/html.html",
58
- "test/source/pages/index.erb",
59
- "test/source/pages/markdown.markdown",
60
- "test/source/pages/posts/first-post.haml",
61
- "test/source/pages/with_extension.haml",
62
- "test/source/pages/with_meta_data.haml",
63
- "test/source/pages/with_title.haml",
64
- "test/source/pages/with_url.haml",
65
- "test/source/pages/without_extension.haml",
66
- "test/source/pages/without_meta_data.haml",
67
- "test/source/pages/without_title.haml",
68
- "test/source/pages/without_url.haml",
69
- "test/source/stylesheets/_base.sass",
70
- "test/source/stylesheets/application.sass",
71
- "test/source/stylesheets/basic.css",
72
- "test/source/stylesheets/less_file.less",
73
- "test/source/views/layouts/application.haml",
74
- "test/source/views/with_helper.haml",
75
- "test/source/views/with_locals.haml",
76
- "test/source/views/without_locals.haml",
77
- "test/test_helpers.rb",
78
- "test/test_javascript.rb",
79
- "test/test_page.rb",
80
- "test/test_resource.rb",
81
- "test/test_site.rb",
82
- "test/test_stylesheet.rb",
83
- "test/test_view.rb"
84
- ]
85
- s.homepage = %q{http://github.com/peterbrowne/massimo}
86
- s.rdoc_options = ["--charset=UTF-8"]
87
- s.require_paths = ["lib"]
88
- s.rubygems_version = %q{1.3.6}
89
- s.summary = %q{Massimo is a static website builder.}
90
- s.test_files = [
91
- "test/assertions.rb",
92
- "test/helper.rb",
93
- "test/source/helpers/test_helper.rb",
94
- "test/source/lib/site.rb",
95
- "test/test_helpers.rb",
96
- "test/test_javascript.rb",
97
- "test/test_page.rb",
98
- "test/test_resource.rb",
99
- "test/test_site.rb",
100
- "test/test_stylesheet.rb",
101
- "test/test_view.rb"
102
- ]
103
-
104
- if s.respond_to? :specification_version then
105
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
106
- s.specification_version = 3
107
-
108
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
109
- s.add_development_dependency(%q<shoulda>, [">= 2.10.3"])
110
- s.add_development_dependency(%q<rr>, [">= 0.10.9"])
111
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.beta"])
112
- s.add_runtime_dependency(%q<sinatra_more>, [">= 0.3.39"])
113
- s.add_runtime_dependency(%q<directory_watcher>, [">= 1.3.1"])
114
- s.add_runtime_dependency(%q<sprockets>, [">= 1.0.2"])
115
- s.add_runtime_dependency(%q<jsmin>, [">= 1.0.1"])
116
- else
117
- s.add_dependency(%q<shoulda>, [">= 2.10.3"])
118
- s.add_dependency(%q<rr>, [">= 0.10.9"])
119
- s.add_dependency(%q<activesupport>, [">= 3.0.0.beta"])
120
- s.add_dependency(%q<sinatra_more>, [">= 0.3.39"])
121
- s.add_dependency(%q<directory_watcher>, [">= 1.3.1"])
122
- s.add_dependency(%q<sprockets>, [">= 1.0.2"])
123
- s.add_dependency(%q<jsmin>, [">= 1.0.1"])
124
- end
125
- else
126
- s.add_dependency(%q<shoulda>, [">= 2.10.3"])
127
- s.add_dependency(%q<rr>, [">= 0.10.9"])
128
- s.add_dependency(%q<activesupport>, [">= 3.0.0.beta"])
129
- s.add_dependency(%q<sinatra_more>, [">= 0.3.39"])
130
- s.add_dependency(%q<directory_watcher>, [">= 1.3.1"])
131
- s.add_dependency(%q<sprockets>, [">= 1.0.2"])
132
- s.add_dependency(%q<jsmin>, [">= 1.0.1"])
133
- end
134
- end
135
-
data/test/assertions.rb DELETED
@@ -1,8 +0,0 @@
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 DELETED
@@ -1,64 +0,0 @@
1
- testdir = File.dirname(__FILE__)
2
- $LOAD_PATH.unshift(testdir) unless $LOAD_PATH.include?(testdir)
3
-
4
- libdir = File.expand_path("../../lib", __FILE__)
5
- $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
6
-
7
- require "rubygems"
8
- require "massimo"
9
- require "test/unit"
10
- require "assertions"
11
- require "shoulda"
12
- require "rr"
13
-
14
- begin
15
- require "turn"
16
- rescue LoadError
17
- begin require "redgreen"; rescue LoadError; end
18
- end
19
-
20
- class Test::Unit::TestCase
21
- include Assertions
22
- include RR::Adapters::TestUnit
23
-
24
- def source_dir(*subdirs)
25
- File.join("./test/source", *subdirs)
26
- end
27
-
28
- def output_dir(*subdirs)
29
- File.join("./test/output", *subdirs)
30
- end
31
-
32
- # Clears all the output files created during tests.
33
- def clear_output
34
- FileUtils.rm_rf(output_dir)
35
- end
36
-
37
- # Create a new Site instance
38
- def site(options = {})
39
- @site = ::Massimo::Site({
40
- :source => source_dir,
41
- :output => output_dir,
42
- :sass => { :cache => false }
43
- }.merge(options))
44
- end
45
-
46
- # Creates a Page instance for the given path
47
- def page(*path)
48
- @page ||= ::Massimo::Page.new(source_dir("pages", *path))
49
- end
50
-
51
- # Creates a View Instance for the given path
52
- def view(*path)
53
- return @view if defined?(@view)
54
- meta_data = path.extract_options!
55
- @view = ::Massimo::View.new(source_dir("views", *path), meta_data)
56
- end
57
-
58
- # All the Page paths in the source dir
59
- def source_page_paths
60
- @source_page_paths ||= Pathname.glob(source_dir("pages/**/*")).
61
- reject { |p| p.basename.to_s =~ /^_/ || File.directory?(p) }.
62
- collect { |p| p.basename }
63
- end
64
- end
@@ -1,4 +0,0 @@
1
- ---
2
- :config: "working"
3
- :sass:
4
- :cache: false
@@ -1,5 +0,0 @@
1
- module TestHelper
2
- def test_method
3
- "working"
4
- end
5
- end
@@ -1 +0,0 @@
1
- var plugin = "plugin";
@@ -1,3 +0,0 @@
1
- //= require "_plugin"
2
-
3
- var application = "application";
@@ -1 +0,0 @@
1
- var lib = "lib";