devloop 0.1.0 → 0.1.2

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: f7d144786989a541134bfda50fe5496b59eb776342e114f6c9c772b630661cc5
4
- data.tar.gz: 2dc23915955ac14ed782ba5efa8240a48a3a5671ce163ef9b58083a2670ae3a2
3
+ metadata.gz: 1aacef492d0bf184908275bc5df40ba6915cf3a1215edc39fb41374fa18574e0
4
+ data.tar.gz: aa92fd7489fcd1fbefaf1ad01e7fddcf9b39b8ab9ba9d9964794ba15cba15559
5
5
  SHA512:
6
- metadata.gz: ad7432cfb77b79e4321705e7fc5ba2cb6df2bd02b87bbbbb34465e73dbe20160890b08367a4c9e14f7177040b1a6c81fd04000c5743419f172d76b569e262fc9
7
- data.tar.gz: a17b35a3eff615cef9398f5dfabf59256080e47b7fb82a15a809d5f4848dd20596631dbccf1049575e7f485da99ed8d2b54f5e14e38b03ff48a816d14014e4ad
6
+ metadata.gz: a26d307a8957fba390304bdcacbb6e3b2b23c4f86bb3fcbbc9b3a2fc0e14b69a16836cf7f4cb9e6b68efcc24a775113bdc5b64b639c0da3921ab9f2a835f006e
7
+ data.tar.gz: 4444e6eede7525a922044f6c2f7c7d1363b5d9490d94dce08499b52d2021338d04acdb1a95eaf3dfc43fed50edfd2a800a006a3b4d8701dcb152c1caa9e958dc
data/README.md CHANGED
@@ -1,6 +1,6 @@
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
 
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
@@ -21,7 +21,13 @@ module Devloop
21
21
  end.uniq
22
22
 
23
23
  # Remove filenames with line number if filename without line number is present
24
- results.reject { |result| results.include?(result.split(":").first) && result.include?(":") }
24
+ res = results.reject { |result| results.include?(result.split(":").first) && result.include?(":") }.map do |el|
25
+ if el.split(":").last == "0"
26
+ el.split(":").first
27
+ else
28
+ el
29
+ end
30
+ end
25
31
  end
26
32
 
27
33
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Devloop
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -96,4 +96,53 @@ describe Devloop::DiffParser do
96
96
  expect(Devloop::DiffParser.call(diff)).to eq(["spec/models/team_spec.rb:19", "spec/models/team_spec.rb:24"])
97
97
  end
98
98
  end
99
+
100
+ context "removes 0 line numbers" do
101
+ let(:diff) do
102
+ <<~DIFF
103
+ diff --git a/spec/config_spec.rb b/spec/config_spec.rb
104
+ index d9716e7..b470ec2 100644
105
+ --- a/spec/config_spec.rb
106
+ +++ b/spec/config_spec.rb
107
+ @@ -5 +5 @@ require "spec_helper"
108
+ -describe "PgLocksMonitor::Confiuration" do
109
+ +describe "PgLocksMonitor::Configuration" do
110
+ @@ -8,2 +8,5 @@ describe "PgLocksMonitor::Confiuration" do
111
+ - expect(config.notify_locks).to eq true
112
+ - expect(config.notify_blocking).to eq true
113
+ + expect(config.monitor_locks).to eq true
114
+ + expect(config.monitor_blocking).to eq true
115
+ + expect(config.locks_min_duration_ms).to eq 200
116
+ + expect(config.blocking_min_duration_ms).to eq 100
117
+ + expect(config.notifier_class).to eq PgLocksMonitor::DefaultNotifier
118
+ @@ -14 +17 @@ describe "PgLocksMonitor::Confiuration" do
119
+ - config.notify_locks = false
120
+ + config.monitor_locks = false
121
+ @@ -17 +20 @@ describe "PgLocksMonitor::Confiuration" do
122
+ - expect(PgLocksMonitor.configuration.notify_locks).to eq false
123
+ + expect(PgLocksMonitor.configuration.monitor_locks).to eq false
124
+ diff --git a/spec/default_notifier_spec.rb b/spec/default_notifier_spec.rb
125
+ new file mode 100644
126
+ index 0000000..d99d3a1
127
+ --- /dev/null
128
+ +++ b/spec/default_notifier_spec.rb
129
+ @@ -0,0 +1,11 @@
130
+ +# frozen_string_literal: true
131
+ +
132
+ +require "spec_helper"
133
+ +
134
+ +describe PgLocksMonitor::DefaultNotifier do
135
+ + it "requires correct config if Slack notifications enabled" do
136
+ + expect {
137
+ + PgLocksMonitor::DefaultNotifier.call({})
138
+ + }.not_to raise_error
139
+ + end
140
+ +end
141
+ DIFF
142
+ end
143
+
144
+ it "parses the diff correctly" do
145
+ expect(Devloop::DiffParser.call(diff)).to eq(["spec/config_spec.rb:5", "spec/config_spec.rb:8", "spec/config_spec.rb:14", "spec/config_spec.rb:17", "spec/default_notifier_spec.rb"])
146
+ end
147
+ end
99
148
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devloop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
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-14 00:00:00.000000000 Z
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen