caboodle 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -1,5 +1,4 @@
1
1
  module Caboodle
2
-
3
2
  class App < Sinatra::Base
4
3
  register Sinatra::Compass
5
4
 
@@ -22,9 +21,7 @@ module Caboodle
22
21
  if File.exists?(config_path)
23
22
  Caboodle::Kit.load_config(config_path)
24
23
  Caboodle::Kit.setup
25
- end
26
-
27
- puts Caboodle::Site.inspect
24
+ end
28
25
  end
29
26
  # get '/:kit/stylesheet.css' do
30
27
  # header 'Content-Type' => 'text/css; charset=utf-8'
@@ -3,6 +3,7 @@
3
3
  %head{:profile => "http://gmpg.org/xfn/11"}
4
4
  %meta{:content => "text/html; charset=utf-8", "http-equiv" => "content-type"}/
5
5
  %meta{:content => "index,follow", :name => "robots"}/
6
+ %meta{:content => "Caboodle", :name => "generator"}/
6
7
 
7
8
  = meta
8
9
 
@@ -20,8 +21,13 @@
20
21
  - Caboodle::Javascripts.each do |js|
21
22
  %script{:charset => "utf-8", :src => js, :type => "text/javascript"}
22
23
 
24
+ - Caboodle::RSS.each do |rss|
25
+ %link{:href => rss, :rel => "alternate", :type => "application/rss+xml"}/
26
+
23
27
  = head
24
28
 
29
+ = root
30
+
25
31
  %body.caboodle
26
32
  = before_page
27
33
  #page.hfeed
@@ -37,7 +43,7 @@
37
43
  %h1
38
44
  %a{:href => "/", :rel => "home", :title => Caboodle::Site.title }
39
45
  = Caboodle::Site.title
40
- - if description
46
+ - if Caboodle::Site.description
41
47
  #site-description
42
48
  %h2= Caboodle::Site.description
43
49
  #access
@@ -47,15 +53,18 @@
47
53
  - if Caboodle::MenuItems.size > 0
48
54
  = before_nav
49
55
  %nav
56
+ = above_nav
50
57
  %ul
51
- %li
52
- %a{:href=>"/"}
53
- = Caboodle::Site.home_title
54
58
  - Caboodle::MenuItems.each do |p|
55
59
  %li
60
+ = above_nav_item
56
61
  %a{:href=>p[:link]}
62
+ = above_nav_item_title
57
63
  = p[:display]
58
-
64
+ = below_nav_item_title
65
+ = below_nav_item
66
+ = below_nav
67
+ = after_nav
59
68
  = below_header
60
69
  = after_header
61
70
  = before_main
@@ -70,6 +79,13 @@
70
79
  = yield
71
80
  = below_content
72
81
  = after_content
82
+ - if credit
83
+ = before_credit
84
+ %section#credit
85
+ = above_credit
86
+ = credit
87
+ = below_credit
88
+ = after_credit
73
89
  = after_main
74
90
  = before_footer
75
91
  %footer#footer
@@ -3,6 +3,8 @@ module Caboodle
3
3
  MenuItems = []
4
4
  Javascripts = []
5
5
  Stylesheets = []
6
+ RSS = []
7
+
6
8
  Defaults = Hashie::Mash.new(Hashie::Mash.new(YAML.load_file(File.join(File.dirname(__FILE__), 'config','defaults.yml'))))
7
9
  RequiredSettings = Hashie::Mash.new()
8
10
  Layout = Hashie::Mash.new()
@@ -10,5 +12,4 @@ module Caboodle
10
12
 
11
13
  Site.required_settings = []
12
14
  Site.kits = [] unless Site.kits
13
- puts Site.inspect
14
15
  end
@@ -1,4 +1,5 @@
1
1
  home_title: Blog
2
+ home_kit: Posterous
2
3
  skimmed: abc123
3
4
  has_footer: true
4
5
  has_caboodle_link: true
@@ -5,6 +5,10 @@ module Sinatra
5
5
  Caboodle::Layout[arg]
6
6
  end
7
7
 
8
+ def credit
9
+ #Caboodle::Kit.credit
10
+ end
11
+
8
12
  end
9
13
  helpers CaboodleHelpers
