caboodle 0.2.21 → 0.2.22

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.21
1
+ 0.2.22
@@ -9,4 +9,5 @@ kits:
9
9
  - Gravatar
10
10
  - Lazyload
11
11
  - SEO
12
- - About
12
+ - About
13
+ - Page
@@ -55,6 +55,7 @@ module Caboodle
55
55
  kit_name = kit_name.downcase
56
56
  orig = Caboodle.constants
57
57
  begin
58
+ puts kit_name
58
59
  require "caboodle/kits/#{kit_name}/#{kit_name}"
59
60
  added = Caboodle.constants - orig
60
61
  added.each do |d|
@@ -1,2 +1,3 @@
1
1
  :feeds:
2
- News: http://feeds.feedburner.com/github
2
+ -
3
+ News: http://feeds.feedburner.com/github
@@ -12,7 +12,6 @@ module Caboodle
12
12
  configure do
13
13
  if Settings.feeds
14
14
  Settings.feeds.map{|q| q.first}.each do |feed_name,feed_url|
15
- puts "menu #{feed_name}"
16
15
  menu feed_name do
17
16
  @feed = FeedNormalizer::FeedNormalizer.parse open(feed_url)
18
17
  @feed.clean!
@@ -1,65 +1,21 @@
1
- require 'haml'
2
-
3
1
  module Caboodle
4
- Pages = []
5
- class Page
6
-
7
- attr_accessor :slug
8
- attr_accessor :body
9
- attr_accessor :file
10
-
11
- def initialize slug
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
- return Caboodle::Pages
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
- def link
49
- "/#{slug}"
50
- end
51
-
52
- end
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
@@ -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
- @content = Maruku.new(open(md).read).to_html_document
6
- haml ".page.about.thin_page= @content"
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: 61
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 21
10
- version: 0.2.21
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
@@ -1,2 +0,0 @@
1
- .page
2
- = page.to_html