caboodle 0.2.16 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/VERSION +1 -1
  2. data/lib/caboodle.rb +1 -1
  3. data/lib/caboodle/app.rb +1 -0
  4. data/lib/caboodle/app/config.ru +1 -0
  5. data/lib/caboodle/app/config/site.yml +2 -1
  6. data/lib/caboodle/app/views/layout.haml +9 -9
  7. data/lib/caboodle/command.rb +5 -9
  8. data/lib/caboodle/config.rb +80 -0
  9. data/lib/caboodle/kit.rb +82 -148
  10. data/lib/caboodle/kits/analytics/analytics.rb +1 -1
  11. data/lib/caboodle/kits/beta/beta.rb +1 -1
  12. data/lib/caboodle/kits/carbonmade/carbonmade.rb +1 -1
  13. data/lib/caboodle/kits/carbonmade/views/portfolio.haml +1 -1
  14. data/lib/caboodle/kits/debugger/debugger.rb +5 -7
  15. data/lib/caboodle/kits/disqus/views/chat.haml +3 -3
  16. data/lib/caboodle/kits/flickr/flickr.rb +6 -6
  17. data/lib/caboodle/kits/flickr/views/photography.haml +2 -2
  18. data/lib/caboodle/kits/github/github.rb +11 -11
  19. data/lib/caboodle/kits/googlelocal/googlelocal.rb +3 -3
  20. data/lib/caboodle/kits/googlelocal/views/near_me.haml +3 -3
  21. data/lib/caboodle/kits/gravatar/gravatar.rb +9 -7
  22. data/lib/caboodle/kits/history/views/history.haml +2 -2
  23. data/lib/caboodle/kits/jquery/jquery.rb +1 -0
  24. data/lib/caboodle/kits/lastfm/lastfm.rb +2 -6
  25. data/lib/caboodle/kits/linkedin/linkedin.rb +3 -3
  26. data/lib/caboodle/kits/onepage/onepage.rb +1 -1
  27. data/lib/caboodle/kits/onepage/views/contact.haml +1 -1
  28. data/lib/caboodle/kits/posterous/posterous.rb +18 -21
  29. data/lib/caboodle/kits/seo/seo.rb +2 -1
  30. data/lib/caboodle/kits/skimmed/skimmed.rb +5 -3
  31. data/lib/caboodle/kits/soundcloud/views/music.haml +3 -3
  32. data/lib/caboodle/kits/standard/standard.rb +3 -2
  33. data/lib/caboodle/kits/standard/views/standard.haml +1 -1
  34. data/lib/caboodle/kits/susy/susy.rb +3 -3
  35. data/lib/caboodle/kits/tumblr/tumblr.rb +27 -26
  36. data/lib/caboodle/kits/tumblr/views/tumblr.haml +1 -1
  37. data/lib/caboodle/kits/twitter/twitter.rb +18 -6
  38. data/lib/caboodle/kits/twitter/views/twitter.haml +1 -1
  39. data/lib/caboodle/kits/typekit/typekit.rb +1 -1
  40. data/lib/caboodle/kits/vimeo/views/vimeo.haml +3 -2
  41. data/lib/caboodle/kits/youtube/views/youtube.haml +7 -0
  42. data/lib/caboodle/kits/youtube/youtube.rb +16 -0
  43. data/lib/caboodle/markdown.rb +9 -0
  44. metadata +7 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.16
1
+ 0.2.18
@@ -1,3 +1,3 @@
1
1
  $:<<File.dirname(__FILE__)
2
2
  $:<<File.join(File.dirname(__FILE__),"caboodle")
3
- %{sinatra/base yaml hashie haml maruku find sinatra/base sinatra/compass sinatra/advanced_routes compass susy pp sleepy caboodle/helpers caboodle/config caboodle/kit caboodle/app caboodle/scrape}.split.each{|a| require a}
3
+ %{sinatra/base yaml hashie haml maruku find sinatra/base sinatra/compass sinatra/advanced_routes compass susy pp sleepy caboodle/config caboodle/markdown caboodle/helpers caboodle/config caboodle/kit caboodle/app caboodle/scrape}.split.each{|a| require a}
@@ -5,6 +5,7 @@ module Caboodle
5
5
  set :root, File.expand_path(".")
6
6
  set :views, Proc.new { File.join(root, "views") }
7
7
  set :public, Proc.new { File.join(root, "public") }
8
+ set :run, false
8
9
 
9
10
  helpers Sinatra::CaboodleHelpers
10
11
 
@@ -1,2 +1,3 @@
1
+ $:<<"../../caboodle/lib"
1
2
  require 'caboodle'
2
3
  run Caboodle::App
@@ -8,4 +8,5 @@ kits:
8
8
  - Jquery
9
9
  - Gravatar
10
10
  - Lazyload
11
- - SEO
11
+ - SEO
12
+ - About
@@ -1,7 +1,7 @@
1
1
  !!!
2
2
  %html{:dir => "ltr", :lang => "en-US", :xmlns => "http://www.w3.org/1999/xhtml"}
3
3
  %head{:profile => "http://gmpg.org/xfn/11"}
4
- %link{:href => Caboodle::Site.url_base, :rel => "index", :title => Caboodle::Site.title}/
4
+ %link{:href => @url_base, :rel => "index", :title => @title}/
5
5
  %meta{:content => "text/html; charset=utf-8", "http-equiv" => "content-type"}/
6
6
  %meta{:content => "index,follow", :name => "robots"}/
7
7
  %meta{:content => "Caboodle", :name => "generator"}/
@@ -37,18 +37,18 @@
37
37
  = before_header
38
38
  %header#site-header
39
39
  = above_header
40
- - unless Caboodle::Site.logo_url.to_s.blank?
40
+ - unless @logo_url.to_s.blank?
41
41
  #logo
42
42
  %a{:href => "/", :rel => "home", :title => Caboodle::Site.title }
43
- %img{:src=>Caboodle::Site.logo_url, :width=>"64", :height=>"64"}
44
- - unless Caboodle::Site.title.blank?
43
+ %img{:src=>@logo_url, :width=>"64", :height=>"64", :alt=>"Logo"}
44
+ - unless @title.blank?
45
45
  #site-title
46
46
  %h1
47
47
  %a{:href => "/", :rel => "home", :title => Caboodle::Site.title }
48
48
  = Caboodle::Site.title
49
- - unless Caboodle::Site.description.to_s.blank?
49
+ - unless @description.to_s.blank?
50
50
  #site-description
51
- %h2= Caboodle::Site.description
51
+ %h2= @description
52
52
  #access
53
53
  .skip-link
54
54
  %a{:href => "#content", :title => "Skip navigation to the content"} Skip to content
@@ -101,11 +101,11 @@
101
101
  = before_footer
102
102
  %footer#footer