10
14
  end
@@ -59,7 +59,7 @@ module Caboodle
59
59
  kit_name = kit_name.downcase
60
60
  puts "Loading Kit: #{kit_name}"
61
61
  orig = Caboodle.constants
62
- require "caboodle/kits/#{kit_name}/#{kit_name}" rescue puts "Problem loading Kit: #{kit_name}"
62
+ require "caboodle/kits/#{kit_name}/#{kit_name}" #rescue puts "Problem loading Kit: #{kit_name}"
63
63
  added = Caboodle.constants - orig
64
64
  added.each do |d|
65
65
  c = Caboodle.const_get(d)
@@ -77,7 +77,7 @@ module Caboodle
77
77
  kit_name = kit_name.downcase
78
78
  puts "Loading Kit: #{kit_name}"
79
79
  orig = Caboodle.constants
80
- require "caboodle/kits/#{kit_name}/#{kit_name}" rescue puts "Problem loading Kit: #{kit_name}"
80
+ require "caboodle/kits/#{kit_name}/#{kit_name}" #rescue puts "Problem loading Kit: #{kit_name}"
81
81
  added = Caboodle.constants - orig
82
82
  added.each do |d|
83
83
  c = Caboodle.const_get(d)
@@ -101,12 +101,14 @@ module Caboodle
101
101
  Site.kits << self.to_s.split("::").last
102
102
  Site.kits.uniq!
103
103
  Caboodle::Kits << self
104
+ Caboodle::Kits
104
105
  end
105
106
 
106
107
  def unregister
107
108
  Caboodle::Kits.delete(self)
108
109
  Caboodle::Site.kits.delete(self.to_s)
109
110
  Caboodle::Kit.dump_config
111
+ Caboodle::Kits
110
112
  end
111
113
 
112
114
  def require_all
@@ -115,14 +117,17 @@ module Caboodle
115
117
  else
116
118
  STDERR.puts "Kits not registered"
117
119
  end
120
+ Caboodle::Kits
118
121
  end
119
122
 
120
123
  def use_all
121
124
  Caboodle::Kits.each { |p| p.start }
122
125
  end
123
126
 
124
- def menu display, link
125
- Caboodle::MenuItems << {:display=>display, :link=>link}
127
+ def menu display, path, &block
128
+ path = "/" if Site.home_kit == self.to_s.gsub("Caboodle::","")
129
+ Caboodle::MenuItems << {:display=>display, :link=>path}
130
+ self.get path, &block
126
131
  end
127
132
 
128
133
  def required keys
@@ -133,18 +138,40 @@ module Caboodle
133
138
  else
134
139
  self.required_settings << keys
135
140
  end
141
+ self.required_settings
136
142
  end
137
143
 
138
144
  def stylesheets array_of_css_files
139
- array_of_css_files.each { |a| Caboodle::Stylesheets << a }
145
+ if array_of_css_files.class == Array
146
+ array_of_css_files.each { |a| Caboodle::Stylesheets << a.to_s }
147
+ else
148
+ Caboodle::Stylesheets << array_of_css_files.to_s
149
+ end
140
150
  Caboodle::Stylesheets.uniq!
141
151
  end
142
152
 
153
+ alias_method :stylesheet, :stylesheets
154
+
143
155
  def javascripts array_of_js_files
144
- array_of_js_files.each { |a| Caboodle::Javascripts << a }
156
+ if array_of_js_files.class == Array
157
+ array_of_js_files.each { |a| Caboodle::Javascripts << a.to_s }
158
+ else
159
+ Caboodle::Javascripts << array_of_js_files.to_s
160
+ end
145
161
  Caboodle::Javascripts.uniq!
146
162
  end
147
163
 
164
+ alias_method :javascript, :javascripts
165
+
166
+ def rss array_of_feeds
167
+ if array_of_feeds.class == Array
168
+ array_of_feeds.each { |a| Caboodle::RSS << a.to_s }
169
+ else
170
+ Caboodle::RSS << array_of_feeds.to_s
171
+ end
172
+ Caboodle::RSS.uniq!
173
+ end
174
+
148
175
  def add_to_layout hash_of_items
149
176
  hash_of_items.each do |k,v|
