mynyml-watchr 0.5.2 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -68,8 +68,11 @@ Signal#trap calls, etc. Updates to script files are picked up on the fly (no
68
68
  need to restart watchr) so experimenting is painless.
69
69
 
70
70
  The wiki[http://wiki.github.com/mynyml/watchr] has more details and examples.
71
- You can also take a look at watchr's own specs.watchr script in the root dir,
72
- as well as docs.watchr
71
+ You might also want to take a look at watchr's own scripts,
72
+ specs.watchr[http://github.com/mynyml/watchr/blob/master/specs.watchr],
73
+ docs.watchr[http://github.com/mynyml/watchr/blob/master/docs.watchr] and
74
+ gem.watchr[http://github.com/mynyml/watchr/blob/master/gem.watchr], to get you
75
+ started.
73
76
 
74
77
 
75
78
  === Install
data/TODO.txt CHANGED
@@ -1,13 +1,16 @@
1
1
 
2
- * rev dependency should be conditional on OS
2
+ * use VERSION file
3
3
 
4
- * fix issue with Script#parse!
4
+ * refactor Script#parse!
5
5
  * only accept paths in initialize?
6
6
 
7
7
  * sometimes an action is fired without a file being saved
8
8
  * buffer flushing issue?
9
9
  * libev issue?
10
10
 
11
+ * when a file is saved twice quickly, subsequent events are ignored.
12
+ * seems like rev/libev drops the file watch
13
+
11
14
  * test on other platforms
12
15
  * mswin
13
16
  * bsd
@@ -2,7 +2,8 @@ require 'observer'
2
2
 
3
3
  module Watchr
4
4
  module EventHandler
5
- class AbstractMethod < Exception; end
5
+ class AbstractMethod < Exception #:nodoc:
6
+ end
6
7
 
7
8
  # Base functionality mixin meant to be included in specific event handlers.
8
9
  module Base
@@ -2,7 +2,7 @@ module Watchr
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- TINY = 2
5
+ TINY = 4
6
6
  end
7
7
 
8
8
  def self.version #:nodoc:
data/lib/watchr.rb CHANGED
@@ -60,14 +60,37 @@ module Watchr
60
60
  puts "[watchr debug] #{str}" if options.debug
61
61
  end
62
62
 
63
+ # Detect current OS and return appropriate handler.
64
+ #
65
+ # NOTE temporarily returns Portable handler for all platforms, until
66
+ # issue #1 is fixed
67
+ #
68
+ # ===== Examples
69
+ #
70
+ # Config::CONFIG['host_os'] #=> 'linux-gnu'
71
+ # Watchr.handler #=> Watchr::EventHandler::Unix
72
+ #
73
+ # Config::CONFIG['host_os'] #=> 'cygwin'
74
+ # Watchr.handler #=> Watchr::EventHandler::Portable
75
+ #
76
+ # ENV['HANDLER'] #=> 'unix'
77
+ # Watchr.handler #=> Watchr::EventHandler::Unix
78
+ #
79
+ # ENV['HANDLER'] #=> 'portable'
80
+ # Watchr.handler #=> Watchr::EventHandler::Portable
81
+ #
82
+ # ===== Returns
83
+ # handler<Class>:: handler class for current architecture
84
+ #
63
85
  def handler
64
86
  @handler ||=
65
87
  #case ENV['HANDLER'] || RUBY_PLATFORM
66
88
  case ENV['HANDLER'] || Config::CONFIG['host_os']
67
89
  when /mswin|windows|cygwin/i
68
90
  Watchr::EventHandler::Portable
69
- when /bsd|sunos|solaris|darwin|osx|mach|linux/i, 'unix'
70
- Watchr::EventHandler::Unix
91
+ when /sunos|solaris|darwin|mach|osx|bsd|linux/i, 'unix'
92
+ #Watchr::EventHandler::Unix
93
+ Watchr::EventHandler::Portable
71
94
  else
72
95
  Watchr::EventHandler::Portable
73
96
  end
data/specs.watchr CHANGED
@@ -22,11 +22,10 @@ end
22
22
  # --------------------------------------------------
23
23
  # Watchr Rules
24
24
  # --------------------------------------------------
25
- watch( '^test.*/test_.*\.rb' ) { |m| run( "ruby -rubygems %s" % m[0] ) }
26
- watch( '^lib/(.*)\.rb' ) { |m| run( "ruby -rubygems test/test_%s.rb" % m[1] ) }
27
- watch( '^lib/watchr/(.*)\.rb' ) { |m| run( "ruby -rubygems test/test_%s.rb" % m[1] ) }
28
- watch( '^lib/watchr/event_handlers/(.*)\.rb' ) { |m| run( "ruby -rubygems test/event_handlers/test_%s.rb" % m[1] ) }
29
- watch( '^test/test_helper\.rb' ) { run_all_tests }
25
+ watch( '^test.*/test_.*\.rb' ) { |m| run( "ruby -rubygems %s" % m[0] ) }
26
+ watch( '^lib/(.*)\.rb' ) { |m| run( "ruby -rubygems test/test_%s.rb" % m[1] ) }
27
+ watch( '^lib/.*/(.*)\.rb' ) { |m| run( "ruby -rubygems test/test_%s.rb" % m[1] ) }
28
+ watch( '^test/test_helper\.rb' ) { run_all_tests }
30
29
 
31
30
  # --------------------------------------------------
32
31
  # Signal Handling
data/test/test_helper.rb CHANGED
@@ -5,9 +5,9 @@ require 'mocha'
5
5
  require 'every'
6
6
  require 'pending'
7
7
  begin
8
- require 'ruby-debug'
9
8
  require 'redgreen'
10
9
  require 'phocus'
10
+ require 'ruby-debug'
11
11
  rescue LoadError, RuntimeError
12
12
  end
13
13
 
data/test/test_watchr.rb CHANGED
@@ -23,21 +23,43 @@ class TestWatchr < Test::Unit::TestCase
23
23
  end
24
24
 
25
25
  test "picking handler" do
26
+
27
+ # temporary workaround to issue #1
28
+ # http://github.com/mynyml/watchr/issues#issue/1
29
+
30
+ #Watchr.handler = nil
31
+ #ENV['HANDLER'] = 'linux'
32
+ #Watchr.handler.should be(Watchr::EventHandler::Unix)
33
+
34
+ #Watchr.handler = nil
35
+ #ENV['HANDLER'] = 'bsd'
36
+ #Watchr.handler.should be(Watchr::EventHandler::Unix)
37
+
38
+ #Watchr.handler = nil
39
+ #ENV['HANDLER'] = 'darwin'
40
+ #Watchr.handler.should be(Watchr::EventHandler::Unix)
41
+
42
+ #Watchr.handler = nil
43
+ #ENV['HANDLER'] = 'unix'
44
+ #Watchr.handler.should be(Watchr::EventHandler::Unix)
45
+
26
46
  Watchr.handler = nil
27
47
  ENV['HANDLER'] = 'linux'
28
- Watchr.handler.should be(Watchr::EventHandler::Unix)
48
+ Watchr.handler.should be(Watchr::EventHandler::Portable)
29
49
 
30
50
  Watchr.handler = nil
31
51
  ENV['HANDLER'] = 'bsd'
32
- Watchr.handler.should be(Watchr::EventHandler::Unix)
52
+ Watchr.handler.should be(Watchr::EventHandler::Portable)
33
53
 
34
54
  Watchr.handler = nil
35
55
  ENV['HANDLER'] = 'darwin'
36
- Watchr.handler.should be(Watchr::EventHandler::Unix)
56
+ Watchr.handler.should be(Watchr::EventHandler::Portable)
37
57
 
38
58
  Watchr.handler = nil
39
59
  ENV['HANDLER'] = 'unix'
40
- Watchr.handler.should be(Watchr::EventHandler::Unix)
60
+ Watchr.handler.should be(Watchr::EventHandler::Portable)
61
+ # end temporary workaround
62
+
41
63
 
42
64
  Watchr.handler = nil
43
65
  ENV['HANDLER'] = 'mswin'
data/watchr.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'watchr'
4
- s.version = '0.5.2'
4
+ s.version = '0.5.4'
5
5
  s.date = '2009-09-17'
6
6
  s.summary = "Modern continious testing (flexible alternative to autotest)"
7
7
  s.description = "Modern continious testing (flexible alternative to autotest)."
@@ -50,9 +50,9 @@ Gem::Specification.new do |s|
50
50
 
51
51
  #require 'rbconfig'
52
52
  #unless Config::CONFIG['host_os'] =~ /mswin|windows|cygwin/i
53
- unless RUBY_PLATFORM =~ /mswin|windows|cygwin/i
54
- s.add_dependency 'rev', '>= 0.3.0'
55
- end
53
+ #unless RUBY_PLATFORM =~ /mswin|windows|cygwin/i
54
+ # s.add_dependency 'rev', '>= 0.3.0'
55
+ #end
56
56
 
57
57
  s.add_development_dependency 'mocha'
58
58
  s.add_development_dependency 'jeremymcanally-matchy'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mynyml-watchr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - mynyml
@@ -12,16 +12,6 @@ cert_chain: []
12
12
  date: 2009-09-17 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rev
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.3.0
24
- version:
25
15
  - !ruby/object:Gem::Dependency
26
16
  name: mocha
27
17
  type: :development