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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5201445c6691e5eef5f6e9a9f6c52d7689dddb49
4
- data.tar.gz: 2d607663ad3e8c8c184f5b49b06e27dd5fbe8b69
2
+ SHA256:
3
+ metadata.gz: 27040a76fb716e97d2216d81cb166f9b4e90751d5f985792ab0075af821dc527
4
+ data.tar.gz: c80796f91699d944316b97d1cabb7cd2b1c464636552c3c0cc1e59a5895c66cf
5
5
  SHA512:
6
- metadata.gz: d0728dfb13977584f14c236c373fbd52a1a8a05e327344c89627e94eab4be4875bdee602c713be77373e74ed3636b58e8948b9e37301c140898745edcb341900
7
- data.tar.gz: 222358f8846c88346cc4fc0ac93916a41545905e5759745e599738e0be20a10522038c6cea22c9e93427dc007683d1d1721b477c0ba537c71f33343d09b2c9b4
6
+ metadata.gz: aabe13cc886b462f737dac4c91ec99dd1ded263bd432da987a68aed712c754cc12b9197f3139fc6edc8f385bb69bc728bf807a315b7ef9096492f90b14f76c07
7
+ data.tar.gz: 7da862685afb10d8bebd45101007ec51cbf028fafac59dec2a40759950581be19eb06d5a27bff7d2308e20a4bf3b3021b4f5a66fb679d47b68eac37793c0ccd1
@@ -1,7 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.3
4
+ TargetRubyVersion: 2.5
5
5
 
6
6
  Layout/IndentHeredoc:
7
7
  EnforcedStyle: squiggly
@@ -1,38 +1,44 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-07-11 13:25:18 -0400 using RuboCop version 0.49.1.
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: 4
9
+ # Offense count: 7
10
10
  Metrics/AbcSize:
11
- Max: 28
11
+ Max: 26
12
12
 
13
- # Offense count: 40
14
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
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
- Style/AccessorMethodName:
19
+ Naming/AccessorMethodName:
26
20
  Exclude:
27
21
  - 'lib/mako/core.rb'
28
22
 
29
- # Offense count: 25
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
@@ -1,7 +1,7 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.1
4
+ - 2.5.1
5
5
  cache: bundler
6
6
  before_install: gem install bundler -v 1.14.6
7
7
 
@@ -7,7 +7,7 @@ require 'httparty'
7
7
  require 'feedjira'
8
8
  require 'nokogiri'
9
9
  require 'json'
10
- require 'sass'
10
+ require 'sassc'
11
11
 
12
12
  require_relative 'mako/core_ext'
13
13
  require_relative 'mako/errors'
@@ -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
- n.name = 'a'
40
- n.content = n['alt'] ? "📷 #{n['alt']}" : '📷 Image'
41
- n['href'] = URI.parse(n['src']).absolutize!(uri)
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') }
@@ -18,7 +18,7 @@ module Mako
18
18
  if COMMANDS.include? command
19
19
  CLI.invoke(command, argv)
20
20
  else
21
- help = <<~EOS
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
- EOS
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
@@ -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', File.dirname(__FILE__)),
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,
@@ -70,6 +70,7 @@ module Mako
70
70
  requesters.each do |feed_request|
71
71
  feed_response = feed_request.fetch
72
72
  next unless feed_request.ok?
73
+
73
74
  constructed_feed = constructor.new(feed_data: feed_response.body,
74
75
  feed_url: feed_response.feed_url)
75
76
  .parse_and_create
@@ -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
- return false
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),
@@ -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
@@ -20,8 +20,8 @@ module Mako
20
20
  def fetch
21
21
  begin
22
22
  request = HTTParty.get(feed_url)
23
- rescue SocketError, HTTParty::RedirectionTooDeep
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
@@ -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('../layouts/_feed_container.html.erb', __FILE__)
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
@@ -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 Sass::Engine. Creates new Sass::Engine instance with main
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
- Sass::Engine.new(load_resource(template), syntax: :scss,
19
- load_paths: [File.expand_path('themes/', Dir.pwd)],
20
- style: :compressed).render
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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mako
4
- VERSION = '0.2.3'
4
+ VERSION = '0.2.5'
5
5
  end
@@ -0,0 +1,14 @@
1
+ pre {
2
+ display: block;
3
+ padding: 9.5px;
4
+ margin: 0 0 10px;
5
+ line-height: 1.42857;
6
+ word-break: break-all;
7
+ word-wrap: break-word;
8
+ border-left: .15rem solid $pd-banner;
9
+ }
10
+
11
+ code {
12
+ white-space: pre-wrap;
13
+ font-size: 90%;
14
+ }
@@ -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}" %>><%= h(feed.title) %></a></h1>
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>
@@ -4,3 +4,4 @@
4
4
  @import "sass/fonts";
5
5
  @import "sass/layout";
6
6
  @import "sass/utilities";
7
+ @import "sass/code";
@@ -1,7 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
- lib = File.expand_path('../lib', __FILE__)
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 'rake', '~> 12.0'
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 'rubocop', '~> 0.49'
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 'sass', '~> 3.4'
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.3
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: 2017-09-12 00:00:00.000000000 Z
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: rake
28
+ name: coveralls
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '12.0'
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: '12.0'
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: vcr
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
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: '3.0'
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.49'
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.49'
82
+ version: '0.50'
83
83
  - !ruby/object:Gem::Dependency
84
- name: coveralls
84
+ name: vcr
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.8'
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.8'
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: sass
154
+ name: sassc
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '3.4'
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: '3.4'
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.13
248
+ rubygems_version: 2.7.6
234
249
  signing_key:
235
250
  specification_version: 4
236
251
  summary: A static site feed reader