devloop 0.0.9 → 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: df5e69165e639a7c989ba94a3e645beb934ee3d265906dfcb327def357867a09
4
- data.tar.gz: 2351433c44454695d6f6ea2bcdd26f574dd79c5939b2fbc2eacd2d9d908f987c
3
+ metadata.gz: 7bdfbb6b5c25d903818042b071bf95090cccb324fd993957d8a6c9232310d6b3
4
+ data.tar.gz: dc18174f6087bca3656a47d072baa8c9b3ef177252ba20a50bdac21660417d9d
5
5
  SHA512:
6
- metadata.gz: 3c4744c85d13176a521691e28232d9db7ef14eacb00cd374fc533ac2d7641dfcf23edf228c30bf3cec02cee7e31e596f986da89e1214a25b6df27a4f48b4e376
7
- data.tar.gz: fbbfc4813cc205ed367529ae84ca758a5915dbba407e052042ff74f9934b71c5e74d56dba3d708e02e2e590e3a5309815aff51422c029d84bc7ed8905136710b
6
+ metadata.gz: dee4939c6e441d48e24d96d70ae4d215376adbbca9fc31f3f69374d0dfd7cc643dd5e2f2fd41975dd5476f477858b95e8bfe1c49716a5657721b74d28a551edc
7
+ data.tar.gz: 8f94d9393b420e40028c53748f27415e0e587252ce94cb67b0b7ebf86f4aa6ff05e9bc1c7617c81d75c4835050b4a7d736d0874eb4807915e50968160ec42e7d
data/README.md CHANGED
@@ -1,17 +1,11 @@
1
1
  # Devloop [![Gem Version](https://badge.fury.io/rb/devloop.svg)](https://badge.fury.io/rb/devloop) [![GH Actions](https://github.com/pawurb/devloop/actions/workflows/ci.yml/badge.svg)](https://github.com/pawurb/devloop/actions)
2
2
 
3
- Devloop is an automated Rspec runner for Rails apps inspired by [TLDR](https://github.com/tendersearls/tldr). The purpose of this tool is to provide continuous and instant feedback when working on the Rails app. It runs only specs from _lines_ modified in the recent git commits. Even if you have a large `spec/user_spec.rb` file, you'll receive specs feedback in ~second on each file save.
3
+ Devloop is an automated Rspec runner for Rails apps inspired by [TLDR](https://github.com/tendersearls/tldr) and Rust ([full story](https://pawelurbanek.com/rust-ruby-workflow)). The purpose of this tool is to provide continuous and instant feedback when working on the Rails app. It runs only specs from _lines_ modified in the recent git commits. Even if you have a large `spec/user_spec.rb` file, you'll receive specs feedback in ~second on each file save.
4
4
 
5
5
  Optionally, you can edit first line of any spec file (i.e. add `#`) to run all the tests from it.
6
6
 
7
7
  ## Installation
8
8
 
9
- It uses [fswatch](https://github.com/emcrisostomo/fswatch) so make sure to install it first:
10
-
11
- ```bash
12
- brew install fswatch
13
- ```
14
-
15
9
  In your `Gemfile`:
16
10
 
17
11
  ```ruby
@@ -31,9 +25,11 @@ gem install devloop
31
25
  devloop
32
26
  ```
33
27
 
28
+ Remember to run the `devloop` command from the root of your Rails application.
29
+
34
30
  ## Usage
35
31
 
36
- While `devloop` command is running it will automatically execute tests related to the recently modified lines of code from `spec/` folder.
32
+ While `devloop` process is running it will automatically execute tests related to the recently modified lines of code from `spec/` folder.
37
33
 
38
34
  Devloop will automatically detect if [Spring](https://github.com/rails/spring) is enabled for your Rails app. I've observed it reduces time needed to run specs by ~4x.
39
35
 
data/bin/devloop CHANGED
@@ -3,6 +3,7 @@
3
3
  $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib") unless $LOAD_PATH.include?(File.dirname(__FILE__) + "/../lib")
4
4
 
5
5
  require "devloop"
6
+ require "listen"
6
7
 
7
8
  begin
8
9
  system("bundle exec spring > /dev/null 2>&1")
@@ -10,7 +11,11 @@ begin
10
11
  run_command = is_bundled ? "bundle exec devloop_run" : "devloop_run"
11
12
  system(run_command)
12
13
  puts "Devloop: watching for changes in spec directory..."
13
- system("fswatch -e '.*' -i '\.rb$' #{Dir.pwd} | xargs -n1 -I{} #{run_command}")
14
+ listener = Listen.to(".", only: %r{.rb$}) do
15
+ system(run_command)
16
+ end
17
+ listener.start
18
+ sleep
14
19
  rescue Interrupt # user pressed CTRL+C
15
20
  STDERR.puts "\nDevloop: exiting due to user request"
16
21
  exit 130
data/bin/devloop_run CHANGED
@@ -10,7 +10,7 @@ rescue LoadError
10
10
  end
11
11
 
12
12
  begin
13
- diff = `git diff -U0 spec/`
13
+ diff = `git diff HEAD -U0 spec/`
14
14
  if diff == ""
15
15
  diff = `git diff HEAD~1 -U0 spec/`
16
16
  end
data/devloop.gemspec CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ["lib"]
17
17
  s.executables = ["devloop", "devloop_run"]
18
18
  s.license = "MIT"
19
+ s.add_dependency "listen"
19
20
  s.add_development_dependency "rake"
20
21
  s.add_development_dependency "rspec"
21
22
  s.add_development_dependency "rufo"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Devloop
4
- VERSION = "0.0.9"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devloop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-13 00:00:00.000000000 Z
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: listen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement