wayfarer 0.4.9 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 102ad4ff568c6a84fb710cbb46f3ca4839ce6a319265d33953f5ed601038d95d
4
- data.tar.gz: 22f2f2460eb814a5534567cfc4222663d5819739df76e8c07bd0e5add4de15ec
3
+ metadata.gz: 39fd7cefe2a4a7e07e2c3f69c0d13f96603e983432c56616444407a04af55442
4
+ data.tar.gz: 465b842759a03128413d66ff59b5116f0f7d444b193ad0929ed3a3914f55d5ad
5
5
  SHA512:
6
- metadata.gz: 7c3c4780264a54b3ffc3b885027affb00d041c7d0d828435987d71d19cdaba03d69a03dda645901abfa59ab8f5b4f702dd85722fec87efb36a08d304a903296b
7
- data.tar.gz: e05ab817b1125ebc8b644b79ec63e18fce3566ffdf4508e6409d5e8669a060b0bbd88e30a782db7f6abc9555198e1919fbb0feda4d9b75aba8f5b8823592c294
6
+ metadata.gz: 21111b9d58ab7d0286f2f0a8c575485f0553cc4ddb8f19ebcad9f82f67e70dd53290832de6a4da137839a22151f0d06a47b0c606bc139b1491c5ce3d2accf188
7
+ data.tar.gz: '049cc40ee6973ecc66ce921d1ca8bf746ae9066ef88ebe3a364a0b859d125d9857daba149dfffd0b630f9addf88d2330ca3f9de5e57dab521d1dc2908a1d5cde'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wayfarer (0.4.9)
4
+ wayfarer (0.4.10)
5
5
  activejob (>= 7.1)
6
6
  addressable (~> 2.8)
7
7
  capybara (~> 3.4)
@@ -2,21 +2,11 @@
2
2
 
3
3
  ## Release Procedure
4
4
 
5
- 1. Ensure `Wayfarer::VERSION` was bumped appropriately.
6
- 2. Ensure the version in wayfarer.gemspec matches.
7
- 3. Open a release Pull Request develop -> master branch
8
- 4. Merge the Pull Request
9
- 5. Publish RubyGem and git tag as follows:
10
-
11
- ```
12
- git checkout master
13
- git pull origin master --rebase
14
- bundle exec rake build
15
- gem push build/wayfarer-*.gem
16
- bundle exec rake clean
17
- git tag <VERSION>
18
- git push origin <VERSION>
19
- ```
5
+ 1. Bump versions:
6
+ * `Wayfarer::VERSION` in `lib/wayfarer.rb`
7
+ * RubyGem version in `wayfarer.gemspec`
8
+ * Run `bundle install` to regenerate `Gemfile.lock`
9
+ 2. Push to `master` or `develop` and run the manual `release` worflow
20
10
 
21
11
  ## Conventions and guidelines
22
12
 
@@ -27,10 +17,11 @@ git push origin <VERSION>
27
17
 
28
18
  ### Navigate the web along URL patterns
29
19
 
30
- URLs are less prone to change than served markup.
31
- One reason for this is that changes to a URL's path can have negative
32
- consequences for its page ranking in search engines. Websites naturally implement
33
- architectural URL patterns like REST or expose surrogate keys.
20
+ URLs are less prone to change than served markup. There are also SEO
21
+ incentives to keep their paths stable. Since websites naturally implement
22
+ architectural URL patterns like REST on the application layer, URL structure
23
+ reflects internal domain concepts necessarily, for which Wayfarer's URL-based
24
+ routing is designed.
34
25
 
35
26
  ### Follow URLs verbatim as they appear in responses
36
27
 
@@ -49,17 +40,18 @@ is ephemeral.
49
40
 
50
41
  There are two core features that depend on Redis. First, per-batch acylicity is
51
42
  achieved by maintaining the set of processed URLs per batch in Redis.
52
- There's no option to follow links in a cyclic manner. Second, batch completion
53
- requires updating an integer value in Redis, and batch completion is a very
54
- useful feature, since most crawls should end eventually, and often you want to
55
- know when.
43
+ There's no configuration option to follow links in a cyclic manner. Second,
44
+ batch completion requires updating an integer value in Redis, and batch completion
45
+ is a very useful feature, since most crawls should end eventually, and often you want
46
+ to know when.
56
47
 
57
48
  ### No configuration files
58
49
 