103
103
  = above_footer
104
- - if Caboodle::Site.has_footer
104
+ - if @has_footer
105
105
  %p
106
106
  \&copy;
107
- = Caboodle::Site.author
108
- - if Caboodle::Site.has_caboodle_link
107
+ = @author
108
+ - if @has_caboodle_link
109
109
  |
110
110
  Powered by
111
111
  %a{:href=>"http://github.com/stefl/caboodle"}
@@ -19,27 +19,23 @@ module Caboodle
19
19
  puts `cd #{site_name} && cp -i #{File.expand_path(File.join(File.dirname(__FILE__), 'app'))}/public .`
20
20
  puts `cd #{site_name} && git init`
21
21
  config = File.expand_path(File.join(".",site_name,"config","site.yml"))
22
- Caboodle::Kit.configure_site config
22
+ Caboodle::Config.configure_site config
23
23
  puts "Please set a few settings to get started"
24
24
  Caboodle::Kit.ask_user_for_all_missing_settings
25
25
  puts `cd #{site_name} && git add .`
26
26
  puts `cd #{site_name} && git commit -m"initial setup"`
27
27
  when /kit:add/
28
- Caboodle::Kit.load_kit args.first.capitalize
28
+ Caboodle::Config.load_kit args.first.capitalize
29
29
  puts "Dump config"
30
30
  Caboodle::Kit.dump_config
31
31
  puts `git commit -m"kit:add #{args}" -a`
32
32
  when /kit:home/
33
- if Caboodle::Kit.available_kits.include?(args.first.capitalize)
34
- Caboodle::Site.home_kit = args.first.capitalize
35
- else
36
- puts "Sorry - that Kit isn't available. Try:"
37
- Caboodle::Kit.available_kits.each {|kit| puts kit}
38
- end
33
+ Caboodle::Site.home_kit = args.first.capitalize
34
+ Caboodle::Kit.dump_config
39
35
  when /kit:list/
40
36
  Caboodle::Kit.available_kits.each {|kit| puts kit}
41
37
  when /kit:remove/
42
- Caboodle::Kit.unload_kit args.first.capitalize
38
+ Caboodle::Config.unload_kit args.first.capitalize
43
39
  puts `git commit -m"kit:remove #{args}" -a`
44
40
  when /config:list/
45
41
  configure
@@ -15,4 +15,84 @@ module Caboodle
15
15
 
16
16
  Site.required_settings = []
17
17
  Site.kits = [] unless Site.kits
18
+
19
+ module Config
20
+ class << self
21
+
22
+ def setup
23
+ require_all
24
+ use_all
25
+ end
26
+
27
+ def load_config p
28
+ loaded = YAML.load(p)
29
+ Hashie::Mash.new(loaded).each{ |k,v|
30
+ v.strip! if v.class == String
31
+ Caboodle::Site[k.to_s] = v } rescue puts "Warning! Skipping #{p}"
32
+ Caboodle::Site.kits.uniq!
33
+ end
34
+
35
+ def load_config_file p
36
+ configure_site(open(p).read)
37
+ end
38
+
39
+ def require_all ask=true
40
+ if(Caboodle::Site.kits)
41
+ Caboodle::Site.kits.each { |k| load_kit k, ask }
42
+ else
43
+ STDERR.puts "No kits to register"
44
+ end
45
+ Caboodle::Kits
46
+ end
47
+
48
+ def use_all
49
+ Caboodle::Kits.each { |p| p.start }
50
+ end
51
+
52
+ def load_kit name, ask=true
53
+ unless name.blank?
54
+ kit_name = name.to_s.split("::").last || name
55
+ kit_name = kit_name.downcase
56
+ orig = Caboodle.constants
57
+ begin
58
+ require "caboodle/kits/#{kit_name}/#{kit_name}"
59
+ added = Caboodle.constants - orig
60
+ added.each do |d|
61
+ c = Caboodle.const_get(d)
62
+ if c.respond_to?(:is_a_caboodle_kit)
63
+ c.register_kit ask
64
+ end
65
+ end
66
+ rescue Exception=>e
67
+ if ENV["RACK_ENV"] == "production"
68
+ Caboodle::Errors << Hashie::Mash.new({:title=>"Failed to load #{name} kit", :reason=>e.backtrace})
69
+ puts "Failed to load #{name} kit: #{e.backtrace}"
70
+ else
71
+ raise e
72
+ end
73
+ end
74
+ end
75
+ Caboodle::Kits
76
+ end
77
+
78
+ def unload_kit name
79
+ unless name.blank?
80
+ kit_name = name.to_s.split("::").last || name
81
+ kit_name = kit_name.downcase
82
+ puts "Unloading Kit: #{kit_name}"
83
+ orig = Caboodle.constants
84
+ require "caboodle/kits/#{kit_name}/#{kit_name}"
85
+ added = Caboodle.constants - orig
86
+ added.each do |d|
87
+ c = Caboodle.const_get(d)
88
+ if c.respond_to?(:is_a_caboodle_kit)
89
+ c.unregister_kit
90
+ end
91
+ end
92
+ end
93
+ Caboodle::Kits
94
+ end
95
+
96
+ end
97
+ end
18
98
  end
@@ -17,6 +17,13 @@ module Caboodle
17
17
  before do
18
18
  Caboodle::Site.cache_for ||= 600
19
19
  response.headers['Cache-Control'] = "public, max-age=#{Caboodle::Site.cache_for}"
20
+
21
+ env['caboodle.config'] ||= Caboodle::Site.clone
22
+ env['caboodle.config'].merge!(Settings)
23
+
24
+ env['caboodle.config'].each do |k,v|
25
+ self.instance_variable_set("@#{k}".to_sym,v)
26
+ end
20
27
  end
21
28
 
22
29
  error SocketError do
@@ -25,28 +32,11 @@ module Caboodle
25
32
  haml File.open(File.join(Caboodle::Kit.root, "views","error.haml")).read
26
33
  end
27
34
 
28
- Config = Hashie::Mash.new
29
-
30
- def markdown sym
31
- puts sym
32
- md = File.expand_path(File.join(Caboodle::App.root,"config","#{sym.to_s}.md"))
33
- @content = Maruku.new(open(md).read).to_html_document
34
- haml ".page.about.thin_page= @content"
35
- end
35
+ Settings = Hashie::Mash.new
36
36
 
37
37
  class << self
38
38
 
39
39
  attr_accessor :credit_link
40
-
41
- def configure_site config_path
42
- set :config_path, config_path
43
- if File.exists?(config_path)
44
- Caboodle::Kit.load_config(config_path)
45
- Caboodle::Kit.setup
46
- else
47
- puts "No such configuration file: #{config_path}"
48
- end
49
- end
50
40
 
51
41
  def inherited subclass
52
42
  set :kit_root, File.expand_path(File.dirname(caller[0].split(/:in/).last))
@@ -63,34 +53,13 @@ module Caboodle
63
53
  true
64
54
  end
65
55
 
66
- def load_config p
67
- set :config, p
68
- loaded = YAML.load_file(p)
69
- Hashie::Mash.new(loaded).each{ |k,v|
70
- v.strip! if v.class == String
71
- Caboodle::Site[k.to_s] = v } rescue puts "Warning! Skipping #{p}"
72
- Caboodle::Site.kits.uniq!
73
- end
74
-
75
56
  def load_custom_config p
76
57
  loaded = YAML.load_file(p)
77
58
  Hashie::Mash.new(loaded).each{ |k,v|
78
59
  v.strip! if v.class == String
79
- Config[k.to_s] = v
60
+ Settings[k.to_s] = v
80
61
  }
81
62
  end
82
-
83
- def dump_config
84
- begin
85
- p = config
86
- d = Caboodle::Site.clone
87
- e = d.to_hash
88
- e.delete("required_settings")
89
- File.open(p, 'w') {|f| f.write(YAML::dump(e))}
90
- rescue
91
- puts "Cannot write to config file: #{p}"
92
- end
93
- end
94
63
 
95
64
  def config_files array_of_files
96
65
  configure do
@@ -121,116 +90,10 @@ module Caboodle
121
90
  puts "\n"
122
91
  puts "#{name.to_s.split("::").last}: #{string}"
123
92
  end
124
-
125
- def setup
126
- require_all
127
- use_all
128
- end
129
-
130
- def load_kit name
131
- unless name.blank?
132
- kit_name = name.to_s.split("::").last || name
133
- kit_name = kit_name.downcase
134
- orig = Caboodle.constants
135
- begin
136
- require "caboodle/kits/#{kit_name}/#{kit_name}"
137
- added = Caboodle.constants - orig
138
- added.each do |d|
139
- c = Caboodle.const_get(d)
140
- if c.respond_to?(:is_a_caboodle_kit)
141
- c.register_kit
142
- end
143
- end
144
- rescue Exception=>e
145
- if ENV["RACK_ENV"] == "production"
146
- Caboodle::Errors << Hashie::Mash.new({:title=>"Failed to load #{name} kit", :reason=>e.backtrace})
147
- else
148
- raise e
149
- end
150
- end
151
- end
152
- Caboodle::Kits
153
- end
154
-
155
- def unload_kit name
156
- unless name.blank?
157
- kit_name = name.to_s.split("::").last || name
158
- kit_name = kit_name.downcase
159
- puts "Unloading Kit: #{kit_name}"
160
- orig = Caboodle.constants
161
- require "caboodle/kits/#{kit_name}/#{kit_name}"
162
- added = Caboodle.constants - orig
163
- added.each do |d|
164
- c = Caboodle.const_get(d)
165
- if c.respond_to?(:is_a_caboodle_kit)
166
- c.unregister_kit
167
- end
168
- end
169
- end
170
- Caboodle::Kits
171
- end
172
93
 
173
94
  def name
174
95
  self.to_s.split("::").last
175
96
  end
176
-
177
- def register_kit
178
- ask_user_for_missing_settings
179
- Site.kits << name
180
- Site.kits.uniq!
181
- Caboodle::Kits << self
182
- Caboodle::Kits
183
- end
184
-
185
- def ask_user r, optional=false
186
- unless ENV["RACK_ENV"] == "production"
187
- puts " "
188
- opt = "Optional: " if optional
189
- puts "#{opt}Please set a value for #{r}:"
190
- v = STDIN.gets
191
- Caboodle::Site[r] = v
192
- Caboodle::Kit.dump_config
193
- end
194
- end
195
-
196
- def ask_user_for_missing_settings
197
- required_settings.each do |r|
198
- if Caboodle::Site[r].blank?
199
- ask_user r
200
- end
201
- end
202
- optional_settings.each do |r|
203
- unless defined?(Caboodle::Site[r])
204
- ask_user r, true
205
- end
206
- end
207
- end
208
-
209
- def ask_user_for_all_missing_settings
210
- Caboodle::Kits.each do |kit|
211
- kit.ask_user_for_missing_settings
212
- end
213
- end
214
-
215
- def unregister_kit
216
- Caboodle::Kits.delete(self)
217
- Caboodle::Site.kits.delete(self.to_s)
218
- Caboodle::Kit.dump_config
219
- Caboodle::Kits
220
- end
221
-
222
- def require_all
223
- if(Caboodle::Site.kits)
224
- Caboodle::Site.kits.each { |k| load_kit k }
225
- else
226
- STDERR.puts "No kits to register"
227
- end
228
- Caboodle::Kits
229
- end
230
-
231
- def use_all
232
- Caboodle::Kits.each { |p| p.start }
233
- end
234
97
 
235
98
  def menu display, path=nil, &block
236
99
  #todo proper slugify
@@ -257,6 +120,8 @@ module Caboodle
257
120
  if keys.class == Array
258
121
  keys.each do |k|
259
122
  self.required_settings << k
123
+ puts "self.set #{k}, #{Caboodle::Site[k]}"
124
+ self.set k.to_s.to_sym, Caboodle::Site[k].to_s
260
125
  end
261
126
  else
262
127
  self.required_settings << keys
@@ -268,11 +133,13 @@ module Caboodle
268
133
  if keys.class == Array
269
134
  keys.each do |k|
270
135
  self.optional_settings << k
136
+ self.set k.to_s.to_sym, Caboodle::Site[k].to_s
271
137
  end
272
138
  else
273
139
  self.optional_settings << keys
274
140
  end
275
- self.optional_settings end
141
+ self.optional_settings
142
+ end
276
143
 
277
144
  def stylesheets array_of_css_files
278
145
  if array_of_css_files.class == Array
@@ -351,7 +218,74 @@ module Caboodle
351
218
  OptionalSettings[kit_name] ||= []
352
219
  OptionalSettings[kit_name]
353
220
  end
221
+
222
+ def register_kit ask=true
223
+ ask_user_for_missing_settings if ask
224
+ Site.kits << name
225
+ Site.kits.uniq!
226
+ Caboodle::Kits << self
227
+ Caboodle::Kits
228
+ end
229
+
230
+ def unregister_kit
231
+ Caboodle::Kits.delete(self)
232
+ Caboodle::Site.kits.delete(self.to_s)
233
+ Caboodle::Kit.dump_config
234
+ Caboodle::Kits
235
+ end
236
+
237
+ def ask_user r, optional=false
238
+ unless ENV["RACK_ENV"] == "production"
239
+ puts " "
240
+ opt = "Optional: " if optional
241
+ puts "#{opt}Please set a value for #{r}:"
242
+ v = STDIN.gets
243
+ Caboodle::Site[r] = v
244
+ Caboodle::Kit.dump_config
245
+ end
246
+ end
247
+
248
+ def ask_user_for_missing_settings
249
+ required_settings.each do |r|
250
+ if Caboodle::Site[r].blank?
251
+ ask_user r
252
+ end
253
+ puts self
254
+ self.set r.to_s.to_sym, Caboodle::Site[r].to_s
255
+ end
256
+ optional_settings.each do |r|
257
+ unless defined?(Caboodle::Site[r])
258
+ ask_user r, true
259
+ end
260
+ self.set r.to_s.to_sym, Caboodle::Site[r].to_s
261
+ end
262
+ end
263
+
264
+ def ask_user_for_all_missing_settings
265
+ Caboodle::Kits.each do |kit|
266
+ kit.ask_user_for_missing_settings
267
+ end
268
+ end
354
269
 
270
+ def dump_config
271
+ begin
272
+ puts "Dump config to: #{config_path}"
273
+ p = config_path
274
+ d = Caboodle::Site.clone
275
+ e = d.to_hash
276
+ e.delete("required_settings")
277
+ File.open(p, 'w') {|f| f.write(YAML::dump(e))}
278
+ rescue
279
+ puts "Cannot write to config file: #{p}"
280
+ end
281
+ end
282
+
283
+ def configure_site configuration_yaml_path
284
+ self.set :config_path, configuration_yaml_path
285
+ Caboodle::Config.load_config(open(configuration_yaml_path).read)
286
+ Caboodle::Config.setup
287
+ end
288
+
355
289
  def kit_name
356
290
  self.ancestors.first.to_s.split("::").last
357
291
  end
@@ -361,7 +295,6 @@ module Caboodle
361
295
  end
362
296
 
363
297
  def start
364
-
365
298
  errors = []
366
299
  self.required_settings.each do |s|
367
300
  if Site[s].blank?
@@ -378,6 +311,7 @@ module Caboodle
378
311
  Caboodle::Errors << Hashie::Mash.new(:title=>"#{kit_name} is disable", :reason=>errors.join(";"))
379
312
  end
380
313
  end
314
+
381
315
  end
382
316
  end
383
317
  end
@@ -7,7 +7,7 @@ class Caboodle::Analytics < Caboodle::Kit
7
7
  if ENV["RACK_ENV"] == "production"
8
8
  add_layout :after_body, "<script type=\"text/javascript\">
9
9
  var _gaq = _gaq || [];
10
- _gaq.push(['_setAccount', '#{Caboodle::Site.analytics_id}']);
10
+ _gaq.push(['_setAccount', '#{analytics_id}']);
11
11
  _gaq.push(['_setDomainName', 'none']);
12
12
  _gaq.push(['_setAllowLinker', true]);
13
13
  _gaq.push(['_trackPageview']);
@@ -6,5 +6,5 @@ class Caboodle::Beta < Caboodle::Kit
6
6
 
7
7
  add_sass ["beta"]
8
8
 
9
- add_layout :above_header, "<div id='beta'><p>#{Caboodle::Site.beta_message}</p></div>"
9
+ add_layout :above_header, "<div id='beta'><p>#{beta_message}</p></div>"
10
10
  end
@@ -6,7 +6,7 @@ module Caboodle
6
6
 
7
7
  required [:carbonmade_url]
8
8
 
9
- credit Caboodle::Site.carbonmade_url, "Carbonmade portfolio"
9
+ credit carbonmade_url, "Carbonmade portfolio"
10
10
 
11
11
  add_sass ["carbonmade"]
12
12
  end
@@ -1,2 +1,2 @@
1
1
  #carbonmade.page
2
- %iframe#carbonmade{:scrolling=>"no",:src=>Caboodle::Site.carbonmade_url}
2
+ %iframe#carbonmade{:scrolling=>"no",:src=>@carbonmade_url}
@@ -1,12 +1,10 @@
1
1
  module Caboodle
2
- class Debugger < Caboodle::Kit
3
-
4
- Caboodle::Debug.each do |debug|
5
- Caboodle::Layout.below_footer = "<div id='debug'>"
6
- Caboodle::Layout.below_footer << "<p>#{debug}</p>"
7
- Caboodle::Layout.below_footer << "</div>"
2
+ class Debugger < Caboodle::Kit
3
+ Debug.each do |debug|
4
+ Layout.below_footer = "<div id='debug'>"
5
+ Layout.below_footer << "<p>#{debug}</p>"
6
+ Layout.below_footer << "</div>"
8
7
  end
9
-
10
8
  end
11
9
  end
12
10
 
@@ -3,11 +3,11 @@
3
3
  var disqus_developer = true;
4
4
 
5
5
  #disqus.page
6
- - if Caboodle::Site.disqus
6
+ - if disqus
7
7
  #disqus_thread
8
- %script{:src => "http://disqus.com/forums/#{Caboodle::Site.disqus}/embed.js", :type => "text/javascript"}
8
+ %script{:src => "http://disqus.com/forums/#{@disqus}/embed.js", :type => "text/javascript"}
9
9
  %noscript
10
- %a{:href => "http://#{Caboodle::Site.disqus}.disqus.com/?url=ref"} View the discussion thread.
10
+ %a{:href => "http://#{@disqus}.disqus.com/?url=ref"} View the discussion thread.
11
11
  %a.dsq-brlink{:href => "http://disqus.com"}
12
12
  Discussion powered by
13
13
  %span.logo-disqus Disqus
@@ -12,7 +12,7 @@ module Caboodle
12
12
  doc = ::Nokogiri::XML.parse(open(url).read)
13
13
  val = doc.css("owner").first.attributes["nsid"].value
14
14
  Site.flickr_user_id = val
15
- Caboodle::Kit.dump_config
15
+ Config.dump_config
16
16
  end
17
17
  Site.flickr_user_id
18
18
  end
@@ -22,7 +22,7 @@ module Caboodle
22
22
  end
23
23
 
24
24
  declare "photosets" do |r|
25
- r.url = "http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=#{Site.flickr_api_key}&user_id=#{Caboodle::FlickrAPI.flickr_user_id}"
25
+ r.url = "http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=#{Site.flickr_api_key}&user_id=#{FlickrAPI.flickr_user_id}"
26
26
  r.via = :get
27
27
  end
28
28
 
@@ -51,6 +51,8 @@ module Caboodle
51
51
 
52
52
  description "A browsable Flickr.com gallery with sets"
53
53
 
54
+ required [:flickr_username, :flickr_api_key]
55
+
54
56
  menu "Photography" do
55
57
  @photosets = FlickrAPI.photosets rescue []
56
58
  haml :photography
@@ -59,17 +61,15 @@ module Caboodle
59
61
  get "/photography/:set_id" do |set_id|
