darthapo-stratus 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +41 -0
- data/Manifest +15 -36
- data/Readme.markdown +4 -0
- data/examples/dev-blog/config/defaults/{article.html → article.default.html} +0 -0
- data/{test/fixtures/site → examples/dev-blog}/config/defaults/page.default.html +0 -0
- data/examples/dev-blog/config/defaults/{page.html → post.default.html} +0 -0
- data/examples/dev-blog/themes/default/styles/main.css +1 -1
- data/examples/dev-blog/themes/default/templates/posts/content.html +4 -5
- data/lib/stratus.rb +1 -0
- data/lib/stratus/filters.rb +35 -1
- data/lib/stratus/generator/builder.rb +32 -8
- data/lib/stratus/generator/context.rb +28 -25
- data/lib/stratus/generator/renderer.rb +5 -2
- data/lib/stratus/logging.rb +28 -2
- data/lib/stratus/resources.rb +4 -2
- data/lib/stratus/resources/base.rb +15 -5
- data/lib/stratus/resources/content.rb +3 -1
- data/lib/stratus/tasks/app/boilerplate/config/content.yaml +19 -0
- data/lib/stratus/tasks/app/boilerplate/config/site.yaml +5 -11
- data/lib/stratus/tasks/app/boilerplate/content/pages/home/index.html +12 -16
- data/lib/stratus/tasks/app/boilerplate/content/posts/001_welcome/index.html +37 -0
- data/lib/stratus/tasks/app/boilerplate/content/posts/002_getting-started/index.html +37 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/images/footer-bg.png +0 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/images/page-bg.png +0 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/scripts/site.js +1 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/styles/main.css +99 -2
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/layouts/main.html +18 -11
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/{objects/page.html → pages/content.html} +9 -1
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/pages/feed.xml +25 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/{objects/page.index.html → pages/list.html} +1 -1
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/content.html +19 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/feed.xml +25 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/list.html +14 -0
- data/lib/stratus/tasks/site/site.rake +5 -0
- data/lib/stratus/version.rb +1 -1
- data/stratus.gemspec +3 -3
- metadata +17 -38
- data/examples/dev-blog/config/defaults/content.html +0 -7
- data/examples/dev-blog/config/defaults/post.html +0 -10
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/objects/post.html +0 -22
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/objects/post.index.html +0 -10
- data/test/fixtures/site/StratusSite +0 -26
- data/test/fixtures/site/config/defaults/article.default.html +0 -7
- data/test/fixtures/site/config/defaults/content.default.html +0 -7
- data/test/fixtures/site/config/defaults/post.default.html +0 -10
- data/test/fixtures/site/config/site.yaml +0 -36
- data/test/fixtures/site/content/articles/001_im-the-title/index.html +0 -10
- data/test/fixtures/site/content/pages/about/index.html +0 -7
- data/test/fixtures/site/content/pages/home/index.html +0 -37
- data/test/fixtures/site/content/pages/projects/index.html +0 -6
- data/test/fixtures/site/content/posts/001_new-blog/dom.js +0 -123
- data/test/fixtures/site/content/posts/001_new-blog/index.html +0 -24
- data/test/fixtures/site/content/posts/001_new-blog/old.html +0 -18
- data/test/fixtures/site/content/posts/002_fun-for-the-whole-family/index.html +0 -12
- data/test/fixtures/site/content/posts/002_fun-for-the-whole-family/snippet_one.rb +0 -5
- data/test/fixtures/site/content/posts/003_life-is-quite-fun-really/index.html +0 -12
- data/test/fixtures/site/themes/default/scripts/code_highlighter.js +0 -188
- data/test/fixtures/site/themes/default/scripts/code_syntax.js +0 -92
- data/test/fixtures/site/themes/default/styles/code_syntax.css +0 -68
- data/test/fixtures/site/themes/default/styles/main.css +0 -66
- data/test/fixtures/site/themes/default/templates/layouts/main.html +0 -36
- data/test/fixtures/site/themes/default/templates/objects/article.html +0 -7
- data/test/fixtures/site/themes/default/templates/objects/article.index.html +0 -8
- data/test/fixtures/site/themes/default/templates/objects/feed.xml +0 -25
- data/test/fixtures/site/themes/default/templates/objects/page.html +0 -7
- data/test/fixtures/site/themes/default/templates/objects/page.index.html +0 -10
- data/test/fixtures/site/themes/default/templates/objects/post.html +0 -22
- data/test/fixtures/site/themes/default/templates/objects/post.index.html +0 -10
data/Changelog
CHANGED
@@ -1,3 +1,44 @@
|
|
1
|
+
2008-12-23 15:43:50 -0600
|
2
|
+
Added 'site:tree' task to print entire collection tree to console.
|
3
|
+
|
4
|
+
2008-12-22 02:05:38 -0600
|
5
|
+
Updated boilerplate site, updated number_of_words filter
|
6
|
+
|
7
|
+
2008-12-21 02:30:26 -0600
|
8
|
+
Udpated example dev-blog and added support Growl, if you have ruby-growl installed.
|
9
|
+
|
10
|
+
2008-12-20 18:38:48 -0600
|
11
|
+
Updated boilerplate, next/prev now honors your sorting settings, memoized LiquidContext's site_data.
|
12
|
+
|
13
|
+
2008-12-20 16:29:37 -0600
|
14
|
+
New: ignoring post dated content, validation failure messsages. Bugfixes: copy_file exceptions.
|
15
|
+
* Copying a file that doesn't exist will no longer throw an exception.
|
16
|
+
* Added support for validation failure messages
|
17
|
+
* Added validation for Content resources to be skipped if they are post dated
|
18
|
+
|
19
|
+
2008-12-20 05:31:31 -0600
|
20
|
+
Nearing core feature completion...
|
21
|
+
* All collection types are rendered now, not just pages and posts
|
22
|
+
* Feed are generated for collection types
|
23
|
+
* Moved content configuration into config/content.yaml
|
24
|
+
* Added simple logging
|
25
|
+
* Added configuration options for creating relative links, forcing XHTML support and more
|
26
|
+
* Added sourcecode Liquid filter and tag.
|
27
|
+
- Tag: It will take all the contents within the tag and create pre/code wrapper around it.
|
28
|
+
- Filter: If an attachment is passed, it will load it and insert it's contents within a pre/code wrapper.
|
29
|
+
|
30
|
+
2008-12-19 03:33:02 -0600
|
31
|
+
Returned markdown support to Maruku
|
32
|
+
|
33
|
+
2008-12-19 03:31:29 -0600
|
34
|
+
Performance updates
|
35
|
+
* All paths are absolute uris (no more path_to_root during Liquid rendering)
|
36
|
+
* Relative paths are generated after the page generation using Hpricot
|
37
|
+
* Memoized liquid hash generation
|
38
|
+
|
39
|
+
2008-12-18 21:41:51 -0600
|
40
|
+
Updated changelog
|
41
|
+
|
1
42
|
2008-12-18 21:40:18 -0600
|
2
43
|
Updated manifest and gemspec
|
3
44
|
|
data/Manifest
CHANGED
@@ -5,10 +5,9 @@ Readme.markdown
|
|
5
5
|
bin/stratus
|
6
6
|
examples/dev-blog/StratusSite
|
7
7
|
examples/dev-blog/config/content.yaml
|
8
|
-
examples/dev-blog/config/defaults/article.html
|
9
|
-
examples/dev-blog/config/defaults/
|
10
|
-
examples/dev-blog/config/defaults/
|
11
|
-
examples/dev-blog/config/defaults/post.html
|
8
|
+
examples/dev-blog/config/defaults/article.default.html
|
9
|
+
examples/dev-blog/config/defaults/page.default.html
|
10
|
+
examples/dev-blog/config/defaults/post.default.html
|
12
11
|
examples/dev-blog/config/site.yaml
|
13
12
|
examples/dev-blog/content/articles/animating-nsviews-in-rubycocoa/awake_from_nib.rb
|
14
13
|
examples/dev-blog/content/articles/animating-nsviews-in-rubycocoa/ib_action.rb
|
@@ -65,16 +64,24 @@ lib/stratus/tags/markdown.rb
|
|
65
64
|
lib/stratus/tags/sourcecode.rb
|
66
65
|
lib/stratus/tags/textile.rb
|
67
66
|
lib/stratus/tasks/app/boilerplate/StratusSite
|
67
|
+
lib/stratus/tasks/app/boilerplate/config/content.yaml
|
68
68
|
lib/stratus/tasks/app/boilerplate/config/defaults/page.default.html
|
69
69
|
lib/stratus/tasks/app/boilerplate/config/defaults/post.default.html
|
70
70
|
lib/stratus/tasks/app/boilerplate/config/site.yaml
|
71
71
|
lib/stratus/tasks/app/boilerplate/content/pages/home/index.html
|
72
|
+
lib/stratus/tasks/app/boilerplate/content/posts/001_welcome/index.html
|
73
|
+
lib/stratus/tasks/app/boilerplate/content/posts/002_getting-started/index.html
|
74
|
+
lib/stratus/tasks/app/boilerplate/themes/default/images/footer-bg.png
|
75
|
+
lib/stratus/tasks/app/boilerplate/themes/default/images/page-bg.png
|
76
|
+
lib/stratus/tasks/app/boilerplate/themes/default/scripts/site.js
|
72
77
|
lib/stratus/tasks/app/boilerplate/themes/default/styles/main.css
|
73
78
|
lib/stratus/tasks/app/boilerplate/themes/default/templates/layouts/main.html
|
74
|
-
lib/stratus/tasks/app/boilerplate/themes/default/templates/
|
75
|
-
lib/stratus/tasks/app/boilerplate/themes/default/templates/
|
76
|
-
lib/stratus/tasks/app/boilerplate/themes/default/templates/
|
77
|
-
lib/stratus/tasks/app/boilerplate/themes/default/templates/
|
79
|
+
lib/stratus/tasks/app/boilerplate/themes/default/templates/pages/content.html
|
80
|
+
lib/stratus/tasks/app/boilerplate/themes/default/templates/pages/feed.xml
|
81
|
+
lib/stratus/tasks/app/boilerplate/themes/default/templates/pages/list.html
|
82
|
+
lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/content.html
|
83
|
+
lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/feed.xml
|
84
|
+
lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/list.html
|
78
85
|
lib/stratus/tasks/app/site.rake
|
79
86
|
lib/stratus/tasks/shared/system.rake
|
80
87
|
lib/stratus/tasks/site/new.rake
|
@@ -82,32 +89,4 @@ lib/stratus/tasks/site/site.rake
|
|
82
89
|
lib/stratus/tasks/site/theme.rake
|
83
90
|
lib/stratus/version.rb
|
84
91
|
stratus.gemspec
|
85
|
-
test/fixtures/site/StratusSite
|
86
|
-
test/fixtures/site/config/defaults/article.default.html
|
87
|
-
test/fixtures/site/config/defaults/content.default.html
|
88
|
-
test/fixtures/site/config/defaults/page.default.html
|
89
|
-
test/fixtures/site/config/defaults/post.default.html
|
90
|
-
test/fixtures/site/config/site.yaml
|
91
|
-
test/fixtures/site/content/articles/001_im-the-title/index.html
|
92
|
-
test/fixtures/site/content/pages/about/index.html
|
93
|
-
test/fixtures/site/content/pages/home/index.html
|
94
|
-
test/fixtures/site/content/pages/projects/index.html
|
95
|
-
test/fixtures/site/content/posts/001_new-blog/dom.js
|
96
|
-
test/fixtures/site/content/posts/001_new-blog/index.html
|
97
|
-
test/fixtures/site/content/posts/001_new-blog/old.html
|
98
|
-
test/fixtures/site/content/posts/002_fun-for-the-whole-family/index.html
|
99
|
-
test/fixtures/site/content/posts/002_fun-for-the-whole-family/snippet_one.rb
|
100
|
-
test/fixtures/site/content/posts/003_life-is-quite-fun-really/index.html
|
101
|
-
test/fixtures/site/themes/default/scripts/code_highlighter.js
|
102
|
-
test/fixtures/site/themes/default/scripts/code_syntax.js
|
103
|
-
test/fixtures/site/themes/default/styles/code_syntax.css
|
104
|
-
test/fixtures/site/themes/default/styles/main.css
|
105
|
-
test/fixtures/site/themes/default/templates/layouts/main.html
|
106
|
-
test/fixtures/site/themes/default/templates/objects/article.html
|
107
|
-
test/fixtures/site/themes/default/templates/objects/article.index.html
|
108
|
-
test/fixtures/site/themes/default/templates/objects/feed.xml
|
109
|
-
test/fixtures/site/themes/default/templates/objects/page.html
|
110
|
-
test/fixtures/site/themes/default/templates/objects/page.index.html
|
111
|
-
test/fixtures/site/themes/default/templates/objects/post.html
|
112
|
-
test/fixtures/site/themes/default/templates/objects/post.index.html
|
113
92
|
test/test_helper.rb
|
data/Readme.markdown
CHANGED
@@ -12,3 +12,7 @@ And yes, I know, I'm on a weird cloud kick.
|
|
12
12
|
* Publishing (S/FTP)
|
13
13
|
* Tagging support (limited)
|
14
14
|
* Category support (limited)
|
15
|
+
|
16
|
+
# Ideas
|
17
|
+
|
18
|
+
* `vimeo` tag that embeds a thumbnail image with a link to the vimeo page (metadata: http://vimeo.com/api/clip/963462.xml)
|
File without changes
|
File without changes
|
File without changes
|
@@ -8,12 +8,11 @@
|
|
8
8
|
Published on {{ this.publish_date | short_date }}. {{ this.body | number_of_words }} words.
|
9
9
|
</p>
|
10
10
|
<p class="pager">
|
11
|
-
{% if this.prev %}
|
12
|
-
<a href="{{ this.prev | uri_rel }}">« {{ this.prev.title }}</a>
|
13
|
-
{% endif %}
|
14
|
-
<a href="{{ page.home | uri_rel }}">Home</a>
|
15
11
|
{% if this.next %}
|
16
|
-
<a href="{{ this.next | uri_rel }}"
|
12
|
+
<a class="older" href="{{ this.next | uri_rel }}">« {{ this.next.title }}</a>
|
13
|
+
{% endif %}
|
14
|
+
{% if this.prev %}
|
15
|
+
<a class="newer" href="{{ this.prev | uri_rel }}">{{ this.prev.title }} »</a>
|
17
16
|
{% endif %}
|
18
17
|
</p>
|
19
18
|
</div>
|
data/lib/stratus.rb
CHANGED
data/lib/stratus/filters.rb
CHANGED
@@ -19,9 +19,43 @@ module Stratus
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def number_of_words(input)
|
22
|
-
input
|
22
|
+
s = strip_html(CGI::unescapeHTML(input))
|
23
|
+
s.gsub!(/[\w|\']+/, 'X')
|
24
|
+
s.gsub!(/\W+/, '')
|
25
|
+
s.length
|
23
26
|
end
|
24
27
|
|
28
|
+
# Moved to base resource...
|
29
|
+
# def last(content)
|
30
|
+
# return nil unless content.is_a? Hash and content.has_key?('collection_type')
|
31
|
+
# collection = Stratus::Generator::LiquidContext.site_data[content['collection_type']]
|
32
|
+
# collection.last
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# def prev(content)
|
36
|
+
# return nil unless content.is_a? Hash and content.has_key?('collection_type')
|
37
|
+
# collection = Stratus::Generator::LiquidContext.site_data[content['collection_type']]
|
38
|
+
# collection.each_with_index do |c,i|
|
39
|
+
# return collection[(i - 1)] if c.slug == content['slug']
|
40
|
+
# end
|
41
|
+
# nil
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# def next(content)
|
45
|
+
# return nil unless content.is_a? Hash and content.has_key?('collection_type')
|
46
|
+
# collection = Stratus::Generator::LiquidContext.site_data[content['collection_type']]
|
47
|
+
# collection.each_with_index do |c,i|
|
48
|
+
# return collection[(i + 1)] if c.slug == content['slug']
|
49
|
+
# end
|
50
|
+
# nil
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# def first(content)
|
54
|
+
# return nil unless content.is_a? Hash and content.has_key?('collection_type')
|
55
|
+
# collection = Stratus::Generator::LiquidContext.site_data[content['collection_type']]
|
56
|
+
# collection.first
|
57
|
+
# end
|
58
|
+
|
25
59
|
EXTS = {
|
26
60
|
'.rb' => 'ruby',
|
27
61
|
'.css' => 'css',
|
@@ -9,10 +9,21 @@ class Builder
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def execute
|
12
|
+
sweep_content
|
13
|
+
render_content
|
14
|
+
copy_theme_files
|
15
|
+
|
16
|
+
info "Done.", "\n"
|
17
|
+
growl "Build complete."
|
18
|
+
end
|
19
|
+
|
20
|
+
def sweep_content
|
12
21
|
info "Scanning source structure..."
|
13
22
|
scanner = Stratus::Generator::Scanner.new(@root_path)
|
14
23
|
scanner.sweep
|
15
|
-
|
24
|
+
end
|
25
|
+
|
26
|
+
def render_content
|
16
27
|
info "Rendering output..."
|
17
28
|
make_dir Stratus.output_dir
|
18
29
|
Stratus::Resources.collection_types.each do |col_type|
|
@@ -42,10 +53,6 @@ class Builder
|
|
42
53
|
else
|
43
54
|
error "NO HOME PAGE DEFINED! UPDATE YOUR CONFIG FILE!!!"
|
44
55
|
end
|
45
|
-
|
46
|
-
copy_theme_files
|
47
|
-
|
48
|
-
info "Done.", "\n"
|
49
56
|
end
|
50
57
|
|
51
58
|
def copy_theme_files
|
@@ -80,12 +87,17 @@ protected
|
|
80
87
|
end
|
81
88
|
|
82
89
|
def copy_file(path, to)
|
83
|
-
|
84
|
-
|
85
|
-
|
90
|
+
unless File.exists?(path)
|
91
|
+
info(" ? #{ to }", '.')
|
92
|
+
else
|
93
|
+
make_dir( File.dirname( to ) )
|
94
|
+
FileUtils.cp_r path, to
|
95
|
+
info(" - #{ to }", '.')
|
96
|
+
end
|
86
97
|
end
|
87
98
|
|
88
99
|
def delete_file(path, force=false)
|
100
|
+
return unless File.exists?(path)
|
89
101
|
if force
|
90
102
|
FileUtils.rm_rf( path )
|
91
103
|
else
|
@@ -102,6 +114,18 @@ class << self
|
|
102
114
|
Builder.new(root_path).execute
|
103
115
|
end
|
104
116
|
|
117
|
+
def page_tree(root_path)
|
118
|
+
builder = Builder.new(root_path)
|
119
|
+
builder.sweep_content
|
120
|
+
|
121
|
+
Stratus::Resources.collection_types.sort.each do |col_type|
|
122
|
+
puts "#{ col_type }/"
|
123
|
+
Stratus::Resources.content(:collection_type=>col_type, :sort_by=>:slug).each do |r|
|
124
|
+
puts " #{ r.slug }"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
105
129
|
end
|
106
130
|
|
107
131
|
end
|
@@ -7,39 +7,42 @@ class LiquidContext < Hash
|
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
super
|
10
|
-
site_data
|
11
|
-
'site' => Stratus.settings['site'],
|
12
|
-
'vars' => Stratus.settings.fetch('vars', {})
|
13
|
-
}
|
14
|
-
Stratus::Resources.collection_types.each do |col_type|
|
15
|
-
sort_col = Stratus.content_setting(col_type, 'sort', 'index').to_sym
|
16
|
-
reversed = Stratus.content_setting(col_type, 'reverse', false)
|
17
|
-
collection_data = Stratus::Resources.content(:collection_type=>col_type, :sort_by=>sort_col, :reverse=>reversed)
|
18
|
-
# puts "#{col_type}: #{collection_data.length} items... (sorted by #{sort_col}#{reversed ? ', reversed': ''})"
|
19
|
-
site_data[col_type] = collection_data
|
20
|
-
site_data[col_type.singularize] = hashify(collection_data)
|
21
|
-
end
|
22
|
-
self.merge!(site_data)
|
10
|
+
self.merge!(self.class.site_data)
|
23
11
|
self
|
24
12
|
end
|
25
13
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
14
|
+
class << self
|
15
|
+
def path_to_root
|
16
|
+
@path_to_root ||= ''
|
17
|
+
end
|
18
|
+
def path_to_root=(path)
|
19
|
+
@path_to_root = path
|
20
|
+
end
|
21
|
+
|
22
|
+
def site_data
|
23
|
+
@site_data ||= returning({}) do |data|
|
24
|
+
data['site'] = Stratus.settings['site']
|
25
|
+
data['vars'] =Stratus.settings.fetch('vars', {})
|
26
|
+
Stratus::Resources.collection_types.each do |col_type|
|
27
|
+
sort_col = Stratus.content_setting(col_type, 'sort', 'index').to_sym
|
28
|
+
reversed = Stratus.content_setting(col_type, 'reverse', false)
|
29
|
+
collection_data = Stratus::Resources.content(:collection_type=>col_type, :sort_by=>sort_col, :reverse=>reversed)
|
30
|
+
data[col_type] = collection_data
|
31
|
+
data[col_type.singularize] = hashify(collection_data)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
32
35
|
|
33
|
-
protected
|
36
|
+
protected
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
def hashify(list)
|
39
|
+
returning({}) do |h|
|
40
|
+
list.each do |item|
|
41
|
+
h[item.slug] = item
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
42
|
-
|
43
46
|
end
|
44
47
|
|
45
48
|
end
|
@@ -54,9 +54,12 @@ protected
|
|
54
54
|
|
55
55
|
# Allows all context changes to be scoped
|
56
56
|
def in_context(&block)
|
57
|
-
old_context = @context.clone
|
57
|
+
#old_context = @context.clone
|
58
58
|
results = yield
|
59
|
-
|
59
|
+
# Make sure stuff doesn't bleed over...
|
60
|
+
@context['this'] = nil
|
61
|
+
@context['content'] = nil
|
62
|
+
#@context = old_context
|
60
63
|
results
|
61
64
|
end
|
62
65
|
|
data/lib/stratus/logging.rb
CHANGED
@@ -12,14 +12,40 @@ module Logging
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def error
|
15
|
+
def error(msg)
|
16
|
+
puts msg
|
17
|
+
end
|
18
|
+
|
19
|
+
def notify(type='', title='', msg='')
|
16
20
|
puts msg
|
17
21
|
end
|
18
22
|
|
19
|
-
def fatal
|
23
|
+
def fatal(msg)
|
20
24
|
puts msg
|
21
25
|
end
|
22
26
|
|
27
|
+
def growl(message, title="Stratus Notification", type="stratus-notify")
|
28
|
+
growler.notify type, title, message
|
29
|
+
#notify(notify_type, title, message, priority = 0, sticky = false)
|
30
|
+
end
|
31
|
+
|
32
|
+
def growler
|
33
|
+
@growler ||= begin
|
34
|
+
if defined?(Growl)
|
35
|
+
Growl.new( "localhost", "stratus", ["stratus-notify"])
|
36
|
+
else
|
37
|
+
self
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
23
42
|
end
|
24
43
|
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
begin
|
48
|
+
require 'ruby-growl'
|
49
|
+
rescue LoadError
|
50
|
+
# If you had ruby-growl, stratus would use it.
|
25
51
|
end
|
data/lib/stratus/resources.rb
CHANGED
@@ -8,11 +8,13 @@ module Stratus::Resources
|
|
8
8
|
|
9
9
|
def register_content(content)
|
10
10
|
content.fixup_meta
|
11
|
-
|
11
|
+
validates, msg = content.validate!
|
12
|
+
if validates
|
12
13
|
collection_types << content.collection_type unless collection_types.include?( content.collection_type ) or content.content_type != :content
|
13
14
|
all << content
|
14
15
|
else
|
15
|
-
|
16
|
+
msg ||= "Failed validation..."
|
17
|
+
puts " * Skipping '#{content.content_path}': #{msg}"
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
@@ -107,12 +107,18 @@ class Base
|
|
107
107
|
Stratus.setting('homepage') == content_path
|
108
108
|
end
|
109
109
|
|
110
|
-
def next_content
|
111
|
-
Stratus::Resources.content(:first, :collection_type=>@collection_type, :index=>(@index + 1)) unless index.nil?
|
112
|
-
end
|
113
|
-
|
114
110
|
def prev_content
|
115
|
-
Stratus::
|
111
|
+
collection = Stratus::Generator::LiquidContext.site_data[ collection_type ]
|
112
|
+
idx = collection.index(self)
|
113
|
+
return false if idx.nil? or idx <= 0
|
114
|
+
collection[(idx - 1)]
|
115
|
+
end
|
116
|
+
|
117
|
+
def next_content
|
118
|
+
collection = Stratus::Generator::LiquidContext.site_data[ collection_type ]
|
119
|
+
idx = collection.index(self)
|
120
|
+
return false if idx.nil? or idx >= (collection.length - 1)
|
121
|
+
collection[(idx + 1)]
|
116
122
|
end
|
117
123
|
|
118
124
|
def to_liquid
|
@@ -190,6 +196,10 @@ protected
|
|
190
196
|
# Coerce the meta data value if it's defined...
|
191
197
|
content = if meta_tag[:type]
|
192
198
|
case meta_tag[:type].downcase.to_sym
|
199
|
+
when :bool
|
200
|
+
(meta_tag[:content] == 'true')
|
201
|
+
when :boolean
|
202
|
+
(meta_tag[:content] == 'true')
|
193
203
|
when :int
|
194
204
|
meta_tag[:content].to_i
|
195
205
|
when :integer
|