suspect 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: cf501a625399385a8be77bcc75418165958be083
4
- data.tar.gz: 74d38bb2d72da37efcdc8ec72252fc12533d50fa
3
+ metadata.gz: 7d8a6b1f3701ec7526b3219eebb0f1f9f2a57531
4
+ data.tar.gz: d1a2a1b0dd181e1633491334164500afd981c3ca
5
5
  SHA512:
6
- metadata.gz: d6ec146b0c9ecd46a48dd913cd6c898d6637643e5ef97b6e36fc91f7b23e82fd69cf5838231e2f38241dfb3a1218fd1f1e65448a3f24795bf32794d17c01acfb
7
- data.tar.gz: f23a292ec133372e10806bac49bac4df157d9b577b4f22f4fa13870fe469fd7b37bdb186d882445df20808349228b448e22c5319d426b008f2f2bda84a4af524
6
+ metadata.gz: f4ccc697e535a6c0e69e442b3f6b1e8c4328b7d967d47245d0ff8943924bffe8a0ecb3f0bc89fc92ab86bf98eddd06d4e4f725621b3d7a0e1af7f6f25660beae
7
+ data.tar.gz: a9d9b18a3d1f9e87434289f809688004b3f0c2f29ab0657a4011b00ec8d4af0e9499cf0ce4132f9fc204767bec7a753bb376a610c6da224dd11826599fdf6806
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
+ [![Build Status](https://travis-ci.org/MitinPavel/suspect.svg?branch=master)](https://travis-ci.org/MitinPavel/suspect)
2
+
1
3
  # Suspect
2
4
 
3
- If you have **slow tests**, you need a troubleshooting strategy. It takes a lot of effort to get rid of this smell. In meantime it is good to have a palliative. `Suspect` provides such a band-aid. The gem collects test results along with VCS (Git) status and use harvested data to select a subset of test files to be run.
5
+ If you have **slow tests**, you need a troubleshooting strategy. It takes a lot of effort to get rid of this smell. In meantime it is good to have a palliative. `Suspect` provides such a band-aid. The gem collects test results along with VCS (Git) status and uses harvested data to select a subset of test files to be run.
4
6
 
5
7
  ## Tags
6
8
 
@@ -69,7 +71,7 @@ end
69
71
 
70
72
  As soon as the gem is added to Gemfile and `Suspect::RSpecListener.setup_using config` is invoked in `spec/spec_helper.rb`, the gathering part is up and running. Each time you run specs, results are stored for further usage. Harvested data is stored under `suspect/` folder in *.suspect files. Adding *.suspect files under source control allows data sharing between project members.
71
73
 
72
- ## Prediction
74
+ ### Prediction
73
75
 
74
76
  `Suspect::Prediction::Default.paths` returns a list of spec files which are more likely to fall. The installation section above contains a simple rake task for the prediction phase. Fill free to modify the task to better meet your requirements.
75
77
 
@@ -27,19 +27,38 @@ module Suspect
27
27
  end
28
28
 
29
29
  def register_listener(reporter)
30
+ return unless supported_platform?
31
+
32
+ structure = build_structure
33
+ listener = build_listener(structure)
34
+
35
+ reporter.register_listener listener, *listener.notification_names
36
+ end
37
+
38
+ private
39
+
40
+ def build_structure
30
41
  root_path = ::Pathname.new('.')
31
42
  file_helper = ::Suspect::FileUtils::Idempotent.new
32
43
  structure = ::Suspect::Setup::Structure.new(root_path)
33
44
  collector_id_generator = ::Suspect::Setup::CollectorIdGenerator.new
34
45
  ::Suspect::Setup::Creator.new(structure, collector_id_generator, file_helper).build
35
46
 
47
+ structure
48
+ end
49
+
50
+ def build_listener(structure)
36
51
  storage_path = ::Suspect::Storage::DirPath.new(structure.storage_path, Time.now.utc)
52
+ file_helper = ::Suspect::FileUtils::Idempotent.new
37
53
  collector_id = file_helper.read(structure.collector_id_path)
38
54
  storage = ::Suspect::Storage::Appender.new(dir_path: storage_path, dir_helper: file_helper, collector_id: collector_id)
39
55
  file_tree = ::Suspect::FileTree::Git::Snapshot.new
40
- listener = ::Suspect::Gathering::RSpec::Listener.new(file_tree, storage, collector_id, ::Time.now.utc)
41
56
 
42
- reporter.register_listener listener, *listener.notification_names
57
+ ::Suspect::Gathering::RSpec::Listener.new(file_tree, storage, collector_id, ::Time.now.utc)
58
+ end
59
+
60
+ def supported_platform?
61
+ ::Gem::Platform.local.os == 'linux'
43
62
  end
44
63
  end
45
64
  end
@@ -1,3 +1,3 @@
1
1
  module Suspect
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suspect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavlo Mitin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-08 00:00:00.000000000 Z
11
+ date: 2017-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler