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 +4 -4
- data/Gemfile.lock +1 -1
- data/docs/guides/development.md +18 -26
- data/docs/guides/tutorial.md +1 -2
- data/lib/wayfarer/cli.rb +16 -0
- data/lib/wayfarer/logging.rb +3 -4
- data/lib/wayfarer.rb +1 -1
- data/spec/spec_helpers.rb +1 -1
- data/wayfarer.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39fd7cefe2a4a7e07e2c3f69c0d13f96603e983432c56616444407a04af55442
|
|
4
|
+
data.tar.gz: 465b842759a03128413d66ff59b5116f0f7d444b193ad0929ed3a3914f55d5ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21111b9d58ab7d0286f2f0a8c575485f0553cc4ddb8f19ebcad9f82f67e70dd53290832de6a4da137839a22151f0d06a47b0c606bc139b1491c5ce3d2accf188
|
|
7
|
+
data.tar.gz: '049cc40ee6973ecc66ce921d1ca8bf746ae9066ef88ebe3a364a0b859d125d9857daba149dfffd0b630f9addf88d2330ca3f9de5e57dab521d1dc2908a1d5cde'
|
data/Gemfile.lock
CHANGED
data/docs/guides/development.md
CHANGED
|
@@ -2,21 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Release Procedure
|
|
4
4
|
|
|
5
|
-
1.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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,
|
|
53
|
-
requires updating an integer value in Redis, and batch completion
|
|
54
|
-
useful feature, since most crawls should end eventually, and often you want
|
|
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,
|
|
60
|
-
may contain Ruby objects that don't de/serialize well,
|
|
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
|
-
###
|
|
54
|
+
### Other features that are out of scope
|
|
63
55
|
|
|
64
56
|
Wayfarer won't provide:
|
|
65
57
|
|
data/docs/guides/tutorial.md
CHANGED
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
|
data/lib/wayfarer/logging.rb
CHANGED
|
@@ -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
|
-
|
|
27
|
-
|
|
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
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