massimo 0.4.3 → 0.4.4
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.
- data/Gemfile +2 -2
- data/VERSION +1 -1
- data/lib/massimo/command.rb +2 -2
- data/lib/massimo/helpers.rb +2 -0
- data/lib/massimo/javascript.rb +4 -0
- data/lib/massimo/page.rb +5 -0
- data/lib/massimo/resource/base.rb +4 -2
- data/lib/massimo/resource/processing.rb +3 -0
- data/lib/massimo/site.rb +9 -1
- data/lib/massimo/stylesheet.rb +3 -0
- data/lib/massimo/templates.rb +2 -0
- data/lib/massimo/view.rb +12 -3
- data/lib/massimo.rb +3 -15
- data/massimo.gemspec +2 -2
- data/test/helper.rb +17 -13
- data/test/test_view.rb +2 -2
- metadata +3 -3
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
source "http://
|
2
|
-
source "http://gems.github.com"
|
1
|
+
source "http://rubygems.org"
|
3
2
|
|
4
3
|
gem "activesupport", ">= 3.0.0.beta"
|
4
|
+
gem "warden", ">= 0.10.1" # needed for sinatra_more
|
5
5
|
gem "sinatra_more", ">= 0.3.39"
|
6
6
|
gem "directory_watcher", ">= 1.3.1"
|
7
7
|
gem "sprockets", ">= 1.0.2"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
data/lib/massimo/command.rb
CHANGED
data/lib/massimo/helpers.rb
CHANGED
data/lib/massimo/javascript.rb
CHANGED
data/lib/massimo/page.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
require "active_support/inflector"
|
2
|
+
require "pathname"
|
1
3
|
require "massimo/resource/processing"
|
2
4
|
require "massimo/resource/collection"
|
3
5
|
|
4
6
|
module Massimo
|
5
7
|
module Resource
|
6
8
|
class Base
|
7
|
-
include
|
8
|
-
extend
|
9
|
+
include Processing
|
10
|
+
extend Collection
|
9
11
|
|
10
12
|
attr_reader :source_path, :body
|
11
13
|
|
data/lib/massimo/site.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
require "active_support/inflector"
|
2
|
+
require "active_support/core_ext/hash/keys"
|
3
|
+
require "singleton"
|
4
|
+
# require "massimo/helpers"
|
5
|
+
# require "massimo/view"
|
6
|
+
|
1
7
|
module Massimo
|
2
8
|
class Site
|
3
9
|
include Singleton
|
@@ -116,8 +122,10 @@ module Massimo
|
|
116
122
|
# Reload the given files and an Array of the reloaded Constants.
|
117
123
|
def reload_files(files)
|
118
124
|
files.collect do |file|
|
125
|
+
class_name = File.basename(file).gsub(File.extname(file), "").classify
|
126
|
+
Object.class_eval { remove_const(class_name) if const_defined?(class_name) }
|
119
127
|
load(file)
|
120
|
-
|
128
|
+
class_name.constantize rescue nil
|
121
129
|
end
|
122
130
|
end
|
123
131
|
end
|
data/lib/massimo/stylesheet.rb
CHANGED
data/lib/massimo/templates.rb
CHANGED
data/lib/massimo/view.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require "tilt"
|
2
|
+
require "massimo/resource/base"
|
3
|
+
|
1
4
|
module Massimo
|
2
5
|
class View < Massimo::Resource::Base
|
3
6
|
attr_reader :meta_data
|
@@ -18,9 +21,15 @@ module Massimo
|
|
18
21
|
|
19
22
|
# All undefined methods are sent to the `@meta_data` hash.
|
20
23
|
def method_missing(method, *args, &block)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
case args.length
|
25
|
+
when 1
|
26
|
+
method_name = method.to_s
|
27
|
+
if method_name.chomp!('=')
|
28
|
+
@meta_data[method_name.to_sym] = args.first
|
29
|
+
else
|
30
|
+
super
|
31
|
+
end
|
32
|
+
when 0
|
24
33
|
@meta_data[method]
|
25
34
|
else
|
26
35
|
super
|
data/lib/massimo.rb
CHANGED
@@ -1,18 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
libdir = File.dirname(__FILE__)
|
2
|
+
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
3
3
|
|
4
|
-
# External
|
5
|
-
require "pathname"
|
6
|
-
require "fileutils"
|
7
|
-
require "singleton"
|
8
|
-
require "active_support/inflector"
|
9
|
-
require "active_support/core_ext/hash/keys"
|
10
|
-
require "sinatra_more"
|
11
|
-
require "sprockets"
|
12
|
-
require "jsmin"
|
13
|
-
require "tilt"
|
14
|
-
|
15
|
-
# Internal
|
16
4
|
require "massimo/helpers"
|
17
5
|
require "massimo/templates"
|
18
6
|
require "massimo/site"
|
@@ -28,7 +16,7 @@ module Massimo
|
|
28
16
|
# instance.
|
29
17
|
def self.Site(options = {})
|
30
18
|
return @site if defined?(@site) && options.empty?
|
31
|
-
@site =
|
19
|
+
@site = Site.instance.setup(options)
|
32
20
|
end
|
33
21
|
|
34
22
|
# All the avaiable Resource types
|
data/massimo.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{massimo}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Peter Browne"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-30}
|
13
13
|
s.default_executable = %q{massimo}
|
14
14
|
s.description = %q{Massimo builds HTML, Javascript, and CSS Files from your source.}
|
15
15
|
s.email = %q{me@petebrowne.com}
|
data/test/helper.rb
CHANGED
@@ -1,36 +1,40 @@
|
|
1
|
-
|
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)
|
2
6
|
|
3
7
|
require "rubygems"
|
8
|
+
require "massimo"
|
4
9
|
require "test/unit"
|
5
|
-
require "shoulda"
|
6
|
-
# begin require "redgreen"; rescue LoadError; end
|
7
|
-
begin require "turn"; rescue LoadError; end
|
8
10
|
require "assertions"
|
11
|
+
require "shoulda"
|
9
12
|
require "rr"
|
10
13
|
|
11
|
-
|
12
|
-
require
|
14
|
+
begin
|
15
|
+
require "turn"
|
16
|
+
rescue LoadError
|
17
|
+
begin require "redgreen"; rescue LoadError; end
|
18
|
+
end
|
13
19
|
|
14
20
|
class Test::Unit::TestCase
|
15
21
|
include Assertions
|
16
22
|
include RR::Adapters::TestUnit
|
17
23
|
|
18
|
-
#
|
19
24
|
def source_dir(*subdirs)
|
20
25
|
File.join("./test/source", *subdirs)
|
21
26
|
end
|
22
27
|
|
23
|
-
#
|
24
28
|
def output_dir(*subdirs)
|
25
29
|
File.join("./test/output", *subdirs)
|
26
30
|
end
|
27
31
|
|
28
|
-
#
|
32
|
+
# Clears all the output files created during tests.
|
29
33
|
def clear_output
|
30
34
|
FileUtils.rm_rf(output_dir)
|
31
35
|
end
|
32
36
|
|
33
|
-
#
|
37
|
+
# Create a new Site instance
|
34
38
|
def site(options = {})
|
35
39
|
@site = ::Massimo::Site({
|
36
40
|
:source => source_dir,
|
@@ -39,19 +43,19 @@ class Test::Unit::TestCase
|
|
39
43
|
}.merge(options))
|
40
44
|
end
|
41
45
|
|
42
|
-
#
|
46
|
+
# Creates a Page instance for the given path
|
43
47
|
def page(*path)
|
44
48
|
@page ||= ::Massimo::Page.new(source_dir("pages", *path))
|
45
49
|
end
|
46
50
|
|
47
|
-
#
|
51
|
+
# Creates a View Instance for the given path
|
48
52
|
def view(*path)
|
49
53
|
return @view if defined?(@view)
|
50
54
|
meta_data = path.extract_options!
|
51
55
|
@view = ::Massimo::View.new(source_dir("views", *path), meta_data)
|
52
56
|
end
|
53
57
|
|
54
|
-
#
|
58
|
+
# All the Page paths in the source dir
|
55
59
|
def source_page_paths
|
56
60
|
@source_page_paths ||= Pathname.glob(source_dir("pages/**/*")).
|
57
61
|
reject { |p| p.basename.to_s =~ /^_/ || File.directory?(p) }.
|
data/test/test_view.rb
CHANGED
@@ -43,8 +43,8 @@ class TestView < Test::Unit::TestCase
|
|
43
43
|
assert_equal "test", @view.new_data
|
44
44
|
end
|
45
45
|
|
46
|
-
should "still
|
47
|
-
|
46
|
+
should "still return nil when accessing non-existent meta_data properties" do
|
47
|
+
assert_nil @view.non_existent_prop
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 4
|
9
|
+
version: 0.4.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Peter Browne
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-30 00:00:00 -05:00
|
18
18
|
default_executable: massimo
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|