devloop 0.0.2 → 0.0.3
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/README.md +27 -1
- data/lib/devloop/diff_parser.rb +4 -4
- data/lib/devloop/version.rb +1 -1
- data/spec/diff_parser_spec.rb +20 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd315f90c485333f7c0f4386b15c08920865b3e42906c8cc60bd081c7c466299
|
4
|
+
data.tar.gz: 8561edca5696f4b1cccb46353717987b093b0820780e801be773196f39f4c0a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6ff478bdb188648ee16f025aada1d5381a373b9ab7095456fea0d2c66d14f53f617581017ba58504607c584b706ee74e68a7c61bfe2bf368e885c8ec27696b1
|
7
|
+
data.tar.gz: 8bde33a6fa0a8b140441f4c5a839948e89d708163ffb30e755cd97f15f4a1252de8cedee8948e6f3cf2c5bf7d3eca6d989eb950918061747976961a6f428f2d8
|
data/README.md
CHANGED
@@ -1 +1,27 @@
|
|
1
|
-
# Devloop
|
1
|
+
# Devloop
|
2
|
+
|
3
|
+
Devloop is an automated Rspec runner for Rails app inspired by [TLDR](https://github.com/tendersearls/tldr). The purpose of this tool is to provide continous and instant feedback when working on Rails app. It run only specs from _lines_ modified in the recent git commits. It means that even if you have a large `spec/user_spec.rb` file, you'll receive specs feedback in fraction on a second on every file save.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
It uses [fswatch](https://github.com/emcrisostomo/fswatch) so make sure to install it first:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
brew install fswatch
|
11
|
+
```
|
12
|
+
|
13
|
+
In your `Gemfile`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem "devloop", group: :development
|
17
|
+
```
|
18
|
+
|
19
|
+
Now you can run:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
bundle exec devloop
|
23
|
+
```
|
24
|
+
|
25
|
+
While this command it running it will automatically execute tests related to the recenly modified lines of code from `specs/` folder.
|
26
|
+
|
27
|
+
This is in a very early stage of development so feedback is welcome.
|
data/lib/devloop/diff_parser.rb
CHANGED
@@ -7,13 +7,13 @@ module Devloop
|
|
7
7
|
def call(diff)
|
8
8
|
lines = diff.split("\n")
|
9
9
|
results = []
|
10
|
+
file = ""
|
10
11
|
lines.each_with_index do |line, index|
|
11
12
|
if line.start_with?("+++ b/")
|
12
13
|
file = line[6..-1]
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
14
|
+
elsif line.start_with?("@@ -")
|
15
|
+
line_number = line.match(/@@ -(\d+)/)[1]
|
16
|
+
results << "#{file}:#{line_number}"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
results
|
data/lib/devloop/version.rb
CHANGED
data/spec/diff_parser_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require "spec_helper"
|
|
4
4
|
require "devloop/diff_parser"
|
5
5
|
|
6
6
|
describe Devloop::DiffParser do
|
7
|
-
let(:
|
7
|
+
let(:diff1) do
|
8
8
|
<<~DIFF
|
9
9
|
diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb
|
10
10
|
index 19772f2a..a32824f9 100644
|
@@ -25,7 +25,25 @@ describe Devloop::DiffParser do
|
|
25
25
|
DIFF
|
26
26
|
end
|
27
27
|
|
28
|
+
let(:diff2) do
|
29
|
+
<<~DIFF
|
30
|
+
diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb
|
31
|
+
index 19772f2a..9f614e20 100644
|
32
|
+
--- a/spec/models/team_spec.rb
|
33
|
+
+++ b/spec/models/team_spec.rb
|
34
|
+
@@ -19 +19 @@ describe Team do
|
35
|
+
- it "has_many emojis" do
|
36
|
+
+ it "has_many eojis" do
|
37
|
+
@@ -24,2 +24,2 @@ describe Team do
|
38
|
+
- describe "normalize attributes" do
|
39
|
+
- it "does not allow empty string values" do
|
40
|
+
+ describe "normalize attrbtes" do
|
41
|
+
+ it "does not allw empty sting values" do
|
42
|
+
DIFF
|
43
|
+
end
|
44
|
+
|
28
45
|
it "parses the diff correctly" do
|
29
|
-
expect(Devloop::DiffParser.call(
|
46
|
+
expect(Devloop::DiffParser.call(diff1)).to eq(["spec/models/team_spec.rb:10", "spec/models/user_spec.rb:167"])
|
47
|
+
expect(Devloop::DiffParser.call(diff2)).to eq(["spec/models/team_spec.rb:19", "spec/models/team_spec.rb:24"])
|
30
48
|
end
|
31
49
|
end
|