weneedfeed 0.2.0 → 0.3.0

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
2
  SHA256:
3
- metadata.gz: b6a5d43bf327c8b96247ed37ce2c98ec546e7a339a8eb777dc647a3a594450a4
4
- data.tar.gz: e9ff73155c418c0989d29b0f3f4e4b4133ea5bbb33b92a349b492bddf5965f38
3
+ metadata.gz: b201152f3a5b05f2c336caf0ba02416eea09da02834a46818dc00c86596ee0d3
4
+ data.tar.gz: 0fc63fe70919ac5284297c309545d0d1ea3a3253166d36f434bb6b598aa92721
5
5
  SHA512:
6
- metadata.gz: 122215c08d29522f980db52d10de20b9c718a17d7064081a277c3587454f5aedb534e2cf3b3818c1cd42fb89db016d1b59eb096ad91f5dd45e563c45d0971935
7
- data.tar.gz: 7f5ae31b297ad9b5dfad5053bb45baae7a3d844014f3269efed007103ff2146d5592d89984987c8a8dde0e13a4ce7845391e6a1215351e6f883f1c0342eb368e
6
+ metadata.gz: a318105d868fc4ca2b91a03541feffde8bb1af257b4c3126716c2988f21703f7ee87699183ab0d8f3ab67d111008af9485ee4e219d464ef618e459b5a8b8fc1e
7
+ data.tar.gz: 726e20a19227146a81a309b32837396753a1fe572fe1ec6fd8ce44767dab61ebc337ccaa5af53d8d1449ba987bcefd76d6486db3988f4c95bd8d316f2440fd57
@@ -1,3 +1,6 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+
1
4
  Lint/SuppressedException:
2
5
  Enabled: false
3
6
 
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.3.0 - 2020-11-08
11
+
12
+ ### Added
13
+
14
+ - Add channel description.
15
+ - Add item description.
16
+ - Add `weneedfeed build` command.
17
+ - Add `weneedfeed server` command.
18
+
19
+ ### Changed
20
+
21
+ - Surround channel title by CDATA.
22
+ - Change channel children order.
23
+
10
24
  ## 0.2.0 - 2020-11-07
11
25
 
12
26
  ### Changed
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weneedfeed (0.1.0)
4
+ weneedfeed (0.3.0)
5
5
  faraday
6
6
  hibana
7
7
  nokogiri
8
8
  rack-capture (>= 0.4.0)
9
+ thor
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
@@ -77,6 +78,7 @@ GEM
77
78
  parser (>= 2.7.1.5)
78
79
  ruby-progressbar (1.10.1)
79
80
  ruby2_keywords (0.0.2)
81
+ thor (1.0.1)
80
82
  tilt (2.0.10)
81
83
  transproc (1.1.1)
82
84
  unicode-display_width (1.7.0)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'weneedfeed'
5
+
6
+ Weneedfeed::Command.start(ARGV)
@@ -5,6 +5,7 @@ require 'weneedfeed/version'
5
5
  module Weneedfeed
6
6
  autoload :Application, 'weneedfeed/application'
7
7
  autoload :Capture, 'weneedfeed/capture'
8
+ autoload :Command, 'weneedfeed/command'
8
9
  autoload :Controllers, 'weneedfeed/controllers'
9
10
  autoload :Item, 'weneedfeed/item'
