starting_blocks 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
data/bin/sb CHANGED
@@ -12,11 +12,13 @@ if ARGV.include? '--verbose'
12
12
  end
13
13
 
14
14
  def run_all_specs options
15
- specs = Dir['**/*_spec.rb*'].
16
- select { |f| File.file?(f) }.
17
- map { |x| File.expand_path(x) }
15
+ files = ['**/*_spec.rb*', '**/*_test.rb*', '**/test_*.rb*'].map do |d|
16
+ Dir[d].
17
+ select { |f| File.file?(f) }.
18
+ map { |x| File.expand_path(x) }
19
+ end.flatten
18
20
 
19
- StartingBlocks::Runner.new(options).run_files specs
21
+ StartingBlocks::Runner.new(options).run_files files
20
22
  end
21
23
 
22
24
  if ARGV.include? '--watch'
@@ -1,5 +1,19 @@
1
1
  require 'blinky'
2
2
 
3
+ # fix issue where no light will cause lock-up
4
+ module Blinky
5
+ class LightFactory
6
+ class << self
7
+ alias :original_detect_lights :detect_lights
8
+ def detect_lights plugins, recipes
9
+ original_detect_lights plugins, recipes
10
+ rescue
11
+ []
12
+ end
13
+ end
14
+ end
15
+ end
16
+
3
17
  module StartingBlocks
4
18
  module Extensions
5
19
  class GreenOnSuccessRedOnFailure
@@ -1,3 +1,3 @@
1
1
  module StartingBlocks
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
@@ -3,6 +3,8 @@ require 'listen'
3
3
  module StartingBlocks
4
4
  module Watcher
5
5
 
6
+ TEST_FILE_CLUES = ["_test", "test_", "_spec"]
7
+
6
8
  include Displayable
7
9
 
8
10
  class << self
@@ -44,10 +46,20 @@ module StartingBlocks
44
46
  private
45
47
 
46
48
  def get_the_specs_to_run(file_that_changed, all_files)
47
- filename = file_that_changed.downcase.split('/')[-1].gsub('_spec', '')
48
- matches = all_files.select { |x| x.gsub('_spec.rb', '.rb').include?(filename) && x != file_that_changed }
49
+ filename = flush_file_name file_that_changed
50
+ matches = all_files.select { |x| flush_file_name(x).include?(filename) && x != file_that_changed }
49
51
  matches << file_that_changed
50
- specs = matches.select { |x| x.include?('_spec') && File.file?(x) }.map { |x| File.expand_path x }
52
+ specs = matches.select { |x| is_a_test_file?(x) && File.file?(x) }.map { |x| File.expand_path x }
53
+ end
54
+
55
+ def is_a_test_file?(file)
56
+ matches = TEST_FILE_CLUES.select { |clue| file.to_s.include?(clue) }
57
+ matches.count > 0
58
+ end
59
+
60
+ def flush_file_name(file)
61
+ the_file = file.downcase.split('/')[-1]
62
+ TEST_FILE_CLUES.reduce(the_file) { |t, i| t.gsub(i, '') }
51
63
  end
52
64
  end
53
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starting_blocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-30 00:00:00.000000000 Z
12
+ date: 2013-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  segments:
166
166
  - 0
167
- hash: 3807703528302681949
167
+ hash: 1338765525331935684
168
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  segments:
175
175
  - 0
176
- hash: 3807703528302681949
176
+ hash: 1338765525331935684
177
177
  requirements: []
178
178
  rubyforge_project:
179
179
  rubygems_version: 1.8.24