pluto 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -12,12 +12,16 @@ lib/pluto/formatter.rb
12
12
  lib/pluto/models.rb
13
13
  lib/pluto/schema.rb
14
14
  lib/pluto/server.rb
15
+ lib/pluto/server/public/feed-icon-10x10.png
15
16
  lib/pluto/server/public/style.css
16
17
  lib/pluto/server/views/_debug.erb
17
18
  lib/pluto/server/views/_version.erb
18
19
  lib/pluto/server/views/debug.erb
20
+ lib/pluto/server/views/feeds.erb
19
21
  lib/pluto/server/views/index.erb
22
+ lib/pluto/server/views/items.erb
20
23
  lib/pluto/server/views/layout.erb
24
+ lib/pluto/server/views/sites.erb
21
25
  lib/pluto/updater.rb
22
26
  lib/pluto/version.rb
23
27
  templates/blank.html.erb
@@ -1,6 +1,79 @@
1
+ /* fix: use sass w/ variables */
2
+ body {
3
+ font-family: sans-serif;
4
+ background-color: #F4F4F4;
5
+ color: #333333;
6
+ }
7
+
8
+ a, a:visited {
9
+ text-decoration: none;
10
+ color: maroon;
11
+ }
12
+
13
+ a:hover {
14
+ text-decoration: underline;
15
+ color: #1E68A6;
16
+ background-color: yellow;
17
+ }
1
18
 
2
- /* for testing some colors */
19
+ .item {
20
+ background-color: white;
21
+ border: 1px solid #9E9E9E;
22
+ padding: 0px 15px 15px 15px;
23
+ margin-bottom: 12px;
24
+ }
25
+
26
+ .item_title {
27
+ margin-top: 0;
28
+ font-size: 16px;
29
+ }
30
+
31
+ .feed_title {
32
+ margin-bottom: 5px;
33
+ font-size: 12px;
34
+ }
35
+
36
+ .colright {
37
+ margin-left: 20px;
38
+ }
39
+
40
+ ul.subscriptions {
41
+ list-style: none;
42
+ margin-left: 0;
43
+ padding-left: 0;
44
+ }
45
+
46
+ /* fix: use .small instead */
47
+ .smaller {
48
+ font-size: 12px;
49
+ /* color: #666666; */ /* lighter gray than text gray */
50
+ }
51
+
52
+ .item_content {
53
+ font-size: 14px;
54
+ }
3
55
 
4
- p { color: maroon;
5
- background-color: grey; }
6
56
 
57
+ /** key, count styles ***********/
58
+
59
+ .key, .count
60
+ {
61
+ font-size: 12px;
62
+ color: grey;
63
+ }
64
+
65
+
66
+
67
+ /** version block **********/
68
+
69
+ .version {
70
+ text-align: center;
71
+ margin-top: 10px;
72
+ color: grey; }
73
+ .version a, .version span {
74
+ font-size: 12px;
75
+ color: grey; }
76
+
77
+ /***************************/
78
+
79
+ div.feedflare { display: none; }
@@ -1,16 +1,16 @@
1
- <h3>Debug</h3>
1
+ <h3>Request</h3>
2
2
 
3
3
  <pre>
4
- request.scheme <%= request.scheme %>
5
- request.script_name <%= request.script_name %>
6
- request.path_info <%= request.path_info %>
7
- request.port <%= request.port %>
8
- request.request_method <%= request.request_method %>
9
- request.query_string <%= request.query_string %>
10
- request.host <%= request.host %>
11
- request.referrer <%= request.referrer %>
12
- request.user_agent <%= request.user_agent %>
13
- request.url <%= request.url %>
14
- request.path <%= request.path %>
15
- request.ip <%= request.ip %>
4
+ request.scheme: <%= request.scheme %>
5
+ request.script_name: <%= request.script_name %>
6
+ request.path_info: <%= request.path_info %>
7
+ request.port: <%= request.port %>
8
+ request.request_method: <%= request.request_method %>
9
+ request.query_string: <%= request.query_string %>
10
+ request.host: <%= request.host %>
11
+ request.referrer: <%= request.referrer %>
12
+ request.user_agent: <%= request.user_agent %>
13
+ request.url: <%= request.url %>
14
+ request.path: <%= request.path %>
15
+ request.ip: <%= request.ip %>
16
16
  </pre>
