pluto 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{History.markdown → History.md} +0 -0
- data/Manifest.txt +7 -18
- data/README.md +172 -0
- data/Rakefile +11 -6
- data/config/pluto.index.yml +19 -0
- data/lib/pluto.rb +14 -12
- data/lib/pluto/cli/main.rb +213 -0
- data/lib/pluto/cli/opts.rb +38 -2
- data/lib/pluto/formatter.rb +17 -39
- data/lib/pluto/installer.rb +58 -0
- data/lib/pluto/lister.rb +42 -0
- data/lib/pluto/manifest_helpers.rb +50 -0
- data/lib/pluto/models.rb +60 -5
- data/lib/pluto/schema.rb +38 -6
- data/lib/pluto/updater.rb +90 -114
- data/lib/pluto/version.rb +1 -1
- metadata +65 -33
- data/README.markdown +0 -107
- data/lib/pluto/cli/runner.rb +0 -96
- data/lib/pluto/server.rb +0 -108
- data/lib/pluto/server/public/feed-icon-10x10.png +0 -0
- data/lib/pluto/server/public/style.css +0 -79
- data/lib/pluto/server/views/_debug.erb +0 -16
- data/lib/pluto/server/views/_version.erb +0 -5
- data/lib/pluto/server/views/debug.erb +0 -14
- data/lib/pluto/server/views/feeds.erb +0 -13
- data/lib/pluto/server/views/index.erb +0 -3
- data/lib/pluto/server/views/items.erb +0 -12
- data/lib/pluto/server/views/layout.erb +0 -22
- data/lib/pluto/server/views/sites.erb +0 -21
- data/templates/blank.html.erb +0 -133
- data/templates/blank.top.html.erb +0 -10
- data/templates/blank.txt +0 -5
- data/templates/feed-icon-10x10.png +0 -0
data/README.markdown
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
# pluto
|
2
|
-
|
3
|
-
Another Planet Generator in Ruby - Lets You Build Web Pages
|
4
|
-
from Published Web Feeds
|
5
|
-
|
6
|
-
* home :: [github.com/geraldb/pluto](https://github.com/geraldb/pluto)
|
7
|
-
* bugs :: [github.com/geraldb/pluto/issues](https://github.com/geraldb/pluto/issues)
|
8
|
-
* gem :: [rubygems.org/gems/pluto](https://rubygems.org/gems/pluto)
|
9
|
-
* rdoc :: [rubydoc.info/gems/pluto](http://rubydoc.info/gems/pluto)
|
10
|
-
|
11
|
-
|
12
|
-
## Usage
|
13
|
-
|
14
|
-
Use the `pluto` command line tool and pass in one or more planet configuration files.
|
15
|
-
Example:
|
16
|
-
|
17
|
-
pluto ruby.yml
|
18
|
-
|
19
|
-
This will
|
20
|
-
|
21
|
-
1) fetch all feeds listed in `ruby.yml` and
|
22
|
-
|
23
|
-
2) store all entries in a local database, that is, `ruby.sqlite` in your working folder and
|
24
|
-
|
25
|
-
3) generate a planet web page, that is, `ruby.html` using the builtin [`blank` template](https://github.com/geraldb/pluto/blob/master/templates/blank.html.erb) in your working folder using all feed entries from the local database.
|
26
|
-
|
27
|
-
Open up `ruby.html` to see your planet web page. Voila!
|
28
|
-
|
29
|
-
|
30
|
-
### Command Line Tool
|
31
|
-
|
32
|
-
~~~
|
33
|
-
pluto - Lets you build web pages from published web feeds.
|
34
|
-
|
35
|
-
Usage: pluto [options] FILE
|
36
|
-
-t, --template MANIFEST Template Manifest (default is blank)
|
37
|
-
-c, --config PATH Configuration Path (default is ~/.pluto)
|
38
|
-
-o, --output PATH Output Path (default is .)
|
39
|
-
-v, --version Show version
|
40
|
-
--verbose Show debug trace
|
41
|
-
-h, --help Show this message
|
42
|
-
~~~
|
43
|
-
|
44
|
-
|
45
|
-
### Planet Configuration Sample
|
46
|
-
|
47
|
-
`ruby.yml`:
|
48
|
-
|
49
|
-
```
|
50
|
-
title: Planet Ruby
|
51
|
-
|
52
|
-
feeds:
|
53
|
-
- rubyflow
|
54
|
-
- rubysource
|
55
|
-
- edgerails
|
56
|
-
- rubyonrails
|
57
|
-
- railstutorial
|
58
|
-
|
59
|
-
rubyflow:
|
60
|
-
title: Ruby Flow
|
61
|
-
feed_url: http://feeds.feedburner.com/Rubyflow?format=xml
|
62
|
-
url: http://rubyflow.com
|
63
|
-
|
64
|
-
rubysource:
|
65
|
-
title: Ruby Source
|
66
|
-
feed_url: http://rubysource.com/feed
|
67
|
-
url: http://rubysource.com
|
68
|
-
|
69
|
-
edgerails:
|
70
|
-
title: What's new in Edge Rails?
|
71
|
-
feed_url: http://www.edgerails.info/blog.atom
|
72
|
-
url: http://www.edgerails.info
|
73
|
-
|
74
|
-
rubyonrails:
|
75
|
-
title: Ruby on Rails Blog
|
76
|
-
feed_url: http://weblog.rubyonrails.org/feed/atom.xml
|
77
|
-
url: http://weblog.rubyonrails.org
|
78
|
-
|
79
|
-
railstutorial:
|
80
|
-
title: Rails Tutorial News
|
81
|
-
feed_url: http://feeds.feedburner.com/railstutorial?format=xml
|
82
|
-
url: http://news.railstutorial.org
|
83
|
-
```
|
84
|
-
|
85
|
-
For more samples, see [`nytimes.yml`](https://github.com/geraldb/pluto/blob/master/samples/nytimes.yml),
|
86
|
-
[`js.yml`](https://github.com/geraldb/pluto/blob/master/samples/js.yml),
|
87
|
-
[`dart.yml`](https://github.com/geraldb/pluto/blob/master/samples/dart.yml).
|
88
|
-
|
89
|
-
|
90
|
-
## Install
|
91
|
-
|
92
|
-
Just install the gem:
|
93
|
-
|
94
|
-
$ gem install pluto
|
95
|
-
|
96
|
-
|
97
|
-
## Alternatives
|
98
|
-
|
99
|
-
planet.rb by Akira Yamada [(Site)](http://planet.rubyforge.org)
|
100
|
-
|
101
|
-
Planet.rb by Pablo Astigarraga [(Site)](https://github.com/pote/planet.rb) - Used with Jekyll/Octopress Site Generator
|
102
|
-
|
103
|
-
|
104
|
-
## License
|
105
|
-
|
106
|
-
The `pluto` scripts are dedicated to the public domain.
|
107
|
-
Use it as you please with no restrictions whatsoever.
|
data/lib/pluto/cli/runner.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
|
2
|
-
module Pluto
|
3
|
-
|
4
|
-
class Runner
|
5
|
-
|
6
|
-
include LogUtils::Logging
|
7
|
-
|
8
|
-
include Models # e.g. Feed,Item,Site,etc.
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@opts = Opts.new
|
12
|
-
end
|
13
|
-
|
14
|
-
attr_reader :opts
|
15
|
-
|
16
|
-
def run( args )
|
17
|
-
opt=OptionParser.new do |cmd|
|
18
|
-
|
19
|
-
cmd.banner = "Usage: pluto [options] FILE"
|
20
|
-
|
21
|
-
## fix/todo: remove .txt from default manifest
|
22
|
-
|
23
|
-
cmd.on( '-t', '--template MANIFEST', "Template Manifest (default is #{opts.manifest})" ) do |manifest|
|
24
|
-
opts.manifest = manifest
|
25
|
-
end
|
26
|
-
|
27
|
-
cmd.on( '-c', '--config PATH', "Configuration Path (default is #{opts.config_path})" ) do |path|
|
28
|
-
opts.config_path = path
|
29
|
-
end
|
30
|
-
|
31
|
-
cmd.on( '-o', '--output PATH', "Output Path (default is #{opts.output_path})" ) { |path| opts.output_path = path }
|
32
|
-
|
33
|
-
cmd.on( '-v', '--version', "Show version" ) do
|
34
|
-
puts Pluto.banner
|
35
|
-
exit
|
36
|
-
end
|
37
|
-
|
38
|
-
cmd.on( "--verbose", "Show debug trace" ) do
|
39
|
-
LogUtils::Logger.root.level = :debug
|
40
|
-
opts.verbose = true
|
41
|
-
end
|
42
|
-
|
43
|
-
## todo: add/allow -? too
|
44
|
-
cmd.on_tail( "-h", "--help", "Show this message" ) do
|
45
|
-
puts <<EOS
|
46
|
-
|
47
|
-
pluto - Lets you build web pages from published web feeds.
|
48
|
-
|
49
|
-
#{cmd.help}
|
50
|
-
|
51
|
-
Examples:
|
52
|
-
pluto ruby
|
53
|
-
|
54
|
-
Further information:
|
55
|
-
https://github.com/geraldb/pluto
|
56
|
-
|
57
|
-
EOS
|
58
|
-
exit
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
opt.parse!( args )
|
63
|
-
|
64
|
-
puts Pluto.banner
|
65
|
-
|
66
|
-
args.each do |arg|
|
67
|
-
|
68
|
-
name = File.basename( arg, '.*' )
|
69
|
-
|
70
|
-
db_config = {
|
71
|
-
adapter: 'sqlite3',
|
72
|
-
database: "#{opts.output_path}/#{name}.db"
|
73
|
-
}
|
74
|
-
|
75
|
-
Connecter.new.connect!( db_config )
|
76
|
-
|
77
|
-
config_path = arg.dup # add .yml file extension if missing (for convenience)
|
78
|
-
config_path << '.yml' unless config_path.ends_with?( '.yml' )
|
79
|
-
|
80
|
-
config = YAML.load_file( config_path )
|
81
|
-
|
82
|
-
puts "dump >#{config_path}<:"
|
83
|
-
pp config
|
84
|
-
|
85
|
-
Fetcher.new( opts, config ).run
|
86
|
-
Formatter.new( opts, config ).run( name )
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
puts 'Done.'
|
91
|
-
|
92
|
-
end # method run
|
93
|
-
|
94
|
-
|
95
|
-
end # class Runner
|
96
|
-
end # module Pakman
|
data/lib/pluto/server.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
######
|
2
|
-
# NB: use rackup to startup Sinatra service (see config.ru)
|
3
|
-
#
|
4
|
-
# e.g. config.ru:
|
5
|
-
# require './boot'
|
6
|
-
# run Pluto::Server
|
7
|
-
|
8
|
-
|
9
|
-
# 3rd party libs/gems
|
10
|
-
|
11
|
-
require 'sinatra/base'
|
12
|
-
|
13
|
-
|
14
|
-
module Pluto
|
15
|
-
|
16
|
-
class Server < Sinatra::Base
|
17
|
-
|
18
|
-
def self.banner
|
19
|
-
"pluto-service #{Pluto::VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] on Sinatra/#{Sinatra::VERSION} (#{ENV['RACK_ENV']})"
|
20
|
-
end
|
21
|
-
|
22
|
-
PUBLIC_FOLDER = "#{Pluto.root}/lib/pluto/server/public"
|
23
|
-
VIEWS_FOLDER = "#{Pluto.root}/lib/pluto/server/views"
|
24
|
-
|
25
|
-
puts "[boot] pluto-service - setting public folder to: #{PUBLIC_FOLDER}"
|
26
|
-
puts "[boot] pluto-service - 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 Models # e.g. Feed, Item, Site, etc.
|
38
|
-
|
39
|
-
#################
|
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}' "
|
71
|
-
end
|
72
|
-
"<a href='#{url}' #{attributes}>#{text}</a>"
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
##############################################
|
77
|
-
# Controllers / Routing / Request Handlers
|
78
|
-
|
79
|
-
get '/' do
|
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 ???
|
93
|
-
end
|
94
|
-
|
95
|
-
# todo/fix: make a generic route for erb w /regex
|
96
|
-
# to auto-allow all routes not just / w/ site data
|
97
|
-
|
98
|
-
get '/d*' do
|
99
|
-
erb :debug
|
100
|
-
end
|
101
|
-
|
102
|
-
|
103
|
-
end # class Server
|
104
|
-
end # module Pluto
|
105
|
-
|
106
|
-
|
107
|
-
# say hello
|
108
|
-
puts Pluto::Server.banner
|
Binary file
|
@@ -1,79 +0,0 @@
|
|
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; }
|
@@ -1,16 +0,0 @@
|
|
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>
|