capybara_spa 0.1.0
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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +88 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/capybara_spa.gemspec +41 -0
- data/lib/capybara_spa.rb +18 -0
- data/lib/capybara_spa/capybara_dsl_ext.rb +33 -0
- data/lib/capybara_spa/server/ng_static_server.rb +164 -0
- data/lib/capybara_spa/version.rb +3 -0
- metadata +175 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8e7e747b02cc0869ce137660bebe934510e93def930cc59986e2613dc1c939a0
|
|
4
|
+
data.tar.gz: 2ec7a9c521540156b1a4ccb3164cdec6a87017cf807a7f3048eb3b9418e5302a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b34d5a3ab60ba7da2e80a12349f578beaeda9eeca8014dd8cfab6edc499af300a05405a7a74160a0abad828ddd61a0c1322bcd4501518246bf4ab8c7024abbd3
|
|
7
|
+
data.tar.gz: 84d47934871fa119e29c2bb24cd6892bc83ce9dc925ab3307e02d96cde55069b6de486184d6c40a050390ac322933ece9f288fa0a965dd7141a55c1398b00f35
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4.1
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
capybara_spa (0.1.0)
|
|
5
|
+
capybara (~> 3.0)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
addressable (2.5.2)
|
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
12
|
+
archive-zip (0.11.0)
|
|
13
|
+
io-like (~> 0.3.0)
|
|
14
|
+
byebug (10.0.2)
|
|
15
|
+
capybara (3.0.3)
|
|
16
|
+
addressable
|
|
17
|
+
mini_mime (>= 0.1.3)
|
|
18
|
+
nokogiri (~> 1.8)
|
|
19
|
+
rack (>= 1.6.0)
|
|
20
|
+
rack-test (>= 0.6.3)
|
|
21
|
+
xpath (~> 3.0)
|
|
22
|
+
childprocess (0.9.0)
|
|
23
|
+
ffi (~> 1.0, >= 1.0.11)
|
|
24
|
+
chromedriver-helper (1.2.0)
|
|
25
|
+
archive-zip (~> 0.10)
|
|
26
|
+
nokogiri (~> 1.8)
|
|
27
|
+
coderay (1.1.2)
|
|
28
|
+
diff-lcs (1.3)
|
|
29
|
+
docile (1.3.0)
|
|
30
|
+
ffi (1.9.23)
|
|
31
|
+
io-like (0.3.0)
|
|
32
|
+
json (2.1.0)
|
|
33
|
+
method_source (0.9.0)
|
|
34
|
+
mini_mime (1.0.0)
|
|
35
|
+
mini_portile2 (2.3.0)
|
|
36
|
+
nokogiri (1.8.2)
|
|
37
|
+
mini_portile2 (~> 2.3.0)
|
|
38
|
+
pry (0.11.3)
|
|
39
|
+
coderay (~> 1.1.0)
|
|
40
|
+
method_source (~> 0.9.0)
|
|
41
|
+
pry-byebug (3.6.0)
|
|
42
|
+
byebug (~> 10.0)
|
|
43
|
+
pry (~> 0.10)
|
|
44
|
+
public_suffix (3.0.2)
|
|
45
|
+
rack (2.0.5)
|
|
46
|
+
rack-test (1.0.0)
|
|
47
|
+
rack (>= 1.0, < 3)
|
|
48
|
+
rake (10.5.0)
|
|
49
|
+
rspec (3.7.0)
|
|
50
|
+
rspec-core (~> 3.7.0)
|
|
51
|
+
rspec-expectations (~> 3.7.0)
|
|
52
|
+
rspec-mocks (~> 3.7.0)
|
|
53
|
+
rspec-core (3.7.1)
|
|
54
|
+
rspec-support (~> 3.7.0)
|
|
55
|
+
rspec-expectations (3.7.0)
|
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
57
|
+
rspec-support (~> 3.7.0)
|
|
58
|
+
rspec-mocks (3.7.0)
|
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
60
|
+
rspec-support (~> 3.7.0)
|
|
61
|
+
rspec-support (3.7.1)
|
|
62
|
+
rubyzip (1.2.1)
|
|
63
|
+
selenium-webdriver (3.11.0)
|
|
64
|
+
childprocess (~> 0.5)
|
|
65
|
+
rubyzip (~> 1.2)
|
|
66
|
+
simplecov (0.16.1)
|
|
67
|
+
docile (~> 1.1)
|
|
68
|
+
json (>= 1.8, < 3)
|
|
69
|
+
simplecov-html (~> 0.10.0)
|
|
70
|
+
simplecov-html (0.10.2)
|
|
71
|
+
xpath (3.0.0)
|
|
72
|
+
nokogiri (~> 1.8)
|
|
73
|
+
|
|
74
|
+
PLATFORMS
|
|
75
|
+
ruby
|
|
76
|
+
|
|
77
|
+
DEPENDENCIES
|
|
78
|
+
bundler (~> 1.16)
|
|
79
|
+
capybara_spa!
|
|
80
|
+
chromedriver-helper (~> 1.2)
|
|
81
|
+
pry-byebug (~> 3.6)
|
|
82
|
+
rake (~> 10.0)
|
|
83
|
+
rspec (~> 3.0)
|
|
84
|
+
selenium-webdriver (~> 3.11)
|
|
85
|
+
simplecov (~> 0.16)
|
|
86
|
+
|
|
87
|
+
BUNDLED WITH
|
|
88
|
+
1.16.1
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Zach Dennis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# CapybaraSpa
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/capybara_spa`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'capybara_spa'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install capybara_spa
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/zdennis/capybara_spa.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "capybara_spa"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "capybara_spa/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "capybara_spa"
|
|
8
|
+
spec.version = CapybaraSpa::VERSION
|
|
9
|
+
spec.authors = ["Zach Dennis"]
|
|
10
|
+
spec.email = ["zach.dennis@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{A friendly library for Capybara to make running single page application servers easy}
|
|
13
|
+
spec.description = %q{A friendly library for Capybara to make running single page application servers easy as pie for integration, e2e, and feature level specs.}
|
|
14
|
+
spec.homepage = "https://github.com/mhs/capybara-spa"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
|
+
if spec.respond_to?(:metadata)
|
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
21
|
+
else
|
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
23
|
+
"public gem pushes."
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
|
28
|
+
end
|
|
29
|
+
spec.bindir = "exe"
|
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
+
spec.require_paths = ["lib"]
|
|
32
|
+
|
|
33
|
+
spec.add_dependency "capybara", "~> 3.0"
|
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
37
|
+
spec.add_development_dependency "chromedriver-helper", "~> 1.2"
|
|
38
|
+
spec.add_development_dependency "pry-byebug", "~> 3.6"
|
|
39
|
+
spec.add_development_dependency "selenium-webdriver", "~> 3.11"
|
|
40
|
+
spec.add_development_dependency "simplecov", "~> 0.16"
|
|
41
|
+
end
|
data/lib/capybara_spa.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'capybara_spa/capybara_dsl_ext')
|
|
2
|
+
require File.join(File.dirname(__FILE__), 'capybara_spa/server/ng_static_server')
|
|
3
|
+
|
|
4
|
+
module CapybaraSpa
|
|
5
|
+
class << self
|
|
6
|
+
# * NG_APP_TAG: the HTML tag where the angular app is stored. Defaults to app-root.
|
|
7
|
+
attr_accessor :app_tag
|
|
8
|
+
|
|
9
|
+
# * NG_LOG_FILE: where to log the output of angular-http-server. Defaults to /dev/null
|
|
10
|
+
attr_accessor :log_file
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
self.app_tag = ENV.fetch('NG_APP_TAG', 'app-root')
|
|
14
|
+
self.log_file = ENV.fetch('NG_LOG_FILE', '/dev/null')
|
|
15
|
+
|
|
16
|
+
module Server
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'capybara/dsl'
|
|
2
|
+
|
|
3
|
+
module Capybara
|
|
4
|
+
module DSL
|
|
5
|
+
def page
|
|
6
|
+
wait_until_angular_app_is_found unless @ignoring_angular
|
|
7
|
+
Capybara.current_session
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def wait_until_angular_app_is_found
|
|
11
|
+
return if @angular_app_found
|
|
12
|
+
|
|
13
|
+
@angular_app_found = false
|
|
14
|
+
|
|
15
|
+
loop do
|
|
16
|
+
Capybara.current_session.visit('/')
|
|
17
|
+
app_tag = CapybaraSpa.app_tag
|
|
18
|
+
@angular_app_found = Capybara.current_session.evaluate_script <<-JAVASCRIPT
|
|
19
|
+
document.getElementsByTagName('#{app_tag}').length === 1
|
|
20
|
+
JAVASCRIPT
|
|
21
|
+
break if @angular_app_found
|
|
22
|
+
sleep 0.25
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def ignoring_angular
|
|
27
|
+
@ignoring_angular = true
|
|
28
|
+
yield
|
|
29
|
+
ensure
|
|
30
|
+
@ignoring_angular = false
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
require 'logger'
|
|
2
|
+
|
|
3
|
+
module CapybaraSpa
|
|
4
|
+
module Server
|
|
5
|
+
# CapybaraSpa::Server::NgStaticServer is a class that wraps running
|
|
6
|
+
# a static Angular app using angular-http-server. It can take the
|
|
7
|
+
# following environment variables:
|
|
8
|
+
#
|
|
9
|
+
# * NG_BUILD_PATH: where the angular app has been built to. Defaults to nil.
|
|
10
|
+
# * NG_HTTP_SERVER_BIN: where angular-http-server binary/script is located. Defaults to nil \
|
|
11
|
+
# which will force lookup of it in PATH, then in node_modules/.
|
|
12
|
+
# * NG_PID_FILE: where to write a PID file to. Defaults to /tmp/angular-process.pid
|
|
13
|
+
# * NG_PORT: what port to run the Angular app on. Defaults to 5001.
|
|
14
|
+
#
|
|
15
|
+
class NgStaticServer
|
|
16
|
+
class NgAppNotFound < ::StandardError ; end
|
|
17
|
+
class NgHttpServerNotFound < ::StandardError ; end
|
|
18
|
+
class NgHttpServerNotExecutable < ::StandardError ; end
|
|
19
|
+
class NodeModulesDirectoryNotFound < ::StandardError ; end
|
|
20
|
+
|
|
21
|
+
attr_accessor :build_path, :http_server_bin_path, :log_file, :pid_file, :port
|
|
22
|
+
attr_accessor :pid
|
|
23
|
+
|
|
24
|
+
def initialize(build_path:, http_server_bin_path: nil, log_file: CapybaraSpa.log_file, pid_file: nil, port: nil)
|
|
25
|
+
@build_path = build_path || ENV.fetch('NG_BUILD_PATH', nil)
|
|
26
|
+
@http_server_bin_path = http_server_bin_path || ENV.fetch('NG_HTTP_SERVER_BIN') { find_http_server_bin_path }
|
|
27
|
+
@log_file = log_file
|
|
28
|
+
@pid_file = pid_file || ENV.fetch('NG_PID_FILE', '/tmp/angular-process.pid')
|
|
29
|
+
@port = port || ENV.fetch('NG_PORT', 5001)
|
|
30
|
+
@started = false
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def started?
|
|
34
|
+
@started
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def stopped?
|
|
38
|
+
!@started
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def start
|
|
42
|
+
return false if started?
|
|
43
|
+
|
|
44
|
+
check_requirements!
|
|
45
|
+
|
|
46
|
+
@pid = fork do
|
|
47
|
+
STDOUT.reopen(@log_file)
|
|
48
|
+
run_server
|
|
49
|
+
end
|
|
50
|
+
File.write(pid_file, pid)
|
|
51
|
+
|
|
52
|
+
at_exit { stop }
|
|
53
|
+
@started = true
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def stop
|
|
57
|
+
if File.exist?(pid_file)
|
|
58
|
+
pid = File.read(pid_file).to_i
|
|
59
|
+
puts "capybara-angular/angular-http-server:parent#at_exit sending SIGTERM to pid: #{pid}" if ENV['DEBUG']
|
|
60
|
+
begin
|
|
61
|
+
Process.kill 'SIGTERM', pid
|
|
62
|
+
Process.wait pid
|
|
63
|
+
rescue Errno::ECHILD => ex
|
|
64
|
+
# no-op, the child process does not exist
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
puts "capybara-angular/angular-http-server removing pid_file: #{pid_file}" if ENV['DEBUG']
|
|
68
|
+
FileUtils.rm pid_file
|
|
69
|
+
@started = false
|
|
70
|
+
true
|
|
71
|
+
else
|
|
72
|
+
puts "capybara-angular/angular-http-server did not find pid_file, no process to SIGHUP: #{pid_file}" if ENV['DEBUG']
|
|
73
|
+
false
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
private
|
|
78
|
+
|
|
79
|
+
def check_requirements!
|
|
80
|
+
check_executable_requirements!
|
|
81
|
+
check_ng_app_requirements!
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def check_executable_requirements!
|
|
85
|
+
executable_name = File.basename(http_server_bin_path)
|
|
86
|
+
|
|
87
|
+
if File.exist?(http_server_bin_path)
|
|
88
|
+
if !File.executable?(http_server_bin_path)
|
|
89
|
+
raise NgHttpServerNotExecutable, 'File found, but not executable!'
|
|
90
|
+
end
|
|
91
|
+
else
|
|
92
|
+
error_message = <<-ERROR.gsub(/^\s*\|/, '')
|
|
93
|
+
|#{executable_name + ' not found!'} Make sure it's installed via npm:
|
|
94
|
+
|
|
|
95
|
+
|To the project:
|
|
96
|
+
|
|
|
97
|
+
| npm install --save-dev #{executable_name}
|
|
98
|
+
|
|
|
99
|
+
|Or globally:
|
|
100
|
+
|
|
|
101
|
+
| npm install -g #{executable_name}
|
|
102
|
+
|
|
|
103
|
+
ERROR
|
|
104
|
+
raise NgHttpServerNotFound, error_message
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def check_ng_app_requirements!
|
|
109
|
+
unless Dir.exist?(build_path)
|
|
110
|
+
error_message = <<-ERROR.gsub(/^\s*\|/, '')
|
|
111
|
+
|#{File.expand_path(build_path)} directory not found! Make sure the angular app is being built:
|
|
112
|
+
|
|
|
113
|
+
|E.g. ng build --aot --environment integration-tests --target=development --output-path=public/app/
|
|
114
|
+
|
|
|
115
|
+
ERROR
|
|
116
|
+
raise NgAppNotFound, error_message
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def find_http_server_bin_path
|
|
121
|
+
http_server_bin_path = `which angular-http-server`.chomp
|
|
122
|
+
|
|
123
|
+
# if no http-server found in default PATH then try to find it in node_modules
|
|
124
|
+
if http_server_bin_path.length == 0
|
|
125
|
+
http_server_bin_path = File.join(node_modules_path, '.bin', 'angular-http-server')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
http_server_bin_path
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def run_server
|
|
132
|
+
build_dir = File.dirname(build_path)
|
|
133
|
+
Dir.chdir(build_dir) do
|
|
134
|
+
cmd = "#{http_server_bin_path} -p #{port} --path #{File.basename(build_path)}"
|
|
135
|
+
puts "capybara-angular/angular-http-server is executing command: #{cmd}" # if ENV['DEBUG']
|
|
136
|
+
spawn_cmd(cmd)
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def spawn_cmd(cmd)
|
|
141
|
+
puts "capybara-angular/angular-http-server is executing command: #{cmd}" if ENV['DEBUG']
|
|
142
|
+
|
|
143
|
+
# use spawn(cmd, arg1, ... ) version to avoid launching a shell that launches the
|
|
144
|
+
# http-server or ng process. We want this pid to be the actual process to kill when
|
|
145
|
+
# this program is done exiting.
|
|
146
|
+
pid = spawn *cmd.split(/\s+/)
|
|
147
|
+
|
|
148
|
+
puts "capybara-angular/angular-http-server:forked child with pid: #{pid}" if ENV['DEBUG']
|
|
149
|
+
|
|
150
|
+
at_exit do
|
|
151
|
+
puts "capybara-angular/angular-http-server:forked#at_exit is sending SIGTERM signal to pid: #{pid}" if ENV['DEBUG']
|
|
152
|
+
begin
|
|
153
|
+
Process.kill 'TERM', pid
|
|
154
|
+
Process.wait pid
|
|
155
|
+
rescue Errno::ESRCH
|
|
156
|
+
# no-op: the process is already dead
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
Process.waitall
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: capybara_spa
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Zach Dennis
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-05-07 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: capybara
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '3.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.16'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.16'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: chromedriver-helper
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '1.2'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '1.2'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: pry-byebug
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3.6'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3.6'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: selenium-webdriver
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '3.11'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '3.11'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: simplecov
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0.16'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0.16'
|
|
125
|
+
description: A friendly library for Capybara to make running single page application
|
|
126
|
+
servers easy as pie for integration, e2e, and feature level specs.
|
|
127
|
+
email:
|
|
128
|
+
- zach.dennis@gmail.com
|
|
129
|
+
executables: []
|
|
130
|
+
extensions: []
|
|
131
|
+
extra_rdoc_files: []
|
|
132
|
+
files:
|
|
133
|
+
- ".gitignore"
|
|
134
|
+
- ".rspec"
|
|
135
|
+
- ".ruby-version"
|
|
136
|
+
- ".travis.yml"
|
|
137
|
+
- Gemfile
|
|
138
|
+
- Gemfile.lock
|
|
139
|
+
- LICENSE.txt
|
|
140
|
+
- README.md
|
|
141
|
+
- Rakefile
|
|
142
|
+
- bin/console
|
|
143
|
+
- bin/setup
|
|
144
|
+
- capybara_spa.gemspec
|
|
145
|
+
- lib/capybara_spa.rb
|
|
146
|
+
- lib/capybara_spa/capybara_dsl_ext.rb
|
|
147
|
+
- lib/capybara_spa/server/ng_static_server.rb
|
|
148
|
+
- lib/capybara_spa/version.rb
|
|
149
|
+
homepage: https://github.com/mhs/capybara-spa
|
|
150
|
+
licenses:
|
|
151
|
+
- MIT
|
|
152
|
+
metadata:
|
|
153
|
+
allowed_push_host: https://rubygems.org
|
|
154
|
+
post_install_message:
|
|
155
|
+
rdoc_options: []
|
|
156
|
+
require_paths:
|
|
157
|
+
- lib
|
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
|
+
requirements:
|
|
160
|
+
- - ">="
|
|
161
|
+
- !ruby/object:Gem::Version
|
|
162
|
+
version: '0'
|
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
|
+
requirements:
|
|
165
|
+
- - ">="
|
|
166
|
+
- !ruby/object:Gem::Version
|
|
167
|
+
version: '0'
|
|
168
|
+
requirements: []
|
|
169
|
+
rubyforge_project:
|
|
170
|
+
rubygems_version: 2.7.2
|
|
171
|
+
signing_key:
|
|
172
|
+
specification_version: 4
|
|
173
|
+
summary: A friendly library for Capybara to make running single page application servers
|
|
174
|
+
easy
|
|
175
|
+
test_files: []
|