@@ -1,2 +1,14 @@
1
+
2
+
3
+ <h3>Named Route Helpers</h3>
4
+
5
+ <pre>
6
+ root_url: <%= root_url %>
7
+ root_path: <%= root_path %>
8
+ sites_path: <%= sites_path %>
9
+ feeds_path: <%= feeds_path %>
10
+ items_path: <%= items_path %>
11
+ </pre>
12
+
1
13
  <%= erb :'_debug' %>
2
14
 
@@ -0,0 +1,13 @@
1
+
2
+ <h2><%= Feed.count %> Feeds</h2>
3
+
4
+ <table>
5
+ <% Feed.all.each do |feed| %>
6
+ <tr>
7
+ <td class='key'><%= feed.key %></td>
8
+ <td><%= feed.title %>
9
+ <span class='count'>(<%= feed.items.count %>)</span>
10
+ </td>
11
+ </tr>
12
+ <% end %>
13
+ </table>
@@ -1,8 +1,3 @@
1
1
 
2
- <h1>pluto test page</h1>
3
2
 
4
- <p>test paragraph paragraph
5
- </p>
6
-
7
- <p>another test paragraph paragraph
8
- </p>
3
+ <p>test page</p>
@@ -0,0 +1,12 @@
1
+
2
+ <h2><%= Item.count %> Items</h2>
3
+
4
+ <table>
5
+ <% Item.all.each do |item| %>
6
+ <tr>
7
+ <td><%= item.title %></td>
8
+ <td class='key'><%= item.guid %></td>
9
+ <td><%= item.feed.title %></td>
10
+ </tr>
11
+ <% end %>
12
+ </table>
@@ -2,11 +2,18 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset='UTF-8'>
5
- <title>planet test site</title>
5
+ <title>Pluto / Admin</title>
6
6
  <link href="<%= url('/style.css') %>" rel='stylesheet'>
7
7
  </head>
8
8
  <body>
9
9
 
10
+ <p>
11
+ Pluto |
12
+ <%= link_to 'Sites', sites_path %> <span class='count'>(<%= Site.count %>)</span> &bull;
13
+ <%= link_to 'Feeds', feeds_path %> <span class='count'>(<%= Feed.count %>)</span> &bull;
14
+ <%= link_to 'Items', items_path %> <span class='count'>(<%= Item.count %>)</span>
15
+ </p>
16
+
10
17
  <%= yield %>
11
18
 
12
19
  <%= erb :'_version' %>
@@ -0,0 +1,21 @@
1
+
2
+
3
+ <h2><%= Site.count %> Sites</h2>
4
+
5
+ <table>
6
+ <% Site.all.each do |site| %>
7
+ <tr>
8
+ <td class='key'><%= site.key %></td>
9
+ <td><%= site.title %>
10
+ <span class='count'>(<%= site.feeds.count %>)</span>
11
+ </td>
12
+ <td>
13
+ <ul>
14
+ <% site.feeds.each do |feed| %>
15
+ <li><%= feed.title %></li>
16
+ <% end %>
17
+ </ul>
18
+ </td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
data/lib/pluto/server.rb CHANGED
@@ -37,23 +37,59 @@ class Server < Sinatra::Base
37
37
  include Models # e.g. Feed, Item, Site, etc.
38
38
 
39
39
  #################
