sfb_scripts 1.3 → 1.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
  SHA1:
3
- metadata.gz: 8eb3ebf4ec08d6ef316ac9d4f462bd320ee622ba
4
- data.tar.gz: da810b2ea163102795299dea7cdf810079923944
3
+ metadata.gz: aab86c1ecf4b9c1691a7a4e686c823c10f9b6c36
4
+ data.tar.gz: b8ad1717e0cc3bbe363db504efb78e655c870d43
5
5
  SHA512:
6
- metadata.gz: 9269cf51001f79af60f8ab56f3de331e41f58b5d10bcd695e8c605633182d67ac6802376b251d091d8ce5e561c9d706fb73b2dfdb0cc4902a6ab19a152ec6f5e
7
- data.tar.gz: 1ae10878537a2e86ee3f9c9b39d42826751a6e48159790d1e829e98a75223f7283d71779c24cb2c5b0855406640674154a718e97c32eb736c0fc2cb3393e79cd
6
+ metadata.gz: 1765662a968df5a669370bf54287973a8b7726e921e6f1cd809b750387edc3ef39c904f5f5fdc9b8f0bed37e13c95acf87de5e28fb71de23ef27784a81626012
7
+ data.tar.gz: 09179f2e6c970043af511743ec2a6ca46793850dc1fb7acb092bcdd251351bb4d3d52e02501d04bfe6f1e5b9dfb4d724765da1392d0ad9828bce06765d34a04f
@@ -4,6 +4,7 @@ require 'work_queue'
4
4
  require_relative 'monkey_patches/string_extension'
5
5
  require_relative 'bundler/bundle_manager'
6
6
  require_relative 'hooks/pre_push_hook'
7
+ require_relative 'hook_manager'
7
8
  require_relative 'migrations/migrator'
8
9
  require_relative 'repositories/repo'
9
10
  require_relative 'repositories/active_repo'
@@ -17,4 +18,5 @@ require_relative 'test_running/test_collection'
17
18
  require_relative 'test_running/status_test_runner'
18
19
  require_relative 'test_running/test_runner'
19
20
  require_relative 'test_running/test_finder'
21
+ require_relative 'test_running/test_filter'
20
22
  require_relative 'folder_guard'
@@ -2,7 +2,7 @@ require_relative 'dependency_loader'
2
2
 
3
3
  class NeedsManager
4
4
 
5
- BUNDLER_MAX_THREAD_COUNT = 2
5
+ BUNDLER_MAX_THREAD_COUNT = 4
6
6
  MIGRATOR_MAX_THREAD_COUNT = 8
7
7
 
8
8
  def self.configure(task, needs, options)
@@ -66,4 +66,5 @@ class Repo
66
66
  shell.run "git rev-parse HEAD"
67
67
  end
68
68
 
69
+
69
70
  end
@@ -37,11 +37,11 @@ class StatusChecker
37
37
  private
38
38
 
39
39
  def test_files
40
- file_names.select {|f| f.match(/_test$/) }
40
+ TestFilter.select_tests(file_names)
41
41
  end
42
42
 
43
43
  def non_test_files
44
- file_names.reject {|f| f.match(/_test$/) }
44
+ TestFilter.reject_tests(file_names)
45
45
  end
46
46
 
47
47
  def file_names
@@ -4,35 +4,38 @@ class StatusTestRunner
4
4
  new(env, ignore_selenium).status
5
5
  end
6
6
 
7
- attr_reader :repo, :shell, :test_runner, :tests, :ignore_selenium
7
+ attr_reader :repo, :shell, :test_runner, :status_tests, :ignore_selenium
8
8
  def initialize(env, ignore_selenium)
9
9
  @repo = env[:repo]
10
10
  @shell = env[:shell]
11
11
  @test_runner = env[:test_runner]
12
12
  @ignore_selenium = ignore_selenium
13
+ @status_tests = get_status_tests
13
14
  end
14
15
 
15
16
  def status
16
- files = repo.status_files.map {|f| {:file => f} }
17
- @tests = TestCollection.new(files)
18
-
19
- if tests.include_selenium?
17
+ if status_tests.include_selenium?
20
18
  handle_selenium
21
19
  end
22
20
 
23
- if tests.empty?
21
+ if status_tests.empty?
24
22
  shell.notify 'No tests to run'
25
23
  exit
26
24
  end
27
25
 
28
- test_runner.run_files(tests)
26
+ test_runner.run_files(status_tests)
29
27
  end
30
28
 
31
29
  private
32
30
 
33
31
  def handle_selenium
34
32
  if ignore_selenium || shell.deny?("The status includes some selenium files. Do you wish to run those?")
35
- tests.remove_selenium!
33
+ status_tests.remove_selenium!
36
34
  end
37
35
  end
36
+
37
+ def get_status_tests
38
+ files = TestFilter.select_tests(repo.status_files)
39
+ TestCollection.new(files)
40
+ end
38
41
  end
@@ -6,6 +6,7 @@ class TestCollection
6
6
 
7
7
  def initialize(tests_data=[])
8
8
  @tests = tests_data.map do |test_data|
9
+ test_data = {file: test_data} if test_data.is_a?(String)
9
10
  TestCase.new(
10
11
  full_path: test_data[:file],
11
12
  line: test_data[:line]
@@ -0,0 +1,15 @@
1
+ class TestFilter
2
+ def self.select_tests(files)
3
+ filter(action: :select, files: files)
4
+ end
5
+
6
+ def self.reject_tests(files)
7
+ filter(action: :reject, files: files)
8
+ end
9
+
10
+ private
11
+
12
+ def self.filter(action:, files:)
13
+ files.send(action) {|f| f.match(/_test(\.rb)?$/) }
14
+ end
15
+ end
@@ -54,9 +54,7 @@ class TestFinder
54
54
  def tests_found_by_file_name
55
55
  @tests_found_by_file_name ||=
56
56
  begin
57
- files = []
58
- files << repo.find_files(query).select {|f| f.match /_test\.rb\Z/ }.map {|f| {:file => f} }
59
- files.flatten!
57
+ files = TestFilter.select_tests(repo.find_files(query))
60
58
  TestCollection.new(files)
61
59
  end
62
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfb_scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Kinnecom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-08 00:00:00.000000000 Z
11
+ date: 2014-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -78,6 +78,7 @@ files:
78
78
  - lib/sfb_scripts/test_running/status_test_runner.rb
79
79
  - lib/sfb_scripts/test_running/test_case.rb
80
80
  - lib/sfb_scripts/test_running/test_collection.rb
81
+ - lib/sfb_scripts/test_running/test_filter.rb
81
82
  - lib/sfb_scripts/test_running/test_finder.rb
82
83
  - lib/sfb_scripts/test_running/test_runner.rb
83
84
  - lib/sfb_scripts/tester.rb