pluto-news 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +225 -3
- data/Rakefile +3 -2
- data/lib/pluto/news.rb +127 -21
- data/lib/pluto/news/version.rb +2 -3
- data/test/test_queries.rb +28 -2
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ac0bb70a3bc40dd269d3f4ac957b10398d12e01
|
4
|
+
data.tar.gz: 7d62cf94421dee4172fb49f22fcd6df482cdda8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd63506d67221c4021665315dda9d3fc952b08827b89e54d1ac3340dab5cda2fbea1bc11110c3fb1c7eba9f0420bbc6ba3bc74daefa98e882fa15122698ee101
|
7
|
+
data.tar.gz: 66917821bbda961d19afe15e61ca93f555e5986fbb8e8cabf0f9b688246e94ad23d4dd901a35de63ad7a68838ae89c4423c908ff3470bc1e8e93ce2c0be03caa
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# pluto-news gem - newsreader for easy (re)use - build your own facebook newsfeed in 5 minutes
|
2
|
-
|
1
|
+
# pluto-news gem - newsreader for easy (re)use - build your own facebook newsfeed in 1-2-3 steps in 5 minutes
|
2
|
+
|
3
3
|
|
4
4
|
* home :: [github.com/feedreader/pluto](https://github.com/feedreader/pluto)
|
5
5
|
* bugs :: [github.com/feedreader/pluto/issues](https://github.com/feedreader/pluto/issues)
|
@@ -11,7 +11,229 @@
|
|
11
11
|
|
12
12
|
## Usage
|
13
13
|
|
14
|
-
|
14
|
+
The `News` module offers easy to (re)use "porcelain" helpers / methods
|
15
|
+
that hide the "plumbing" for building your own newsreader or newsfeeds in minutes.
|
16
|
+
|
17
|
+
|
18
|
+
### Step 1 - Subscribe
|
19
|
+
|
20
|
+
Use the `News.subscribe( *feeds )` method to subscribe to news feeds / channels.
|
21
|
+
Example:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
News.subscribe(
|
25
|
+
'http://www.ruby-lang.org/en/feeds/news.rss', # Ruby Lang News
|
26
|
+
'http://www.jruby.org/atom.xml', # JRuby Lang News
|
27
|
+
'http://blog.rubygems.org/atom.xml', # RubyGems News
|
28
|
+
'http://bundler.io/blog/feed.xml', # Bundler News
|
29
|
+
'http://weblog.rubyonrails.org/feed/atom.xml', # Ruby on Rails News
|
30
|
+
'http://sinatrarb.com/feed.xml', # Sinatra News
|
31
|
+
'https://hanamirb.org/atom.xml', # Hanami News
|
32
|
+
'http://jekyllrb.com/feed.xml', # Jekyll News
|
33
|
+
'http://feeds.feedburner.com/jetbrains_rubymine?format=xml', # RubyMine IDE News
|
34
|
+
'https://blog.phusion.nl/rss/', # Phusion News
|
35
|
+
'https://rubyinstaller.org/feed.xml', # Ruby Installer for Windows News
|
36
|
+
'http://planetruby.github.io/calendar/feed.xml', # Ruby Conferences & Camps News
|
37
|
+
'https://rubytogether.org/news.xml', # Ruby Together News
|
38
|
+
'https://foundation.travis-ci.org/feed.xml', # Travis Foundation News
|
39
|
+
'https://railsgirlssummerofcode.org/blog.xml', # Rails Girls Summer of Code News
|
40
|
+
|
41
|
+
'http://blog.zenspider.com/atom.xml', # Ryan Davis @ Seattle › Washington › United States
|
42
|
+
'http://tenderlovemaking.com/atom.xml', # Aaron Patterson @ Seattle › Washington › United States
|
43
|
+
'http://blog.headius.com/feed.xml', # Charles Nutter @ Richfield › Minnesota › United States
|
44
|
+
'http://www.schneems.com/feed.xml', # Richard Schneeman @ Austin › Texas › United States
|
45
|
+
'https://eregon.me/blog/feed.xml', # Benoit Daloze @ Zurich › Switzerland
|
46
|
+
'http://samsaffron.com/posts.rss', # Sam Saffron @ Sydney › Australia
|
47
|
+
)
|
48
|
+
```
|
49
|
+
|
50
|
+
|
51
|
+
Note: If you call `News.subscribe` the method will setup a single-file SQLite database,
|
52
|
+
that is, `./news.db` and auto-migrate the schema, that is, database tables and so on.
|
53
|
+
|
54
|
+
|
55
|
+
### Step 2 - Update
|
56
|
+
|
57
|
+
Use the `News.update` method to fetch from the internets all news feeds / channels
|
58
|
+
and update the `./news.db` database. Example:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
News.update
|
62
|
+
```
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
### Step 3 - Query and Remix the News Items
|
67
|
+
|
68
|
+
Profit! Now you can query the `./news.db` database with any of the many
|
69
|
+
pre-made / ready-to-use query helpers. Example:
|
70
|
+
|
71
|
+
``` ruby
|
72
|
+
puts ":::::::::::::::::::::::::::::::::::::::::::::::::::"
|
73
|
+
puts ":: #{News.items.count} news items from #{News.channels.count} channels:"
|
74
|
+
puts
|
75
|
+
```
|
76
|
+
|
77
|
+
resulting in:
|
78
|
+
|
79
|
+
```
|
80
|
+
:::::::::::::::::::::::::::::::::::::::::::::::::::
|
81
|
+
:: 793 news items from 21 channels:
|
82
|
+
```
|
83
|
+
|
84
|
+
and
|
85
|
+
|
86
|
+
``` ruby
|
87
|
+
puts "100 Latest News Items"
|
88
|
+
News.latest.limit( 100 ).each do |item|
|
89
|
+
print "%4dd " % (Date.today.jd-item.updated.to_date.jd)
|
90
|
+
print " #{item.updated}"
|
91
|
+
print " - #{item.title}"
|
92
|
+
print " - #{URI(item.feed.feed_url).host}"
|
93
|
+
print "\n"
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
resulting in:
|
98
|
+
|
99
|
+
```
|
100
|
+
100 Latest News Items
|
101
|
+
0d 2020-02-04 00:00:00 - RubyNess @ Inverness, Scotland, United Kingdom - planetruby.github.io
|
102
|
+
0d 2020-02-04 00:00:00 - Ruby by the Bay (Ruby for Good, West Coast Edition) @ Marin Headlands (near San Francisco), California, United States - planetruby.github.io
|
103
|
+
8d 2020-01-27 14:44:38 - RubyMine 2020.1 EAP is Open! - jetbrains.com
|
104
|
+
11d 2020-01-24 00:00:00 - Crowdfunding for 2020 scholarships has commenced - railsgirlssummerofcode.org
|
105
|
+
15d 2020-01-20 00:00:00 - Alumni Interview with Keziah Naggita - railsgirlssummerofcode.org
|
106
|
+
16d 2020-01-19 00:00:00 - This week in Rails - Rack 2.1 released, disallowed deprecations, and more! - weblog.rubyonrails.org
|
107
|
+
19d 2020-01-16 00:00:00 - RubyConf Belarus (BY) @ Minsk, Belarus - planetruby.github.io
|
108
|
+
22d 2020-01-13 14:00:39 - Guide to String Encoding in Ruby - tenderlovemaking.com
|
109
|
+
23d 2020-01-12 23:00:00 - A Migration Path to Bundler 2+ - eregon.me
|
110
|
+
24d 2020-01-11 00:00:00 - This week in Rails - Deprecations, bugfixes and improvements! - weblog.rubyonrails.org
|
111
|
+
30d 2020-01-05 00:00:00 - This week in Rails - The 2019 edition - weblog.rubyonrails.org
|
112
|
+
30d 2020-01-05 00:00:00 - RubyInstaller 2.7.0-1 released - rubyinstaller.org
|
113
|
+
32d 2020-01-03 00:00:00 - Submit Your Open Source Projects - railsgirlssummerofcode.org
|
114
|
+
34d 2020-01-01 00:00:00 - Happy new year & Sinatra 2.0.8! - sinatrarb.com
|
115
|
+
39d 2019-12-27 00:00:00 - Ruby 2.7.0, Rails 6.0.2.1 and more - weblog.rubyonrails.org
|
116
|
+
41d 2019-12-25 00:00:00 - Ruby 2.7.0 Released - ruby-lang.org
|
117
|
+
...
|
118
|
+
```
|
119
|
+
|
120
|
+
More queries include:
|
121
|
+
|
122
|
+
``` ruby
|
123
|
+
News.today
|
124
|
+
|
125
|
+
News.week
|
126
|
+
News.week( 1 )
|
127
|
+
News.week( 1, 2019 )
|
128
|
+
|
129
|
+
News.month
|
130
|
+
News.month( 1 )
|
131
|
+
News.month( 1, 2019 )
|
132
|
+
|
133
|
+
News.year
|
134
|
+
News.year( 2019 )
|
135
|
+
|
136
|
+
News.this_week
|
137
|
+
News.this_month
|
138
|
+
News.this_year
|
139
|
+
|
140
|
+
News.q1
|
141
|
+
News.q2
|
142
|
+
News.q3
|
143
|
+
News.q4
|
144
|
+
```
|
145
|
+
|
146
|
+
and some more.
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
### All Together Now - Let's Build A Newsfeed in 20 Lines
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
require 'pluto/news'
|
154
|
+
|
155
|
+
# step 1) subscribe to a list of news feeds / channels
|
156
|
+
|
157
|
+
News.subscribe(
|
158
|
+
'http://www.ruby-lang.org/en/feeds/news.rss', # Ruby Lang News
|
159
|
+
'http://www.jruby.org/atom.xml', # JRuby Lang News
|
160
|
+
'http://blog.rubygems.org/atom.xml', # RubyGems News
|
161
|
+
'http://bundler.io/blog/feed.xml', # Bundler News
|
162
|
+
'http://weblog.rubyonrails.org/feed/atom.xml', # Ruby on Rails News
|
163
|
+
'http://sinatrarb.com/feed.xml', # Sinatra News
|
164
|
+
'https://hanamirb.org/atom.xml', # Hanami News
|
165
|
+
'http://jekyllrb.com/feed.xml', # Jekyll News
|
166
|
+
'http://feeds.feedburner.com/jetbrains_rubymine?format=xml', # RubyMine IDE News
|
167
|
+
'https://blog.phusion.nl/rss/', # Phusion News
|
168
|
+
'https://rubyinstaller.org/feed.xml', # Ruby Installer for Windows News
|
169
|
+
'http://planetruby.github.io/calendar/feed.xml', # Ruby Conferences & Camps News
|
170
|
+
'https://rubytogether.org/news.xml', # Ruby Together News
|
171
|
+
'https://foundation.travis-ci.org/feed.xml', # Travis Foundation News
|
172
|
+
'https://railsgirlssummerofcode.org/blog.xml', # Rails Girls Summer of Code News
|
173
|
+
|
174
|
+
'http://blog.zenspider.com/atom.xml', # Ryan Davis @ Seattle › Washington › United States
|
175
|
+
'http://tenderlovemaking.com/atom.xml', # Aaron Patterson @ Seattle › Washington › United States
|
176
|
+
'http://blog.headius.com/feed.xml', # Charles Nutter @ Richfield › Minnesota › United States
|
177
|
+
'http://www.schneems.com/feed.xml', # Richard Schneeman @ Austin › Texas › United States
|
178
|
+
'https://eregon.me/blog/feed.xml', # Benoit Daloze @ Zurich › Switzerland
|
179
|
+
'http://samsaffron.com/posts.rss', # Sam Saffron @ Sydney › Australia
|
180
|
+
)
|
181
|
+
|
182
|
+
|
183
|
+
# step 2) fetch and update news feeds / channels
|
184
|
+
|
185
|
+
News.update
|
186
|
+
|
187
|
+
|
188
|
+
# step 3) mix up all news items in a new page
|
189
|
+
|
190
|
+
puts News.render( <<TXT )
|
191
|
+
<% News.latest.limit(100).each do |item| %>
|
192
|
+
<div class="item">
|
193
|
+
<h2><a href="<%= item.url %>"><%= item.title %></a></h2>
|
194
|
+
<div><%= item.content %></div>
|
195
|
+
</div>
|
196
|
+
<% end %>
|
197
|
+
TXT
|
198
|
+
```
|
199
|
+
|
200
|
+
resulting in:
|
201
|
+
|
202
|
+
``` html
|
203
|
+
<div class="item">
|
204
|
+
<h2><a href="http://planetruby.github.io/calendar/2020#rubyness">RubyNess @ Inverness,
|
205
|
+
Scotland, United Kingdom - Ruby Conferences 'n' Camps Update</a></h2>
|
206
|
+
<div><p>What's News? What's Upcoming in 2020?</p>
|
207
|
+
<p>
|
208
|
+
<b><a href="https://rubyness.org/" id="rubyness">RubyNess</a></b><br>
|
209
|
+
Jul/16+17 (2d) Thu+Fri @ Inverness, Scotland, United Kingdom •
|
210
|
+
<a href="https://twitter.com/rubynessconf" title="@rubynessconf">(Updates)</a>
|
211
|
+
</p>
|
212
|
+
<p>
|
213
|
+
See all <a href="http://planetruby.github.io/calendar/2020">Conferences 'n' Camps in 2020»</a>.
|
214
|
+
</p></div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class="item">
|
218
|
+
<h2><a href="http://feedproxy.google.com/~r/jetbrains_rubymine/~3/DiNxpQHKHrk/">RubyMine
|
219
|
+
2020.1 EAP is Open!</a></h2>
|
220
|
+
<div><p>Hello everyone,</p>
|
221
|
+
<p>Today we are happy to announce the opening of the Early Access Program (EAP)
|
222
|
+
for RubyMine 2020.1! You can get EAP builds...
|
223
|
+
</p>
|
224
|
+
<p>Happy Developing!<br>
|
225
|
+
Your RubyMine team
|
226
|
+
</p></div>
|
227
|
+
</div>
|
228
|
+
...
|
229
|
+
```
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
## More
|
234
|
+
|
235
|
+
- [news.rb quick starter script](https://github.com/feedreader/news.rb) - build your own facebook newsfeed in 1-2-3 steps in 5 minutes
|
236
|
+
|
15
237
|
|
16
238
|
|
17
239
|
## License
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ Hoe.spec 'pluto-news' do
|
|
5
5
|
|
6
6
|
self.version = PlutoNews::VERSION
|
7
7
|
|
8
|
-
self.summary = "pluto-news - newsreader for easy (re)use - build your own facebook newsfeed in 5 minutes"
|
8
|
+
self.summary = "pluto-news - newsreader for easy (re)use - build your own facebook newsfeed in 1-2-3 steps in 5 minutes"
|
9
9
|
self.description = summary
|
10
10
|
|
11
11
|
self.urls = ['https://github.com/feedreader/pluto']
|
@@ -18,7 +18,8 @@ Hoe.spec 'pluto-news' do
|
|
18
18
|
self.history_file = 'CHANGELOG.md'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['pluto-models', '>= 1.5.
|
21
|
+
['pluto-models', '>= 1.5.5'],
|
22
|
+
['sqlite3'], # note: for easy installation include sqlite database library
|
22
23
|
]
|
23
24
|
|
24
25
|
self.licenses = ['Public Domain']
|
data/lib/pluto/news.rb
CHANGED
@@ -1,6 +1,52 @@
|
|
1
|
+
|
1
2
|
require 'pluto/update'
|
2
3
|
|
3
4
|
|
5
|
+
## todo/fix: include stdlibs in pluto/update or pluto/models upstream!!!
|
6
|
+
require 'date'
|
7
|
+
require 'time'
|
8
|
+
require 'cgi'
|
9
|
+
require 'uri'
|
10
|
+
require 'digest'
|
11
|
+
|
12
|
+
require 'erb'
|
13
|
+
require 'ostruct'
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
class Date
|
18
|
+
## def quarter() 1+(self.month-1)/3; end
|
19
|
+
|
20
|
+
def quarter
|
21
|
+
case self.month
|
22
|
+
when 1,2,3 then 1
|
23
|
+
when 4,5,6 then 2
|
24
|
+
when 7,8,9 then 3
|
25
|
+
when 10,11,12 then 4
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# -- for testing:
|
31
|
+
# (1..12).each do |num|
|
32
|
+
# puts "#{num} -> #{Date.new(2020,num,1).quarter}"
|
33
|
+
# end
|
34
|
+
# -- prints:
|
35
|
+
# 1 -> 1
|
36
|
+
# 2 -> 1
|
37
|
+
# 3 -> 1
|
38
|
+
# 4 -> 2
|
39
|
+
# 5 -> 2
|
40
|
+
# 6 -> 2
|
41
|
+
# 7 -> 3
|
42
|
+
# 8 -> 3
|
43
|
+
# 9 -> 3
|
44
|
+
# 10 -> 4
|
45
|
+
# 11 -> 4
|
46
|
+
# 12 -> 4
|
47
|
+
|
48
|
+
|
49
|
+
|
4
50
|
## our own code
|
5
51
|
require 'pluto/news/version'
|
6
52
|
|
@@ -13,15 +59,24 @@ module News
|
|
13
59
|
'title' => 'News, News, News'
|
14
60
|
}
|
15
61
|
|
16
|
-
feeds.each_with_index do |feed
|
17
|
-
|
18
|
-
##
|
19
|
-
##
|
20
|
-
##
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
62
|
+
feeds.each_with_index do |feed|
|
63
|
+
## note:
|
64
|
+
## use a "fingerprint" hash digest as key
|
65
|
+
## do NOT include scheme (e.g. https or http)
|
66
|
+
## do NOT include port
|
67
|
+
## so you can change it without "breaking" the key - why? why not?
|
68
|
+
##
|
69
|
+
## e.g. u = URI( 'https://example.com:333/a/b?f=xml'
|
70
|
+
## u.host+u.request_uri
|
71
|
+
## #=> example.com/a/b?f=xml
|
72
|
+
uri = URI( feed )
|
73
|
+
## note: add host in "plain" text - making errors and the key more readable
|
74
|
+
## note: cut-off www. if leading e.g. www.ruby-lang.org => ruby-lang.org
|
75
|
+
host = uri.host.downcase.sub( /^www\./, '' )
|
76
|
+
# use a differt separator e.g _ or ~ and NOT $ - why? why not?
|
77
|
+
key = "#{host}$#{Digest::MD5.hexdigest( uri.request_uri )}"
|
78
|
+
|
79
|
+
site_hash[ key ] = { 'feed' => feed }
|
25
80
|
end
|
26
81
|
|
27
82
|
connection ## make sure we have a database connection (and setup) up-and-running
|
@@ -91,13 +146,35 @@ module News
|
|
91
146
|
end
|
92
147
|
|
93
148
|
def self.month( month=Date.today.month, year=Date.today.year )
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
149
|
+
q = "%4d-%02d" % [year,month] # e.g. 2020-01 etc.
|
150
|
+
items.
|
151
|
+
where(
|
152
|
+
Arel.sql( "strftime('%Y-%m', coalesce(items.updated,items.published,'1970-01-01')) = '#{q}'" )
|
153
|
+
)
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.quarter( quarter=Date.today.quarter, year=Date.today.year )
|
157
|
+
case quarter
|
158
|
+
when 1 then between( Date.new( year, 1, 1), Date.new( year, 3, 31) );
|
159
|
+
when 2 then between( Date.new( year, 4, 1), Date.new( year, 6, 30) );
|
160
|
+
when 3 then between( Date.new( year, 7, 1), Date.new( year, 9, 30) );
|
161
|
+
when 4 then between( Date.new( year, 10, 1), Date.new( year,12, 31) );
|
162
|
+
else raise ArgumentError
|
163
|
+
end
|
99
164
|
end
|
100
165
|
|
166
|
+
def self.quarter1( year=Date.today.year ) quarter(1, year); end
|
167
|
+
def self.quarter2( year=Date.today.year ) quarter(2, year); end
|
168
|
+
def self.quarter3( year=Date.today.year ) quarter(3, year); end
|
169
|
+
def self.quarter4( year=Date.today.year ) quarter(4, year); end
|
170
|
+
|
171
|
+
def self.q( quarter=Date.today.quarter, year=Date.today.year ) quarter( quarter, year ); end
|
172
|
+
def self.q1( year=Date.today.year ) quarter1( year ); end
|
173
|
+
def self.q2( year=Date.today.year ) quarter2( year ); end
|
174
|
+
def self.q3( year=Date.today.year ) quarter3( year ); end
|
175
|
+
def self.q4( year=Date.today.year ) quarter4( year ); end
|
176
|
+
|
177
|
+
|
101
178
|
def self.year( year=Date.today.year )
|
102
179
|
q = year
|
103
180
|
items.
|
@@ -106,15 +183,44 @@ module News
|
|
106
183
|
)
|
107
184
|
end
|
108
185
|
|
109
|
-
|
110
|
-
|
111
|
-
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
def self.this_week() week; end ## convenience alias - keep - why? why not?
|
190
|
+
def self.this_month() month; end
|
191
|
+
def self.this_quarter() quarter; end
|
192
|
+
def self.this_year() year; end
|
193
|
+
|
194
|
+
|
112
195
|
|
196
|
+
class Template
|
197
|
+
class Context < OpenStruct
|
198
|
+
## use a different name - why? why not?
|
199
|
+
## e.g. to_h, to_hash, vars, locals, assigns, etc.
|
200
|
+
def get_binding() binding; end
|
201
|
+
|
202
|
+
## add builtin helpers / shortcuts
|
203
|
+
def h( text ) CGI.escapeHTML( text ); end
|
204
|
+
end # class Template::Context
|
205
|
+
|
206
|
+
|
207
|
+
def initialize( text )
|
208
|
+
@template = ERB.new( text )
|
209
|
+
end
|
210
|
+
|
211
|
+
## todo: use locals / assigns or something instead of **kwargs - why? why not?
|
212
|
+
## allow/support (extra) locals / assigns - why? why not?
|
213
|
+
def render( **kwargs )
|
214
|
+
## note: Ruby >= 2.5 has ERB#result_with_hash - use later - why? why not?
|
215
|
+
@template.result( Context.new( **kwargs ).get_binding )
|
216
|
+
end
|
217
|
+
end # class Template
|
218
|
+
|
219
|
+
def self.render( text, **kwargs )
|
220
|
+
template = Template.new( text )
|
221
|
+
template.render( **kwargs )
|
222
|
+
end
|
113
223
|
|
114
|
-
def self.q1( year=Date.today.year ) between( Date.new( year, 1, 1), Date.new( year, 3, 31) ); end
|
115
|
-
def self.q2( year=Date.today.year ) between( Date.new( year, 4, 1), Date.new( year, 6, 30) ); end
|
116
|
-
def self.q3( year=Date.today.year ) between( Date.new( year, 7, 1), Date.new( year, 9, 30) ); end
|
117
|
-
def self.q4( year=Date.today.year ) between( Date.new( year, 10, 1), Date.new( year,12, 31) ); end
|
118
224
|
|
119
225
|
|
120
226
|
|
data/lib/pluto/news/version.rb
CHANGED
data/test/test_queries.rb
CHANGED
@@ -14,7 +14,7 @@ class TestQueries < MiniTest::Test
|
|
14
14
|
puts News.items.to_sql
|
15
15
|
|
16
16
|
|
17
|
-
puts News.latest.limit(2).to_sql
|
17
|
+
puts News.latest.limit( 2 ).to_sql
|
18
18
|
puts News.today.to_sql
|
19
19
|
|
20
20
|
puts News.week.to_sql
|
@@ -30,16 +30,42 @@ class TestQueries < MiniTest::Test
|
|
30
30
|
|
31
31
|
puts News.this_week.to_sql
|
32
32
|
puts News.this_month.to_sql
|
33
|
+
puts News.this_quarter.to_sql
|
33
34
|
puts News.this_year.to_sql
|
35
|
+
|
34
36
|
|
37
|
+
puts News.quarter.to_sql
|
38
|
+
puts News.q.to_sql
|
39
|
+
|
40
|
+
puts News.quarter( 1 ).to_sql
|
41
|
+
puts News.quarter( 2 ).to_sql
|
42
|
+
puts News.quarter( 3 ).to_sql
|
43
|
+
puts News.quarter( 4 ).to_sql
|
44
|
+
puts News.quarter1.to_sql
|
45
|
+
puts News.quarter2.to_sql
|
46
|
+
puts News.quarter3.to_sql
|
47
|
+
puts News.quarter4.to_sql
|
48
|
+
|
49
|
+
puts News.q( 1 ).to_sql
|
50
|
+
puts News.q( 2 ).to_sql
|
51
|
+
puts News.q( 3 ).to_sql
|
52
|
+
puts News.q( 4 ).to_sql
|
35
53
|
puts News.q1.to_sql
|
36
54
|
puts News.q2.to_sql
|
37
55
|
puts News.q3.to_sql
|
38
56
|
puts News.q4.to_sql
|
57
|
+
puts News.q( 1, 2019 ).to_sql
|
58
|
+
puts News.q( 2, 2019 ).to_sql
|
59
|
+
puts News.q( 3, 2019 ).to_sql
|
60
|
+
puts News.q( 4, 2019 ).to_sql
|
61
|
+
puts News.q1( 2019 ).to_sql
|
62
|
+
puts News.q2( 2019 ).to_sql
|
63
|
+
puts News.q3( 2019 ).to_sql
|
64
|
+
puts News.q4( 2019 ).to_sql
|
39
65
|
|
40
66
|
|
41
67
|
###### run queries
|
42
|
-
pp News.latest.limit(2).to_a
|
68
|
+
pp News.latest.limit( 2 ).to_a
|
43
69
|
pp News.today.to_a
|
44
70
|
|
45
71
|
pp News.week.to_a
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluto-news
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.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: 2020-02-
|
11
|
+
date: 2020-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pluto-models
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.5.
|
19
|
+
version: 1.5.5
|
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.5.
|
26
|
+
version: 1.5.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rdoc
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +67,7 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '3.16'
|
55
69
|
description: pluto-news - newsreader for easy (re)use - build your own facebook newsfeed
|
56
|
-
in 5 minutes
|
70
|
+
in 1-2-3 steps in 5 minutes
|
57
71
|
email: wwwmake@googlegroups.com
|
58
72
|
executables: []
|
59
73
|
extensions: []
|
@@ -96,5 +110,5 @@ rubygems_version: 2.5.2
|
|
96
110
|
signing_key:
|
97
111
|
specification_version: 4
|
98
112
|
summary: pluto-news - newsreader for easy (re)use - build your own facebook newsfeed
|
99
|
-
in 5 minutes
|
113
|
+
in 1-2-3 steps in 5 minutes
|
100
114
|
test_files: []
|