pluto-admin 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -3,4 +3,15 @@ Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  lib/pluto/admin.rb
6
+ lib/pluto/admin/public/feed-icon-10x10.png
7
+ lib/pluto/admin/public/style.css
8
+ lib/pluto/admin/server.rb
6
9
  lib/pluto/admin/version.rb
10
+ lib/pluto/admin/views/_debug.erb
11
+ lib/pluto/admin/views/_version.erb
12
+ lib/pluto/admin/views/debug.erb
13
+ lib/pluto/admin/views/feeds.erb
14
+ lib/pluto/admin/views/items.erb
15
+ lib/pluto/admin/views/layout.erb
16
+ lib/pluto/admin/views/sites.erb
17
+ lib/pluto/admin/views/timeline.erb
data/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  planet web admin - sintara web app ready to get mounted into your web app
4
4
 
5
5
 
6
- * home :: [github.com/rubylibs/pluto.admin](https://github.com/rubylibs/pluto.admin)
7
- * bugs :: [github.com/rubylibs/pluto.admin/issues](https://github.com/rubylibs/pluto.admin/issues)
6
+ * home :: [github.com/feedreader/pluto.admin](https://github.com/feedreader/pluto.admin)
7
+ * bugs :: [github.com/feedreader/pluto.admin/issues](https://github.com/feedreader/pluto.admin/issues)
8
8
  * gem :: [rubygems.org/gems/pluto-admin](https://rubygems.org/gems/pluto-admin)
9
9
  * rdoc :: [rubydoc.info/gems/pluto-admin](http://rubydoc.info/gems/pluto-admin)
10
10
 
@@ -23,7 +23,6 @@ All together - `config.ru` (see `planet.live`):
23
23
 
24
24
  ~~~
25
25
  map '/' do
26
-
27
26
  run Planet
28
27
  map '/db' do
29
28
  run PlutoAdmin::Server
@@ -34,5 +33,5 @@ end
34
33
 
35
34
  ## License
36
35
 
37
- The `pluto` scripts are dedicated to the public domain.
36
+ The `pluto.admin` scripts are dedicated to the public domain.
38
37
  Use it as you please with no restrictions whatsoever.
data/lib/pluto/admin.rb CHANGED
@@ -19,5 +19,5 @@ end # module PlutoAdmin
19
19
 
20
20
  puts PlutoAdmin.banner # say hello
21
21
 
22
- puts "[boot] plut-admin root: #{PlutAdmin.root}"
22
+ puts "[boot] pluto-admin root: #{PlutoAdmin.root}"
23
23
 
@@ -0,0 +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
+ }
18
+
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
+ }
55
+
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; }
@@ -0,0 +1,116 @@
1
+ ######
2
+ # NB: use rackup to startup Sinatra service (see config.ru)
3
+ #
4
+ # e.g. config.ru:
5
+ # require './boot'
6
+ # run PlutoAdmin::Server
7
+
8
+
9
+ # 3rd party libs/gems
10
+
11
+ require 'sinatra/base'
12
+
13
+
14
+ module PlutoAdmin
15
+
16
+ class Server < Sinatra::Base
17
+
18
+ def self.banner
19
+ "pluto-admin #{PlutoAdmin::VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] on Sinatra/#{Sinatra::VERSION} (#{ENV['RACK_ENV']})"
20
+ end
21
+
22
+ PUBLIC_FOLDER = "#{PlutoAdmin.root}/lib/pluto/admin/public"
23
+ VIEWS_FOLDER = "#{PlutoAdmin.root}/lib/pluto/admin/views"
24
+
25
+ puts "[boot] pluto-admin - setting public folder to: #{PUBLIC_FOLDER}"
26
+ puts "[boot] pluto-admin - setting views folder to: #{VIEWS_FOLDER}"
27
+
28
+ set :public_folder, PUBLIC_FOLDER # set up the static dir (with images/js/css inside)
29
+ set :views, VIEWS_FOLDER # set up the views dir
30
+
31
+ set :static, true # set up static file routing
32
+
33
+
34
+ #######################
35
+ # Models
36
+
37
+ include Pluto::Models # e.g. Feed, Item, Site, etc.
38
+
39
+ #################
40
+ # Helpers
41
+
42
+ def path_prefix
43
+ request.script_name # 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 timeline_path
59
+ "#{path_prefix}/time"
60
+ end
61
+
62
+ def root_path
63
+ "#{path_prefix}/"
64
+ end
65
+
66
+ def root_url
67
+ url( '/' )
68
+ end
69
+
70
+
71
+ def link_to( text, url, opts={} )
72
+ attributes = ""
73
+ opts.each do |key,value|
74
+ attributes << "#{key}='#{value}' "
75
+ end
76
+ "<a href='#{url}' #{attributes}>#{text}</a>"
77
+ end
78
+
79
+
80
+ ##############################################
81
+ # Controllers / Routing / Request Handlers
82
+
83
+ get '/' do
84
+ redirect( sites_path )
85
+ end
86
+
87
+ get '/sites' do
88
+ erb :sites # needed or default fallthrough possible ???
89
+ end
90
+
91
+ get '/feeds' do
92
+ erb :feeds # needed or default fallthrough possible ???
93
+ end
94
+
95
+ get '/items' do
96
+ erb :items # needed or default fallthrough possible ???
97
+ end
98
+
99
+ get '/time' do
100
+ erb :timeline
101
+ end
102
+
103
+ # todo/fix: make a generic route for erb w /regex
104
+ # to auto-allow all routes not just / w/ site data
105
+
106
+ get '/d*' do
107
+ erb :debug
108
+ end
109
+
110
+
111
+ end # class Server
112
+ end # module PlutoAdmin
113
+
114
+
115
+ # say hello
116
+ puts PlutoAdmin::Server.banner
@@ -1,4 +1,4 @@
1
1
 
2
2
  module PlutoAdmin
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.0'
4
4
  end
@@ -0,0 +1,16 @@
1
+ <h3>Request</h3>
2
+
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 %>
16
+ </pre>
@@ -0,0 +1,8 @@
1
+ <div class='version'>
2
+ <a href="https://github.com/feedreader/pluto">pluto/<%= Pluto::VERSION %></a>,
3
+ <a href="https://github.com/feedreader/pluto.admin">pluto.admin/<%= PlutoAdmin::VERSION %></a>,
4
+ <a href="https://github.com/rubylibs/feedutils">feedutils/<%= FeedUtils::VERSION %></a>
5
+ -
6
+ <span>Ruby/<%= "#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM})" %> on</span>
7
+ <span>Sinatra/<%= Sinatra::VERSION %> (<%= ENV['RACK_ENV'] %>)</span>
8
+ </div>
@@ -0,0 +1,15 @@
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
+ timeline_path: <%= timeline_path %>
12
+ </pre>
13
+
14
+ <%= erb :'_debug' %>
15
+
@@ -0,0 +1,15 @@
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
+ <td><%= feed.format %></td>
12
+ <td><%= feed.etag %></td>
13
+ </tr>
14
+ <% end %>
15
+ </table>
@@ -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>
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='UTF-8'>
5
+ <title>Pluto / Admin</title>
6
+ <link href="<%= url('/style.css') %>" rel='stylesheet'>
7
+ </head>
8
+ <body>
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> &bull;
15
+ <%= link_to 'Timeline', timeline_path %> <span class='count'>(<%= Action.count %>)</span>
16
+ </p>
17
+
18
+ <%= yield %>
19
+
20
+ <%= erb :'_version' %>
21
+
22
+ </body>
23
+ </html>
@@ -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>
@@ -0,0 +1,18 @@
1
+
2
+ <h2>Timeline</h2>
3
+
4
+ <table>
5
+ <% Action.all.each do |action| %>
6
+ <tr>
7
+ <td><%= action.title %></td>
8
+ <td><%= action.object %></td>
9
+ <td><%= action.created_at %></td>
10
+ <td>
11
+ <!-- only show if different from created_at -->
12
+ <% unless action.created_at == action.updated_at %>
13
+ <%= action.updated_at %>
14
+ <% end %>
15
+ </td>
16
+ </tr>
17
+ <% end %>
18
+ </table>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pluto-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logutils
16
- requirement: &80396680 !ruby/object:Gem::Requirement
16
+ requirement: &83711660 !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: *80396680
24
+ version_requirements: *83711660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &80395460 !ruby/object:Gem::Requirement
27
+ requirement: &83710660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.10'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *80395460
35
+ version_requirements: *83710660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe
38
- requirement: &80394390 !ruby/object:Gem::Requirement
38
+ requirement: &83710250 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.3'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *80394390
46
+ version_requirements: *83710250
47
47
  description: planet web admin - sintara web app ready to get mounted into your web
48
48
  app
49
49
  email: webslideshow@googlegroups.com
@@ -57,7 +57,18 @@ files:
57
57
  - README.md
58
58
  - Rakefile
59
59
  - lib/pluto/admin.rb
60
+ - lib/pluto/admin/public/feed-icon-10x10.png
61
+ - lib/pluto/admin/public/style.css
62
+ - lib/pluto/admin/server.rb
60
63
  - lib/pluto/admin/version.rb
64
+ - lib/pluto/admin/views/_debug.erb
65
+ - lib/pluto/admin/views/_version.erb
66
+ - lib/pluto/admin/views/debug.erb
67
+ - lib/pluto/admin/views/feeds.erb
68
+ - lib/pluto/admin/views/items.erb
69
+ - lib/pluto/admin/views/layout.erb
70
+ - lib/pluto/admin/views/sites.erb
71
+ - lib/pluto/admin/views/timeline.erb
61
72
  homepage: https://github.com/feedreader/pluto.admin
62
73
  licenses:
63
74
  - Public Domain