pie 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/bin/pie CHANGED
@@ -24,8 +24,17 @@ rescue LoadError
24
24
  require 'pie'
25
25
  end
26
26
 
27
- include Pie
28
- load pie_file
27
+ class PieEnvironment
28
+ include Pie
29
+ end
30
+ pie_data = PieEnvironment.new
29
31
 
32
+ File.open(pie_file) do |f|
33
+ pie_data.instance_eval do
34
+ eval(f.read)
35
+ end
36
+ end
30
37
  require 'pie_server'
31
- WebApp.run! :port => 31415
38
+
39
+ Pie::WebApp.set :pie_data, pie_data
40
+ Pie::WebApp.run! :port => 31415
data/lib/pie_server.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'sinatra/base'
2
2
 
3
- class WebApp < Sinatra::Base
3
+ class Pie::WebApp < Sinatra::Base
4
4
  set :root, File.join(File.expand_path(File.dirname(__FILE__)), "..")
5
5
 
6
6
  get '/' do
@@ -8,13 +8,19 @@ class WebApp < Sinatra::Base
8
8
  end
9
9
 
10
10
  get '/:place_name' do
11
- name = params[:place_name].to_sym
12
- current_place(name) unless name.nil?
13
- puts "current place name is #{current_place.name}"
14
- puts "current place is #{current_place.description}"
15
- puts "--- skip out"; return if current_place.nil?
16
- puts "current links are #{current_place.paths.inspect}"
17
- puts "displaying template: #{template.inspect}"
18
- erb template
11
+ puts "settings.pie_data = #{settings.pie_data.inspect}"
12
+
13
+ pie ||= settings.pie_data
14
+ pie ||= request.env["PIE_DATA"]
15
+ puts "pie = #{pie.inspect}"
16
+ name = params[:place_name].to_sym
17
+ pie.current_place(name) unless name.nil?
18
+ puts "current place name is #{pie.current_place.name}"
19
+ puts "current place is #{pie.current_place.description}"
20
+ puts "--- skip out"; return if pie.current_place.nil?
21
+ puts "current links are #{pie.current_place.paths.inspect}"
22
+ puts "displaying template: #{pie.template.inspect}"
23
+ erb pie.template, {}, {:pie => pie}
19
24
  end
25
+
20
26
  end
@@ -49,11 +49,11 @@
49
49
  </head>
50
50
 
51
51
  <body>
52
- <img src="<%= current_image %>" class="bg" />
52
+ <img src="<%= pie.current_image %>" class="bg" />
53
53
  <div id="content">
54
- <p><%= current_place.description %></p>
54
+ <p><%= pie.current_place.description %></p>
55
55
  <p>
56
- <% current_place.paths.each do |place_name, label| %>
56
+ <% pie.current_place.paths.each do |place_name, label| %>
57
57
  <%= " <a href='#{place_name}'>#{label}</a> " %>
58
58
  <% end %>
59
59
  </p>
@@ -52,14 +52,14 @@
52
52
 
53
53
  <body>
54
54
  <div id="background">
55
- <% if current_image %>
56
- <img src="<%= current_image %>" />
55
+ <% if pie.current_image %>
56
+ <img src="<%= pie.current_image %>" />
57
57
  <% end %>
58
58
  </div>
59
59
  <div id="content">
60
- <p><%= current_place.description %></p>
60
+ <p><%= pie.current_place.description %></p>
61
61
  <p>
62
- <% current_place.paths.each do |place_name, label| %>
62
+ <% pie.current_place.paths.each do |place_name, label| %>
63
63
  <%= " <a href='#{place_name}'>#{label}</a> " %>
64
64
  <% end %>
65
65
  </p>
data/views/image_page.erb CHANGED
@@ -48,9 +48,9 @@
48
48
  </head>
49
49
 
50
50
  <body>
51
- <img src="<%= current_image %>" class="bg" />
51
+ <img src="<%= pie.current_image %>" class="bg" />
52
52
  <div id="content">
53
- <p><%= current_place.description %></p>
53
+ <p><%= pie.current_place.description %></p>
54
54
  </div>
55
55
  </body>
56
56
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 6
9
- version: 0.2.6
8
+ - 7
9
+ version: 0.2.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sarah Allen, Sarah Mei, Rich Kilmer
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-07 00:00:00 -07:00
17
+ date: 2010-10-08 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20