pluto-models 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gemtest +0 -0
- data/HISTORY.md +4 -0
- data/Manifest.txt +30 -0
- data/README.md +82 -0
- data/Rakefile +41 -0
- data/config/pluto.index.yml +23 -0
- data/lib/pluto/activerecord.rb +18 -0
- data/lib/pluto/connecter.rb +96 -0
- data/lib/pluto/fetcher.rb +292 -0
- data/lib/pluto/formatter.rb +81 -0
- data/lib/pluto/installer.rb +58 -0
- data/lib/pluto/lister.rb +42 -0
- data/lib/pluto/manifest_helpers.rb +51 -0
- data/lib/pluto/models.rb +130 -0
- data/lib/pluto/models/activity.rb +8 -0
- data/lib/pluto/models/feed.rb +127 -0
- data/lib/pluto/models/item.rb +73 -0
- data/lib/pluto/models/site.rb +19 -0
- data/lib/pluto/models/subscription.rb +14 -0
- data/lib/pluto/models/utils.rb +47 -0
- data/lib/pluto/refresher.rb +130 -0
- data/lib/pluto/schema.rb +139 -0
- data/lib/pluto/subscriber.rb +102 -0
- data/lib/pluto/tasks/env.rake +25 -0
- data/lib/pluto/tasks/setup.rake +40 -0
- data/lib/pluto/tasks/stats.rake +10 -0
- data/lib/pluto/tasks/update.rake +24 -0
- data/lib/pluto/updater.rb +50 -0
- data/lib/pluto/version.rb +28 -0
- data/test/helper.rb +13 -0
- data/test/test_helpers.rb +22 -0
- metadata +262 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
task :env do
|
4
|
+
LogUtils::Logger.root.level = :debug
|
5
|
+
|
6
|
+
Pluto.connect!
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
#########
|
11
|
+
# for debugging
|
12
|
+
|
13
|
+
desc 'pluto - debug site setup'
|
14
|
+
task :site => :env do
|
15
|
+
site = Pluto::Models::Site.first # FIX: for now assume one planet per DB (fix later; allow planet key or similar)
|
16
|
+
if site.present?
|
17
|
+
puts "site found:"
|
18
|
+
pp site
|
19
|
+
else
|
20
|
+
puts "no site found"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
### todo: add new task :sites
|
25
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
desc 'pluto -=- setup/update feed subscriptions'
|
4
|
+
task :setup => :env do
|
5
|
+
|
6
|
+
## check if PLANET key passed in
|
7
|
+
if ENV['PLANET'].present?
|
8
|
+
key = ENV['PLANET']
|
9
|
+
puts "setup planet for key >#{key}<"
|
10
|
+
else
|
11
|
+
puts 'no PLANET=key passed along; try defaults'
|
12
|
+
# try pluto.yml or planet.yml if exist
|
13
|
+
|
14
|
+
if File.exists?( './pluto.ini' ) || File.exists?( './pluto.yml' ) # check if pluto.yml exists, if yes add/use it
|
15
|
+
key ='pluto'
|
16
|
+
elsif File.exists?( './planet.ini' ) || File.exists?( './planet.yml' ) # check if planet.yml exists, if yes add/use it
|
17
|
+
key = 'planet'
|
18
|
+
else
|
19
|
+
puts '*** note: no arg passed in; no pluto.ini|yml or planet.ini|yml found in working folder'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
config_path = "./#{key}.ini"
|
25
|
+
if File.exists?( config_path )
|
26
|
+
config = INI.load_file( config_path )
|
27
|
+
else ## assume .yml
|
28
|
+
config_path = "./#{key}.yml"
|
29
|
+
config = YAML.load_file( config_path )
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
puts "dump planet setup settings >#{config_path}<:"
|
34
|
+
pp config
|
35
|
+
|
36
|
+
# note: allow multiple planets (sites) for a single install
|
37
|
+
Pluto::Subscriber.new.update_subscriptions_for( key, config )
|
38
|
+
|
39
|
+
puts 'Done.'
|
40
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
desc 'pluto - show planet (feed) stats'
|
4
|
+
task :stats => :env do
|
5
|
+
puts "stats:"
|
6
|
+
puts " Feeds: #{Pluto::Models::Feed.count}"
|
7
|
+
puts " Items: #{Pluto::Models::Item.count}"
|
8
|
+
puts " Sites: #{Pluto::Models::Site.count}"
|
9
|
+
puts " Subscriptions: #{Pluto::Models::Subscription.count}"
|
10
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
desc 'pluto -=- update planet (site configs)'
|
4
|
+
task :update_sites => :env do
|
5
|
+
|
6
|
+
Pluto.update_sites # update all site configs if source (url) present/specified
|
7
|
+
|
8
|
+
puts 'Done (Update Sites).'
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
desc 'pluto -=- update planet (feeds)'
|
13
|
+
task :update_feeds => :env do
|
14
|
+
|
15
|
+
Pluto.update_feeds
|
16
|
+
|
17
|
+
puts 'Done (Update Feeds).'
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
desc 'pluto -=- update planet (site configs + feeds)'
|
22
|
+
task :update => [:update_sites, :update_feeds] do
|
23
|
+
puts 'Done.'
|
24
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Pluto
|
2
|
+
|
3
|
+
class Updater
|
4
|
+
|
5
|
+
include LogUtils::Logging
|
6
|
+
|
7
|
+
### fix!!!!!: change config to text - yes/no - why? why not??
|
8
|
+
# or pass along struct
|
9
|
+
# - with hash and text and format(e.g. ini/yml) as fields???
|
10
|
+
#
|
11
|
+
# - why? - we need to get handle on md5 digest/hash plus on plain text, ideally to store in db
|
12
|
+
## - pass along unparsed text!! - not hash struct
|
13
|
+
# - will get saved in db plus we need to generate md5 hash
|
14
|
+
# - add filename e.g. ruby.ini|ruby.conf|ruby.yml as opt ??
|
15
|
+
# or add config format as opt e.g. ini or yml?
|
16
|
+
|
17
|
+
def initialize( opts, config )
|
18
|
+
@opts = opts
|
19
|
+
@config = config
|
20
|
+
end
|
21
|
+
|
22
|
+
attr_reader :opts, :config
|
23
|
+
|
24
|
+
def run( arg )
|
25
|
+
arg = arg.downcase.gsub('.ini','').gsub('.yml','') # remove file extension if present
|
26
|
+
|
27
|
+
update_for( arg )
|
28
|
+
end
|
29
|
+
|
30
|
+
def update_for( site_key )
|
31
|
+
###################
|
32
|
+
# step 1) update subscriptions
|
33
|
+
subscriber = Subscriber.new
|
34
|
+
|
35
|
+
# pass along debug/verbose setting/switch
|
36
|
+
subscriber.debug = true if opts.verbose?
|
37
|
+
subscriber.update_subscriptions_for( site_key, config )
|
38
|
+
|
39
|
+
##############################
|
40
|
+
# step 2) update feeds
|
41
|
+
refresher = Refresher.new
|
42
|
+
|
43
|
+
# pass along debug/verbose setting/switch
|
44
|
+
refresher.debug = true if opts.verbose?
|
45
|
+
refresher.update_feeds_for( site_key )
|
46
|
+
end # method run
|
47
|
+
|
48
|
+
end # class Updater
|
49
|
+
|
50
|
+
end # module Pluto
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Pluto
|
4
|
+
|
5
|
+
MAJOR = 1
|
6
|
+
MINOR = 1
|
7
|
+
PATCH = 0
|
8
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
9
|
+
|
10
|
+
def self.version
|
11
|
+
VERSION
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.banner
|
15
|
+
### todo: add RUBY_PATCHLEVEL or RUBY_PATCH_LEVEL e.g. -p124
|
16
|
+
"pluto-models/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.generator # convenience alias for banner (matches HTML generator meta tag)
|
20
|
+
"Pluto #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.root
|
24
|
+
"#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
|
25
|
+
end
|
26
|
+
|
27
|
+
end # module Pluto
|
28
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_rss.rb
|
6
|
+
# or better
|
7
|
+
# rake test
|
8
|
+
|
9
|
+
require 'helper'
|
10
|
+
|
11
|
+
class TestHelper < MiniTest::Test
|
12
|
+
|
13
|
+
## add some tests; to be done
|
14
|
+
|
15
|
+
def test_banner
|
16
|
+
puts Pluto.banner
|
17
|
+
|
18
|
+
assert true
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end # class TestHelper
|
metadata
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pluto-models
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gerald Bauer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pakman
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.5.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.5.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fetcher
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.4.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.4.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: logutils
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.6.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.6.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: feedutils
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.4.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.4.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: props
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.1.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.1.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: textutils
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.10.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.10.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: gli
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.12.2
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.12.2
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activerecord
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: logutils-activerecord
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.2.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.2.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: props-activerecord
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.1.0
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.1.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: activityutils
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.1.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.1.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rdoc
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '4.0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '4.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: hoe
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '3.13'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '3.13'
|
195
|
+
description: pluto-models - planet models and generator machinery for easy (re)use
|
196
|
+
email: feedreader@googlegroups.com
|
197
|
+
executables: []
|
198
|
+
extensions: []
|
199
|
+
extra_rdoc_files:
|
200
|
+
- HISTORY.md
|
201
|
+
- Manifest.txt
|
202
|
+
- README.md
|
203
|
+
files:
|
204
|
+
- ".gemtest"
|
205
|
+
- HISTORY.md
|
206
|
+
- Manifest.txt
|
207
|
+
- README.md
|
208
|
+
- Rakefile
|
209
|
+
- config/pluto.index.yml
|
210
|
+
- lib/pluto/activerecord.rb
|
211
|
+
- lib/pluto/connecter.rb
|
212
|
+
- lib/pluto/fetcher.rb
|
213
|
+
- lib/pluto/formatter.rb
|
214
|
+
- lib/pluto/installer.rb
|
215
|
+
- lib/pluto/lister.rb
|
216
|
+
- lib/pluto/manifest_helpers.rb
|
217
|
+
- lib/pluto/models.rb
|
218
|
+
- lib/pluto/models/activity.rb
|
219
|
+
- lib/pluto/models/feed.rb
|
220
|
+
- lib/pluto/models/item.rb
|
221
|
+
- lib/pluto/models/site.rb
|
222
|
+
- lib/pluto/models/subscription.rb
|
223
|
+
- lib/pluto/models/utils.rb
|
224
|
+
- lib/pluto/refresher.rb
|
225
|
+
- lib/pluto/schema.rb
|
226
|
+
- lib/pluto/subscriber.rb
|
227
|
+
- lib/pluto/tasks/env.rake
|
228
|
+
- lib/pluto/tasks/setup.rake
|
229
|
+
- lib/pluto/tasks/stats.rake
|
230
|
+
- lib/pluto/tasks/update.rake
|
231
|
+
- lib/pluto/updater.rb
|
232
|
+
- lib/pluto/version.rb
|
233
|
+
- test/helper.rb
|
234
|
+
- test/test_helpers.rb
|
235
|
+
homepage: https://github.com/feedreader/pluto-models
|
236
|
+
licenses:
|
237
|
+
- Public Domain
|
238
|
+
metadata: {}
|
239
|
+
post_install_message:
|
240
|
+
rdoc_options:
|
241
|
+
- "--main"
|
242
|
+
- README.md
|
243
|
+
require_paths:
|
244
|
+
- lib
|
245
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 1.9.2
|
250
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - ">="
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '0'
|
255
|
+
requirements: []
|
256
|
+
rubyforge_project:
|
257
|
+
rubygems_version: 2.4.2
|
258
|
+
signing_key:
|
259
|
+
specification_version: 4
|
260
|
+
summary: pluto-models - planet models and generator machinery for easy (re)use
|
261
|
+
test_files:
|
262
|
+
- test/test_helpers.rb
|