pluto-models 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +19 -19
- data/README.md +22 -17
- data/Rakefile +10 -10
- data/lib/pluto/connecter.rb +6 -10
- data/lib/pluto/models/feed.rb +2 -13
- data/lib/pluto/schema.rb +10 -10
- data/lib/pluto/version.rb +1 -2
- metadata +23 -27
- data/.gemtest +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd11efa85f9dedf8eace5016aee8f33e8c1d7eec
|
4
|
+
data.tar.gz: 2d4c4f5e9a919c65c7bc68883b4bc069a88d8393
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dadef8f729fb4991b346a5320b973fe2f76b7a00f128228907f7e59c2a55ca55ede3b49cf5411c9a1c3e1e2b04be136fc0957c2327c978c034efacd84136749d
|
7
|
+
data.tar.gz: ecd1033a25050c3c124179b9c4bb798e5d0886588aa9e4e35c5389d9950658b7df5994d8c5103904688b8245172514c41f0e4d261a90b252c0d34669b817f262
|
data/Manifest.txt
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
HISTORY.md
|
2
|
-
Manifest.txt
|
3
|
-
README.md
|
4
|
-
Rakefile
|
5
|
-
lib/pluto/connecter.rb
|
6
|
-
lib/pluto/models.rb
|
7
|
-
lib/pluto/models/feed.rb
|
8
|
-
lib/pluto/models/forward.rb
|
9
|
-
lib/pluto/models/item.rb
|
10
|
-
lib/pluto/models/site.rb
|
11
|
-
lib/pluto/models/subscription.rb
|
12
|
-
lib/pluto/models/utils.rb
|
13
|
-
lib/pluto/schema.rb
|
14
|
-
lib/pluto/version.rb
|
15
|
-
test/data/ruby.ini
|
16
|
-
test/helper.rb
|
17
|
-
test/test_filter.rb
|
18
|
-
test/test_helpers.rb
|
19
|
-
test/test_site.rb
|
1
|
+
HISTORY.md
|
2
|
+
Manifest.txt
|
3
|
+
README.md
|
4
|
+
Rakefile
|
5
|
+
lib/pluto/connecter.rb
|
6
|
+
lib/pluto/models.rb
|
7
|
+
lib/pluto/models/feed.rb
|
8
|
+
lib/pluto/models/forward.rb
|
9
|
+
lib/pluto/models/item.rb
|
10
|
+
lib/pluto/models/site.rb
|
11
|
+
lib/pluto/models/subscription.rb
|
12
|
+
lib/pluto/models/utils.rb
|
13
|
+
lib/pluto/schema.rb
|
14
|
+
lib/pluto/version.rb
|
15
|
+
test/data/ruby.ini
|
16
|
+
test/helper.rb
|
17
|
+
test/test_filter.rb
|
18
|
+
test/test_helpers.rb
|
19
|
+
test/test_site.rb
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# pluto-models gem - planet schema 'n' models for easy (re)use
|
2
2
|
|
3
|
-
* home :: [github.com/feedreader/pluto
|
4
|
-
* bugs :: [github.com/feedreader/pluto
|
3
|
+
* home :: [github.com/feedreader/pluto](https://github.com/feedreader/pluto)
|
4
|
+
* bugs :: [github.com/feedreader/pluto/issues](https://github.com/feedreader/pluto/issues)
|
5
5
|
* gem :: [rubygems.org/gems/pluto-models](https://rubygems.org/gems/pluto-models)
|
6
6
|
* rdoc :: [rubydoc.info/gems/pluto-models](http://rubydoc.info/gems/pluto-models)
|
7
|
-
* forum :: [groups.google.com/group/
|
7
|
+
* forum :: [groups.google.com/group/wwwmake](http://groups.google.com/group/wwwmake)
|
8
8
|
|
9
9
|
|
10
10
|
|
@@ -14,52 +14,55 @@
|
|
14
14
|
|
15
15
|
Site • Feed • Item • Subscription
|
16
16
|
|
17
|
+
![](pluto-models.png)
|
18
|
+
|
19
|
+
|
17
20
|
#### Site
|
18
21
|
|
19
|
-
|
22
|
+
```
|
20
23
|
class Site
|
21
24
|
has_many :subscriptions
|
22
25
|
has_many :feeds, :through => :subscriptions
|
23
26
|
has_many :items, :through => :feeds
|
24
27
|
...
|
25
|
-
end
|
26
|
-
|
28
|
+
end
|
29
|
+
```
|
27
30
|
|
28
31
|
#### Feed
|
29
32
|
|
30
|
-
|
33
|
+
```
|
31
34
|
class Feed
|
32
35
|
has_many :items
|
33
36
|
has_many :subscriptions
|
34
37
|
has_many :sites, :through => :subscriptions
|
35
38
|
...
|
36
39
|
end
|
37
|
-
|
40
|
+
```
|
38
41
|
|
39
42
|
#### Item
|
40
43
|
|
41
|
-
|
44
|
+
```
|
42
45
|
class Item
|
43
46
|
belongs_to :feed
|
44
47
|
...
|
45
48
|
end
|
46
|
-
|
49
|
+
```
|
47
50
|
|
48
51
|
#### Subscription
|
49
52
|
|
50
|
-
|
53
|
+
```
|
51
54
|
class Subscription
|
52
55
|
belongs_to :site
|
53
56
|
belongs_to :feed
|
54
57
|
...
|
55
58
|
end
|
56
|
-
|
59
|
+
```
|
57
60
|
|
58
61
|
|
59
62
|
|
60
63
|
### Examples
|
61
64
|
|
62
|
-
|
65
|
+
```
|
63
66
|
DB_CONFIG = {
|
64
67
|
adapter: 'sqlite3',
|
65
68
|
database: './planet.db'
|
@@ -78,24 +81,26 @@ Pluto::Model::Item.latest.limit(10).each_with_index do |item,i|
|
|
78
81
|
## warn: no content found
|
79
82
|
end
|
80
83
|
end
|
81
|
-
|
84
|
+
```
|
82
85
|
|
83
86
|
|
84
87
|
|
85
88
|
## Real World Usage
|
86
89
|
|
87
90
|
- [`pluto`](https://github.com/feedreader/pluto) - planet generator command line tool using the pluto-models gem
|
88
|
-
- [`pluto.live.starter`](https://github.com/
|
89
|
-
- [`pluto.live`](https://github.com/
|
91
|
+
- [`pluto.live.starter`](https://github.com/plutolive/pluto.live.starter) - sample planet site; sinatra web app starter template in ruby using the pluto-models gem
|
92
|
+
- [`pluto.live`](https://github.com/plutolive/pluto.live) - sample planet site; rails web app in ruby using the pluto-models gem
|
90
93
|
|
91
94
|
|
92
95
|
|
93
96
|
## License
|
94
97
|
|
98
|
+
![](https://publicdomainworks.github.io/buttons/zero88x31.png)
|
99
|
+
|
95
100
|
The `pluto-models` scripts are dedicated to the public domain.
|
96
101
|
Use it as you please with no restrictions whatsoever.
|
97
102
|
|
98
103
|
## Questions? Comments?
|
99
104
|
|
100
|
-
Send them along to the [
|
105
|
+
Send them along to the [wwwmake Forum/Mailing List](http://groups.google.com/group/wwwmake).
|
101
106
|
Thanks!
|
data/Rakefile
CHANGED
@@ -8,33 +8,33 @@ Hoe.spec 'pluto-models' do
|
|
8
8
|
self.summary = "pluto-models - planet schema 'n' models for easy (re)use"
|
9
9
|
self.description = summary
|
10
10
|
|
11
|
-
self.urls = ['https://github.com/feedreader/pluto
|
11
|
+
self.urls = ['https://github.com/feedreader/pluto']
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
|
-
self.email = '
|
14
|
+
self.email = 'wwwmake@googlegroups.com'
|
15
15
|
|
16
16
|
# switch extension to .markdown for gihub formatting
|
17
17
|
self.readme_file = 'README.md'
|
18
18
|
self.history_file = 'HISTORY.md'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['props', '>= 1.
|
21
|
+
['props', '>= 1.2.0'],
|
22
22
|
['logutils', '>= 0.6.1'],
|
23
|
-
['feedparser', '>= 1.0
|
23
|
+
['feedparser', '>= 2.1.0'],
|
24
24
|
['feedfilter', '>= 1.1.1'],
|
25
|
-
['textutils', '>= 1.0
|
25
|
+
['textutils', '>= 1.4.0'],
|
26
26
|
['activerecord'],
|
27
|
-
['logutils-activerecord', '>= 0.2.
|
28
|
-
['props-activerecord', '>= 0.
|
29
|
-
['activityutils', '>= 0.1.
|
30
|
-
['activerecord-utils', '>= 0.
|
27
|
+
['logutils-activerecord', '>= 0.2.1'],
|
28
|
+
['props-activerecord', '>= 0.2.0'],
|
29
|
+
['activityutils', '>= 0.1.1'],
|
30
|
+
['activerecord-utils', '>= 0.4.0'],
|
31
31
|
]
|
32
32
|
|
33
33
|
|
34
34
|
self.licenses = ['Public Domain']
|
35
35
|
|
36
36
|
self.spec_extras = {
|
37
|
-
required_ruby_version: '>=
|
37
|
+
required_ruby_version: '>= 2.3'
|
38
38
|
}
|
39
39
|
|
40
40
|
end
|
data/lib/pluto/connecter.rb
CHANGED
@@ -4,7 +4,7 @@ module Pluto
|
|
4
4
|
|
5
5
|
|
6
6
|
# DB Connecter / Connection Manager
|
7
|
-
# lets you establish connection
|
7
|
+
# lets you establish connection
|
8
8
|
|
9
9
|
class Connecter
|
10
10
|
|
@@ -15,13 +15,9 @@ class Connecter
|
|
15
15
|
end
|
16
16
|
|
17
17
|
|
18
|
-
def debug=(value)
|
19
|
-
|
20
|
-
end
|
18
|
+
def debug=(value) @debug = value; end
|
19
|
+
def debug?() @debug || false; end
|
21
20
|
|
22
|
-
def debug?
|
23
|
-
@debug || false
|
24
|
-
end
|
25
21
|
|
26
22
|
def connect( config={} )
|
27
23
|
|
@@ -53,7 +49,7 @@ class Connecter
|
|
53
49
|
pp config
|
54
50
|
|
55
51
|
### for dbbrowser and other tools add to ActiveRecord
|
56
|
-
|
52
|
+
|
57
53
|
if ActiveRecord::Base.configurations.nil? # todo/check: can this ever happen? remove?
|
58
54
|
puts "ActiveRecord configurations nil - set to empty hash"
|
59
55
|
ActiveRecord::Base.configurations = {} # make it an empty hash
|
@@ -63,7 +59,7 @@ class Connecter
|
|
63
59
|
puts 'ar configurations (before):'
|
64
60
|
pp ActiveRecord::Base.configurations
|
65
61
|
end
|
66
|
-
|
62
|
+
|
67
63
|
# note: for now always use pluto key for config storage
|
68
64
|
ActiveRecord::Base.configurations['pluto'] = config
|
69
65
|
|
@@ -75,7 +71,7 @@ class Connecter
|
|
75
71
|
|
76
72
|
# for debugging - disable for production use
|
77
73
|
if debug?
|
78
|
-
ActiveRecord::Base.logger = Logger.new( STDOUT )
|
74
|
+
ActiveRecord::Base.logger = Logger.new( STDOUT )
|
79
75
|
end
|
80
76
|
|
81
77
|
ActiveRecord::Base.establish_connection( config )
|
data/lib/pluto/models/feed.rb
CHANGED
@@ -13,7 +13,7 @@ class Feed < ActiveRecord::Base
|
|
13
13
|
|
14
14
|
|
15
15
|
## todo/fix:
|
16
|
-
## use a module ref or something; do NOT include all methods - why? why not?
|
16
|
+
## use a module ref or something; do NOT include all methods - why? why not?
|
17
17
|
include TextUtils::HypertextHelper ## e.g. lets us use strip_tags( ht )
|
18
18
|
|
19
19
|
|
@@ -133,16 +133,6 @@ class Feed < ActiveRecord::Base
|
|
133
133
|
|
134
134
|
def update_from_struct!( data )
|
135
135
|
|
136
|
-
## todo: move to FeedParser::Feed ??? why? why not??
|
137
|
-
if data.generator
|
138
|
-
generator_full = ''
|
139
|
-
generator_full << data.generator
|
140
|
-
generator_full << " @version=#{data.generator_version}" if data.generator_version
|
141
|
-
generator_full << " @uri=#{data.generator_uri}" if data.generator_uri
|
142
|
-
else
|
143
|
-
generator_full = nil
|
144
|
-
end
|
145
|
-
|
146
136
|
##
|
147
137
|
# todo:
|
148
138
|
## strip all tags from summary (subtitle)
|
@@ -153,13 +143,12 @@ class Feed < ActiveRecord::Base
|
|
153
143
|
## The higher-traffic mailing list for all kinds of discussion is
|
154
144
|
## <a href="https://groups.google.com/group/polymer-dev">https://groups.google.com/group/polymer-dev</a>
|
155
145
|
|
156
|
-
|
157
146
|
feed_attribs = {
|
158
147
|
format: data.format,
|
159
148
|
updated: data.updated,
|
160
149
|
published: data.published,
|
161
150
|
summary: data.summary,
|
162
|
-
generator:
|
151
|
+
generator: data.generator.to_s, ## note: use single-line/string generator stringified -- might return null (if no data)
|
163
152
|
### todo/fix: add/use
|
164
153
|
# auto_title: ???,
|
165
154
|
# auto_url: ???,
|
data/lib/pluto/schema.rb
CHANGED
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
module Pluto
|
4
4
|
|
5
|
-
class CreateDb
|
5
|
+
class CreateDb
|
6
6
|
|
7
|
-
|
7
|
+
def up
|
8
|
+
|
9
|
+
ActiveRecord::Schema.define do
|
8
10
|
create_table :sites do |t|
|
9
11
|
t.string :key, null: false # e.g. ruby, js, etc.
|
10
12
|
t.string :title, null: false # e.g Planet Ruby, Planet JavaScript, etc.
|
@@ -142,12 +144,10 @@ class CreateDb < ActiveRecord::Migration
|
|
142
144
|
## todo: add author/authors, category/categories
|
143
145
|
end
|
144
146
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
end # class CreateDb
|
152
|
-
|
147
|
+
end # block Schema.define
|
148
|
+
|
149
|
+
end # method up
|
150
|
+
|
151
|
+
end # class CreateDb
|
152
|
+
|
153
153
|
end # module Pluto
|
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.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: props
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: logutils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.0
|
47
|
+
version: 2.1.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0
|
54
|
+
version: 2.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: feedfilter
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0
|
75
|
+
version: 1.4.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.0
|
82
|
+
version: 1.4.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: activerecord
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,56 +100,56 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.2.
|
103
|
+
version: 0.2.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.2.
|
110
|
+
version: 0.2.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: props-activerecord
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.2.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.2.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: activityutils
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.1.
|
131
|
+
version: 0.1.1
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.1.
|
138
|
+
version: 0.1.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: activerecord-utils
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 0.4.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 0.4.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rdoc
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,16 +170,16 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '3.
|
173
|
+
version: '3.16'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '3.
|
180
|
+
version: '3.16'
|
181
181
|
description: pluto-models - planet schema 'n' models for easy (re)use
|
182
|
-
email:
|
182
|
+
email: wwwmake@googlegroups.com
|
183
183
|
executables: []
|
184
184
|
extensions: []
|
185
185
|
extra_rdoc_files:
|
@@ -187,7 +187,6 @@ extra_rdoc_files:
|
|
187
187
|
- Manifest.txt
|
188
188
|
- README.md
|
189
189
|
files:
|
190
|
-
- ".gemtest"
|
191
190
|
- HISTORY.md
|
192
191
|
- Manifest.txt
|
193
192
|
- README.md
|
@@ -207,7 +206,7 @@ files:
|
|
207
206
|
- test/test_filter.rb
|
208
207
|
- test/test_helpers.rb
|
209
208
|
- test/test_site.rb
|
210
|
-
homepage: https://github.com/feedreader/pluto
|
209
|
+
homepage: https://github.com/feedreader/pluto
|
211
210
|
licenses:
|
212
211
|
- Public Domain
|
213
212
|
metadata: {}
|
@@ -221,7 +220,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
221
220
|
requirements:
|
222
221
|
- - ">="
|
223
222
|
- !ruby/object:Gem::Version
|
224
|
-
version:
|
223
|
+
version: '2.3'
|
225
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
225
|
requirements:
|
227
226
|
- - ">="
|
@@ -229,11 +228,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
228
|
version: '0'
|
230
229
|
requirements: []
|
231
230
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
231
|
+
rubygems_version: 2.5.2
|
233
232
|
signing_key:
|
234
233
|
specification_version: 4
|
235
234
|
summary: pluto-models - planet schema 'n' models for easy (re)use
|
236
|
-
test_files:
|
237
|
-
- test/test_filter.rb
|
238
|
-
- test/test_site.rb
|
239
|
-
- test/test_helpers.rb
|
235
|
+
test_files: []
|
data/.gemtest
DELETED
File without changes
|