starting_blocks 0.0.21 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module StartingBlocks
2
- VERSION = "0.0.21"
2
+ VERSION = "0.0.22"
3
3
  end
@@ -11,43 +11,47 @@ module StartingBlocks
11
11
 
12
12
  class << self
13
13
  def start_watching(dir, options)
14
+ set_up_the_runner options
15
+
14
16
  location = dir.getwd
15
- all_files = Dir['**/*']
17
+ @all_files = Dir['**/*']
18
+
16
19
  puts "Listening to: #{location}"
17
20
  Listen.to!(location) do |modified, added, removed|
18
- if modified.count > 0
19
- StartingBlocks::Watcher.run_it modified[0], all_files, options
20
- end
21
- if added.count > 0
22
- StartingBlocks::Watcher.add_it added[0], all_files, options
23
- end
24
- if removed.count > 0
25
- StartingBlocks::Watcher.delete_it removed[0], all_files, options
26
- end
21
+ StartingBlocks::Watcher.add_it(added[0]) if added.count > 0
22
+ StartingBlocks::Watcher.delete_it(removed[0]) if removed.count > 0
23
+ return if @running
24
+ StartingBlocks::Watcher.run_it(modified[0]) if modified.count > 0
27
25
  end
28
26
  end
29
27
 
30
- def add_it(file_that_changed, all_files, options)
28
+ def add_it(file_that_changed)
31
29
  return if file_that_changed.index('.git') == 0
32
30
  display "Adding: #{file_that_changed}"
33
- all_files << file_that_changed
31
+ @all_files << file_that_changed
34
32
  end
35
33
 
36
- def run_it(file_that_changed, all_files, options)
37
- specs = get_the_specs_to_run file_that_changed, all_files
34
+ def run_it(file_that_changed)
35
+ @running = true
36
+ specs = get_the_specs_to_run file_that_changed
38
37
  display "Matches: #{specs.inspect}"
39
- results = StartingBlocks::Runner.new(options).run_files specs
38
+ results = @runner.run_files specs
40
39
  store_the_specs_if_they_failed results, specs
40
+ @running = false
41
41
  end
42
42
 
43
- def delete_it(file_that_changed, all_files, options)
43
+ def delete_it(file_that_changed)
44
44
  return if file_that_changed.index('.git') == 0
45
45
  display "Deleting: #{file_that_changed}"
46
- all_files.delete(file_that_changed)
46
+ @all_files.delete(file_that_changed)
47
47
  end
48
48
 
49
49
  private
50
50
 
51
+ def set_up_the_runner options
52
+ @runner = StartingBlocks::Runner.new(options)
53
+ end
54
+
51
55
  def store_the_specs_if_they_failed results, specs
52
56
  parsed_results = StartingBlocks::Publisher.result_parser.parse(results)
53
57
  if parsed_results[:failures] > 0 || parsed_results[:skips] > 0 || parsed_results[:errors] > 0
@@ -58,9 +62,9 @@ module StartingBlocks
58
62
  rescue
59
63
  end
60
64
 
61
- def get_the_specs_to_run(file_that_changed, all_files)
65
+ def get_the_specs_to_run(file_that_changed)
62
66
  filename = flush_file_name file_that_changed
63
- matches = all_files.select { |x| flush_file_name(x).include?(filename) && x != file_that_changed }
67
+ matches = @all_files.select { |x| flush_file_name(x).include?(filename) && x != file_that_changed }
64
68
  matches << file_that_changed
65
69
 
66
70
  specs = matches.select { |x| is_a_test_file?(x) && File.file?(x) }.map { |x| File.expand_path x }
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "contrast"
24
24
  spec.add_development_dependency "subtle"
25
25
  spec.add_development_dependency "mocha"
26
- spec.add_runtime_dependency 'listen'
26
+ spec.add_runtime_dependency 'listen', ">= 1.0"
27
27
  spec.add_runtime_dependency 'blinky'
28
28
  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.21
4
+ version: 0.0.22
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-05-09 00:00:00.000000000 Z
12
+ date: 2013-05-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: '1.0'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: '1.0'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: blinky
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  segments:
166
166
  - 0
167
- hash: 549270903443390071
167
+ hash: -1399351932341596499
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: 549270903443390071
176
+ hash: -1399351932341596499
177
177
  requirements: []
178
178
  rubyforge_project:
179
179
  rubygems_version: 1.8.24