capybara-thruster 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bc03687a30687dca088cab2424fe1a465846f32fc4fb8fefea3c4de456d198a4
4
+ data.tar.gz: 68e08163670060ae649dbdb197eb29828de70569cf87873ce1b32d5996042969
5
+ SHA512:
6
+ metadata.gz: c46e4326e4ade9956935184e2cdc68af4a1dcd8680d44a3eff6309ac0ecb1cb8dada1fdc5d62a599b689dfe0914478b065ffd5cdbc0d51329ef584e5c6868a73
7
+ data.tar.gz: 50afac1e54db88918b2297fe0796e60d5b97cac087d8b1e37e608abb5cadb1a23687d25ba1f82b0fa8f17b8b33256c70d396c740b7b4688711a2684ac71893c5
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # Change log
2
+
3
+ ## master
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2024 Vladimir Dementyev
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ [![Gem Version](https://badge.fury.io/rb/capybara-thruster.svg)](https://rubygems.org/gems/capybara-thruster)
2
+ [![Build](https://github.com/evilmartians/capybara-thruster/workflows/Build/badge.svg)](https://github.com/palkan/capybara-thruster/actions)
3
+
4
+ # Capybara Thruster server
5
+
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
+
8
+ > [TIP!]
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
+
11
+ ## Getting started
12
+
13
+ Adding the gem to your project:
14
+
15
+ ```ruby
16
+ # Gemfile
17
+ gem "capybara-thruster", group: :test
18
+ ```
19
+
20
+ Then, configure Capybara to use Thruster as a server:
21
+
22
+ ```ruby
23
+ Capybara.server = :thruster
24
+
25
+ # You can also specify some options.
26
+
27
+ # For example, if you want to see the server output,
28
+ # pass the `debug: true` option
29
+ Capybara.server = :thruster, {debug: true}
30
+
31
+ # To customize the server settings, you can pass arbitrary environment
32
+ # variables via the `env` option
33
+ Capybara.server = :thruster, {env: {"DEBUG" => "true"}}
34
+ ```
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/evilmartians/capybara-thruster](https://github.com/evilmartians/capybara-thruster).
39
+
40
+ ## Credits
41
+
42
+ This gem is generated via [`newgem` template](https://github.com/palkan/newgem) by [@palkan](https://github.com/palkan).
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
47
+
48
+ [Thruster]: https://github.com/basecamp/thruster
49
+ [anycable-thruster]: https://github.com/anycable/thruster
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Capybara
4
+ module Thruster # :nodoc:
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "childprocess"
4
+ require "capybara"
5
+
6
+ # Replaces the default Puma server on CAPYBARA_SERVER_PORT port with Thruster server.
7
+ # Requests are proxied to the Puma server running on the internal port (CAPYBARA_SERVER_PORT + 1).
8
+ Capybara.register_server :thruster do |app, port, host, **options|
9
+ puma_port = port + 1
10
+
11
+ # TODO: Figure out how to avoid sleep here
12
+ process = ChildProcess.build("bundle", "exec", "thrust", "ruby", "-e", "sleep")
13
+ process.environment["TARGET_PORT"] = puma_port.to_s
14
+ process.environment["HTTP_PORT"] = port.to_s
15
+
16
+ # Additional environment variables
17
+ options.fetch(:env, {}).each { |k, v| process.environment[k.to_s] = v.to_s }
18
+
19
+ process.io.inherit! if options.delete(:debug) == true
20
+ process.start
21
+
22
+ at_exit { process.stop }
23
+
24
+ Capybara.servers[:puma].call(app, puma_port, host)
25
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "capybara/thruster/version"
4
+ require "capybara/thruster"
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capybara-thruster
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Vladimir Dementyev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-05-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: childprocess
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: puma
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '1.15'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '1.15'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ description: Example description
84
+ email:
85
+ - Vladimir Dementyev
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - CHANGELOG.md
91
+ - LICENSE.txt
92
+ - README.md
93
+ - lib/capybara-thruster.rb
94
+ - lib/capybara/thruster.rb
95
+ - lib/capybara/thruster/version.rb
96
+ homepage: https://github.com/evilmartians/capybara-thruster
97
+ licenses:
98
+ - MIT
99
+ metadata:
100
+ bug_tracker_uri: https://github.com/evilmartians/capybara-thruster/issues
101
+ changelog_uri: https://github.com/evilmartians/capybara-thruster/blob/master/CHANGELOG.md
102
+ documentation_uri: https://github.com/evilmartians/capybara-thruster
103
+ homepage_uri: https://github.com/evilmartians/capybara-thruster
104
+ source_code_uri: https://github.com/evilmartians/capybara-thruster
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '2.7'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubygems_version: 3.4.20
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: Example description
124
+ test_files: []