bf_multi_rss 0.3.3 → 0.3.4

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
  SHA1:
3
- metadata.gz: e536f09d93fe1aba09a5cdabc13073ff09adda50
4
- data.tar.gz: 2bf087aba436f1ddd25f3493c6bcfd6e5ae66c85
3
+ metadata.gz: 39ca4c6be277969a9f7ac91e70a7a2df11d4e350
4
+ data.tar.gz: b5c5e2493ab2efcd2f9b75d98f44f3a28f05f075
5
5
  SHA512:
6
- metadata.gz: 02427e4d4ead863633080a0157592c3c4c6bbe7045e2ecf9b6ffe0150c932f2e52e022ddf9828bb1b3d53253bf8bec245e5592fbfdd0aeb3a3e323465f977052
7
- data.tar.gz: b72e75ca1e7e00b02d32a0c5054f11fc695102208db78c9c71c16cec03142bcd3d196c1de0ee0b41692870ae2f2a398d0fb81c9f7a060f68818fcc4c705bfbe0
6
+ metadata.gz: 07e4f7674b170d9e55fb9589a03c0ccf3b962811076a6511fd8eb2852011989bf9d8356c558befc1b8091dc645820e899bf488e0635fded7d1f78e8440446c6f
7
+ data.tar.gz: 27b59e4d6112017fcf64cfa2d798b6cca7efa653e2dfbdd9f713f243d009d00d2102dcc697a14c17d1907b33d90bc3574a4f849425457fdaa04ce0ff98b34f6b
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at sebs@2xs.org. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ group :development do
5
+ gem 'guard'
6
+ gem 'guard-rspec', require: false
7
+ gem 'guard-rubocop'
8
+ gem 'rspec'
9
+ gem 'rubocop'
10
+ gem 'webmock'
11
+ end
@@ -0,0 +1,122 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bf_multi_rss (0.3.3)
5
+ http (~> 2.2)
6
+ parallel (~> 1.10)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.5.0)
12
+ public_suffix (~> 2.0, >= 2.0.2)
13
+ ast (2.3.0)
14
+ coderay (1.1.1)
15
+ crack (0.4.3)
16
+ safe_yaml (~> 1.0.0)
17
+ diff-lcs (1.3)
18
+ domain_name (0.5.20170223)
19
+ unf (>= 0.0.5, < 1.0.0)
20
+ ffi (1.9.18)
21
+ formatador (0.2.5)
22
+ guard (2.14.1)
23
+ formatador (>= 0.2.4)
24
+ listen (>= 2.7, < 4.0)
25
+ lumberjack (~> 1.0)
26
+ nenv (~> 0.1)
27
+ notiffany (~> 0.0)
28
+ pry (>= 0.9.12)
29
+ shellany (~> 0.0)
30
+ thor (>= 0.18.1)
31
+ guard-compat (1.2.1)
32
+ guard-rspec (4.7.3)
33
+ guard (~> 2.1)
34
+ guard-compat (~> 1.1)
35
+ rspec (>= 2.99.0, < 4.0)
36
+ guard-rubocop (1.2.0)
37
+ guard (~> 2.0)
38
+ rubocop (~> 0.20)
39
+ hashdiff (0.3.2)
40
+ http (2.2.1)
41
+ addressable (~> 2.3)
42
+ http-cookie (~> 1.0)
43
+ http-form_data (~> 1.0.1)
44
+ http_parser.rb (~> 0.6.0)
45
+ http-cookie (1.0.3)
46
+ domain_name (~> 0.5)
47
+ http-form_data (1.0.1)
48
+ http_parser.rb (0.6.0)
49
+ listen (3.1.5)
50
+ rb-fsevent (~> 0.9, >= 0.9.4)
51
+ rb-inotify (~> 0.9, >= 0.9.7)
52
+ ruby_dep (~> 1.2)
53
+ lumberjack (1.0.11)
54
+ method_source (0.8.2)
55
+ nenv (0.3.0)
56
+ notiffany (0.1.1)
57
+ nenv (~> 0.1)
58
+ shellany (~> 0.0)
59
+ parallel (1.11.1)
60
+ parser (2.4.0.0)
61
+ ast (~> 2.2)
62
+ powerpack (0.1.1)
63
+ pry (0.10.4)
64
+ coderay (~> 1.1.0)
65
+ method_source (~> 0.8.1)
66
+ slop (~> 3.4)
67
+ public_suffix (2.0.5)
68
+ rainbow (2.2.1)
69
+ rake (10.5.0)
70
+ rb-fsevent (0.9.8)
71
+ rb-inotify (0.9.8)
72
+ ffi (>= 0.5.0)
73
+ rspec (3.5.0)
74
+ rspec-core (~> 3.5.0)
75
+ rspec-expectations (~> 3.5.0)
76
+ rspec-mocks (~> 3.5.0)
77
+ rspec-core (3.5.4)
78
+ rspec-support (~> 3.5.0)
79
+ rspec-expectations (3.5.0)
80
+ diff-lcs (>= 1.2.0, < 2.0)
81
+ rspec-support (~> 3.5.0)
82
+ rspec-mocks (3.5.0)
83
+ diff-lcs (>= 1.2.0, < 2.0)
84
+ rspec-support (~> 3.5.0)
85
+ rspec-support (3.5.0)
86
+ rubocop (0.47.1)
87
+ parser (>= 2.3.3.1, < 3.0)
88
+ powerpack (~> 0.1)
89
+ rainbow (>= 1.99.1, < 3.0)
90
+ ruby-progressbar (~> 1.7)
91
+ unicode-display_width (~> 1.0, >= 1.0.1)
92
+ ruby-progressbar (1.8.1)
93
+ ruby_dep (1.5.0)
94
+ safe_yaml (1.0.4)
95
+ shellany (0.0.1)
96
+ slop (3.6.0)
97
+ thor (0.19.4)
98
+ unf (0.1.4)
99
+ unf_ext
100
+ unf_ext (0.0.7.2)
101
+ unicode-display_width (1.1.3)
102
+ webmock (2.3.2)
103
+ addressable (>= 2.3.6)
104
+ crack (>= 0.3.2)
105
+ hashdiff
106
+
107
+ PLATFORMS
108
+ ruby
109
+
110
+ DEPENDENCIES
111
+ bf_multi_rss!
112
+ bundler (~> 1.14)
113
+ guard
114
+ guard-rspec
115
+ guard-rubocop
116
+ rake (~> 10.0)
117
+ rspec
118
+ rubocop
119
+ webmock
120
+
121
+ BUNDLED WITH
122
+ 1.14.6
@@ -0,0 +1,75 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.call("routing/#{m[1]}_routing"),
51
+ rspec.spec.call("controllers/#{m[1]}_controller"),
52
+ rspec.spec.call("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
71
+
72
+ guard :rubocop do
73
+ watch(%r{.+\.rb$})
74
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
75
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Sebastian Schürmann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ # BfMultiRss
2
+
3
+ Fetches multiple RSS Feeds in 'parallel' and gives you back the result
4
+
5
+ ## TODO
6
+
7
+ * learn ruby
8
+ * Better api
9
+ * checking parameters
10
+ * reporting errors
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'bf_multi_rss'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install bf_multi_rss
27
+
28
+ ## Usage
29
+
30
+ ```
31
+ require 'bf_multi_rss'
32
+ bf = BfMultiRss.new(10)
33
+ bf.fetch_all['http://','http://']
34
+ ``
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bf_multi_rss. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
44
+
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bf_multi_rss"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bf_multi_rss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Schürmann
@@ -86,9 +86,15 @@ executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
- - lib/bf_multi_rss/fetcher.rb
90
- - lib/bf_multi_rss/rss_error.rb
91
- - lib/bf_multi_rss/rss_result.rb
89
+ - CODE_OF_CONDUCT.md
90
+ - Gemfile
91
+ - Gemfile.lock
92
+ - Guardfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/console
97
+ - bin/setup
92
98
  homepage: https://github.com/bundesfeeds
93
99
  licenses:
94
100
  - MIT
@@ -1,80 +0,0 @@
1
- require 'rss'
2
- require 'http'
3
- require 'parallel'
4
- require 'bf_multi_rss/rss_result'
5
- require 'bf_multi_rss/rss_error'
6
-
7
- module BfMultiRss
8
- class NotInvertibleError < StandardError
9
- end
10
-
11
- class Fetcher
12
- attr_reader :concurrency, :errors
13
- def initialize(concurrency = 4)
14
- @concurrency = concurrency
15
- @errors = []
16
- end
17
-
18
- def fetch_uri(uri)
19
- response = HTTP.get(uri)
20
- raise_errors(response, uri)
21
- response.to_s
22
- end
23
-
24
- def fetch_rss(uri)
25
- response = fetch_uri(uri)
26
- rss = RSS::Parser.parse(response, false)
27
- if rss.nil?
28
- err = 'ParseErr ' + uri
29
- raise NotInvertibleError, err
30
- end
31
- rss.items
32
- end
33
-
34
- def raise_errors(response, uri)
35
- case response.status
36
- when 500
37
- err = 'Http500 ' + uri
38
- raise NotInvertibleError, err
39
- when 404
40
- err = 'Http404 ' + uri
41
- raise NotInvertibleError, err
42
- when 301
43
- err = 'Http301 ' + uri
44
- raise NotInvertibleError, err
45
- end
46
- end
47
-
48
- def fetch_all(uris)
49
- @errors = []
50
- results = Parallel.map(
51
- uris,
52
- in_processes: @concurrency
53
- ) do |uri|
54
- begin
55
- posts = fetch_rss(uri)
56
- BfMultiRss::RssResult.new(uri, posts)
57
-
58
- rescue REXML::ParseException,
59
- OpenURI::HTTPError,
60
- Errno::EHOSTUNREACH,
61
- Errno::ETIMEDOUT,
62
- RSS::NotWellFormedError,
63
- Net::OpenTimeout,
64
- Net::ReadTimeout,
65
- Errno::ECONNREFUSED,
66
- Errno::ECONNRESET,
67
- NotInvertibleError => e
68
- BfMultiRss::RssError.new(uri, e)
69
- end
70
- end
71
- errors = results.select do |result|
72
- result.is_a? BfMultiRss::RssError
73
- end
74
- @errors = errors
75
- results.select do |result|
76
- !result.is_a? BfMultiRss::RssError
77
- end
78
- end
79
- end
80
- end
@@ -1,9 +0,0 @@
1
- module BfMultiRss
2
- class RssError
3
- attr_reader :uri, :e
4
- def initialize(uri, e)
5
- @uri = uri
6
- @e = e
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- module BfMultiRss
2
- class RssResult
3
- # remove the public setter interface
4
- attr_reader :posts, :src
5
-
6
- def initialize(src, posts = [])
7
- @posts = posts
8
- @src = src
9
- end
10
- end
11
- end