artery-browser 0.1.1 → 0.1.2

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: e5263f5360c2a6b3a147fcd384287ddb794d8648e1323405fe1695eb3081099a
4
- data.tar.gz: 2a30bac97c7fb1de241c9e66fa464068eb0480aabbfb4dbf4c578e98300025f4
3
+ metadata.gz: db7bbd61337e83f82abf28ea7cc9ee0d03f65ba51c709f8f2e6f7d521408d0a6
4
+ data.tar.gz: 1348fe854f6c7f4b3bad5d10d3342252c27122ce45799208bea314e202dab9f0
5
5
  SHA512:
6
- metadata.gz: eeb8d4c9c390166201c3aaaa1636f40c9dc6109d85177dd90fd042709111bd6e7b961ae2652031981ddd337ff4fc040b7f6b28914c40192080076654a6331e52
7
- data.tar.gz: 6bf23f0aad6bf3e3388fc19ee6354a808bf822b10bb7c4c7a64bbd8d81ec61129b50e1cd82427921c262a433dbf69c5999be37dc38098343a3836d8bc0e69c82
6
+ metadata.gz: db5b52e2c14466ef473a86ae885d43969c3f8426540485690c241e33c35e5894ecb2e84e0da71de3cda3bf1f92f9676668dc899de3c0cdd327d5a93622cf80b6
7
+ data.tar.gz: 12e9593767b055e70e0ad26d6723c48df12c28387168411bc5fa33a9a80a92ca6e0c3c61f3114819ecc17d62322bbe24bdc5b763e32acce8edab2b3ea8dc50f7
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
2
+ # configuration file. It makes it possible to enable/disable
3
+ # certain cops (checks) and to alter their behavior if they accept
4
+ # any parameters. The file can be placed either in your home
5
+ # directory or in some project directory.
6
+ #
7
+ # RuboCop will start looking for the configuration file in the directory
8
+ # where the inspected file is and continue its way up to the root directory.
9
+ #
10
+ # See https://docs.rubocop.org/rubocop/configuration
11
+
12
+ Style/Documentation:
13
+ Enabled: false
14
+
15
+ Metrics/MethodLength:
16
+ Max: 50
data/Gemfile CHANGED
@@ -9,3 +9,4 @@ gemspec
9
9
 
10
10
  gem 'rack', '~> 3.2'
11
11
  gem 'rack-test'
12
+ gem 'rubocop', '~> 1.81'
data/Gemfile.lock CHANGED
@@ -1,18 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- artery-browser (0.1.0)
4
+ artery-browser (0.1.1)
5
5
  rack (~> 3.2)
6
6
  webrick (~> 1.9)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ ast (2.4.3)
11
12
  diff-lcs (1.6.2)
13
+ json (2.16.0)
14
+ language_server-protocol (3.17.0.5)
15
+ lint_roller (1.1.0)
16
+ parallel (1.27.0)
17
+ parser (3.3.10.0)
18
+ ast (~> 2.4.1)
19
+ racc
20
+ prism (1.6.0)
21
+ racc (1.8.1)
12
22
  rack (3.2.4)
13
23
  rack-test (2.2.0)
14
24
  rack (>= 1.3)
25
+ rainbow (3.1.1)
15
26
  rake (10.5.0)
27
+ regexp_parser (2.11.3)
16
28
  rspec (3.13.2)
17
29
  rspec-core (~> 3.13.0)
18
30
  rspec-expectations (~> 3.13.0)
@@ -26,6 +38,24 @@ GEM
26
38
  diff-lcs (>= 1.2.0, < 2.0)
27
39
  rspec-support (~> 3.13.0)
28
40
  rspec-support (3.13.6)
41
+ rubocop (1.81.7)
42
+ json (~> 2.3)
43
+ language_server-protocol (~> 3.17.0.2)
44
+ lint_roller (~> 1.1.0)
45
+ parallel (~> 1.10)
46
+ parser (>= 3.3.0.2)
47
+ rainbow (>= 2.2.2, < 4.0)
48
+ regexp_parser (>= 2.9.3, < 3.0)
49
+ rubocop-ast (>= 1.47.1, < 2.0)
50
+ ruby-progressbar (~> 1.7)
51
+ unicode-display_width (>= 2.4.0, < 4.0)
52
+ rubocop-ast (1.48.0)
53
+ parser (>= 3.3.7.2)
54
+ prism (~> 1.4)
55
+ ruby-progressbar (1.13.0)
56
+ unicode-display_width (3.2.0)
57
+ unicode-emoji (~> 4.1)
58
+ unicode-emoji (4.1.0)
29
59
  webrick (1.9.1)
30
60
 
31
61
  PLATFORMS
@@ -39,6 +69,7 @@ DEPENDENCIES
39
69
  rack-test
40
70
  rake (~> 10.0)
41
71
  rspec (~> 3.0)
72
+ rubocop (~> 1.81)
42
73
 
43
74
  BUNDLED WITH
44
75
  2.6.9
@@ -33,10 +33,13 @@ Gem::Specification.new do |spec|
33
33
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
34
34
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
35
  end
36
+
36
37
  spec.bindir = 'exe'
