devloop 0.0.5 → 0.0.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/bin/devloop +1 -0
- data/lib/devloop/diff_parser.rb +19 -6
- data/lib/devloop/version.rb +1 -1
- data/spec/diff_parser_spec.rb +65 -38
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 329272a8c3033e7d6d4cb63d2ca284b87f8d4883e64fc613ad00e2f2eaf7ca8b
|
4
|
+
data.tar.gz: 3fa337ca6600ffd440c53170ed6d1aa59cdf09207d64738c8248cf3f027e2ab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48664a8ba229cd1730994c47d60f1a1f0fcb7e225f038c6903ae17125f27ae3091b8ef75d75558932b21e6e82ad15e5e3de47fdfc337450b15dacf3b88644a29
|
7
|
+
data.tar.gz: c75e9d90a51e8aa003e0f069490004957241dbc54543fe202058efd82ab943678b094d7ff45f2a1aad44fd31240f9d7c656b8b7e08a8fa9f2f4432f37596ae21
|
data/bin/devloop
CHANGED
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib") unless $LOAD_PATH.include
|
|
5
5
|
require "devloop"
|
6
6
|
|
7
7
|
begin
|
8
|
+
system("bundle exec spring > /dev/null 2>&1")
|
8
9
|
system("bundle exec devloop_run")
|
9
10
|
puts "Devloop: watching for changes in spec directory..."
|
10
11
|
system("fswatch -e '.*' -i '\.rb$' #{Dir.pwd} | xargs -n1 -I{} bundle exec devloop_run")
|
data/lib/devloop/diff_parser.rb
CHANGED
@@ -5,18 +5,31 @@ module Devloop
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def call(diff)
|
8
|
-
|
9
|
-
results = []
|
10
|
-
file = ""
|
11
|
-
lines.each_with_index do |line, index|
|
8
|
+
_, results = diff.split("\n").reduce(["", []]) do |(file, results), line|
|
12
9
|
if line.start_with?("+++ b/")
|
13
|
-
|
10
|
+
[line[6..-1], results]
|
14
11
|
elsif line.start_with?("@@ -")
|
15
12
|
line_number = line.match(/@@ -(\d+)/)[1]
|
16
|
-
results << "#{file}:#{line_number}"
|
13
|
+
[file, results << "#{relative_path(file)}:#{line_number}"]
|
14
|
+
else
|
15
|
+
[file, results]
|
17
16
|
end
|
18
17
|
end
|
19
18
|
results
|
20
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def relative_path(path)
|
24
|
+
path.gsub(project_path, "")
|
25
|
+
end
|
26
|
+
|
27
|
+
def project_path
|
28
|
+
@project_path ||= Dir.pwd.gsub("#{git_root_path}/", "") + "/"
|
29
|
+
end
|
30
|
+
|
31
|
+
def git_root_path
|
32
|
+
@git_root_path ||= `git rev-parse --show-toplevel`.strip
|
33
|
+
end
|
21
34
|
end
|
22
35
|
end
|
data/lib/devloop/version.rb
CHANGED
data/spec/diff_parser_spec.rb
CHANGED
@@ -4,46 +4,73 @@ require "spec_helper"
|
|
4
4
|
require "devloop/diff_parser"
|
5
5
|
|
6
6
|
describe Devloop::DiffParser do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
7
|
+
context "when the project root is the same as git root" do
|
8
|
+
let(:diff1) do
|
9
|
+
<<~DIFF
|
10
|
+
diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb
|
11
|
+
index 19772f2a..a32824f9 100644
|
12
|
+
--- a/spec/models/team_spec.rb
|
13
|
+
+++ b/spec/models/team_spec.rb
|
14
|
+
@@ -10,2 +10,2 @@ describe Team do
|
15
|
+
- it "has a valid factory" do
|
16
|
+
- expect(team).to be_valid
|
17
|
+
+ it "has valid factory" do
|
18
|
+
+ expect(team).not_to be_valid
|
19
|
+
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
|
20
|
+
index 410ffa8c..610d9e19 100644
|
21
|
+
--- a/spec/models/user_spec.rb
|
22
|
+
+++ b/spec/models/user_spec.rb
|
23
|
+
@@ -167 +167 @@ describe User do
|
24
|
+
- web_auth_token_generated_at: 50.minutes.ago,
|
25
|
+
+ web_auth_token_generated_at: 10.minutes.ago,
|
26
|
+
DIFF
|
27
|
+
end
|
28
|
+
|
29
|
+
let(:diff2) do
|
30
|
+
<<~DIFF
|
31
|
+
diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb
|
32
|
+
index 19772f2a..9f614e20 100644
|
33
|
+
--- a/spec/models/team_spec.rb
|
34
|
+
+++ b/spec/models/team_spec.rb
|
35
|
+
@@ -19 +19 @@ describe Team do
|
36
|
+
- it "has_many emojis" do
|
37
|
+
+ it "has_many eojis" do
|
38
|
+
@@ -24,2 +24,2 @@ describe Team do
|
39
|
+
- describe "normalize attributes" do
|
40
|
+
- it "does not allow empty string values" do
|
41
|
+
+ describe "normalize attrbtes" do
|
42
|
+
+ it "does not allw empty sting values" do
|
43
|
+
DIFF
|
44
|
+
end
|
27
45
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
46
|
+
it "parses the diff correctly" do
|
47
|
+
expect(Devloop::DiffParser.call(diff1)).to eq(["spec/models/team_spec.rb:10", "spec/models/user_spec.rb:167"])
|
48
|
+
expect(Devloop::DiffParser.call(diff2)).to eq(["spec/models/team_spec.rb:19", "spec/models/team_spec.rb:24"])
|
49
|
+
end
|
43
50
|
end
|
44
51
|
|
45
|
-
|
46
|
-
|
47
|
-
|
52
|
+
context "when the project root is different from the git root" do
|
53
|
+
let(:diff) do
|
54
|
+
<<~DIFF
|
55
|
+
diff --git a/src/spec/models/team_spec.rb b/src/spec/models/team_spec.rb
|
56
|
+
index 19772f2a..9f614e20 100644
|
57
|
+
--- a/src/spec/models/team_spec.rb
|
58
|
+
+++ b/src/spec/models/team_spec.rb
|
59
|
+
@@ -19 +19 @@ describe Team do
|
60
|
+
- it "has_many emojis" do
|
61
|
+
+ it "has_many eojis" do
|
62
|
+
@@ -24,2 +24,2 @@ describe Team do
|
63
|
+
- describe "normalize attributes" do
|
64
|
+
- it "does not allow empty string values" do
|
65
|
+
+ describe "normalize attrbtes" do
|
66
|
+
+ it "does not allw empty sting values" do
|
67
|
+
DIFF
|
68
|
+
end
|
69
|
+
|
70
|
+
it "parses the diff correctly" do
|
71
|
+
allow_any_instance_of(Devloop::DiffParser).to receive(:git_root_path).and_return("/Users/username/projects/")
|
72
|
+
allow_any_instance_of(Devloop::DiffParser).to receive(:project_path).and_return("src/")
|
73
|
+
expect(Devloop::DiffParser.call(diff)).to eq(["spec/models/team_spec.rb:19", "spec/models/team_spec.rb:24"])
|
74
|
+
end
|
48
75
|
end
|
49
76
|
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.0.
|
4
|
+
version: 0.0.7
|
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-
|
11
|
+
date: 2024-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|