marcinbunsch-bolt 0.1.4 → 0.1.6

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.
data/bin/bolt CHANGED
@@ -4,33 +4,9 @@ require 'bolt'
4
4
 
5
5
  # Rails support
6
6
  if File.exists?('test/test_helper.rb')
7
- puts '** Rails found, loading environment'
8
- ENV['RAILS_ENV'] = 'test'
9
- require 'test/test_helper.rb'
10
- end
11
-
12
- # This is a hack for Rails Test::Unit to prevent raising errors when a test file is loaded again
13
- module ActiveSupport
14
- module Testing
15
- module Declarative
16
- # test "verify something" do
17
- # ...
18
- # end
19
- def test(name, &block)
20
- test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
21
- defined = instance_method(test_name) rescue false
22
- # raise "#{test_name} is already defined in #{self}" if defined # do not raise this error
23
- if block_given?
24
- define_method(test_name, &block)
25
- else
26
- define_method(test_name) do
27
- flunk "No implementation provided for #{name}"
28
- end
29
- end
30
- end
31
- end
32
- end
7
+ require 'bolt/adapters/rails'
33
8
  end
34
9
 
10
+
35
11
  # start a listener
36
12
  Bolt::Listener.new
@@ -0,0 +1,116 @@
1
+ module Bolt
2
+ module Adapters
3
+ module Rails
4
+ end
5
+ end
6
+ end
7
+
8
+ puts '** Rails found, loading environment'
9
+ ENV['RAILS_ENV'] = 'test'
10
+ require 'test/test_helper.rb'
11
+
12
+ # This is a hack for Rails Test::Unit to prevent raising errors when a test file is loaded again
13
+ module ActiveSupport
14
+ module Testing
15
+ module Declarative
16
+ # test "verify something" do
17
+ # ...
18
+ # end
19
+ def test(name, &block)
20
+ test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
21
+ defined = instance_method(test_name) rescue false
22
+ # raise "#{test_name} is already defined in #{self}" if defined # do not raise this error
23
+ if block_given?
24
+ define_method(test_name, &block)
25
+ else
26
+ define_method(test_name) do
27
+ flunk "No implementation provided for #{name}"
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ # These hacks disable caching in views
36
+ module ActionView #:nodoc:
37
+ class PathSet #:nodoc:
38
+ class Path
39
+ def eager_load_templates?
40
+ false
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ # disable the class check in initialize for path
47
+ module ActionView #:nodoc:
48
+ class Template
49
+ class Path
50
+ def initialize(path)
51
+ # raise ArgumentError, "path already is a Path class" if path.is_a?(Path)
52
+ @path = path.freeze
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ # only in rails >= 2.3.2
59
+ if Rails::VERSION::STRING =~ /^2\.3\.[2-9]/
60
+ # make sure that type_cast always returns the ReloadablePath
61
+ module ActionView #:nodoc:
62
+ class PathSet #:nodoc:
63
+ def self.type_cast(obj)
64
+ return ReloadableTemplate::ReloadablePath.new(obj)
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+
71
+ # Rails < 2.3.0
72
+ if Rails::VERSION::STRING =~ /^2\.3\.0/ || Rails::VERSION::STRING =~ /^2\.[0-2]\.[0-9]/
73
+ module ActionView
74
+ # NOTE: The template that this mixin is being included into is frozen
75
+ # so you cannot set or modify any instance variables
76
+ module Renderable
77
+ private
78
+ def recompile?(path)
79
+ true
80
+ end
81
+ end
82
+ end
83
+
84
+ module ActionView #:nodoc:
85
+ class PathSet #:nodoc:
86
+
87
+ class Path
88
+
89
+ # make it always return a refreshed template!
90
+ def [](template_path)
91
+
92
+ begin
93
+ template = Template.new(template_path, path.to_s)
94
+ rescue ::ActionView::MissingTemplate
95
+ begin
96
+ template_path = template_path + '.erb' if !template_path.match('.erb')
97
+ template = Template.new(template_path, path.to_s)
98
+ rescue ::ActionView::MissingTemplate
99
+
100
+ end
101
+ end
102
+ return template
103
+ end
104
+
105
+
106
+ def initialize(path, load = true)
107
+ #raise ArgumentError, "path already is a Path class" if path.is_a?(Path)
108
+ @path = path.freeze
109
+ reload! if load
110
+ end
111
+ end
112
+
113
+ end
114
+ end
115
+
116
+ end
data/lib/bolt/listener.rb CHANGED
@@ -46,7 +46,7 @@ module Bolt
46
46
  def handle(updated_files)
47
47
  # notifier.spotted(updated_files.first)
48
48
  # send them to mapper
49
-
49
+ Runners.files = updated_files
50
50
  runner.handle(updated_files.first)
51
51
  # run appropriate tests in runner
52
52
  end
data/lib/bolt.rb CHANGED
@@ -22,6 +22,16 @@ module Bolt
22
22
  # Wrapper for specific runners
23
23
  #
24
24
  module Runners
25
+ @@noticed_files = []
26
+
27
+ def self.files=(arr)
28
+ @@noticed_files = arr
29
+ end
30
+
31
+ def self.files
32
+ @@noticed_files
33
+ end
34
+
25
35
  autoload :TestUnit, 'bolt/runners/test_unit'
26
36
  autoload :RSpec, 'bolt/runners/rspec'
27
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marcinbunsch-bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Bunsch
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-06-15 00:00:00 -07:00
13
+ date: 2009-06-16 00:00:00 -07:00
14
14
  default_executable: bolt
15
15
  dependencies: []
16
16
 
@@ -26,6 +26,8 @@ files:
26
26
  - Rakefile
27
27
  - bin/bolt
28
28
  - lib/bolt
29
+ - lib/bolt/adapters
30
+ - lib/bolt/adapters/rails.rb
29
31
  - lib/bolt/listener.rb
30
32
  - lib/bolt/listeners
31
33
  - lib/bolt/listeners/generic.rb