caboodle 0.2.21 → 0.2.22
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/VERSION +1 -1
- data/lib/caboodle/app/config/site.yml +2 -1
- data/lib/caboodle/config.rb +1 -0
- data/lib/caboodle/kits/feed/config/feed.yml +2 -1
- data/lib/caboodle/kits/feed/feed.rb +0 -1
- data/lib/caboodle/kits/page/page.rb +14 -58
- data/lib/caboodle/markdown.rb +9 -2
- metadata +3 -4
- data/lib/caboodle/kits/page/views/page.haml +0 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.22
|
data/lib/caboodle/config.rb
CHANGED
@@ -1,65 +1,21 @@
|
|
1
|
-
require 'haml'
|
2
|
-
|
3
1
|
module Caboodle
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@slug = slug
|
13
|
-
end
|
14
|
-
|
15
|
-
def file
|
16
|
-
@file ||= File.new(Dir[File.join(File.dirname(__FILE__),"pages","#{@slug}.haml")].first)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.all
|
20
|
-
return Caboodle::Pages unless Caboodle::Pages.empty?
|
21
|
-
Dir[File.join(File.dirname(__FILE__),"pages","*.haml")].map do |a|
|
22
|
-
p = Page.new(a.split("/").last.gsub(".haml",""))
|
23
|
-
Caboodle::Pages << p
|
24
|
-
Caboodle::MenuItems << {:display=>p.title, :link=>p.link}
|
2
|
+
class Page < Caboodle::Kit
|
3
|
+
|
4
|
+
description "Create markdown pages in the config directory and they are displayed as menu items and pages"
|
5
|
+
|
6
|
+
configure do
|
7
|
+
pages = []
|
8
|
+
Dir[File.join(Caboodle::App.root,"pages","*.md")].map do |a|
|
9
|
+
pages << a.split("/").last.split(".").first
|
25
10
|
end
|
26
11
|
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.get slug
|
31
|
-
STDERR.puts "Get page: #{slug}"
|
32
|
-
return nil unless Caboodle::Pages.map{|a| a.slug}.include?(slug)
|
33
|
-
Page.new(slug.gsub(" ", "_"))
|
34
|
-
end
|
35
|
-
|
36
|
-
def body
|
37
|
-
@body ||= file.read
|
38
|
-
end
|
39
|
-
|
40
|
-
def to_html
|
41
|
-
Haml::Engine.new(body).render
|
42
|
-
end
|
43
|
-
|
44
|
-
def title
|
45
|
-
@slug.gsub("_","").capitalize
|
46
|
-
end
|
12
|
+
puts pages.inspect
|
47
13
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
class PageApp < Caboodle::Kit
|
55
|
-
|
56
|
-
Caboodle::Site.pages = Caboodle::Page.all
|
57
|
-
Caboodle::Site.pages.each do |page|
|
58
|
-
get "/#{page.slug}" do
|
59
|
-
@page = Page.get(request.path_info.gsub("/",""))
|
60
|
-
pass if @page.blank?
|
61
|
-
@title = @page.title
|
62
|
-
haml :page, :locals => {:page => @page}
|
14
|
+
pages.each do |page|
|
15
|
+
puts "Add page: #{page}"
|
16
|
+
menu "#{page.capitalize.gsub('_',' ')}" do
|
17
|
+
markdown :"#{page}"
|
18
|
+
end
|
63
19
|
end
|
64
20
|
end
|
65
21
|
end
|
data/lib/caboodle/markdown.rb
CHANGED
@@ -2,8 +2,15 @@ module Sinatra
|
|
2
2
|
class Base
|
3
3
|
def markdown sym
|
4
4
|
md = File.expand_path(File.join(Caboodle::App.root,"config","#{sym.to_s}.md"))
|
5
|
-
|
6
|
-
|
5
|
+
unless File.exists?(md)
|
6
|
+
md = File.expand_path(File.join(Caboodle::App.root,"pages","#{sym.to_s}.md"))
|
7
|
+
end
|
8
|
+
if File.exists?(md)
|
9
|
+
@content = Maruku.new(open(md).read).to_html_document
|
10
|
+
haml ".page.#{sym.to_s}.thin_page= @content"
|
11
|
+
else
|
12
|
+
haml "%h2.#{sym.to_s}= 'Sorry - #{sym.to_s}.md was not found"
|
13
|
+
end
|
7
14
|
end
|
8
15
|
end
|
9
16
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboodle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 22
|
10
|
+
version: 0.2.22
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stef Lewandowski
|
@@ -342,7 +342,6 @@ files:
|
|
342
342
|
- lib/caboodle/kits/onepage/onepage.rb
|
343
343
|
- lib/caboodle/kits/onepage/views/contact.haml
|
344
344
|
- lib/caboodle/kits/page/page.rb
|
345
|
-
- lib/caboodle/kits/page/views/page.haml
|
346
345
|
- lib/caboodle/kits/posterous/posterous.rb
|
347
346
|
- lib/caboodle/kits/posterous/views/_post.haml
|
348
347
|
- lib/caboodle/kits/posterous/views/post.haml
|