pluto 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
File without changes
|
data/Manifest.txt
CHANGED
@@ -1,30 +1,19 @@
|
|
1
|
-
History.
|
1
|
+
History.md
|
2
2
|
Manifest.txt
|
3
|
-
README.
|
3
|
+
README.md
|
4
4
|
Rakefile
|
5
5
|
bin/pluto
|
6
|
+
config/pluto.index.yml
|
6
7
|
lib/pluto.rb
|
8
|
+
lib/pluto/cli/main.rb
|
7
9
|
lib/pluto/cli/opts.rb
|
8
|
-
lib/pluto/cli/runner.rb
|
9
10
|
lib/pluto/connecter.rb
|
10
11
|
lib/pluto/fetcher.rb
|
11
12
|
lib/pluto/formatter.rb
|
13
|
+
lib/pluto/installer.rb
|
14
|
+
lib/pluto/lister.rb
|
15
|
+
lib/pluto/manifest_helpers.rb
|
12
16
|
lib/pluto/models.rb
|
13
17
|
lib/pluto/schema.rb
|
14
|
-
lib/pluto/server.rb
|
15
|
-
lib/pluto/server/public/feed-icon-10x10.png
|
16
|
-
lib/pluto/server/public/style.css
|
17
|
-
lib/pluto/server/views/_debug.erb
|
18
|
-
lib/pluto/server/views/_version.erb
|
19
|
-
lib/pluto/server/views/debug.erb
|
20
|
-
lib/pluto/server/views/feeds.erb
|
21
|
-
lib/pluto/server/views/index.erb
|
22
|
-
lib/pluto/server/views/items.erb
|
23
|
-
lib/pluto/server/views/layout.erb
|
24
|
-
lib/pluto/server/views/sites.erb
|
25
18
|
lib/pluto/updater.rb
|
26
19
|
lib/pluto/version.rb
|
27
|
-
templates/blank.html.erb
|
28
|
-
templates/blank.top.html.erb
|
29
|
-
templates/blank.txt
|
30
|
-
templates/feed-icon-10x10.png
|
data/README.md
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
# pluto
|
2
|
+
|
3
|
+
Another planet generator in ruby - lets you build web pages
|
4
|
+
from published web feeds.
|
5
|
+
|
6
|
+
* home :: [github.com/feedreader/pluto](https://github.com/feedreader/pluto)
|
7
|
+
* bugs :: [github.com/feedreader/pluto/issues](https://github.com/feedreader/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 build ruby.yml or
|
18
|
+
pluto b ruby
|
19
|
+
|
20
|
+
This will
|
21
|
+
|
22
|
+
1) fetch all feeds listed in `ruby.yml` and
|
23
|
+
|
24
|
+
2) store all entries in a local database, that is, `ruby.db` in your working folder and
|
25
|
+
|
26
|
+
3) generate a planet web page, that is, `ruby.html` using the [`blank` template pack](https://github.com/feedreader/pluto.blank) in your working folder using all feed entries from the local database.
|
27
|
+
|
28
|
+
Open up `ruby.html` to see your planet web page. Voila!
|
29
|
+
|
30
|
+
|
31
|
+
### Command Line Tool
|
32
|
+
|
33
|
+
~~~~
|
34
|
+
NAME
|
35
|
+
pluto - another planet generator - lets you build web pages from published web feeds
|
36
|
+
|
37
|
+
SYNOPSIS
|
38
|
+
pluto [global options] command [command options] [arguments...]
|
39
|
+
|
40
|
+
GLOBAL OPTIONS
|
41
|
+
-c, --config=PATH - Configuration Path (default: ~/.pluto)
|
42
|
+
-q, --quiet - Only show warnings, errors and fatal messages
|
43
|
+
--verbose - (Debug) Show debug messages
|
44
|
+
--version - Display the program version
|
45
|
+
--help - Show this message
|
46
|
+
|
47
|
+
COMMANDS
|
48
|
+
build, b - Build planet
|
49
|
+
install, i - Install template pack
|
50
|
+
list, ls, l - List installed template packs
|
51
|
+
about, a - (Debug) Show more version info
|
52
|
+
help - Shows a list of commands or help for one command
|
53
|
+
~~~~
|
54
|
+
|
55
|
+
#### `build` Command
|
56
|
+
|
57
|
+
~~~
|
58
|
+
NAME
|
59
|
+
build - Build planet
|
60
|
+
|
61
|
+
SYNOPSIS
|
62
|
+
pluto [global options] build [command options] FILE
|
63
|
+
|
64
|
+
COMMAND OPTIONS
|
65
|
+
-o, --output=PATH - Output Path (default: .)
|
66
|
+
-t, --template=MANIFEST - Template Manifest (default: blank)
|
67
|
+
|
68
|
+
EXAMPLE
|
69
|
+
pluto build ruby.yml
|
70
|
+
pluto b ruby
|
71
|
+
~~~
|
72
|
+
|
73
|
+
#### `list` Command
|
74
|
+
|
75
|
+
~~~
|
76
|
+
NAME
|
77
|
+
list - List installed template packs
|
78
|
+
|
79
|
+
SYNOPSIS
|
80
|
+
pluto [global options] list
|
81
|
+
|
82
|
+
EXAMPLE
|
83
|
+
pluto list
|
84
|
+
pluto ls
|
85
|
+
~~~
|
86
|
+
|
87
|
+
#### `install` Command
|
88
|
+
|
89
|
+
~~~
|
90
|
+
NAME
|
91
|
+
install - Install template pack
|
92
|
+
|
93
|
+
SYNOPSIS
|
94
|
+
pluto [global options] install MANIFEST
|
95
|
+
|
96
|
+
EXAMPLE
|
97
|
+
pluto install news # install "river of news" template pack
|
98
|
+
~~~
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
### Planet Configuration Sample
|
103
|
+
|
104
|
+
`ruby.yml`:
|
105
|
+
|
106
|
+
```
|
107
|
+
title: Planet Ruby
|
108
|
+
|
109
|
+
feeds:
|
110
|
+
- rubyflow
|
111
|
+
- edgerails
|
112
|
+
- rubyonrails
|
113
|
+
- railstutorial
|
114
|
+
|
115
|
+
rubyflow:
|
116
|
+
title: Ruby Flow
|
117
|
+
feed_url: http://feeds.feedburner.com/Rubyflow?format=xml
|
118
|
+
url: http://rubyflow.com
|
119
|
+
|
120
|
+
edgerails:
|
121
|
+
title: What's new in Edge Rails?
|
122
|
+
feed_url: http://www.edgerails.info/blog.atom
|
123
|
+
url: http://www.edgerails.info
|
124
|
+
|
125
|
+
rubyonrails:
|
126
|
+
title: Ruby on Rails Blog
|
127
|
+
feed_url: http://weblog.rubyonrails.org/feed/atom.xml
|
128
|
+
url: http://weblog.rubyonrails.org
|
129
|
+
|
130
|
+
railstutorial:
|
131
|
+
title: Rails Tutorial News
|
132
|
+
feed_url: http://feeds.feedburner.com/railstutorial?format=xml
|
133
|
+
url: http://news.railstutorial.org
|
134
|
+
```
|
135
|
+
|
136
|
+
For more samples, see [`nytimes.yml`](https://github.com/feedreader/pluto.samples/blob/master/nytimes.yml),
|
137
|
+
[`js.yml`](https://github.com/feedreader/pluto.samples/blob/master/js.yml),
|
138
|
+
[`dart.yml`](https://github.com/feedreader/pluto.samples/blob/master/dart.yml).
|
139
|
+
|
140
|
+
|
141
|
+
## Install
|
142
|
+
|
143
|
+
Just install the gem:
|
144
|
+
|
145
|
+
$ gem install pluto
|
146
|
+
|
147
|
+
|
148
|
+
## Real World Usage
|
149
|
+
|
150
|
+
[`pluto.live`](https://github.com/feedreader/pluto.live) - sample planet site; sinatra web app/starter template in ruby using the pluto gem
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
## Alternatives
|
155
|
+
|
156
|
+
### Ruby
|
157
|
+
|
158
|
+
`planet.rb` by Akira Yamada [(Site)](http://planet.rubyforge.org)
|
159
|
+
|
160
|
+
`Planet.rb` by Pablo Astigarraga [(Site)](https://github.com/pote/planet.rb) - used with jekyll/octopress site generator
|
161
|
+
|
162
|
+
### Python
|
163
|
+
|
164
|
+
Planet Planet by Scott James Remnant n Jeff Waugh [(Site)](http://www.planetplanet.org) - uses Mark Pilgrim's universal feed parser (RDF, RSS and Atom) and Tomas Styblo's templating engine
|
165
|
+
|
166
|
+
Planet Venus by Sam Ruby [(Site)](https://github.com/rubys/venus) - cleaned up Planet Planet code
|
167
|
+
|
168
|
+
|
169
|
+
## License
|
170
|
+
|
171
|
+
The `pluto` scripts are dedicated to the public domain.
|
172
|
+
Use it as you please with no restrictions whatsoever.
|
data/Rakefile
CHANGED
@@ -8,22 +8,27 @@ Hoe.spec 'pluto' do
|
|
8
8
|
self.summary = 'pluto - Another Planet Generator'
|
9
9
|
self.description = 'pluto - Another Planet Generator (Lets You Build Web Pages from Published Web Feeds)'
|
10
10
|
|
11
|
-
self.urls = ['https://github.com/
|
11
|
+
self.urls = ['https://github.com/feedreader/pluto']
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
14
|
self.email = 'webslideshow@googlegroups.com'
|
15
15
|
|
16
16
|
# switch extension to .markdown for gihub formatting
|
17
|
-
self.readme_file = 'README.
|
18
|
-
self.history_file = 'History.
|
17
|
+
self.readme_file = 'README.md'
|
18
|
+
self.history_file = 'History.md'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['pakman',
|
22
|
-
['fetcher',
|
23
|
-
['logutils',
|
21
|
+
['pakman', '>= 0.5'],
|
22
|
+
['fetcher', '>= 0.3'],
|
23
|
+
['logutils', '>= 0.6'],
|
24
|
+
['feedutils', '>= 0.3'],
|
25
|
+
['props', '>= 1.0.0'],
|
26
|
+
['textutils', '>= 0.6.8'], # future: add some filters (for include/exclude)
|
27
|
+
['gli', '>= 2.5.6']
|
24
28
|
## ['activerecord', '~> 3.2'], # NB: soft dependency, will include activesupport,etc.
|
25
29
|
]
|
26
30
|
|
31
|
+
|
27
32
|
self.licenses = ['Public Domain']
|
28
33
|
|
29
34
|
self.spec_extras = {
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#########################################
|
2
|
+
# Pluto Update Index for Template Packs
|
3
|
+
|
4
|
+
|
5
|
+
#############
|
6
|
+
# shortcuts for fetching template packs
|
7
|
+
# maps shortcut to URI
|
8
|
+
|
9
|
+
blank: https://raw.github.com/feedreader/pluto.blank/master/blank.txt
|
10
|
+
|
11
|
+
top: https://raw.github.com/feedreader/pluto.top/master/top.txt
|
12
|
+
|
13
|
+
news: https://raw.github.com/feedreader/pluto.news/master/news.txt
|
14
|
+
|
15
|
+
|
16
|
+
####
|
17
|
+
# all:
|
18
|
+
# - add why? why not??
|
19
|
+
#
|
data/lib/pluto.rb
CHANGED
@@ -3,28 +3,26 @@
|
|
3
3
|
#
|
4
4
|
# 1.9.x: ruby -Ilib lib/pakman.rb
|
5
5
|
|
6
|
-
# core and
|
6
|
+
# core and stdlibs
|
7
7
|
|
8
8
|
require 'yaml'
|
9
9
|
require 'json'
|
10
10
|
require 'uri'
|
11
11
|
require 'pp'
|
12
|
-
require 'logger'
|
13
12
|
require 'optparse'
|
14
13
|
require 'fileutils'
|
15
14
|
|
16
15
|
|
17
|
-
|
18
|
-
require 'rss'
|
19
|
-
|
20
|
-
# rubygems
|
16
|
+
# 3rd party ruby gems/libs
|
21
17
|
|
22
18
|
require 'active_record' ## todo: add sqlite3? etc.
|
23
19
|
|
24
|
-
|
25
20
|
require 'logutils'
|
21
|
+
require 'props' # manage settings/env
|
26
22
|
require 'fetcher' # fetch (download) files
|
27
|
-
require 'pakman' # template pack manager
|
23
|
+
require 'pakman' # template pack manager
|
24
|
+
require 'feedutils'
|
25
|
+
require 'textutils'
|
28
26
|
|
29
27
|
|
30
28
|
# our own code
|
@@ -32,13 +30,16 @@ require 'pakman' # template pack manager
|
|
32
30
|
require 'pluto/version' # let version always get first
|
33
31
|
require 'pluto/schema'
|
34
32
|
require 'pluto/models'
|
33
|
+
require 'pluto/manifest_helpers'
|
35
34
|
require 'pluto/connecter'
|
35
|
+
|
36
|
+
require 'pluto/installer'
|
36
37
|
require 'pluto/updater'
|
37
38
|
require 'pluto/fetcher'
|
39
|
+
require 'pluto/lister'
|
38
40
|
require 'pluto/formatter'
|
39
41
|
|
40
|
-
require 'pluto/cli/opts'
|
41
|
-
require 'pluto/cli/runner'
|
42
|
+
require 'pluto/cli/opts' ## fix: make sure fetcher/updater etc. do not depend on cli/opts
|
42
43
|
|
43
44
|
module Pluto
|
44
45
|
|
@@ -62,10 +63,11 @@ module Pluto
|
|
62
63
|
Updater.new.update_feeds
|
63
64
|
end
|
64
65
|
|
65
|
-
|
66
66
|
def self.main
|
67
|
-
|
67
|
+
require 'pluto/cli/main'
|
68
|
+
## Runner.new.run(ARGV) - old code
|
68
69
|
end
|
70
|
+
|
69
71
|
|
70
72
|
end # module Pluto
|
71
73
|
|
@@ -0,0 +1,213 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'gli'
|
4
|
+
|
5
|
+
|
6
|
+
include GLI::App
|
7
|
+
|
8
|
+
program_desc 'another planet generator (lets you build web pages from published web feeds)'
|
9
|
+
version Pluto::VERSION
|
10
|
+
|
11
|
+
|
12
|
+
## some setup code
|
13
|
+
|
14
|
+
LogUtils::Logger.root.level = :info # set logging level to info
|
15
|
+
|
16
|
+
logger = LogUtils::Logger.root
|
17
|
+
|
18
|
+
|
19
|
+
opts = Pluto::Opts.new
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
class SysInfo
|
24
|
+
|
25
|
+
## todo/fix:
|
26
|
+
## pass in/use config (props)
|
27
|
+
|
28
|
+
def initialize( opts )
|
29
|
+
@opts = opts
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_reader :opts
|
33
|
+
|
34
|
+
|
35
|
+
def dump
|
36
|
+
puts <<EOS
|
37
|
+
|
38
|
+
#{Pluto.banner}
|
39
|
+
|
40
|
+
Gems versions:
|
41
|
+
- pakman #{Pakman::VERSION}
|
42
|
+
- fetcher #{Fetcher::VERSION}
|
43
|
+
- feedutils #{FeedUtils::VERSION}
|
44
|
+
- textutils #{TextUtils::VERSION}
|
45
|
+
- props #{Props::VERSION}
|
46
|
+
|
47
|
+
Env home: #{Env.home}
|
48
|
+
Pluto config: #{opts.config_path}
|
49
|
+
Pluto root: #{Pluto.root}
|
50
|
+
|
51
|
+
EOS
|
52
|
+
|
53
|
+
# dump Pluto settings
|
54
|
+
# config.dump
|
55
|
+
# puts
|
56
|
+
|
57
|
+
|
58
|
+
## todo: add more gem version info
|
59
|
+
# todo: add logutils version
|
60
|
+
# add gli2 version
|
61
|
+
end
|
62
|
+
|
63
|
+
end # class SysInfo
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
## "global" options (switches/flags)
|
69
|
+
|
70
|
+
desc '(Debug) Show debug messages'
|
71
|
+
switch [:verbose], negatable: false ## todo: use -w for short form? check ruby interpreter if in use too?
|
72
|
+
|
73
|
+
desc 'Only show warnings, errors and fatal messages'
|
74
|
+
switch [:q, :quiet], negatable: false
|
75
|
+
|
76
|
+
|
77
|
+
desc 'Configuration Path'
|
78
|
+
arg_name 'PATH'
|
79
|
+
default_value opts.config_path
|
80
|
+
flag [:c, :config]
|
81
|
+
|
82
|
+
|
83
|
+
desc 'Build planet'
|
84
|
+
arg_name 'FILE', multiple: true ## todo/fix: check multiple will not print typeo???
|
85
|
+
command [:build, :b] do |c|
|
86
|
+
|
87
|
+
c.desc 'Output Path'
|
88
|
+
c.arg_name 'PATH'
|
89
|
+
c.default_value opts.output_path
|
90
|
+
c.flag [:o,:output]
|
91
|
+
|
92
|
+
c.desc 'Template Manifest'
|
93
|
+
c.arg_name 'MANIFEST'
|
94
|
+
c.default_value opts.manifest
|
95
|
+
c.flag [:t, :template]
|
96
|
+
|
97
|
+
|
98
|
+
c.action do |g,o,args|
|
99
|
+
logger.debug 'hello from build command'
|
100
|
+
|
101
|
+
args.each do |arg|
|
102
|
+
|
103
|
+
name = File.basename( arg, '.*' )
|
104
|
+
|
105
|
+
db_config = {
|
106
|
+
adapter: 'sqlite3',
|
107
|
+
database: "#{opts.output_path}/#{name}.db"
|
108
|
+
}
|
109
|
+
|
110
|
+
Pluto::Connecter.new.connect!( db_config )
|
111
|
+
|
112
|
+
config_path = arg.dup # add .yml file extension if missing (for convenience)
|
113
|
+
config_path << '.yml' unless config_path.ends_with?( '.yml' )
|
114
|
+
|
115
|
+
config = YAML.load_file( config_path )
|
116
|
+
|
117
|
+
puts "dump >#{config_path}<:"
|
118
|
+
pp config
|
119
|
+
|
120
|
+
Pluto::Fetcher.new( opts, config ).run
|
121
|
+
Pluto::Formatter.new( opts, config ).run( name )
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
puts 'Done.'
|
126
|
+
end
|
127
|
+
end # command build
|
128
|
+
|
129
|
+
|
130
|
+
desc 'List installed template packs'
|
131
|
+
command [:list,:ls,:l] do |c|
|
132
|
+
|
133
|
+
c.action do |g,o,args|
|
134
|
+
logger.debug 'hello from list command'
|
135
|
+
|
136
|
+
Pluto::Lister.new( opts ).list
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
|
141
|
+
desc 'Install template pack'
|
142
|
+
arg_name 'MANIFEST', multiple: true
|
143
|
+
command [:install,:i] do |c|
|
144
|
+
|
145
|
+
c.action do |g,o,args|
|
146
|
+
logger.debug 'hello from install command'
|
147
|
+
|
148
|
+
args.each do |arg|
|
149
|
+
Pluto::Installer.new( opts ).install( arg ) ## todo: remove opts merge into config
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
desc '(Debug) Show more version info'
|
156
|
+
skips_pre
|
157
|
+
command [:about,:a] do |c|
|
158
|
+
c.action do
|
159
|
+
logger.debug 'hello from about command'
|
160
|
+
|
161
|
+
SysInfo.new( opts ).dump
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
desc '(Debug) Show global options, options, arguments for test command'
|
167
|
+
command :test do |c|
|
168
|
+
c.action do |g,o,args|
|
169
|
+
puts 'hello from test command'
|
170
|
+
puts 'g/global_options:'
|
171
|
+
pp g
|
172
|
+
puts 'o/options:'
|
173
|
+
pp o
|
174
|
+
puts 'args:'
|
175
|
+
pp args
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
pre do |g,c,o,args|
|
182
|
+
opts.merge_gli_options!( g )
|
183
|
+
opts.merge_gli_options!( o )
|
184
|
+
|
185
|
+
puts Pluto.banner
|
186
|
+
|
187
|
+
LogUtils::Logger.root.level = :debug if opts.verbose?
|
188
|
+
|
189
|
+
logger.debug " executing command #{c.name}"
|
190
|
+
true
|
191
|
+
end
|
192
|
+
|
193
|
+
|
194
|
+
post do |global,c,o,args|
|
195
|
+
logger.debug " executed command #{c.name}"
|
196
|
+
true
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
on_error do |e|
|
201
|
+
puts
|
202
|
+
puts "*** error: #{e.message}"
|
203
|
+
puts
|
204
|
+
|
205
|
+
## todo/fix: find a better way to print; just raise exception e.g. raise e - why? why not??
|
206
|
+
## puts e.backtrace.inspect if opts.verbose?
|
207
|
+
raise e if opts.verbose?
|
208
|
+
|
209
|
+
false # skip default error handling
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
exit run(ARGV)
|