capybara-thruster 0.1.0 → 0.1.1

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: 7c86552005b469de6607669044d8f7e9f23e270288bd5061bd7cd3901e70446a
4
- data.tar.gz: 3fd8eea18a226a87a298ab9191e4ab8c6b56cc0adeecfa54de99a6084d7abfeb
3
+ metadata.gz: eb193e41ea232704ba2ae902a1dcb1ce3986503d1cbe4a0032bc0749af052ca0
4
+ data.tar.gz: d42cad741af90cc72b10c2cad6e715b1494edb52ea533ae2f6b66bbbc1f9b99e
5
5
  SHA512:
6
- metadata.gz: 8a02ca6162bc0803b33c13ac552b7405b857b1d5c7a53c41346e2e86990f3abaca8079075545ea583ab146360f82299bac892d5428ef512b58c91333299b0f4d
7
- data.tar.gz: f64098a1c11164915af7fae74b549535130e12d5ae1e12022529ef50f524d67376c4f309aab7b5372c1a19b92b844793bc9a015d35e2efe063a1dcbd169b8983
6
+ metadata.gz: 931611098086ebf60db3ac10085e2b0af922af17b8513c5a0a2c431f176e585588f94a76b32830b523940b6f9fa707aa2a7f7a89f3871db3625e1825328cf28e
7
+ data.tar.gz: 3d6edd5a360dbfcbc3652b4deb18f79cb90b3e1f9c4fbd7f71ccc0a80eec6da274921296ddf4e459a2abf1e95e03959b53e9225c3c8d43b2117239536af46bfd
data/CHANGELOG.md CHANGED
@@ -2,8 +2,13 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.1.1
6
+
7
+ - Show a warning if no Thruster gem installed. ([@prog-supdex][])
8
+
5
9
  ## 0.1.0
6
10
 
7
11
  - Initial release ([@palkan][])
8
12
 
9
13
  [@palkan]: https://github.com/palkan
14
+ [@prog-supdex]: https://github.com/prog-supdex
data/README.md CHANGED
@@ -5,11 +5,23 @@
5
5
 
6
6
  This gem makes it possible to use [Thruster][] as a Capybara server. Run your browser test with HTTP/2 enabled and static assets served via Thruster for faster load times!
7
7
 
8
- > [TIP!]
8
+ > [!TIP]
9
9
  > Using AnyCable? This gem works with [AnyCable-d Thruster][anycable-thruster], so you can run your system tests against a real AnyCable server with all its features!
10
10
 
11
11
  ## Getting started
12
12
 
13
+ ### Prerequisites
14
+
15
+ Before adding the gem to your project, ensure you have either `thruster` or `anycable-thruster` installed. You can add one of these gems to your `Gemfile`:
16
+
17
+ ```ruby
18
+ # For thruster
19
+ gem "thruster"
20
+
21
+ # or for anycable-thruster
22
+ gem "anycable-thruster"
23
+ ```
24
+
13
25
  Adding the gem to your project:
14
26
 
15
27
  ```ruby
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Capybara
4
+ module Thruster
5
+ class DependencyChecker
6
+ def self.call
7
+ new.call
8
+ end
9
+
10
+ def call
11
+ unless thruster_installed?
12
+ warn "*********************************************************"
13
+ warn "Warning: capybara-thruster requires either 'thruster' or 'anycable-thruster' gem."
14
+ warn "Please install one of them to ensure proper functionality."
15
+ warn "*********************************************************"
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def thruster_installed?
22
+ gem_installed?("thruster") || gem_installed?("anycable-thruster")
23
+ end
24
+
25
+ def gem_installed?(name)
26
+ Gem::Specification.find_all_by_name(name).any?
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capybara
4
4
  module Thruster # :nodoc:
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
@@ -2,6 +2,10 @@
2
2
 
3
3
  require "childprocess"
4
4
  require "capybara"
5
+ require "capybara/dependency_checker"
6
+ require "rack/handler"
7
+
8
+ Capybara::Thruster::DependencyChecker.call
5
9
 
6
10
  # Replaces the default Puma server on CAPYBARA_SERVER_PORT port with Thruster server.
7
11
  # Requests are proxied to the Puma server running on the internal port (CAPYBARA_SERVER_PORT + 1).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-thruster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-28 00:00:00.000000000 Z
11
+ date: 2024-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -133,6 +133,7 @@ files:
133
133
  - LICENSE.txt
134
134
  - README.md
135
135
  - lib/capybara-thruster.rb
136
+ - lib/capybara/dependency_checker.rb
136
137
  - lib/capybara/thruster.rb
137
138
  - lib/capybara/thruster/version.rb
138
139
  homepage: https://github.com/evilmartians/capybara-thruster