rspec_runner 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd87f40735837abca2d9730eadb0d65aa5d4c791
4
- data.tar.gz: 29cec1c82ff59cf60020c246e9ff08825a16cb48
3
+ metadata.gz: c4227d2023f75f3a91bdae89cebaf00a7b7c9167
4
+ data.tar.gz: a8420e460e923c281cb2d25e55a32b553e8ce143
5
5
  SHA512:
6
- metadata.gz: 353cf8f6f139354e52fb1c368da09f8009975c78824a478018918f1dd64277ace8c0caccf69b65e6e39c9e2b5fcd1e5fd487a0f04407803b62929b14ffbe20b3
7
- data.tar.gz: 754c624c020fb4c40d3daee7fe322c08e688d0e6288b00e6f7ff60cae2e8036708b057b2ac1ef8d0dee4e9c95be60c4edc05caf4e3cf00d945937953c387d8a6
6
+ metadata.gz: 21ffcd34a0c4fd49dd4a12789431b9395e0ff9782ffa46c326d0fbfd686d14cb14f86e937d8659f55dcfbc129cb8bc4a953a9305cd7574a743992f96852e2919
7
+ data.tar.gz: 7f07ff94a4ff38eef5a3f9080b25fee95939fe9718a3a142826b546943bd028cf7b47fcea41b9a13430ac4ed92060b9104149d6d8153189cb57aa63ef17a0028
data/README.md CHANGED
@@ -2,12 +2,15 @@
2
2
 
3
3
  ## Usage
4
4
 
5
- Run monitor:
5
+ ![DEMO](./demo.gif)
6
+
7
+ Run `monitor`:
6
8
 
7
9
  $ bundle exec rspec_runner monitor
8
10
 
9
- It runs `monitor`, which requires all dependencies and shows test results with RSpec.
10
- It also tracks file changes and automatically reloads all dependencies if necessary.
11
+ It runs `monitor`, which preloads dependencies and shows test results with RSpec.
12
+ It also tracks file changes with [listen](https://github.com/guard/listen/) and automatically reloads dependencies if necessary.
13
+ Similar to [spork](https://github.com/sporkrb/spork) it forks a new process but only if files have changed.
11
14
 
12
15
  Run your test:
13
16
 
@@ -27,6 +30,26 @@ And then execute:
27
30
 
28
31
  $ bundle
29
32
 
33
+ ## Configuration
34
+
35
+ To customize RspecRunner you have to add `spec/rspec_runner.rb` file with the following content:
36
+
37
+ ```ruby
38
+ # Default config
39
+
40
+ RspecRunner.configure do |config|
41
+ config.uri_filepath = 'tmp/rspec_runner'
42
+ config.client_timeout = 60 # seconds
43
+
44
+ config.listen_directories = [Dir.pwd]
45
+ config.listen_options = { # https://github.com/guard/listen#options
46
+ only: /\.rb$/,
47
+ ignore: /spec\/.+_spec\.rb$/,
48
+ wait_for_delay: 1
49
+ }
50
+ end
51
+ ```
52
+
30
53
  ## Development
31
54
 
32
55
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests.
@@ -40,7 +63,6 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
40
63
  ## TODO
41
64
 
42
65
  * Try to kill a process without `kill -9`
43
- * Make it configurable
44
66
  * Add tests!
45
67
  * Speedup client
46
68
 
data/demo.gif ADDED
Binary file
@@ -1,13 +1,14 @@
1
1
  module RspecRunner
2
+ CONFIG_FILEPATH = "#{Dir.pwd}/spec/rspec_runner.rb"
3
+
2
4
  class Configuration
3
- attr_accessor :uri_filepath, :client_timeout, :watch_directories, :watch_pattern, :ignore_pattern
5
+ attr_accessor :uri_filepath, :client_timeout, :listen_directories, :listen_options
4
6
 
5
7
  def initialize
6
8
  @uri_filepath = "#{Dir.pwd}/tmp/rspec_runner"
7
9
  @client_timeout = 60 # seconds
8
- @watch_directories = ["#{Dir.pwd}"]
9
- @watch_pattern = /\.rb$/
10
- @ignore_pattern = /spec\/.+_spec\.rb$/
10
+ @listen_directories = [Dir.pwd]
11
+ @listen_options = {only: /\.rb$/, ignore: /spec\/.+_spec\.rb$/, wait_for_delay: 1}
11
12
  end
12
13
  end
13
14
 
@@ -18,4 +19,6 @@ module RspecRunner
18
19
  def self.configure
19
20
  yield(configuration)
20
21
  end
22
+
23
+ eval(File.new(CONFIG_FILEPATH).read) if File.exists?(CONFIG_FILEPATH)
21
24
  end
@@ -1,3 +1,3 @@
1
1
  module RspecRunner
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -10,12 +10,8 @@ module RspecRunner
10
10
  end
11
11
 
12
12
  @thread = Thread.new do
13
- @listener = Listen.to(
14
- *RspecRunner.configuration.watch_directories,
15
- only: RspecRunner.configuration.watch_pattern,
16
- ignore: RspecRunner.configuration.ignore_pattern,
17
- wait_for_delay: 1
18
- ) do |modified, added, removed|
13
+ config = RspecRunner.configuration
14
+ @listener = Listen.to(*config.listen_directories, config.listen_options) do |modified, added, removed|
19
15
  if((modified.size + added.size + removed.size) > 0)
20
16
  block.call(modified: modified, added: added, removed: removed)
21
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - exAspArk
@@ -88,6 +88,7 @@ files:
88
88
  - Rakefile
89
89
  - bin/rspec_runner
90
90
  - bin/setup
91
+ - demo.gif
91
92
  - lib/rspec_runner.rb
92
93
  - lib/rspec_runner/client.rb
93
94
  - lib/rspec_runner/configuration.rb