cortex-reaver 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -11,6 +11,14 @@ simple attachments. Features include canonically named URLs
11
11
  modules for content (HTML sanitizing, attachment references, BlueCloth, etc),
12
12
  and custom pages.
13
13
 
14
+ Why Cortex Reaver
15
+ -----------------
16
+
17
+ - Adaptible. Runs on every web server and database Ramaze and Sequel support.
18
+ - Visual. Large, beautiful photographs, with concise EXIF support.
19
+ - Comprehensive. Comments, file attachments, and tags on everything.
20
+ - Devastating. The main page of Aphyr.com scales to ~400 requests/second.
21
+
14
22
  Getting Started
15
23
  ---------------
16
24
 
data/lib/cortex_reaver.rb CHANGED
@@ -101,6 +101,12 @@ module CortexReaver
101
101
  Ramaze::Log.loggers << Ramaze::Logger::Informer.new(
102
102
  File.join(config[:log_root], 'development.log')
103
103
  )
104
+
105
+ # Also use SQL log
106
+ require 'logger'
107
+ db.logger = Logger.new(
108
+ File.join(config[:log_root], 'sql.log')
109
+ )
104
110
  end
105
111
  else
106
112
  raise ArgumentError.new("unknown Cortex Reaver mode #{config[:mode].inspect}. Expected one of [:production, :development].")
@@ -4,7 +4,6 @@ module CortexReaver
4
4
 
5
5
  map '/journals'
6
6
  layout '/text_layout'
7
- deny_layout :atom
8
7
  template :edit, :form
9
8
  template :new, :form
10
9
  engine :Erubis
@@ -41,7 +41,11 @@ module CortexReaver
41
41
  end
42
42
 
43
43
  for_feed do |photograph, x|
44
- x.content render_template('atom_fragment.rhtml', :photograph => photograph)
44
+ p photograph
45
+ x.content(
46
+ render_template('atom_fragment.rhtml', :photograph => photograph),
47
+ :type => 'html'
48
+ )
45
49
  end
46
50
  end
47
51
  end
@@ -31,7 +31,7 @@ module CortexReaver
31
31
  on_save do |project, request|
32
32
  project.title = request[:title]
33
33
  project.description = request[:description]
34
- project.name = Journal.canonicalize request[:name], project.id
34
+ project.name = Project.canonicalize request[:name], project.id
35
35
  project.body = request[:body]
36
36
  project.user = session[:user]
37
37
  end
@@ -122,6 +122,8 @@ module Ramaze
122
122
  raise unless @model.save
123
123
  end
124
124
 
125
+ raise RuntimeError.new("Ack!")
126
+
125
127
  flash[:notice] = "Created #{model_class.to_s.demodulize.downcase} #{h @model.to_s}."
126
128
  redirect @model.url
127
129
  end
@@ -20,9 +20,13 @@ module Ramaze
20
20
  @for_feed_block
21
21
  end
22
22
 
23
+ # Cache feeds
23
24
  if base.respond_to? :cache
24
25
  cache :atom, :ttl => 300
25
26
  end
27
+
28
+ # Don't use layout
29
+ base.deny_layout :atom
26
30
  end
27
31
  end
28
32
 
@@ -51,21 +55,26 @@ module Ramaze
51
55
  updated = Time.now.xmlschema
52
56
  end
53
57
 
58
+ # Construct URL base
59
+ port = CortexReaver.config[:port]
60
+ url_base = "#{request.scheme}://#{request.host}"
61
+ url_base << ":#{port}" unless port == 80
62
+
54
63
  x.feed(:xmlns => 'http://www.w3.org/2005/Atom') do
55
- x.id = model_class.url
56
- x.title "#{CortexReaver.config[:name]} - #{model_class.to_s.demodulize.titleize}"
64
+ x.id url_base + model_class.url
65
+ x.title "#{CortexReaver.config[:site][:name]} - #{model_class.to_s.demodulize.titleize}"
57
66
  # x.subtitle
58
67
  x.updated updated
59
- x.link :href => model_class.url
60
- x.link :href => model_class.atom_url, :rel => 'self'
68
+ x.link :href => url_base + model_class.url
69
+ x.link :href => (url_base + model_class.atom_url), :rel => 'self'
61
70
 
62
71
  recent.all do |model|
63
72
  x.entry do
64
- x.id model.url
73
+ x.id url_base + model.url
65
74
  x.title model.title
66
75
  x.published model.created_on.xmlschema
67
76
  x.updated model.updated_on.xmlschema
68
- x.link :href => model.url, :rel => 'alternate'
77
+ x.link :href => (url_base + model.url), :rel => 'alternate'
69
78
 
70
79
  x.author do
71
80
  x.name model.user.name
@@ -1,9 +1,6 @@
1
1
  module CortexReaver
2
2
  class Photograph < Sequel::Model(:photographs)
3
- def self.url
4
- '/photographs'
5
- end
6
-
3
+
7
4
  include CortexReaver::Model::Timestamps
8
5
  include CortexReaver::Model::Canonical
9
6
  include CortexReaver::Model::Attachments
@@ -31,6 +28,10 @@ module CortexReaver
31
28
  presence_of :title
32
29
  end
33
30
 
31
+ def self.atom_url
32
+ '/photographs/atom'
33
+ end
34
+
34
35
  def self.get(id)
35
36
  self[:name => id] || self[id]
36
37
  end
@@ -39,6 +40,10 @@ module CortexReaver
39
40
  reverse_order(:created_on).limit(16)
40
41
  end
41
42
 
43
+ def self.url
44
+ '/photographs'
45
+ end
46
+
42
47
  def atom_url
43
48
  '/photographs/atom/' + name
44
49
  end
@@ -1,6 +1,6 @@
1
1
  module CortexReaver
2
2
  APP_NAME = 'Cortex Reaver'
3
- APP_VERSION = '0.0.4'
3
+ APP_VERSION = '0.0.5'
4
4
  APP_AUTHOR = 'aphyr'
5
5
  APP_EMAIL = 'aphyr@aphyr.com'
6
6
  APP_URL = 'http://aphyr.com'
@@ -9,13 +9,7 @@
9
9
  <td id="photograph_<%= @photograph.name %>" class="content">
10
10
  <img src="<%= @photograph.full_public_path %>" id="photo" alt="<%= attr_h @photograph.title %>" title="<%= attr_h @photograph.title %>" />
11
11
  <h2>
12
- <% if previous_photo %>
13
- <%= A('&laquo;', :href => previous_photo.url) %>
14
- <% end %>
15
12
  <%=h @photograph.title %>
16
- <% if next_photo %>
17
- <%= A('&raquo;', :href => next_photo.url) %>
18
- <% end %>
19
13
  </h2>
20
14
  <div class="byline">
21
15
  <div class="description"><%= description_of @photograph %></div>
@@ -32,51 +26,3 @@
32
26
  <td class="border_bottom_right"></td>
33
27
  </tr>
34
28
  </table>
35
-
36
- <% unless @photograph.comments.empty? %>
37
- <table class="text frame" cellspacing="0" cellpadding="0">
38
- <tr>
39
- <td class="border_top_left"></td>
40
- <td class="border_top"></td>
41
- <td class="border_top_right"></td>
42
- </tr>
43
- <tr>
44
- <td class="border_left"></td>
45
- <td class="content">
46
- <div class="comments">
47
- <a id="comments"></a>
48
- <% @photograph.comments.each do |comment| %>
49
- <%= render_template '../comments/comment.rhtml', 'comment' => comment %>
50
- <% end %>
51
- </div>
52
-
53
- </td>
54
- <td class="border_right"></td>
55
- </tr>
56
- <tr>
57
- <td class="border_bottom_left"></td>
58
- <td class="border_bottom"></td>
59
- <td class="border_bottom_right"></td>
60
- </tr>
61
- </table>
62
- <% end %>
63
-
64
- <table class="text frame" cellspacing="0" cellpadding="0">
65
- <tr>
66
- <td class="border_top_left"></td>
67
- <td class="border_top"></td>
68
- <td class="border_top_right"></td>
69
- </tr>
70
- <tr>
71
- <td class="border_left"></td>
72
- <td class="content">
73
- <%= render_template '../comments/post_form.rhtml', 'comment' => @new_comment %>
74
- </td>
75
- <td class="border_right"></td>
76
- </tr>
77
- <tr>
78
- <td class="border_bottom_left"></td>
79
- <td class="border_bottom"></td>
80
- <td class="border_bottom_right"></td>
81
- </tr>
82
- </table>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cortex-reaver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - aphyr
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-21 00:00:00 -08:00
12
+ date: 2008-12-24 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency