caboodle 0.2.2 → 0.2.3

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.2
1
+ 0.2.3
@@ -29,16 +29,16 @@
29
29
  = before_header
30
30
  %header#site-header
31
31
  = above_header
32
- - if Caboodle::Site.logo_url
32
+ - unless Caboodle::Site.logo_url.blank?
33
33
  #logo
34
34
  %a{:href => "/", :rel => "home", :title => Caboodle::Site.title }
35
35
  %img{:src=>Caboodle::Site.logo_url, :width=>"64", :height=>"64"}
36
- - if Caboodle::Site.title
36
+ - unless Caboodle::Site.title.blank?
37
37
  #site-title
38
38
  %h1
39
39
  %a{:href => "/", :rel => "home", :title => Caboodle::Site.title }
40
40
  = Caboodle::Site.title
41
- - if Caboodle::Site.description
41
+ - unless Caboodle::Site.description.blank?
42
42
  #site-description
43
43
  %h2= Caboodle::Site.description
44
44
  #access
@@ -16,7 +16,6 @@ module Caboodle
16
16
  puts `cd #{args.first} && git add .`
17
17
  puts `cd #{args.first} && git commit -m"initial setup"`
18
18
  puts `cd #{args.first} && heroku create #{args.first}`
19
- puts `cd #{args.first} && git push heroku master`
20
19
 
21
20
  when /kit:add/
22
21
  Caboodle::Kit.load_kit args.first.capitalize
data/lib/caboodle/kit.rb CHANGED
@@ -74,14 +74,16 @@ module Caboodle
74
74
  unless name.blank?
75
75
  kit_name = name.to_s.split("::").last || name
76
76
  kit_name = kit_name.downcase
77
- puts "Loading Kit: #{kit_name}"
77
+ puts "))) Loading Kit: #{kit_name}"
78
78
  orig = Caboodle.constants
79
79
  require "caboodle/kits/#{kit_name}/#{kit_name}" #rescue puts "Problem loading Kit: #{kit_name}"
80
80
  added = Caboodle.constants - orig
81
+ puts added
81
82
  added.each do |d|
82
83
  c = Caboodle.const_get(d)
83
84
  if c.respond_to?(:is_a_caboodle_kit)
84
- c.register
85
+ puts "*** Register #{c}"
86
+ c.register_kit
85
87
  end
86
88
  end
87
89
  end
@@ -92,36 +94,42 @@ module Caboodle
92
94
  unless name.blank?
93
95
  kit_name = name.to_s.split("::").last || name
94
96
  kit_name = kit_name.downcase
95
- puts "Loading Kit: #{kit_name}"
97
+ puts "Unloading Kit: #{kit_name}"
96
98
  orig = Caboodle.constants
97
99
  require "caboodle/kits/#{kit_name}/#{kit_name}" #rescue puts "Problem loading Kit: #{kit_name}"
98
100
  added = Caboodle.constants - orig
99
101
  added.each do |d|
100
102
  c = Caboodle.const_get(d)
101
103
  if c.respond_to?(:is_a_caboodle_kit)
102
- c.unregister
104
+ c.unregister_kit
103
105
  end
104
106
  end
105
107
  end
106
108
  Caboodle::Kits
107
109
  end
108
110
 
109
- def register
111
+ def name
112
+ self.to_s.split("::").last
113
+ end
114
+
115
+ def register_kit
110
116
  required_settings.each do |r|
111
- unless Caboodle::Site[r]
117
+ puts "checking #{r}"
118
+ puts "value: #{Caboodle::Site[r]}"
119
+ if Caboodle::Site[r].blank?
112
120
  puts "Please set a value for #{r}:"
113
121
  v = STDIN.gets
114
122
  Caboodle::Site[r] = v
115
123
  Caboodle::Kit.dump_config
116
124
  end
117
125
  end
118
- Site.kits << self.to_s.split("::").last
126
+ Site.kits << name
119
127
  Site.kits.uniq!
120
128
  Caboodle::Kits << self