40
- # Utilities
41
-
42
- def site_config_hash
43
- h = {}
44
- site = Site.first # FIX: for now assume one planet per DB (fix later; allow planet key or similar)
45
- if site.present?
46
- h['title'] = site.title
47
- else
48
- h['title'] = 'Planet Untitled'
40
+ # Helpers
41
+
42
+ def path_prefix
43
+ request.env['SCRIPT_NAME']
44
+ end
45
+
46
+ def sites_path
47
+ "#{path_prefix}/sites"
48
+ end
49
+
50
+ def feeds_path
51
+ "#{path_prefix}/feeds"
52
+ end
53
+
54
+ def items_path
55
+ "#{path_prefix}/items"
56
+ end
57
+
58
+ def root_path
59
+ "#{path_prefix}/"
60
+ end
61
+
62
+ def root_url
63
+ url( '/' )
64
+ end
65
+
66
+
67
+ def link_to( text, url, opts={} )
68
+ attributes = ""
69
+ opts.each do |key,value|
70
+ attributes << "#{key}='#{value}' "
49
71
  end
72
+ "<a href='#{url}' #{attributes}>#{text}</a>"
50
73
  end
51
74
 
75
+
52
76
  ##############################################
53
77
  # Controllers / Routing / Request Handlers
54
78
 
55
79
  get '/' do
56
- erb :index, locals: { site: site_config_hash }
80
+ redirect( sites_path )
81
+ end
82
+
83
+ get '/sites' do
84
+ erb :sites # needed or default fallthrough possible ???
85
+ end
86
+
87
+ get '/feeds' do
88
+ erb :feeds # needed or default fallthrough possible ???
89
+ end
90
+
91
+ get '/items' do
92
+ erb :items # needed or default fallthrough possible ???
57
93
  end
58
94
 
59
95
  # todo/fix: make a generic route for erb w /regex
data/lib/pluto/version.rb CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
2
  module Pluto
3
- VERSION = '0.6.0'
3
+ VERSION = '0.7.0'
4
4
  end
5
5
 
6
-
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.6.0
4
+ version: 0.7.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-10 00:00:00.000000000 Z
12
+ date: 2013-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pakman
16
- requirement: &83822120 !ruby/object:Gem::Requirement
16
+ requirement: &73611800 !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: *83822120
24
+ version_requirements: *73611800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fetcher
27
- requirement: &83821440 !ruby/object:Gem::Requirement
27
+ requirement: &73611130 !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: *83821440
35
+ version_requirements: *73611130
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: logutils
38
- requirement: &83818890 !ruby/object:Gem::Requirement
38
+ requirement: &73610460 !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: *83818890
46
+ version_requirements: *73610460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &83844650 !ruby/object:Gem::Requirement
49
+ requirement: &73609750 !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: *83844650
57
+ version_requirements: *73609750
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hoe
60
- requirement: &83842540 !ruby/object:Gem::Requirement
60
+ requirement: &73609370 !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: *83842540
68
+ version_requirements: *73609370
69
69
  description: pluto - Another Planet Generator (Lets You Build Web Pages from Published
70
70
  Web Feeds)
71
71
  email: webslideshow@googlegroups.com
@@ -90,12 +90,16 @@ files:
90
90
  - lib/pluto/models.rb
91
91
  - lib/pluto/schema.rb
92
92
  - lib/pluto/server.rb
93
+ - lib/pluto/server/public/feed-icon-10x10.png
93
94
  - lib/pluto/server/public/style.css
94
95
  - lib/pluto/server/views/_debug.erb
95
96
  - lib/pluto/server/views/_version.erb
96
97
  - lib/pluto/server/views/debug.erb
98
+ - lib/pluto/server/views/feeds.erb
97
99
  - lib/pluto/server/views/index.erb
100
+ - lib/pluto/server/views/items.erb
98
101
  - lib/pluto/server/views/layout.erb
102
+ - lib/pluto/server/views/sites.erb
99
103
  - lib/pluto/updater.rb
100
104
  - lib/pluto/version.rb
101
105
  - templates/blank.html.erb