150
177
  unless Caboodle::Layout[k.to_sym].blank?
@@ -162,6 +189,10 @@ module Caboodle
162
189
  hash.each {|k,v| Site[k] = v }
163
190
  end
164
191
  end
192
+
193
+ def original url
194
+ set :credit, "<a href='#{url}' rel='me'>via #{self.class.name.split("::").last}</a>"
195
+ end
165
196
 
166
197
  def required_settings
167
198
  r = RequiredSettings[self.ancestors.first.to_s.split("::").last] ||= [:title, :description, :logo_url, :author]
@@ -44,16 +44,12 @@ module Caboodle
44
44
 
45
45
  class Flickr < Caboodle::Kit
46
46
 
47
- def home
47
+ menu "Photography", "/photography" do
48
48
  @photosets = FlickrAPI.photosets rescue []
49
49
  @title = "Photography"
50
50
  haml :photography
51
51
  end
52
52
 
53
- get "/photography" do
54
- home
55
- end
56
-
57
53
  get "/photography/:set_id" do |set_id|
58
54
  @photosets = FlickrAPI.photosets rescue []
59
55
  @set_id = set_id
@@ -64,6 +60,8 @@ module Caboodle
64
60
 
65
61
  required [:flickr_username, :flickr_api_key]
66
62
 
67
- menu "Photography", "/photography"
63
+ javascripts ["/galleria.noconflict.min.js"]
64
+
65
+ original "http://flickr.com/#{Caboodle::Site.flickr_username}"
68
66
  end
69
67
  end