121
129
  Caboodle::Kits
122
130
  end
123
131
 
124
- def unregister
132
+ def unregister_kit
125
133
  Caboodle::Kits.delete(self)
126
134
  Caboodle::Site.kits.delete(self.to_s)
127
135
  Caboodle::Kit.dump_config
@@ -145,6 +153,9 @@ module Caboodle
145
153
  path = "/" if Site.home_kit == self.to_s.gsub("Caboodle::","")
146
154
  Caboodle::MenuItems << {:display=>display, :link=>path, :kit=>self}
147
155
  self.get path, &block
156
+ if Site.home_kit.blank?
157
+ Site.home_kit = name
158
+ end
148
159
  end
149
160
 
150
161
  def required keys
@@ -1,14 +1,18 @@
1
+ require "open-uri"
2
+
1
3
  module Caboodle
2
4
 
3
5
  class FlickrAPI < Weary::Base
4
6
 
5
7
  def self.flickr_user_id
6
8
  return Site.flickr_user_id unless Site.flickr_user_id.blank?
7
- url = "http://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Fisithackday.com%2Fapi%2Fflickr.whois.xml%22%20as%20flickr.whois%3Bselect%20*%20from%20flickr.whois%20where%20owner%3D%22#{Site.flickr_username}%22&format=xml"
8
- doc = Nokogiri::XML.parse(open(url))
9
- val = doc.css("owner").first.attributes["nsid"].value
10
- Site.flickr_user_id = val
11
- Caboodle::Kit.dump_config
9
+ unless Site.flickr_username.blank?
10
+ url = "http://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Fisithackday.com%2Fapi%2Fflickr.whois.xml%22%20as%20flickr.whois%3Bselect%20*%20from%20flickr.whois%20where%20owner%3D%22#{Site.flickr_username}%22&format=xml"
11
+ doc = Nokogiri::XML.parse(open(url).read)
12
+ val = doc.css("owner").first.attributes["nsid"].value
13
+ Site.flickr_user_id = val
14
+ Caboodle::Kit.dump_config
15
+ end
12
16
  Site.flickr_user_id
13
17
  end
14
18
 
@@ -45,17 +49,25 @@ module Caboodle
45
49
  class Flickr < Caboodle::Kit
46
50
 
47
51
  menu "Photography", "/photography" do
48
- @photosets = FlickrAPI.photosets rescue []
49
- @title = "Photography"
50
- haml :photography
52
+ unless Site.flickr_user_id.blank?
53
+ @photosets = FlickrAPI.photosets rescue []
54
+ @title = "Photography"
55
+ haml :photography
56
+ else
57
+ "<h2>Please set your Flickr username</h2>"
58
+ end
51
59
  end
52
60
 
53
61
  get "/photography/:set_id" do |set_id|
54
- @photosets = FlickrAPI.photosets rescue []
55
- @set_id = set_id
56
- @photoset = Caboodle::FlickrAPI.photoset_info(@set_id) rescue nil
57
- @title = "Photography: #{@photoset.title if @photoset.respond_to?(:title)}"
58
- haml :photography
62
+ unless Site.flickr_user_id.blank?
63
+ @photosets = FlickrAPI.photosets rescue []
64
+ @set_id = set_id
65
+ @photoset = Caboodle::FlickrAPI.photoset_info(@set_id) rescue nil
66
+ @title = "Photography: #{@photoset.title if @photoset.respond_to?(:title)}"
67
+ haml :photography
68
+ else
69
+ "<h2>Please set your Flickr username</h2>"
70
+ end
59
71
  end
60
72
 
61
73
  required [:flickr_username, :flickr_api_key]
@@ -1,4 +1,4 @@
1
- :portfolio_years:
1
+ :history_years:
2
2
  2010:
3
3
  -
4
4
  title: Something I did
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
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
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-23 00:00:00 +01:00
18
+ date: 2010-08-24 00:00:00 +01:00
19
19
  default_executable: caboodle
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency