devloop 0.0.2 → 0.0.4

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: f2dab016e7249d6883987e3d5cebb59e0d08e644884ee3c54320e44ac84cee8d
4
- data.tar.gz: 4cd78a1c396874542cf1c0790c2b94c3366a5355f26cf206806a1bfb28c06522
3
+ metadata.gz: 91e4157cebedf7e64ae0993c9a71d455bbf9985e8a275eb88316693eb487d662
4
+ data.tar.gz: db2865a758fb9a3c5a00d93475bd38943c2f7e49c08368807e41dbb89505c8df
5
5
  SHA512:
6
- metadata.gz: b8f7cee13c1094e4d7214083f102e2274d279211fe8956784fa847406f19387a734ef0357cb1b7db2052e60d5e7fcbb5dc60f56e24ad93d37baf4d32760b650e
7
- data.tar.gz: 839f53f6b4f803454b7722c70b827aa3f5abf73a7c5763231f442d590741d29364b7d95ce7bf07e8abdc6082465e0d57616572590e382208e24b9952991d7389
6
+ metadata.gz: f2ac525fddd4e4ca4e2dc1603393ba478ad99af47557824aacf6d4158b93b57c641f83c093d661fe923ef4cea75955cd581005b03f24bf195ed1b8df8f943a56
7
+ data.tar.gz: 2139a8f57bfd94e98d4a6ec179b8757d2d67f0d87fdff787f060a337be6a682973973377b8c3f4f3fa33beb7e761c87626b585ee6dc4562b1519de2bd5d31668
data/README.md CHANGED
@@ -1 +1,31 @@
1
- # Devloop [WIP]
1
+ # Devloop
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 a fraction of a second on each 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 recently modified lines of code from `specs/` folder.
26
+
27
+ 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.
28
+
29
+ If currently there are no modified spec files, devloop will run tests based on changes in the most recent git commit.
30
+
31
+ This is in a very early stage of development so feedback is welcome.
data/devloop.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.version = Devloop::VERSION
9
9
  s.authors = ["pawurb"]
10
10
  s.email = ["contact@pawelurbanek.com"]
11
- s.summary = %q{ Ruby test runner }
12
- s.description = %q{ This simple tool allows to run apps tests based on current git diff output. }
11
+ s.summary = "An automated test runner for Rails applications. Execute specs instantly based on a recent git diff output."
12
+ s.description = "Devloop is an automated Rspec runner for Rails app. The purpose of this tool is to provide continuous and instant feedback when working on Rails app. It runs only specs from lines modified in the recent git commits. Even if you have a large user_spec.rb file, you'll receive specs feedback in a fraction of a second on each file save."
13
13
  s.homepage = "https://github.com/pawurb/devloop"
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = s.files.grep(%r{^(spec)/})
@@ -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
- if lines[index + 1] && lines[index + 1].start_with?("@@ -")
14
- line_number = lines[index + 1].split(" ")[1].split(",")[0][1..-1]
15
- results << "#{file}:#{line_number}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Devloop
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.4"
5
5
  end
@@ -4,7 +4,7 @@ require "spec_helper"
4
4
  require "devloop/diff_parser"
5
5
 
6
6
  describe Devloop::DiffParser do
7
- let(:diff) do
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(diff)).to eq(["spec/models/team_spec.rb:10", "spec/models/user_spec.rb:167"])
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devloop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
@@ -52,8 +52,11 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: " This simple tool allows to run apps tests based on current git diff
56
- output. "
55
+ description: Devloop is an automated Rspec runner for Rails app. The purpose of this
56
+ tool is to provide continuous and instant feedback when working on Rails app. It
57
+ runs only specs from lines modified in the recent git commits. Even if you have
58
+ a large user_spec.rb file, you'll receive specs feedback in a fraction of a second
59
+ on each file save.
57
60
  email:
58
61
  - contact@pawelurbanek.com
59
62
  executables:
@@ -98,7 +101,8 @@ requirements: []
98
101
  rubygems_version: 3.5.4
99
102
  signing_key:
100
103
  specification_version: 4
101
- summary: Ruby test runner
104
+ summary: An automated test runner for Rails applications. Execute specs instantly
105
+ based on a recent git diff output.
102
106
  test_files:
103
107
  - spec/diff_parser_spec.rb
104
108
  - spec/spec_helper.rb