hypertest 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/dev.yml +3 -0
- data/hypertest.gemspec +26 -0
- data/lib/hypertest.rb +55 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e55e87ee52f10eb7e5ff86354124cd305239f3a95bc40e2a6d264957e65a1872
|
4
|
+
data.tar.gz: 5e12c783c60363473716ef99ac366c1c122fb07b4e4bd3967dc40175e7793ce7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0b1955115622af7ad0fa6e4aae5633b22790b26911395c607c87b1c75bc994c054cdcc75501a30880f273bb1291d4235f0e42a9f97a234a65937460ff12e97d5
|
7
|
+
data.tar.gz: 04d45210a85e6ea5530766643480893c73c265a1d0029b6e0250c0be703afb8810d212c9ae46682670bc18978b7a32e955d68bddc030a044b1da351fc8a14b23
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hypertest (0.1.1)
|
5
|
+
rb-fsevent (~> 0.10.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
rake (10.5.0)
|
11
|
+
rb-fsevent (0.10.4)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
arm64-darwin-23
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
hypertest!
|
19
|
+
rake (~> 10.0)
|
20
|
+
|
21
|
+
BUNDLED WITH
|
22
|
+
2.5.11
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2024 Burke Libbey
|
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
|
+
# Hypertest
|
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/hypertest`. 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 'hypertest'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install hypertest
|
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. 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/burke/hypertest.
|
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/dev.yml
ADDED
data/hypertest.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "hypertest"
|
7
|
+
spec.version = "0.1.0"
|
8
|
+
spec.authors = ["Burke Libbey"]
|
9
|
+
spec.email = ["burke.libbey@shopify.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Run tests fast}
|
12
|
+
spec.description = %q{Run tests fast}
|
13
|
+
spec.homepage = "https://github.com/Shopify/hypertest"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
|
25
|
+
spec.add_dependency "rb-fsevent", "~> 0.10.3"
|
26
|
+
end
|
data/lib/hypertest.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rb-fsevent'
|
2
|
+
|
3
|
+
module Hypertest
|
4
|
+
class << self
|
5
|
+
# ignore: pattern of directories to ignore events for
|
6
|
+
# debounce: number of seconds to drop successive event batches after
|
7
|
+
# initiating a run
|
8
|
+
# &block: run your tests!
|
9
|
+
def run(ignore: %r{/(?:\.git|tmp)/}, debounce: 0.050, &block)
|
10
|
+
q = Queue.new
|
11
|
+
Thread.new { produce(q, ignore) }
|
12
|
+
consume(q, debounce, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def produce(q, ignore)
|
18
|
+
fsevent = FSEvent.new
|
19
|
+
fsevent.watch(Dir.pwd, latency: 0.0) do |directories|
|
20
|
+
directories.reject! { |f| ignore =~ f }
|
21
|
+
unless directories.empty?
|
22
|
+
q << Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
fsevent.run
|
26
|
+
end
|
27
|
+
|
28
|
+
def consume(q, debounce, &block)
|
29
|
+
last_run = 0
|
30
|
+
while (ts = q.pop)
|
31
|
+
if ts - last_run > debounce
|
32
|
+
last_run = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
33
|
+
fork_invoke(&block)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def fork_invoke(&block)
|
39
|
+
t1 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
40
|
+
pid = fork(&block)
|
41
|
+
_, stat = Process.waitpid2(pid)
|
42
|
+
t2 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
43
|
+
print_result(t1, t2, stat)
|
44
|
+
end
|
45
|
+
|
46
|
+
def print_result(t1, t2, stat)
|
47
|
+
ms = ((t2 - t1) * 1000).round
|
48
|
+
if stat.success?
|
49
|
+
STDERR.puts "\x1b[1;34m%% Completed in #{ms}ms\x1b[0m"
|
50
|
+
else
|
51
|
+
STDERR.puts "\x1b[1;31m%% Failed in #{ms}ms\x1b[0m"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hypertest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Burke Libbey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-06-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rb-fsevent
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.10.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.10.3
|
41
|
+
description: Run tests fast
|
42
|
+
email:
|
43
|
+
- burke.libbey@shopify.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- dev.yml
|
55
|
+
- hypertest.gemspec
|
56
|
+
- lib/hypertest.rb
|
57
|
+
homepage: https://github.com/Shopify/hypertest
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubygems_version: 3.5.11
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Run tests fast
|
80
|
+
test_files: []
|