pluto-models 1.2.4 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pluto/models/feed.rb +12 -4
- data/lib/pluto/models/item.rb +3 -1
- data/lib/pluto/models/site.rb +9 -1
- data/lib/pluto/schema.rb +28 -16
- data/lib/pluto/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6690b769ee8041814fe15af85acc647ced2c4f33
|
4
|
+
data.tar.gz: 797c2054af4bc2975495e9a7ba61ddf922d5f770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dca815302f8ffffbb8902241bf4db7388a2b747839cf88ee7be68ce2dc392de935127e994b1428454229516cd0efcb169e08b17ac46e20fbaecd6e526263b23
|
7
|
+
data.tar.gz: af2731d41d1837c7ea81f7ac466c2714ed421e9a8ae0897e5e7dd989c9055f26daf594ffeb0b7469f0a396521c2b7912f5e6b92c61c401e98bf3cc976e5a7d56
|
data/lib/pluto/models/feed.rb
CHANGED
@@ -31,10 +31,18 @@ class Feed < ActiveRecord::Base
|
|
31
31
|
#
|
32
32
|
# todo: check if we can use alias_method :name, :title - works for non-existing/on-demand-generated method too??
|
33
33
|
|
34
|
-
def name() title; end # alias
|
35
|
-
def description() summary; end # alias
|
36
|
-
def
|
37
|
-
def
|
34
|
+
def name() title; end # alias for title
|
35
|
+
def description() summary; end # alias for summary
|
36
|
+
def desc() summary; end # alias(2) for summary
|
37
|
+
def link() url; end # alias for url
|
38
|
+
def feed() feed_url; end # alias for feed_url
|
39
|
+
|
40
|
+
def author_name() author; end # alias for author
|
41
|
+
def owner_name() author; end # alias(2) for author
|
42
|
+
def owner() author; end # alias(3) for author
|
43
|
+
def author_email() email; end # alias for email
|
44
|
+
def author_email() email; end # alias(2) for email
|
45
|
+
|
38
46
|
|
39
47
|
def url?() read_attribute(:url).present?; end
|
40
48
|
def title?() read_attribute(:title).present?; end
|
data/lib/pluto/models/item.rb
CHANGED
@@ -16,9 +16,11 @@ class Item < ActiveRecord::Base
|
|
16
16
|
##################################
|
17
17
|
# attribute reader aliases
|
18
18
|
def name() title; end # alias for title
|
19
|
-
def description() summary; end # alias
|
19
|
+
def description() summary; end # alias for summary -- also add descr shortcut??
|
20
|
+
def desc() summary; end # alias (2) for summary -- also add descr shortcut??
|
20
21
|
def link() url; end # alias for url
|
21
22
|
|
23
|
+
|
22
24
|
def self.latest
|
23
25
|
# note: order by first non-null datetime field
|
24
26
|
# coalesce - supported by sqlite (yes), postgres (yes)
|
data/lib/pluto/models/site.rb
CHANGED
@@ -15,7 +15,15 @@ class Site < ActiveRecord::Base
|
|
15
15
|
def name() title; end # alias for title
|
16
16
|
def fetched_at() fetched; end # - legacy attrib reader -- remove!!!
|
17
17
|
|
18
|
-
end
|
18
|
+
def owner_name() author; end # alias for author
|
19
|
+
def owner() author; end # alias(2) for author
|
20
|
+
def author_name() author; end # alias(3) for author
|
21
|
+
|
22
|
+
def owner_email() email; end # alias for email
|
23
|
+
def author_email() email; end # alias(2) for email
|
24
|
+
|
25
|
+
end # class Site
|
26
|
+
|
19
27
|
|
20
28
|
end # module Model
|
21
29
|
end # module Pluto
|
data/lib/pluto/schema.rb
CHANGED
@@ -6,22 +6,27 @@ class CreateDb < ActiveRecord::Migration
|
|
6
6
|
|
7
7
|
def up
|
8
8
|
create_table :sites do |t|
|
9
|
-
t.string :
|
10
|
-
t.string :
|
9
|
+
t.string :key, null: false # e.g. ruby, js, etc.
|
10
|
+
t.string :title, null: false # e.g Planet Ruby, Planet JavaScript, etc.
|
11
|
+
|
12
|
+
t.string :author # owner_name, author_name
|
13
|
+
t.string :email # owner_email, author_email
|
14
|
+
t.datetime :updated # date for subscription list last updated via pluto
|
11
15
|
|
12
16
|
############
|
13
17
|
# filters (site-wide)
|
14
18
|
t.string :includes # regex
|
15
19
|
t.string :excludes # regex
|
16
20
|
|
21
|
+
|
17
22
|
######################
|
18
23
|
# for auto-update of feed list/site config
|
19
24
|
|
20
25
|
t.string :url # source url for auto-update (optional)
|
21
26
|
|
22
|
-
## note: make sure to use same fields for update check as feed
|
27
|
+
## note: make sure to use same fields for update check as feed
|
23
28
|
|
24
|
-
t.datetime :fetched # last fetched/checked
|
29
|
+
t.datetime :fetched # date for last fetched/checked for feeds via pluto -- make not null ??
|
25
30
|
t.integer :http_code # last http status code e.g. 200,404,etc.
|
26
31
|
t.string :http_etag # last http header etag
|
27
32
|
## note: save last-modified header as text (not datetime) - pass through as is
|
@@ -31,7 +36,6 @@ class CreateDb < ActiveRecord::Migration
|
|
31
36
|
# note: do NOT store body content (that is, text) and md5 digest
|
32
37
|
# use git! and github! commit will be http_etag!!
|
33
38
|
|
34
|
-
t.datetime :fetched # last fetched/checked date
|
35
39
|
|
36
40
|
#############
|
37
41
|
# more fields
|
@@ -39,13 +43,18 @@ class CreateDb < ActiveRecord::Migration
|
|
39
43
|
t.timestamps # created_at, updated_at
|
40
44
|
end
|
41
45
|
|
46
|
+
|
42
47
|
create_table :subscriptions do |t| # has_many join table (sites/feeds)
|
43
|
-
t.references :site, :
|
44
|
-
t.references :feed, :
|
48
|
+
t.references :site, null: false
|
49
|
+
t.references :feed, null: false
|
45
50
|
t.timestamps
|
46
51
|
end
|
47
52
|
|
48
53
|
create_table :feeds do |t|
|
54
|
+
t.string :key, null: false
|
55
|
+
t.string :encoding, null: false, default: 'utf8' # charset encoding; default to utf8
|
56
|
+
t.string :format # e.g. atom (1.0), rss 2.0, rss 0.7 etc.
|
57
|
+
|
49
58
|
t.string :title # user supplied title
|
50
59
|
t.string :auto_title # "fallback" - auto(fill) title from feed
|
51
60
|
|
@@ -66,10 +75,16 @@ class CreateDb < ActiveRecord::Migration
|
|
66
75
|
t.datetime :built # from feed lastBuiltDate(rss)
|
67
76
|
t.datetime :touched # from feed updated(atom)
|
68
77
|
|
78
|
+
|
69
79
|
### extras (move to array for custom fields or similar??)
|
80
|
+
t.string :author # author_name, owner_name
|
81
|
+
t.string :email # author_email, owner_email
|
82
|
+
t.string :avatar # gravator or hackergotchi handle (optional)
|
83
|
+
|
70
84
|
t.string :github # github handle (optional)
|
71
85
|
t.string :twitter # twitter handle (optional)
|
72
|
-
t.string :
|
86
|
+
t.string :meetup # meetup handle (optional)
|
87
|
+
|
73
88
|
|
74
89
|
### add class/kind field e.g.
|
75
90
|
# - personal feed/blog/site, that is, individual author
|
@@ -79,16 +94,14 @@ class CreateDb < ActiveRecord::Migration
|
|
79
94
|
# - other (link blog?, podcast?) - why? why not??
|
80
95
|
|
81
96
|
############
|
82
|
-
# filters
|
97
|
+
# filters (feed-wide)
|
83
98
|
t.string :includes # regex
|
84
99
|
t.string :excludes # regex
|
85
100
|
# todo: add generic filter list e.g. t.string :filters (comma,pipe or space separated method names?)
|
86
101
|
|
87
102
|
# -- our own (meta) fields
|
88
|
-
t.datetime :last_published
|
89
|
-
|
90
|
-
t.string :key, :null => false
|
91
|
-
t.string :format # e.g. atom (1.0), rss 2.0, rss 0.7 etc.
|
103
|
+
t.datetime :last_published # cache last (latest) published for items - e.g. latest date from publisehd item
|
104
|
+
t.datetime :fetched # last fetched date via pluto
|
92
105
|
|
93
106
|
t.integer :http_code # last http status code e.g. 200,404,etc.
|
94
107
|
t.string :http_etag # last http header etag
|
@@ -99,7 +112,6 @@ class CreateDb < ActiveRecord::Migration
|
|
99
112
|
t.string :md5 # md5 hash of body
|
100
113
|
t.text :body # last http response body (complete feed!)
|
101
114
|
|
102
|
-
t.datetime :fetched # last fetched/checked date
|
103
115
|
|
104
116
|
t.timestamps # created_at, updated_at
|
105
117
|
end
|
@@ -122,9 +134,9 @@ class CreateDb < ActiveRecord::Migration
|
|
122
134
|
t.datetime :touched # from feed updated (atom)
|
123
135
|
|
124
136
|
## todo: add :last_updated_at ?? (NOTE: updated_at already take by auto-timestamps)
|
125
|
-
t.references :feed, :
|
137
|
+
t.references :feed, null: false
|
126
138
|
|
127
|
-
t.datetime :fetched # last fetched/check date
|
139
|
+
t.datetime :fetched # last fetched/check date via pluto
|
128
140
|
t.timestamps # created_at, updated_at
|
129
141
|
|
130
142
|
## t.string :author
|
data/lib/pluto/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluto-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: props
|