fsr 0.1.5 → 0.1.7
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 +4 -4
- data/.ruby-version +1 -0
- data/Gemfile.lock +3 -2
- data/README.md +49 -16
- data/lib/fsr/version.rb +1 -1
- data/lib/fsr.rb +35 -13
- metadata +4 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1007a1152ea79f91d7a34ae1ae49c0ca727f09249853e2c780345a44e9214f4e
|
|
4
|
+
data.tar.gz: 946ca1428e3d97e367b7f01b8f0bcff27849ae474b251f60c67437a9a7befee0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96abacca6384358efdef8853019a10af4e15de3a3166d572ed4658feac5d406caf9322c39915020e7b7697889a350d2f5d69975d8b1e66c6b32b0ec564d39d11
|
|
7
|
+
data.tar.gz: b784142527032e170b5894a1a3052d4a9a5865aeb9ae72e2134d95758024d32fd29a2f10e2fa1374cf102f719bd3c74270f2e8072bd2eadee547fc5417c5a1fe
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.2
|
data/Gemfile.lock
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fsr (0.1.
|
|
4
|
+
fsr (0.1.7)
|
|
5
5
|
listen
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
10
|
ast (2.4.2)
|
|
11
|
-
ffi (1.17.0
|
|
11
|
+
ffi (1.17.0)
|
|
12
12
|
json (2.7.2)
|
|
13
13
|
language_server-protocol (3.17.0.3)
|
|
14
14
|
listen (3.9.0)
|
|
@@ -46,6 +46,7 @@ GEM
|
|
|
46
46
|
|
|
47
47
|
PLATFORMS
|
|
48
48
|
arm64-darwin-22
|
|
49
|
+
x86_64-darwin-23
|
|
49
50
|
|
|
50
51
|
DEPENDENCIES
|
|
51
52
|
fsr!
|
data/README.md
CHANGED
|
@@ -1,34 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# *fsr - fast spec runner*
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
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/fsr`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
3
|
+
`fsr` listens for file change events and runs RSpecs automatically in rails console avoiding the rails boot process and provides instant feedback which is crucial for Test Driven Development (TDD).
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
|
7
|
+
1. Add `fsr` to your app’s `Gemfile` in `test`:
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
```ruby
|
|
10
|
+
group :test do
|
|
11
|
+
gem 'fsr'
|
|
12
|
+
end
|
|
13
|
+
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
2. Then, in your project directory:
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
```sh
|
|
18
|
+
$ bundle install
|
|
19
|
+
```
|
|
18
20
|
|
|
19
21
|
## Usage
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
Open rails console in test environment.
|
|
24
|
+
|
|
25
|
+
```rb
|
|
26
|
+
RAILS_ENV=test bundle exec rails c
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
All following examples should be run in this console.
|
|
30
|
+
|
|
31
|
+
```rb
|
|
32
|
+
listener = Fsr.listen(['spec/models/user_spec.rb'])
|
|
33
|
+
listener.start
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This will listen to any file change events, automatically load the changed file and run the given spec.
|
|
37
|
+
|
|
38
|
+
To stop the listener,
|
|
39
|
+
|
|
40
|
+
```rb
|
|
41
|
+
listener.stop
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
By default, it listens for file change events on `app/`, `lib/`, `spec/` directories. This can be overriden with `listen` option.
|
|
45
|
+
|
|
46
|
+
```rb
|
|
47
|
+
Fsr.listen(['spec/models/user_spec.rb'], listen: ['dir/'])
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You can pass any RSpec command line arguments. For example, to run based on line number.
|
|
22
51
|
|
|
23
|
-
|
|
52
|
+
```rb
|
|
53
|
+
Fsr.listen(['spec/models/user_spec.rb:12'])
|
|
54
|
+
```
|
|
24
55
|
|
|
25
|
-
|
|
56
|
+
To run based on line number.
|
|
26
57
|
|
|
27
|
-
|
|
58
|
+
```rb
|
|
59
|
+
Fsr.listen(['spec/models/user_spec.rb', 'spec/models/admin_spec.rb'])
|
|
60
|
+
```
|
|
28
61
|
|
|
29
62
|
## Contributing
|
|
30
63
|
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/elamaranae/fsr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/elamaranae/fsr/blob/master/CODE_OF_CONDUCT.md).
|
|
32
65
|
|
|
33
66
|
## License
|
|
34
67
|
|
|
@@ -36,4 +69,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
36
69
|
|
|
37
70
|
## Code of Conduct
|
|
38
71
|
|
|
39
|
-
Everyone interacting in the Fsr project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
|
72
|
+
Everyone interacting in the Fsr project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elamaranae/fsr/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/fsr/version.rb
CHANGED
data/lib/fsr.rb
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
require_relative 'fsr/version'
|
|
4
4
|
require 'listen'
|
|
5
5
|
|
|
6
|
+
$LOAD_PATH.push('spec')
|
|
7
|
+
|
|
6
8
|
# Run RSpec fast by avoiding full app boot
|
|
7
9
|
#
|
|
8
10
|
# ```rb
|
|
@@ -15,22 +17,42 @@ require 'listen'
|
|
|
15
17
|
# listener.stop
|
|
16
18
|
# ```
|
|
17
19
|
module Fsr
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
@listener = nil
|
|
21
|
+
|
|
22
|
+
LISTEN_DIRS = [
|
|
23
|
+
"#{`pwd`.strip}/app",
|
|
24
|
+
"#{`pwd`.strip}/api",
|
|
25
|
+
"#{`pwd`.strip}/components",
|
|
26
|
+
"#{`pwd`.strip}/lib",
|
|
27
|
+
"#{`pwd`.strip}/spec",
|
|
28
|
+
"#{`pwd`.strip}/db"
|
|
29
|
+
].select { |dir| Dir.exist?(dir) }
|
|
30
|
+
|
|
31
|
+
def self.listen(run, load: [], listen: [])
|
|
32
|
+
require 'rspec/core'
|
|
33
|
+
ActiveRecord::Base.connection.reconnect!
|
|
34
|
+
@listener.stop rescue 'error'
|
|
35
|
+
@listener = build_listener(run, load: load, listen: listen)
|
|
36
|
+
@listener.start
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.build_listener(run, load: [], listen: [])
|
|
40
|
+
listen = (listen.empty? ? LISTEN_DIRS : listen).select { |dir| Dir.exist?(dir) }
|
|
41
|
+
@listener = Listen.to(*listen) do |modified, added|
|
|
42
|
+
begin
|
|
43
|
+
files = [modified, added, load].compact.flatten
|
|
44
|
+
Fsr::Runner.new(run, load: files).run
|
|
45
|
+
rescue => e
|
|
46
|
+
puts "Something went wrong while loading the files or running the spec, #{e.message}, #{e.backtrace}"
|
|
47
|
+
end
|
|
31
48
|
end
|
|
32
49
|
end
|
|
33
50
|
|
|
51
|
+
def self.run(run, load: [])
|
|
52
|
+
ActiveRecord::Base.connection.reconnect!
|
|
53
|
+
Fsr::Runner.new(run, load: load).run
|
|
54
|
+
end
|
|
55
|
+
|
|
34
56
|
def self.sandboxed
|
|
35
57
|
orig_world = RSpec.world
|
|
36
58
|
orig_example = RSpec.current_example
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fsr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elamaran Angusamy Elango
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2025-09-10 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: listen
|
|
@@ -24,7 +23,6 @@ dependencies:
|
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
|
-
description:
|
|
28
26
|
email:
|
|
29
27
|
- maran@maran.dev
|
|
30
28
|
executables: []
|
|
@@ -32,6 +30,7 @@ extensions: []
|
|
|
32
30
|
extra_rdoc_files: []
|
|
33
31
|
files:
|
|
34
32
|
- ".rubocop.yml"
|
|
33
|
+
- ".ruby-version"
|
|
35
34
|
- CHANGELOG.md
|
|
36
35
|
- CODE_OF_CONDUCT.md
|
|
37
36
|
- Gemfile
|
|
@@ -50,7 +49,6 @@ metadata:
|
|
|
50
49
|
homepage_uri: https://maran.dev
|
|
51
50
|
source_code_uri: https://github.com/elamaranae/fsr
|
|
52
51
|
changelog_uri: https://github.com/elamaranae/fsr/CHANGELOG.md
|
|
53
|
-
post_install_message:
|
|
54
52
|
rdoc_options: []
|
|
55
53
|
require_paths:
|
|
56
54
|
- lib
|
|
@@ -65,8 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
65
63
|
- !ruby/object:Gem::Version
|
|
66
64
|
version: '0'
|
|
67
65
|
requirements: []
|
|
68
|
-
rubygems_version: 3.
|
|
69
|
-
signing_key:
|
|
66
|
+
rubygems_version: 3.6.2
|
|
70
67
|
specification_version: 4
|
|
71
68
|
summary: Run RSpec fast by avoiding full app boot
|
|
72
69
|
test_files: []
|