59
- Wayfarer can be configured through `Wayfarer.config` only, because `Wayfarer.config`
60
- may contain Ruby objects that don't de/serialize well, such as `Proc`s or `Set`s.
50
+ Wayfarer can be configured through `Wayfarer.config` in Ruby code only,
51
+ because `Wayfarer.config` may contain Ruby objects that don't de/serialize well,
52
+ such as `Proc`s or `Set`s.
61
53
 
62
- ### Features out of scope
54
+ ### Other features that are out of scope
63
55
 
64
56
  Wayfarer won't provide:
65
57
 
@@ -62,5 +62,4 @@ bundle exec wayfarer perform -r dummy_job.rb DummyJob https://example.com
62
62
  If you don't provide a batch, Wayfarer uses a generated UUID instead.
63
63
  We could have also used `DummyJob.crawl
64
64
 
65
-
66
-
65
+ (To be continued.)
data/lib/wayfarer/cli.rb CHANGED
@@ -13,6 +13,13 @@ module Wayfarer
13
13
 
14
14
  class_option :require, aliases: :r, type: :string, default: nil
15
15
 
16
+ class_option :log_level,
17
+ aliases: :l,
18
+ type: :string,
19
+ desc: "Set the log level (debug, info, warn, error, fatal).",
20
+ enum: %w[debug info warn error fatal unknown],
21
+ default: "info"
22
+
16
23
  desc "route JOB URL", "Routing tree for URL for JOB"
17
24
  option :format, type: :string, enum: %w[yaml json ruby], default: "yaml"
18
25
  def route(job, url)
@@ -84,6 +91,8 @@ module Wayfarer
84
91
  require File.join(Dir.pwd, require_path) if require_path
85
92
 
86
93
  load_rails
94
+
95
+ set_log_level
87
96
  end
88
97
 
89
98
  def load_rails
@@ -99,5 +108,12 @@ module Wayfarer
99
108
  require File.expand_path("config/boot", Dir.pwd)
100
109
  require File.expand_path("config/environment", Dir.pwd)
101
110
  end
111
+
112
+ def set_log_level
113
+ level = options[:log_level] || return
114
+ severity = ActiveSupport::Logger::Severity.const_get(level.upcase)
115
+
116
+ Wayfarer::Logging.logger.level = severity
117
+ end
102
118
  end
103
119
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Wayfarer
4
4
  module Logging
5
- mattr_accessor :logger, default: ActiveSupport::Logger.new($stdout)
5
+ mattr_accessor :logger, default: ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new($stdout))
6
6
 
7
7
  def self.emit(...)
8
8
  Emitter.new(...)
@@ -23,9 +23,8 @@ module Wayfarer
23
23
  level, msg = messages[key] || raise(ArgumentError, "No log message for #{key.inspect}")
24
24
  severity = ActiveSupport::Logger::Severity.const_get(level.upcase)
25
25
 
26
- ActiveSupport::TaggedLogging
27
- .new(Logging.logger)
28
- .tagged(task.batch, task.url, task[:controller]&.class&.name) do |logger|
26
+ Logging.logger
27
+ .tagged(task.batch, task.url, task[:controller]&.class&.name) do |logger|
29
28
  logger.add(severity, msg % args)
30
29
  end
31
30
  end
data/lib/wayfarer.rb CHANGED
@@ -41,7 +41,7 @@ module Wayfarer
41
41
  module VERSION
42
42
  MAJOR = 0
43
43
  MINOR = 4
44
- TINY = 9
44
+ TINY = 10
45
45
  STRING = [MAJOR, MINOR, TINY].join(".")
46
46
  end
47
47
 
data/spec/spec_helpers.rb CHANGED
@@ -61,7 +61,7 @@ RSpec.configure do |config|
61
61
  config.include_context "with Redis", :redis
62
62
 
63
63
  config.before :suite do
64
- Wayfarer::Logging.logger = Logger.new($stdout)
64
+ Wayfarer::Logging.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new($stdout))
65
65
 
66
66
  FactoryBot.find_definitions
67
67
  FactoryBot::SyntaxRunner.include(SpecHelpers)
data/wayfarer.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "wayfarer"
5
- s.version = "0.4.9"
5
+ s.version = "0.4.10"
6
6
  s.license = "MIT"
7
7
 
8
8
  s.homepage = "http://github.com/bauerd/wayfarer"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wayfarer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Bauer