60
62
  @photosets = FlickrAPI.photosets rescue []
61
63
  @set_id = set_id
62
- @photoset = Caboodle::FlickrAPI.photoset_info(@set_id) rescue nil
64
+ @photoset = FlickrAPI.photoset_info(@set_id) rescue nil
63
65
  @title = "Photography: #{@photoset.title if @photoset.respond_to?(:title)}"
64
66
  haml :photography
65
67
  end
66
68
 
67
- required [:flickr_username, :flickr_api_key]
68
-
69
69
  javascripts ["/galleria.noconflict.min.js"]
70
70
 
71
71
  add_sass ["photography"]
72
72
 
73
- credit "http://flickr.com/#{Caboodle::Site.flickr_username}"
73
+ credit "http://flickr.com/#{flickr_username}", "#{flickr_username} on Flickr.com"
74
74
  end
75
75
  end
@@ -8,9 +8,9 @@
8
8
  jQuery(document).ready(function(){
9
9
 
10
10
  var ifo = {
11
- Api : '#{Caboodle::Site.flickr_api_key}', //flickr api
11
+ Api : '#{@flickr_api_key}', //flickr api
12
12
  Set : '#{@set_id}', //photo set
13
- fLink : 'http://www.flickr.com/photos/#{Caboodle::Site.flickr_username}/',
13
+ fLink : 'http://www.flickr.com/photos/#{@flickr_username}/',
14
14
  Cant : 24
15
15
  };
16
16
 
@@ -18,21 +18,21 @@ module Caboodle
18
18
 
19
19
  required [:github_username]
20
20
 
21
- credit "http://github.com/#{Site.github_username}", "Fork #{Site.github_username} on Github"
21
+ credit "http://github.com/#{github_username}", "Fork #{github_username} on Github"
22
22
  end
23
23
 
24
24
  class GithubAPI < Weary::Base
25
25
 
26
- declare "repositories" do |r|
27
- r.url = "http://github.com/api/v2/json/repos/show/#{Caboodle::Site.github_username}"
28
- r.via = :get
29
- end
30
-
31
- def self.repositories
32
- a = Hashie::Mash.new(GithubAPI.new.repositories.perform_sleepily.parse).repositories
33
- puts a.inspect
34
- a
35
- end
26
+ declare "repositories" do |r|
27
+ r.url = "http://github.com/api/v2/json/repos/show/#{Caboodle::Site.github_username}"
28
+ r.via = :get
29
+ end
30
+
31
+ def self.repositories
32
+ a = Hashie::Mash.new(GithubAPI.new.repositories.perform_sleepily.parse).repositories
33
+ puts a.inspect
34
+ a
35
+ end
36
36
 
37
37
  end
38
38
  end
@@ -10,14 +10,14 @@ module Caboodle
10
10
  stylesheets ["http://www.google.com/uds/solutions/mapsearch/gsmapsearch.css", "http://www.google.com/uds/css/gsearch.css"]
11
11
 
12
12
  before do
13
- @locations = Config.google_local_locations
14
- @location = Config.google_local_locations.first
13
+ @locations = Settings.google_local_locations
14
+ @location = Settings.google_local_locations.first
15
15
  end
16
16
 
17
17
  menu "Near me"
18
18
 
19
19
  get "/near_me/:slug" do
20
- Config.google_local_locations.each do |loc|
20
+ Settings.google_local_locations.each do |loc|
21
21
  if loc.title.downcase.gsub(" ","-") == params[:slug]
22
22
  @location = loc
23
23
  end
@@ -9,8 +9,8 @@
9
9
  %span
10
10
  Loading...
11
11
 
12
- %script{:src=>"http://maps.google.com/maps?file=api&v=2&key=#{Caboodle::Site.google_maps_api_key}", :type=>"text/javascript"}
13
- %script{:src=>"http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-msw&key=#{Caboodle::Site.google_maps_api_key}", :type=>"text/javascript"}
12
+ %script{:src=>"http://maps.google.com/maps?file=api&v=2&key=#{@google_maps_api_key}", :type=>"text/javascript"}
13
+ %script{:src=>"http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-msw&key=#{@google_maps_api_key}", :type=>"text/javascript"}
14
14
  :javascript
15
15
  window._uds_msw_donotrepair = true;
16
16
  %script{:src=>"http://www.google.com/uds/solutions/mapsearch/gsmapsearch.js?mode=new", :type=>"text/javascript"}
@@ -19,7 +19,7 @@
19
19
  function LoadMapSearchControl() {
20
20
  var options = {
21
21
  zoomControl : GSmapSearchControl.ZOOM_CONTROL_ENABLE_ALL,
22
- title : '#{Caboodle::Site.title}',
22
+ title : '#{title}',
23
23
  url : '#{request.host}',
24
24
  idleMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM+1,
25
25
  activeMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM+1
@@ -1,15 +1,17 @@
1
1
  require 'digest/md5'
2
2
 
3
- class Caboodle::Gravatar < Caboodle::Kit
3
+ module Caboodle
4
+ class Gravatar < Caboodle::Kit
4
5
 
5
- description "Sets the logo of the site to your gravatar.com image"
6
+ description "Sets the logo of the site to your gravatar.com image"
6
7
 
7
- optional [:email]
8
+ optional [:email]
8
9
 
9
- configure do
10
- if Caboodle::Site.logo_url.to_s.blank? && !Caboodle::Site.email.to_s.blank?
11
- hash = Digest::MD5.hexdigest(Caboodle::Site.email)
12
- Caboodle::Site.logo_url = "http://www.gravatar.com/avatar/#{hash}"
10
+ configure do
11
+ if Site.logo_url.to_s.blank? && !Site.email.to_s.blank?
12
+ hash = Digest::MD5.hexdigest(Site.email)
13
+ Site.logo_url = "http://www.gravatar.com/avatar/#{hash}"
14
+ end
13
15
  end
14
16
  end
15
17
  end
@@ -1,8 +1,8 @@
1
1
  - #todo - this should be a vcalendar
2
2
  #history.page
3
3
  %dl
4
- - if Caboodle::History::Config.history_years.respond_to?(:sort)
5
- - Caboodle::History::Config.history_years.sort.reverse.each do |year,items|
4
+ - if @history_years.respond_to?(:sort)
5
+ - @history_years.sort.reverse.each do |year,items|
6
6
  %dt.year{:class=>year}
7
7
  = year
8
8
  %dd
@@ -1,4 +1,5 @@
1
1
  class Caboodle::Jquery < Caboodle::Kit
2
2
  description "Adds Jquery to every page of the site"
3
+ optional [:jquery_version]
3
4
  javascripts ["http://ajax.googleapis.com/ajax/libs/jquery/#{Caboodle::Site.jquery_version || "1.4.2"}/jquery.min.js"]
4
5
  end
@@ -4,12 +4,8 @@ class Caboodle::Lastfm < Caboodle::Kit
4
4
 
5
5
  required [:lastfm_username]
6
6
 
7
- def scrape
8
- @last ||= Caboodle.scrape("http://www.last.fm/user/#{Caboodle::Site.lastfm_username}")
9
- end
10
-
11
7
  menu "Listening" do
12
-
8
+ scrape = Caboodle.scrape("http://www.last.fm/user/#{Caboodle::Site.lastfm_username}")
13
9
  @recent = scrape.css("#recentTracks .module-body").to_html
14
10
  @recent.gsub!("href=\"/", 'href="http://last.fm/')
15
11
  @top = scrape.css(".modulechartsartists .module-body").to_html
@@ -18,6 +14,6 @@ class Caboodle::Lastfm < Caboodle::Kit
18
14
  haml :listening
19
15
  end
20
16
 
21
- credit "http://www.last.fm/listen/user/#{Caboodle::Site.lastfm_username}", "#{Caboodle::Site.lastfm_username} on Last.fm"
17
+ credit "http://www.last.fm/listen/user/#{lastfm_username}", "#{lastfm_username} on Last.fm"
22
18
 
23
19
  end
@@ -5,9 +5,9 @@ module Caboodle
5
5
  attr_accessor :full
6
6
 
7
7
  def initialize
8
- @full = Caboodle.scrape(Caboodle::Site.linkedin_profile_url)
8
+ @full = Caboodle.scrape(Site.linkedin_profile_url)
9
9
  @full.css('.showhide-link').each{|a| @full.delete(a)}
10
- @full = @full.css("#main").to_html.gsub("#{Caboodle::Site.linkedin_full_name}’s ","")
10
+ @full = @full.css("#main").to_html.gsub("#{Site.linkedin_full_name}’s ","")
11
11
  end
12
12
  def method_missing(method_name)
13
13
  @data.send(method_name.to_sym)
@@ -25,7 +25,7 @@ module Caboodle
25
25
 
26
26
  required [:linkedin_full_name, :linkedin_profile_url]
27
27
 
28
- credit Caboodle::Site.linkedin_profile_url, "Linkedin profile"
28
+ credit linkedin_profile_url, "Linkedin profile"
29
29
 
30
30
  add_sass ["linkedin"]
31
31
 
@@ -7,6 +7,6 @@ module Caboodle
7
7
 
8
8
  required [:onepage_username]
9
9
 
10
- credit "http://myonepage.com/#{Caboodle::Site.onepage_username}"
10
+ credit "http://myonepage.com/#{onepage_username}"
11
11
  end
12
12
  end
@@ -1,2 +1,2 @@
1
1
  #onepage.page
2
- %iframe#onepage{:scrolling=>"no",:src=>"http://myonepage.com/#{Caboodle::Site.onepage_username}/widget"}
2
+ %iframe#onepage{:scrolling=>"no",:src=>"http://myonepage.com/#{@onepage_username}/widget"}
@@ -7,20 +7,20 @@ module Caboodle
7
7
  class PosterousAPI < Weary::Base
8
8
 
9
9
  def initialize(opts={})
10
- Caboodle::Site.posterous_password ||= ENV["posterous_password"]
11
- self.credentials(opts[:username] || Caboodle::Site.posterous_username, opts[:password] || Caboodle::Site.posterous_password)
12
- sitename = opts[:sitename] || Caboodle::Site.posterous_sitename
13
- unless defined?(Caboodle::Site.posterous_site_id)
10
+ Site.posterous_password ||= ENV["posterous_password"]
11
+ self.credentials(opts[:username] || Site.posterous_username, opts[:password] || Site.posterous_password)
12
+ sitename = opts[:sitename] || Site.posterous_sitename
13
+ unless defined?(Site.posterous_site_id)
14
14
  sites = Hashie::Mash.new(getsites.perform_sleepily.parse).rsp.site
15
15
 
16
16
  sites.each do |site|
17
- if site.url.include?("http://#{Caboodle::Site.posterous_sitename}.posterous.com")
18
- Caboodle::Site.posterous_site_id = site.id
17
+ if site.url.include?("http://#{Site.posterous_sitename}.posterous.com")
18
+ Site.posterous_site_id = site.id
19
19
  end
20
20
  end
21
21
  end
22
22
 
23
- self.defaults = {:site_id => Caboodle::Site.posterous_site_id}
23
+ self.defaults = {:site_id => Site.posterous_site_id}
24
24
  end
25
25
 
26
26
  declare "getsites" do |r|
@@ -50,14 +50,12 @@ module Caboodle
50
50
  end
51
51
 
52
52
  def self.from_slug(slug)
53
- doc = Caboodle.scrape("http://#{Caboodle::Site.posterous_sitename}.posterous.com/#{slug}")
53
+ doc = Caboodle.scrape("http://#{Site.posterous_sitename}.posterous.com/#{slug}")
54
54
  opts = {}
55
55
  opts["body"] = doc.css('div.bodytext').inner_html
56
56
  opts["title"] = doc.css('title').inner_html.split(" - ").first
57
- opts["link"] = "http://#{Caboodle::Site.posterous_sitename}.posterous.com/#{slug}"
57
+ opts["link"] = "http://#{Site.posterous_sitename}.posterous.com/#{slug}"
58
58
  perma = doc.css('.permalink').inner_html
59
- STDERR.puts "Opts: #{opts.inspect}"
60
- STDERR.puts "Perma: #{perma}"
61
59
  opts["date"] = Date.parse(perma)
62
60
  PosterousPost.new(opts)
63
61
  end
@@ -69,9 +67,8 @@ module Caboodle
69
67
 
70
68
  def self.all(opts={})
71
69
  r = []
72
- STDERR.puts "All posts for: #{opts.inspect}"
73
70
  p = PosterousAPI.new
74
- opts[:site_id] = Caboodle::Site.posterous_site_id
71
+ opts[:site_id] = Site.posterous_site_id
75
72
  rsp = p.all(opts).perform_sleepily.parse["rsp"]
76
73
  rsp["post"].each{|a| r << PosterousPost.new(a)} if rsp["post"]
77
74
  r
@@ -122,7 +119,7 @@ module Caboodle
122
119
  end
123
120
 
124
121
  def full_url
125
- Caboodle::Site.url_base.gsub(/\/$/, '') + url
122
+ Site.url_base.gsub(/\/$/, '') + url
126
123
  end
127
124
 
128
125
  def slug
@@ -134,6 +131,10 @@ module Caboodle
134
131
 
135
132
  description "Displays a Posterous blog with permalinks, pagination and commends if the Disqus kit is included"
136
133
 
134
+ required [:posterous_sitename, :posterous_username, :posterous_password]
135
+
136
+ optional [:disqus]
137
+
137
138
  get "/posterous/:page_number" do |page_number|
138
139
  @posts = PosterousPost.page(page_number)
139
140
  not_found if @posts.class == Array && @posts.blank?
@@ -153,16 +154,12 @@ module Caboodle
153
154
  @posts = PosterousPost.all(:page=>(params[:page] || 1))
154
155
  haml :posts.to_sym
155
156
  end
156
-
157
- required [:posterous_sitename, :posterous_username, :posterous_password]
158
-
159
- optional [:disqus]
160
-
161
- stylesheets ["http://disqus.com/stylesheets/#{Caboodle::Site.disqus}/disqus.css?v=2.0"]
157
+
158
+ stylesheets ["http://disqus.com/stylesheets/#{disqus}/disqus.css?v=2.0"] if disqus
162
159
 
163
160
  rss ["feed://stef.posterous.com/rss.xml"]
164
161
 
165
- credit "http://#{Caboodle::Site.posterous_sitename}.posterous.com", "#{Caboodle::Site.posterous_sitename} on Posterous"
162
+ credit "http://#{posterous_sitename}.posterous.com", "#{posterous_sitename} on Posterous"
166
163
 
167
164
  add_sass ["posterous"]
168
165
  end
@@ -1,5 +1,6 @@
1
1
  class Caboodle::SEO < Caboodle::Kit
2
2
  description "Adds basic search engine optimisation"
3
- add_layout :meta, "<meta type='keywords' value='#{Caboodle::Site.seo_keywords}' /><meta type='description' value='#{Caboodle::Site.seo_description}' />"
4
3
  optional [:seo_keywords,:seo_description]
4
+ add_layout :meta, "<meta type='keywords' value='#{seo_keywords}' />" if seo_keywords
5
+ add_layout :meta, "<meta type='description' value='#{seo_description}' />" if seo_description
5
6
  end
@@ -1,4 +1,6 @@
1
- class Skimmed < Caboodle::Kit
2
- javascripts ["http://skimlinks.com/js/#{Caboodle::Site.skimmed}.js"]
3
- required [:skimmed]
1
+ module Caboodle
2
+ class Skimmed < Caboodle::Kit
3
+ javascripts ["http://skimlinks.com/js/#{Site.skimmed}.js"]
4
+ required [:skimmed]
5
+ end
4
6
  end
@@ -6,12 +6,12 @@
6
6
  = mix.title
7
7
  %dd
8
8
  - url = "http%3A%2F%2Fsoundcloud.com%2F#{mix.user.permalink}%2Fsets%2F#{mix.permalink}"
9
- - if Caboodle::Site.soundcloud_widget == "comments"
9
+ - if soundcloud_widget == "comments"
10
10
  :plain
11
11
  <object height="136" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=#{url}"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="136" src="http://player.soundcloud.com/player.swf?url=#{url}" type="application/x-shockwave-flash" width="100%"></embed> </object>
12
- - elsif Caboodle::Site.soundcloud_widget == "tiny"
12
+ - elsif soundcloud_widget == "tiny"
13
13
  :plain
14
14
  <object height="18" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=#{url}&amp;auto_play=false&amp;player_type=tiny&amp;font=Arial&amp;color=0066cc"> <param name="allowscriptaccess" value="always"> <embed allowscriptaccess="always" height="18" src="http://player.soundcloud.com/player.swf?url=#{url}&amp;auto_play=false&amp;player_type=tiny&amp;font=Arial&amp;color=0066cc" type="application/x-shockwave-flash" width="100%"> </object>
15
- - else Caboodle::Site.soundcloud_widget == "artwork"
15
+ - else soundcloud_widget == "artwork"
16
16
  :plain
17
17
  <object height="200" width="200"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=#{url}&amp;auto_play=false&amp;player_type=artwork&amp;color=0066cc"> <param name="allowscriptaccess" value="always"> <embed allowscriptaccess="always" height="200" src="http://player.soundcloud.com/player.swf?url=#{url}&amp;auto_play=false&amp;player_type=artwork&amp;color=0066cc" type="application/x-shockwave-flash" width="200"> </object>
@@ -1,8 +1,9 @@
1
1
  class Caboodle::Standard < Caboodle::Kit
2
- description "The default home page and site options"
2
+ description "The default home page"
3
3
  required [:title, :description, :author]
4
4
  optional [:logo_url]
5
- if Caboodle::Site.home_kit.blank?
5
+ puts "Home kit: #{Caboodle::Site.home_kit}"
6
+ if Caboodle::Site.home_kit.blank? || Caboodle::Site.home_kit =="Standard"
6
7
  puts "Using the default home kit - you will want to run 'caboodle kit:home <kit name>' to specify your own kit"
7
8
  get "/" do
8
9
  haml :standard
@@ -1,4 +1,4 @@
1
- #standard.page
1
+ #standard.page.thin_page
2
2
  %h2
3
3
  Welcome to Caboodle
4
4
 
@@ -15,8 +15,8 @@ module Caboodle
15
15
  get("/susy/:name.css") do
16
16
  content_type 'text/css', :charset => 'utf-8'
17
17
  sass_dir = File.expand_path(File.join(File.dirname(__FILE__),"views","susy"))
18
- load_paths = [Caboodle::App.root, File.join(Caboodle::App.root,"views"), File.join(Caboodle::App.root,"views","stylesheets"), sass_dir] + ::Compass.sass_engine_options[:load_paths]
19
- Caboodle::Kits.each do |name|
18
+ load_paths = [App.root, File.join(App.root,"views"), File.join(App.root,"views","stylesheets"), sass_dir] + ::Compass.sass_engine_options[:load_paths]
19
+ Kits.each do |name|
20
20
  kit_name = name.to_s.split("::").last || name
21
21
  kit_name = kit_name.downcase
22
22
  path = File.expand_path(File.join(File.dirname(__FILE__),"..",kit_name,"views"))
@@ -26,7 +26,7 @@ module Caboodle
26
26
  options = {:sass_dir => sass_dir, :syntax => :scss, :load_paths => load_paths}
27
27
  the_sass = open(File.join(File.dirname(__FILE__),"views","susy","screen.scss")).read
28
28
  imported_files = []
29
- Caboodle::SASS.each do |s|
29
+ SASS.each do |s|
30
30
  the_sass << "\n"
31
31
  add_file = "@import \"#{s}\";"
32
32
  imported_files << add_file
@@ -1,36 +1,37 @@
1
1
  gem "tumblr-rb"
2
2
  require 'tumblr'
3
3
 
4
- class Caboodle::Tumblr < Caboodle::Kit
5
- description "Includes a tumblr.com account"
4
+ module Caboodle
5
+ class Tumblr < Caboodle::Kit
6
+ description "Includes a tumblr.com account"
6
7
 
7
- helpers do
8
- def semantic_date post
9
- date = Date.parse(post.date)
10
- a = []
11
- a << "slug-#{post.slug}"
12
- a << "y#{date.year}"
13
- a << "m#{date.month}"
14
- a << "d#{date.day}"
15
- a.join(" ")
8
+ helpers do
9
+ def semantic_date post
10
+ date = Date.parse(post.date)
11
+ a = []
12
+ a << "slug-#{post.slug}"
13
+ a << "y#{date.year}"
14
+ a << "m#{date.month}"
15
+ a << "d#{date.day}"
16
+ a.join(" ")
17
+ end
16
18
  end
17
- end
18
19
 
19
- required [:tumblr_email, :tumblr_password, :tumblr_sitename]
20
-
21
- menu "Tumblr" do
22
- tumblr = ::Tumblr::Reader.new(Caboodle::Site.tumblr_email,Caboodle::Site.tumblr_password)
23
- req = tumblr.read(Caboodle::Site.tumblr_sitename, {:num=>10}).perform_sleepily
24
- posts = ::Tumblr::Reader.get_posts(req)
25
- haml :tumblr, :locals => { :posts => posts }
26
- end
20
+ required [:tumblr_email, :tumblr_password, :tumblr_sitename]
27
21
 
28
- get "/tumblr/page/:page" do
29
- tumblr = ::Tumblr::Reader.new(Caboodle::Site.tumblr_email,Caboodle::Site.tumblr_password)
30
- posts = tumblr.get_posts()
31
- haml :tumblr, :locals => { :posts => posts }
32
- end
22
+ menu "Tumblr" do
23
+ tumblr = ::Tumblr::Reader.new(@tumblr_email,@tumblr_password)
24
+ req = tumblr.read(@tumblr_sitename, {:num=>10}).perform_sleepily
25
+ posts = ::Tumblr::Reader.get_posts(req)
26
+ haml :tumblr, :locals => { :posts => posts }
27
+ end
33
28
 
34
- add_sass ["tumblr"]
29
+ get "/tumblr/page/:page" do
30
+ tumblr = ::Tumblr::Reader.new(@tumblr_email,@tumblr_password)
31
+ posts = tumblr.get_posts()
32
+ haml :tumblr, :locals => { :posts => posts }
33
+ end
35
34
 
35
+ add_sass ["tumblr"]
36
+ end
36
37
  end
@@ -6,7 +6,7 @@
6
6
  %aside.entry-meta
7
7
  %span.meta-prep.meta-prep-author By
8
8
  %span.author.vcard
9
- %a.url.fn.n{:href => "/about", :title => "About the author"}= Caboodle::Site.author
9
+ %a.url.fn.n{:href => "/about", :title => "About the author"}= author
10
10
  %span.meta-sep.meta-sep-entry-date |
11
11
  %span.meta-prep.meta-prep-entry-date Published:
12
12
  %span.entry-date
@@ -1,11 +1,23 @@
1
- class Caboodle::Twitter < Caboodle::Kit
2
- description "Display recent tweets from a given twitter account, with infinite scrolling for looking back in time."
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ module Caboodle
5
+ class Twitter < Caboodle::Kit
6
+ description "Display recent tweets from a given twitter account, with infinite scrolling for looking back in time."
3
7
 
4
- menu "Twitter"
8
+ required [:twitter_username]
5
9
 
6
- required [:twitter_username]
10
+ menu "Twitter"
7
11
 
8
- credit "http://twitter.com/#{Caboodle::Site.twitter_username}", "Follow @#{Caboodle::Site.twitter_username} on Twitter"
12
+ configure do
13
+ if Site.logo_url.to_s.blank? && !Site.twitter_username.to_s.blank?
14
+ xml = Nokogiri::XML(open("http://twitter.com/users/#{Site.twitter_username}.xml").read)
15
+ Site.logo_url = xml.css("profile_image_url").children.first.to_s
16
+ end
17
+ end
9
18
 
10
- add_sass ["twitter"]
19
+ credit "http://twitter.com/#{twitter_username}", "Follow @#{twitter_username} on Twitter"
20
+
21
+ add_sass ["twitter"]
22
+ end
11
23
  end
@@ -34,7 +34,7 @@
34
34
  /**
35
35
  * Username to load the timeline from
36
36
  */
37
- var username = '#{Caboodle::Site.twitter_username}';
37
+ var username = '#{@twitter_username}';
38
38
 
39
39
  /**
40
40
  * Variable for the current page
@@ -1,8 +1,8 @@
1
1
  module Caboodle
2
2
  class Typekit < Caboodle::Kit
3
3
  description "Adds support for Typekit.com CSS options"
4
- javascripts ["http://use.typekit.com/#{Caboodle::Site.typekit}.js","/typekit.js"]
5
4
  required [:typekit]
6
5
  add_sass ["typekit"]
6
+ javascripts ["http://use.typekit.com/#{typekit}.js","/typekit.js"]
7
7
  end
8
8
  end
@@ -1,2 +1,3 @@
1
- %h2
2
- Simple layout
1
+ .page.vimeo.thin_page
2
+ %h2
3
+ Simple layout
@@ -0,0 +1,7 @@
1
+ .page.thin_page.youtube
2
+ - @videos.each do |video|
3
+ %article.youtube_video
4
+ %h2
5
+ = video.title
6
+ = video.embed_html
7
+
@@ -0,0 +1,16 @@
1
+ require 'youtube_g'
2
+
3
+ module Caboodle
4
+ class Youtube < Caboodle::Kit
5
+ description "Display's a user's public videos as a page"
6
+
7
+ required [:youtube_username]
8
+
9
+ menu "Youtube" do
10
+ client = YouTubeG::Client.new
11
+ @videos = client.videos_by(:user => @youtube_username).videos
12
+ haml :youtube
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ module Sinatra
2
+ class Base
3
+ def markdown sym
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"
7
+ end
8
+ end
9
+ 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: 55
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 16
10
- version: 0.2.16
9
+ - 18
10
+ version: 0.2.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stef Lewandowski
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-02 00:00:00 +01:00
18
+ date: 2010-09-04 00:00:00 +01:00
19
19
  default_executable: caboodle
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -351,6 +351,9 @@ files:
351
351
  - lib/caboodle/kits/typekit/views/typekit.scss
352
352
  - lib/caboodle/kits/vimeo/views/vimeo.haml
353
353
  - lib/caboodle/kits/vimeo/vimeo.rb
354
+ - lib/caboodle/kits/youtube/views/youtube.haml
355
+ - lib/caboodle/kits/youtube/youtube.rb
356
+ - lib/caboodle/markdown.rb
354
357
  - lib/caboodle/scrape.rb
355
358
  - test/helper.rb
356
359
  - test/test_caboodle.rb