37
38
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
39
  spec.require_paths = ['lib']
39
40
 
41
+ spec.required_ruby_version = '>= 2.7'
42
+
40
43
  spec.add_dependency 'rack', '~> 3.2'
41
44
  spec.add_dependency 'webrick', '~> 1.9'
42
45
 
@@ -0,0 +1 @@
1
+ 0549022cfbcab5c23b96f79c8a17d185402d267d8583ce75d338f6cf9c9a2bf4aecf92a44f2a5e313a104c3b50d9f62aca8db905e06bbed142cc62db6b400fe4
@@ -0,0 +1 @@
1
+ 1e087ca524bbf3db235de3f47e76c22b8c0f3a40dc842c90d8b59004d11e49c2ba5bfc0852c29805bfa29c02ec4a6392cb1e3da8628174bd381f6e34692a48ea
@@ -13,13 +13,10 @@ module Artery
13
13
  ::Rack::Builder.new do
14
14
  use Rack::Static,
15
15
  urls:
16
- %w[
17
- index.html
18
- logo.svg
19
- assets/index-CFTHRyuc.js
20
- assets/index-Dw-hdo5G.css
21
- assets/validate-routes-Cx95rB3S.js
22
- ].map { |f| ["/#{f}", f] }.to_h,
16
+ %w[index.html logo.svg
17
+ assets/index-CFTHRyuc.js
18
+ assets/index-Dw-hdo5G.css
19
+ assets/validate-routes-Cx95rB3S.js].map { |f| ["/#{f}", f] }.to_h,
23
20
  root: "#{__dir__}/../../../public"
24
21
  run App.new
25
22
  end
@@ -27,6 +24,7 @@ module Artery
27
24
 
28
25
  def initialize; end
29
26
 
27
+ # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity
30
28
  def call(env)
31
29
  router = Router.new
32
30
  %w[/].each do |starting_route|
@@ -54,22 +52,26 @@ module Artery
54
52
  end
55
53
 
56
54
  router.add_route('PUT', '/listeners/:listener_id') do |params, request|
57
- listener = Artery.subscription_info_class.find(params.fetch('listener_id'))
55
+ listener_info = Artery.subscription_info_class.find(params.fetch('listener_id'))
58
56
  updates = JSON.parse(request.body.gets).slice('latest_index')
59
- listener.update!(updates)
57
+
60
58
  Artery.subscriptions.each_value do |listeners|
61
59
  listeners.each do |subscription_listener|
62
- subscription_listener.info.reload if subscription_listener.info == listener
60
+ subscription_listener_info = subscription_listener.info
61
+ next unless subscription_listener_info == listener_info
62
+
63
+ subscription_listener_info.with_lock { subscription_listener_info.update!(updates) }
63
64
  end
64
65
  end
65
66
 
66
- json(listener.attributes)
67
+ json(listener_info.attributes.slice('id'))
67
68
  end
68
69
 
69
70
  router.handle(::Rack::Request.new(env))
70
71
  rescue Router::NoMatch
71
72
  not_found
72
73
  end
74
+ # rubocop:enable Metrics/PerceivedComplexity, Metrics/AbcSize, Metrics/CyclomaticComplexity
73
75
 
74
76
  private
75
77
 
@@ -6,7 +6,7 @@ module Artery
6
6
  NoMatch = Class.new(StandardError)
7
7
 
8
8
  class Route
9
- NAMED_SEGMENTS_PATTERN = %r{/([^/]*):([^:$/]+)}
9
+ NAMED_SEGMENTS_PATTERN = %r{/([^/]*):([^:$/]+)}.freeze
10
10
  private_constant :NAMED_SEGMENTS_PATTERN
11
11
 
12
12
  def initialize(request_method, pattern, &block)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Artery
4
4
  module Browser
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artery-browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Askar Zinurov
@@ -88,6 +88,7 @@ extra_rdoc_files: []
88
88
  files:
89
89
  - ".gitignore"
90
90
  - ".rspec"
91
+ - ".rubocop.yml"
91
92
  - ".ruby-version"
92
93
  - ".travis.yml"
93
94
  - Gemfile
@@ -96,7 +97,8 @@ files:
96
97
  - README.md
97
98
  - Rakefile
98
99
  - artery-browser.gemspec
99
- - checksums/artery-browser-0.1.0.gem.sha512
100
+ - checksums/artery-browser-0.1.1.gem.sha512
101
+ - checksums/artery-browser-0.1.2.gem.sha512
100
102
  - lib/artery/browser.rb
101
103
  - lib/artery/browser/app.rb
102
104
  - lib/artery/browser/router.rb
@@ -146,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
148
  requirements:
147
149
  - - ">="
148
150
  - !ruby/object:Gem::Version
149
- version: '0'
151
+ version: '2.7'
150
152
  required_rubygems_version: !ruby/object:Gem::Requirement
151
153
  requirements:
152
154
  - - ">="
@@ -1 +0,0 @@
1
- 93e63729fc36eb69839910adb9924954dc7b73d9a7e2f554a4a1078988191c29c8ff2024837ccd286283e08a14091b3ec5d933da9460fb58e206a5ca02bf2f3e