10
11
  autoload :Page, 'weneedfeed/page'
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rack'
4
+ require 'thor'
5
+ require 'yaml'
6
+
7
+ module Weneedfeed
8
+ class Command < ::Thor
9
+ class << self
10
+ # @note Override for thor breaking change.
11
+ # See https://github.com/erikhuda/thor/issues/244.
12
+ def exit_on_failure?
13
+ true
14
+ end
15
+ end
16
+
17
+ desc(
18
+ 'build',
19
+ 'Build static files for feeds.'
20
+ )
21
+
22
+ method_option(
23
+ :base_url,
24
+ desc: 'Base URL where to locate built files. (e.g. `"https://user.github.io/repo"`)',
25
+ required: true,
26
+ type: :string
27
+ )
28
+
29
+ method_option(
30
+ :schema_path,
31
+ default: 'weneedfeed.yml',
32
+ desc: 'Path to weneedfeed YAML schema file.',
33
+ type: :string
34
+ )
35
+
36
+ # @param [String] base_url
37
+ # @param [String] schema_path
38
+ def build
39
+ ::Weneedfeed::Capture.call(
40
+ base_url: options[:base_url],
41
+ schema_path: options[:schema_path]
42
+ )
43
+ end
44
+
45
+ desc(
46
+ 'server',
47
+ 'Run HTTP server'
48
+ )
49
+
50
+ method_option(
51
+ :schema_path,
52
+ default: 'weneedfeed.yml',
53
+ desc: 'Path to weneedfeed YAML schema file.',
54
+ type: :string
55
+ )
56
+
57
+ def server
58
+ schema = ::YAML.load_file(options[:schema_path])
59
+ application = Weneedfeed::Application.new(schema: schema)
60
+ ::Rack::Handler.default.run(application)
61
+ end
62
+ end
63
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Weneedfeed
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
@@ -3,16 +3,17 @@
3
3
  xmlns:atom="http://www.w3.org/2005/Atom"
4
4
  xmlns:content="http://purl.org/rss/1.0/modules/content/">
5
5
  <channel>
6
- <description></description>
6
+ <title><![CDATA[<%= @page.title %>]]></title>
7
7
  <link><%= "#{request.base_url}#{request.path}" %></link>
8
8
  <atom:link href="<%= "#{request.base_url}#{request.path}" %>" rel="self"/>
9
- <title><%= @page.title %></title>
9
+ <description><![CDATA[Recent content on <%= @page.title %>]]></description>
10
10
  <lastBuildDate><%= Time.now.rfc822 %></lastBuildDate>
11
11
  <% items.each do |item| %>
12
12
  <item>
13
13
  <title><![CDATA[<%= item.title %>]]></title>
14
14
  <link><%= item.link %></link>
15
15
  <pubDate><%= item.time.rfc822 %></pubDate>
16
+ <description><![CDATA[<%= item.description %>]]></description>
16
17
  <content:encoded><![CDATA[<%= item.description %>]]></content:encoded>
17
18
  <guid isPermaLink="true"><%= item.link %></guid>
18
19
  </item>
@@ -21,10 +21,13 @@ Gem::Specification.new do |spec|
21
21
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
23
  end
24
+ spec.bindir = 'exe'
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
26
  spec.require_paths = ['lib']
25
27
 
26
28
  spec.add_runtime_dependency 'faraday'
27
29
  spec.add_runtime_dependency 'hibana'
28
30
  spec.add_runtime_dependency 'nokogiri'
29
31
  spec.add_runtime_dependency 'rack-capture', '>= 0.4.0'
32
+ spec.add_runtime_dependency 'thor'
30
33
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weneedfeed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2020-11-07 00:00:00.000000000 Z
12
12
  dependencies:
@@ -66,10 +66,25 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.4.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: thor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email:
71
85
  - r7kamura@gmail.com
72
- executables: []
86
+ executables:
87
+ - weneedfeed
73
88
  extensions: []
74
89
  extra_rdoc_files: []
75
90
  files:
@@ -85,9 +100,11 @@ files:
85
100
  - Rakefile
86
101
  - bin/console
87
102
  - bin/setup
103
+ - exe/weneedfeed
88
104
  - lib/weneedfeed.rb
89
105
  - lib/weneedfeed/application.rb
90
106
  - lib/weneedfeed/capture.rb
107
+ - lib/weneedfeed/command.rb
91
108
  - lib/weneedfeed/controllers.rb
92
109
  - lib/weneedfeed/controllers/show_feed.rb
93
110
  - lib/weneedfeed/controllers/show_top_page.rb