@@ -1,4 +1,4 @@
1
- $j=jQuery.noConflict();$j(function(){var $$;$$=$j.fn.galleria=function($options){if(!$$.hasCSS()){return false;}
1
+ $j=jQuery;$j(function(){var $$;$$=$j.fn.galleria=function($options){if(!$$.hasCSS()){return false;}
2
2
  $j.historyInit($$.onPageLoad);var $defaults={insert:'.galleria_container',history:true,clickNext:true,onImage:function(image,caption,thumb){},onThumb:function(thumb){}};var $opts=$j.extend($defaults,$options);for(var i in $opts){if(i){$j.galleria[i]=$opts[i];}}
3
3
  var _insert=($j($opts.insert).is($opts.insert))?$j($opts.insert):jQuery(document.createElement('div')).insertBefore(this);var _div=$j(document.createElement('div')).addClass('galleria_wrapper');var _span=$j(document.createElement('span')).addClass('caption');_insert.addClass('galleria_container').append(_div).append(_span);return this.each(function(){$j(this).addClass('galleria');$j(this).children('li').each(function(i){var _container=$j(this);var _o=$j.meta?$j.extend({},$opts,_container.data()):$opts;_o.clickNext=$j(this).is(':only-child')?false:_o.clickNext;var _a=$j(this).find('a').is('a')?$j(this).find('a'):false;var _img=$j(this).children('img').css('display','none');var _src=_a?_a.attr('href'):_img.attr('src');var _title=_a?_a.attr('title'):_img.attr('title');var _loader=new Image();if(_o.history&&(window.location.hash&&window.location.hash.replace(/\#/,'')==_src)){_container.siblings('.active').removeClass('active');_container.addClass('active');}
4
4
  $j(_loader).load(function(){$j(this).attr('alt',_img.attr('alt'));var _thumb=_a?_a.find('img').addClass('thumb noscale').css('display','none'):_img.clone(true).addClass('thumb').css('display','none');if(_a){_a.replaceWith(_thumb);}
@@ -4,8 +4,6 @@
4
4
  Sorry - there was a problem communicating with Flickr
5
5
  - else
6
6
 
7
- %script{:charset => "utf-8", :src => "/galleria.js", :type => "text/javascript"}
8
-
9
7
  :javascript
10
8
  jQuery(document).ready(function(){
11
9
 
@@ -1,7 +1,7 @@
1
1
  module Caboodle
2
2
  class Github < Caboodle::Kit
3
3
 
4
- get "/code" do
4
+ menu "Code", "/code" do
5
5
  @title = "Code"
6
6
  @repos = GithubAPI.repositories
7
7
 
@@ -15,11 +15,11 @@ module Caboodle
15
15
  haml :github
16
16
  end
17
17
 
18
- menu "Code", "/code"
19
-
20
18
  required [:github_username]
21
19
 
22
20
  defaults []
21
+
22
+ original "http://gitbhu.com/#{Site.github_username}"
23
23
  end
24
24
 
25
25
  class GithubAPI < Weary::Base
@@ -1,3 +1,5 @@
1
- $("img").lazyload({
2
- effect : "fadeIn"
1
+ jQuery(document).ready(function(){
2
+ $("img").lazyload({
3
+ effect : "fadeIn"
4
+ });
3
5
  });
@@ -16,14 +16,14 @@ module Caboodle
16
16
 
17
17
  class Linkedin < Caboodle::Kit
18
18
 
19
- get "/cv" do
19
+ menu "CV", "/cv" do
20
20
  @title = "Curriculum Vitae"
21
21
  @linkedin = LinkedinAPI.new #rescue nil
22
22
  haml :cv
23
23
  end
24
24
 
25
- menu "CV", "/cv"
26
-
27
25
  required [:linkedin_full_name, :linkedin_profile_url]
26
+
27
+ original Caboodle::Site.linkedin_profile_url
28
28
  end
29
29
  end
@@ -1,13 +1,13 @@
1
1
  module Caboodle
2
2
  class Onepage < Caboodle::Kit
3
3
 
4
- get "/contact" do
4
+ menu "Contact", "/contact" do
5
5
  @title = "Contact"
6
6
  haml :contact
7
7
  end
8
8
 
9
- menu "Contact", "/contact"
10
-
11
9
  required [:onepage_username]
10
+
11
+ original "http://myonepage.com/#{Caboodle::Site.onepage_username}"
12
12
  end
13
13
  end
@@ -11,11 +11,10 @@ module Caboodle
11
11
  end
12
12
  end
13
13
 
14
- get "/portfolio" do
14
+ menu "Portfolio", "/portfolio" do
15
15
  @title = "Portfolio"
16
16
  haml :portfolio
17
17
  end
18
18
 
19
- menu "Portfolio", "/portfolio"
20
19
  end
21
20
  end
@@ -147,7 +147,7 @@ module Caboodle
147
147
  haml :post, :locals => { :post => post }
148
148
  end
149
149
 
150
- get "/" do
150
+ menu "Blog", "/blog" do
151
151
  @posts = Post.all(:page=>(params[:page] || 1))
152
152
  haml :posts.to_sym
153
153
  end
@@ -155,6 +155,10 @@ module Caboodle
155
155
  required [:posterous_sitename, :posterous_username, :posterous_password, :disqus]
156
156
 
157
157
  stylesheets ["http://disqus.com/stylesheets/#{Caboodle::Site.disqus}/disqus.css?v=2.0"]
158
+
159
+ rss ["feed://stef.posterous.com/rss.xml"]
160
+
161
+ original "http://#{Caboodle::Site.posterous_sitename}.posterous.com"
158
162
  end
159
163
  end
160
164
 
@@ -1,14 +1,12 @@
1
1
  module Caboodle
2
2
  class Soundcloud < Caboodle::Kit
3
3
 
4
- get "/mixes" do
4
+ menu "Mixes", "/mixes" do
5
5
  @title = "Mixes"
6
6
  @mixes = SoundcloudAPI.sets
7
7
  haml :soundcloud
8
8
  end
9
-
10
- menu "Mixes", "/mixes"
11
-
9
+
12
10
  required [:soundcloud_query]
13
11
  end
14
12
 
@@ -1,13 +1,13 @@
1
1
  module Caboodle
2
2
  class Twitter < Caboodle::Kit
3
3
 
4
- get "/twitter" do
4
+ menu "Twitter", "/twitter" do
5
5
  @title = "Twitter"
6
6
  haml :twitter
7
7
  end
8
8
 
9
- menu "Twitter", "/twitter"
10
-
11
9
  required [:twitter_username]
10
+
11
+ original "http://twitter.com/#{Caboodle::Site.twitter_username}"
12
12
  end
13
13
  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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - steflewandowski
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-14 00:00:00 +01:00
18
+ date: 2010-08-15 00:00:00 +01:00
19
19
  default_executable: caboodle
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency