pluto 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,8 @@ class Runner
5
5
 
6
6
  include LogUtils::Logging
7
7
 
8
+ include Models # e.g. Feed,Item,etc.
9
+
8
10
  def initialize
9
11
  @opts = Opts.new
10
12
  end
data/lib/pluto/fetcher.rb CHANGED
@@ -5,6 +5,8 @@ class Fetcher
5
5
 
6
6
  include LogUtils::Logging
7
7
 
8
+ include Models
9
+
8
10
  def initialize( opts, config )
9
11
  @opts = opts
10
12
  @config = config
@@ -4,6 +4,9 @@ class Formatter
4
4
 
5
5
  include LogUtils::Logging
6
6
 
7
+ include Models
8
+
9
+
7
10
  def initialize( opts, config )
8
11
  @opts = opts
9
12
  @config = config
@@ -11,7 +14,7 @@ class Formatter
11
14
 
12
15
  attr_reader :opts
13
16
 
14
- def headers
17
+ def site
15
18
  @config
16
19
  end
17
20
 
data/lib/pluto/models.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Pluto
2
-
2
+ module Models
3
+
3
4
  class Feed < ActiveRecord::Base
4
5
  self.table_name = 'feeds'
5
6
 
@@ -16,4 +17,5 @@ class Item < ActiveRecord::Base
16
17
  end
17
18
  end
18
19
 
20
+ end # module Models
19
21
  end # module Pluto
data/lib/pluto/server.rb CHANGED
@@ -30,13 +30,25 @@ class Server < Sinatra::Base
30
30
 
31
31
  set :static, true # set up static file routing
32
32
 
33
+
34
+ set :site_config, {} # empty hash by default; use site_config
35
+
36
+ #######################
37
+ # Models
38
+
39
+ include Models # e.g. Feed, Item, etc.
40
+
41
+
33
42
  ##############################################
34
43
  # Controllers / Routing / Request Handlers
35
44
 
36
45
  get '/' do
37
- erb :index
46
+ erb :index, locals: { site: settings.site_config }
38
47
  end
39
48
 
49
+ # todo/fix: make a generic route for erb w /regex
50
+ # to auto-allow all routes not just / w/ site data
51
+
40
52
  get '/d*' do
41
53
  erb :debug
42
54
  end
data/lib/pluto/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Pluto
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
 
6
6
 
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
  <head>
3
3
  <meta charset="UTF-8">
4
- <title><%= headers['title'] %></title>
4
+ <title><%= site['title'] %></title>
5
5
  <meta name="generator" content="<%= Pluto.banner %>">
6
6
  <style>
7
7
  /* fix: use sass w/ variables */
@@ -61,14 +61,14 @@
61
61
  </style>
62
62
  </head>
63
63
  <body>
64
- <h1><%= headers['title'] %></h1>
64
+ <h1><%= site['title'] %></h1>
65
65
 
66
66
  <table>
67
67
  <tr>
68
68
  <td style='vertical-align:top;'><!-- first column -->
69
69
 
70
70
  <% last_published_at = Time.local( 1999, 1, 1 )
71
- Item.latest.each do |item| %>
71
+ Item.latest.limit(24).each do |item| %>
72
72
 
73
73
  <% unless last_published_at.year == item.published_at.year &&
74
74
  last_published_at.month == item.published_at.month &&
@@ -3,7 +3,7 @@
3
3
  <% Feed.all.each do |feed| %>
4
4
  <h3><%= feed.title %> </h3>
5
5
  <ul>
6
- <% feed.items.latest.each do |item| %>
6
+ <% feed.items.latest.limit(11).each do |item| %>
7
7
  <li><%= item.title %> (<%= item.published_at %>)</li>
8
8
  <% end %>
9
9
  </ul>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pluto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-09 00:00:00.000000000 Z
12
+ date: 2013-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pakman
16
- requirement: &81211800 !ruby/object:Gem::Requirement
16
+ requirement: &79513810 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *81211800
24
+ version_requirements: *79513810
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fetcher
27
- requirement: &81211430 !ruby/object:Gem::Requirement
27
+ requirement: &79512200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.3'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *81211430
35
+ version_requirements: *79512200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: logutils
38
- requirement: &81211020 !ruby/object:Gem::Requirement
38
+ requirement: &79510570 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.6'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *81211020
46
+ version_requirements: *79510570
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &81210620 !ruby/object:Gem::Requirement
49
+ requirement: &79509720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '3.10'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *81210620
57
+ version_requirements: *79509720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hoe
60
- requirement: &81210350 !ruby/object:Gem::Requirement
60
+ requirement: &79508820 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '3.3'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *81210350
68
+ version_requirements: *79508820
69
69
  description: pluto - Another Planet Generator (Lets You Build Web Pages from Published
70
70
  Web Feeds)
71
71
  email: webslideshow@googlegroups.com