mako_rss 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +19 -13
- data/.travis.yml +1 -1
- data/lib/mako.rb +1 -1
- data/lib/mako/article.rb +8 -3
- data/lib/mako/cli.rb +3 -2
- data/lib/mako/configuration.rb +1 -1
- data/lib/mako/core.rb +1 -0
- data/lib/mako/feed_constructor.rb +3 -1
- data/lib/mako/feed_finder.rb +1 -0
- data/lib/mako/feed_requester.rb +2 -2
- data/lib/mako/html_renderer.rb +1 -1
- data/lib/mako/sass_renderer.rb +4 -4
- data/lib/mako/version.rb +1 -1
- data/lib/templates/themes/sass/_code.scss +14 -0
- data/lib/templates/themes/simple.html.erb +1 -1
- data/lib/templates/themes/simple.scss +1 -0
- data/mako_rss.gemspec +6 -6
- metadata +32 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 27040a76fb716e97d2216d81cb166f9b4e90751d5f985792ab0075af821dc527
|
4
|
+
data.tar.gz: c80796f91699d944316b97d1cabb7cd2b1c464636552c3c0cc1e59a5895c66cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aabe13cc886b462f737dac4c91ec99dd1ded263bd432da987a68aed712c754cc12b9197f3139fc6edc8f385bb69bc728bf807a315b7ef9096492f90b14f76c07
|
7
|
+
data.tar.gz: 7da862685afb10d8bebd45101007ec51cbf028fafac59dec2a40759950581be19eb06d5a27bff7d2308e20a4bf3b3021b4f5a66fb679d47b68eac37793c0ccd1
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,38 +1,44 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2018-12-03 18:55:17 -0500 using RuboCop version 0.60.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 7
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
11
|
+
Max: 26
|
12
12
|
|
13
|
-
# Offense count:
|
14
|
-
# Configuration parameters:
|
15
|
-
# URISchemes: http, https
|
16
|
-
Metrics/LineLength:
|
17
|
-
Max: 629
|
18
|
-
|
19
|
-
# Offense count: 8
|
20
|
-
# Configuration parameters: CountComments.
|
13
|
+
# Offense count: 11
|
14
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
21
15
|
Metrics/MethodLength:
|
22
16
|
Max: 25
|
23
17
|
|
24
18
|
# Offense count: 1
|
25
|
-
|
19
|
+
Naming/AccessorMethodName:
|
26
20
|
Exclude:
|
27
21
|
- 'lib/mako/core.rb'
|
28
22
|
|
29
|
-
# Offense count:
|
23
|
+
# Offense count: 26
|
30
24
|
Style/Documentation:
|
31
25
|
Enabled: false
|
32
26
|
|
27
|
+
# Offense count: 1
|
28
|
+
# Cop supports --auto-correct.
|
29
|
+
Style/RedundantBegin:
|
30
|
+
Exclude:
|
31
|
+
- 'lib/mako/article.rb'
|
32
|
+
|
33
33
|
# Offense count: 1
|
34
34
|
# Cop supports --auto-correct.
|
35
35
|
# Configuration parameters: AllowAsExpressionSeparator.
|
36
36
|
Style/Semicolon:
|
37
37
|
Exclude:
|
38
38
|
- 'lib/mako/article.rb'
|
39
|
+
|
40
|
+
# Offense count: 58
|
41
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
42
|
+
# URISchemes: http, https
|
43
|
+
Metrics/LineLength:
|
44
|
+
Max: 581
|
data/.travis.yml
CHANGED
data/lib/mako.rb
CHANGED
data/lib/mako/article.rb
CHANGED
@@ -36,9 +36,14 @@ module Mako
|
|
36
36
|
doc = Nokogiri::HTML::DocumentFragment.parse(html)
|
37
37
|
if Mako.config.sanitize_images
|
38
38
|
doc.css('img').each do |n|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
begin
|
40
|
+
n.name = 'a'
|
41
|
+
n.content = n['alt'] ? "📷 #{n['alt']}" : '📷 Image'
|
42
|
+
n['href'] = URI.parse(n['src']).absolutize!(uri)
|
43
|
+
rescue URI::InvalidURIError
|
44
|
+
# if there's a problem, just ignore it
|
45
|
+
next
|
46
|
+
end
|
42
47
|
end
|
43
48
|
end
|
44
49
|
doc.css('h1,h2,h3,h4,h5,h6').each { |n| n.name = 'p'; n.set_attribute('class', 'bold') }
|
data/lib/mako/cli.rb
CHANGED
@@ -18,7 +18,7 @@ module Mako
|
|
18
18
|
if COMMANDS.include? command
|
19
19
|
CLI.invoke(command, argv)
|
20
20
|
else
|
21
|
-
help = <<~
|
21
|
+
help = <<~HELP
|
22
22
|
Usage:
|
23
23
|
mako [subcommand] [path...]
|
24
24
|
|
@@ -30,7 +30,7 @@ module Mako
|
|
30
30
|
|
31
31
|
Options:
|
32
32
|
--with-sass When supplied to build, also generates CSS from SCSS files.
|
33
|
-
|
33
|
+
HELP
|
34
34
|
Mako.logger.info help
|
35
35
|
end
|
36
36
|
end
|
@@ -43,6 +43,7 @@ module Mako
|
|
43
43
|
def self.invoke(command, args = [])
|
44
44
|
Object.const_get("Mako::#{command.capitalize}").perform(args)
|
45
45
|
return unless Mako.errors.any?
|
46
|
+
|
46
47
|
Mako.errors.messages.each do |error_msg|
|
47
48
|
Mako.logger.warn error_msg
|
48
49
|
end
|
data/lib/mako/configuration.rb
CHANGED
@@ -4,7 +4,7 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
module Mako
|
6
6
|
class Configuration
|
7
|
-
DEFAULT_CONFIGURATION = { 'source_templates' => File.expand_path('../templates',
|
7
|
+
DEFAULT_CONFIGURATION = { 'source_templates' => File.expand_path('../templates', __dir__),
|
8
8
|
'destination' => File.expand_path('site/', Dir.pwd),
|
9
9
|
'theme' => 'simple',
|
10
10
|
'sanitize_images' => true,
|
data/lib/mako/core.rb
CHANGED
@@ -16,6 +16,7 @@ module Mako
|
|
16
16
|
def parse_and_create
|
17
17
|
parsed_feed = parse_feed
|
18
18
|
return false unless parsed_feed
|
19
|
+
|
19
20
|
feed = create_feed(parsed_feed)
|
20
21
|
create_articles(feed, parsed_feed)
|
21
22
|
feed
|
@@ -30,7 +31,7 @@ module Mako
|
|
30
31
|
Feedjira::Feed.parse(feed_data)
|
31
32
|
rescue Feedjira::NoParserAvailable
|
32
33
|
Mako.errors.add_error "Unable to parse #{feed_url}."
|
33
|
-
|
34
|
+
false
|
34
35
|
end
|
35
36
|
|
36
37
|
# Creates new Mako::Feed object from the parsed Feedjira::Feed object
|
@@ -50,6 +51,7 @@ module Mako
|
|
50
51
|
def create_articles(feed, parsed_feed)
|
51
52
|
parsed_feed.entries.each do |entry|
|
52
53
|
next unless entry.published >= (Time.now - 1.day).beginning_of_day
|
54
|
+
|
53
55
|
feed.articles << Article.new(title: entry.title,
|
54
56
|
published: entry.published,
|
55
57
|
summary: entry_summary(entry),
|
data/lib/mako/feed_finder.rb
CHANGED
@@ -55,6 +55,7 @@ module Mako
|
|
55
55
|
parsed_uri = URI.parse('http://' + uri) if parsed_uri.scheme.nil?
|
56
56
|
request = Mako::FeedRequester.new(feed_url: parsed_uri).fetch
|
57
57
|
next unless request.ok?
|
58
|
+
|
58
59
|
if MIME_TYPES.include? request.headers['content-type'].split(';').first
|
59
60
|
{ uri: parsed_uri.to_s }
|
60
61
|
else
|
data/lib/mako/feed_requester.rb
CHANGED
@@ -20,8 +20,8 @@ module Mako
|
|
20
20
|
def fetch
|
21
21
|
begin
|
22
22
|
request = HTTParty.get(feed_url)
|
23
|
-
rescue
|
24
|
-
Mako.errors.add_error "Could not complete request to #{feed_url}."
|
23
|
+
rescue StandardError => e
|
24
|
+
Mako.errors.add_error "Could not complete request to #{feed_url}: #{e.class}."
|
25
25
|
self.ok = false
|
26
26
|
return self
|
27
27
|
end
|
data/lib/mako/html_renderer.rb
CHANGED
@@ -9,7 +9,7 @@ module Mako
|
|
9
9
|
def initialize(args)
|
10
10
|
@template = args.fetch(:template, File.expand_path(File.join('themes', "#{Mako.config.theme}.html.erb"), Dir.pwd))
|
11
11
|
@bound = args.fetch(:bound)
|
12
|
-
@feed_template = File.expand_path('
|
12
|
+
@feed_template = File.expand_path('layouts/_feed_container.html.erb', __dir__)
|
13
13
|
end
|
14
14
|
|
15
15
|
# Wrapper for ERB renderer. Creates new ERB instance with view template
|
data/lib/mako/sass_renderer.rb
CHANGED
@@ -10,14 +10,14 @@ module Mako
|
|
10
10
|
@template = args.fetch(:template, File.expand_path(File.join('themes', "#{Mako.config.theme}.scss"), Dir.pwd))
|
11
11
|
end
|
12
12
|
|
13
|
-
# Wrapper for
|
13
|
+
# Wrapper for SassC::Engine. Creates new SassC::Engine instance with main
|
14
14
|
# Sass file and renders it.
|
15
15
|
#
|
16
16
|
# @return [String]
|
17
17
|
def render
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
SassC::Engine.new(load_resource(template), syntax: :scss,
|
19
|
+
load_paths: [File.expand_path('themes/', Dir.pwd)],
|
20
|
+
style: :compressed).render
|
21
21
|
end
|
22
22
|
|
23
23
|
# Default file name for rendererd file.
|
data/lib/mako/version.rb
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
<% feeds.select { |f| f.articles.size.positive? }.each_with_index do |feed, index| %>
|
23
23
|
<section>
|
24
24
|
<header class="article-header">
|
25
|
-
<h1><a href="<%= feed.url %>" id=<%= "feed-#{index}" %>><%=
|
25
|
+
<h1><a href="<%= feed.url %>" id=<%= "feed-#{index}" %>><%= feed.title %></a></h1>
|
26
26
|
</header>
|
27
27
|
<% feed.articles_desc.each do |article| %>
|
28
28
|
<article>
|
data/mako_rss.gemspec
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
5
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
5
|
require 'mako/version'
|
7
6
|
|
@@ -23,14 +22,15 @@ Gem::Specification.new do |spec|
|
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
24
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
26
|
-
spec.add_development_dependency '
|
25
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
27
26
|
spec.add_development_dependency 'minitest', '~> 5.1'
|
27
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 0.50'
|
28
29
|
spec.add_development_dependency 'vcr', '~> 3.0'
|
29
|
-
spec.add_development_dependency '
|
30
|
-
spec.add_development_dependency 'coveralls', '~> 0.8'
|
30
|
+
spec.add_development_dependency 'webmock', '~> 3.1'
|
31
31
|
|
32
32
|
spec.add_runtime_dependency 'feedjira', '~> 2.0'
|
33
33
|
spec.add_runtime_dependency 'httparty', '~> 0.15'
|
34
34
|
spec.add_runtime_dependency 'nokogiri', '~> 1.8'
|
35
|
-
spec.add_runtime_dependency '
|
35
|
+
spec.add_runtime_dependency 'sassc', '~> 2.0'
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mako_rss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Pike
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: coveralls
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0.8'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,47 +53,61 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '12.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '12.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.50'
|
76
76
|
type: :development
|
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: '0.
|
82
|
+
version: '0.50'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: vcr
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
89
|
+
version: '3.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.1'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.1'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: feedjira
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,19 +151,19 @@ dependencies:
|
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '1.8'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: sassc
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
159
|
+
version: '2.0'
|
146
160
|
type: :runtime
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
166
|
+
version: '2.0'
|
153
167
|
description:
|
154
168
|
email:
|
155
169
|
- jonathan.d.s.pike@gmail.com
|
@@ -202,6 +216,7 @@ files:
|
|
202
216
|
- lib/templates/sample_subscriptions/subscriptions.json
|
203
217
|
- lib/templates/sample_subscriptions/subscriptions.txt
|
204
218
|
- lib/templates/sample_subscriptions/subscriptions.xml
|
219
|
+
- lib/templates/themes/sass/_code.scss
|
205
220
|
- lib/templates/themes/sass/_fonts.scss
|
206
221
|
- lib/templates/themes/sass/_layout.scss
|
207
222
|
- lib/templates/themes/sass/_reboot.scss
|
@@ -230,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
245
|
version: '0'
|
231
246
|
requirements: []
|
232
247
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.6
|
248
|
+
rubygems_version: 2.7.6
|
234
249
|
signing_key:
|
235
250
|
specification_version: 4
|
236
251
|
summary: A static site feed reader
|