rspactor 0.7.0.beta.1 → 0.7.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -5,24 +5,26 @@ Version 0.7.x is a complete rewrite, RubyCocoa is no more needed, FSEvents are s
5
5
 
6
6
  == Features
7
7
 
8
- * FSEvent support (without RubyCocoa!)
9
- * RSpec 2.0 support (from beta.14)
10
- * Bundler support
11
- * Super fast change detection
12
- * Automatic _spec.rb files detection (even new file created, unlike watchr)
13
- * Growl notification (please install {growlnotify}[http://growl.info/documentation/growlnotify.php])
8
+ - FSEvent support on Mac OS X (without RubyCocoa!)
9
+ - Inotify support on Linux
10
+ - RSpec 2.0 support (from beta.14)
11
+ - Bundler support
12
+ - Super fast change detection
13
+ - Automatic _spec.rb files detection (even new file created, unlike watchr)
14
+ - Growl notification (please install {growlnotify}[http://growl.info/documentation/growlnotify.php])
15
+ - Libnotify notification
14
16
 
15
17
  == Install
16
18
 
17
- At the moment, only Mac OS X (10.5+) is supported. Tested on ruby 1.8.7 & 1.9.2dev.
19
+ At the moment, only Mac OS X (10.5+) & Linux are supported. Tested on ruby 1.8.7 & 1.9.2dev.
18
20
 
19
21
  Install the gem:
20
22
 
21
- gem install rspactor
23
+ gem install rspactor --pre
22
24
 
23
25
  If you are using Bundler, please add it to your Gemfile (inside test group):
24
26
 
25
- gem 'rspactor', '>= 0.7.beta.1'
27
+ gem 'rspactor', '>= 0.7.beta.2'
26
28
 
27
29
  == Usage
28
30
 
@@ -36,22 +38,23 @@ Options list is available with:
36
38
 
37
39
  Signal handlers are now used to interact with RSpactor:
38
40
 
39
- * Ctrl-C => Quit RSpactor or quick abort running spec(s)
40
- * Ctrl-/ => Running all specs
41
+ - Ctrl-C - Quit RSpactor or quick abort running spec(s)
42
+ - Ctrl-\ - Running all specs
41
43
 
42
44
  == TODO
43
45
 
44
- * Specific files (spec_helper, factories, fixtures...) inspections
45
- * RSpec 1.3 support
46
- * Inotify support (linux)
47
- * Spork support (when {this issue}[http://github.com/timcharper/spork/issues#issue/37] will be resolved)
48
- * Cucumber support (if really needed? {Steak}[http://github.com/cavalle/steak] works fine.)
49
- * Other ideas?
46
+ - RSpec 1.3 support
47
+ - Specific files (spec_helper, factories, fixtures...) inspections
48
+ - Spork support (when {this issue}[http://github.com/timcharper/spork/issues#issue/37] will be resolved)
49
+ - {LiveReload}[http://github.com/mockko/livereload] support
50
+ - Cucumber support (You can use {Steak}[http://github.com/cavalle/steak] in the meantime)
51
+ - .rspec options file support
52
+ - Other ideas?
50
53
 
51
54
  == Development
52
55
 
53
- * Source hosted at {GitHub}[http://github.com/thibaudgg/rspactor].
54
- * Report issues/Questions/Feature requests on {GitHub Issues}[http://github.com/thibaudgg/rspactor/issues]
56
+ - Source hosted at {GitHub}[http://github.com/thibaudgg/rspactor]
57
+ - Report issues/Questions/Feature requests on {GitHub Issues}[http://github.com/thibaudgg/rspactor/issues]
55
58
 
56
59
  Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
57
60
  you make.
@@ -62,9 +65,9 @@ From version 0.7.x was completely rewritten by {Thibaud Guillaume-Gentil}[http:/
62
65
 
63
66
  Older versions authors are:
64
67
 
65
- * {Mislav Marohnić}[http://github.com/mislav]
66
- * {Andreas Wolff}[http://github.com/phunkwork]
67
- * {Pelle Braendgaard}[http://github.com/pelle]
68
- * {Thibaud Guillaume-Gentil}[http://github.com/thibaudgg]
68
+ - {Mislav Marohnić}[http://github.com/mislav]
69
+ - {Andreas Wolff}[http://github.com/phunkwork]
70
+ - {Pelle Braendgaard}[http://github.com/pelle]
71
+ - {Thibaud Guillaume-Gentil}[http://github.com/thibaudgg]
69
72
 
70
- Thanks to {Giovanni Cangiani}[http://github.com/multiscan] for the IO.open/FSEvent trick & {Rémy Coutable}[http://github.com/rymai] for beta testing.
73
+ Thanks to {Giovanni Cangiani}[http://github.com/multiscan] for the IO.popen/FSEvent trick & {Rémy Coutable}[http://github.com/rymai] for beta testing.
data/bin/inotify_watch ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rb-inotify'
5
+
6
+ folders = Array.new
7
+ notifier = INotify::Notifier.new
8
+
9
+ notifier.watch(ARGV.first || '.', :modify, :recursive) do |event|
10
+ dir = File.expand_path(File.dirname(event.absolute_name)) + '/'
11
+ if !folders.include?(dir)
12
+ folders << dir
13
+ end
14
+ end
15
+
16
+ while true do
17
+ notifier.process
18
+
19
+ if !folders.empty?
20
+ $stdout.puts folders.join(' ')
21
+ $stdout.flush
22
+ folders.clear
23
+ end
24
+
25
+ sleep(0.5)
26
+ end
27
+
@@ -1,28 +1,28 @@
1
- # Workaround to make Rubygems believe it builds a native gem
2
-
3
- def emulate_extension_install(extension_name)
4
- File.open('Makefile', 'w') { |f| f.write "all:\n\ninstall:\n\n" }
5
- File.open('make', 'w') do |f|
6
- f.write '#!/bin/sh'
7
- f.chmod f.stat.mode | 0111
1
+ if `uname -s`.chomp == 'Darwin'
2
+ # Workaround to make Rubygems believe it builds a native gem
3
+ def emulate_extension_install(extension_name)
4
+ File.open('Makefile', 'w') { |f| f.write "all:\n\ninstall:\n\n" }
5
+ File.open('make', 'w') do |f|
6
+ f.write '#!/bin/sh'
7
+ f.chmod f.stat.mode | 0111
8
+ end
9
+ File.open(extension_name + '.so', 'w') {}
10
+ File.open(extension_name + '.dll', 'w') {}
11
+ File.open('nmake.bat', 'w') { |f| }
8
12
  end
9
- File.open(extension_name + '.so', 'w') {}
10
- File.open(extension_name + '.dll', 'w') {}
11
- File.open('nmake.bat', 'w') { |f| }
12
- end
13
-
14
- emulate_extension_install('fsevent')
15
-
16
- # Compile the actual fsevent_watch binary
17
-
18
- raise "Only Darwin (Mac OS X) systems are supported for the moment" unless `uname -s`.chomp == 'Darwin'
19
-
20
- GEM_ROOT = File.expand_path(File.join('..', '..'))
21
- DARWIN_VERSION = `uname -r`.to_i
22
- SDK_VERSION = { 9 => '10.5', 10 => '10.6', 11 => '10.7' }[DARWIN_VERSION]
23
-
24
- raise "Darwin #{DARWIN_VERSION} is not supported" unless SDK_VERSION
25
-
26
- `CFLAGS='-isysroot /Developer/SDKs/MacOSX#{SDK_VERSION}.sdk -mmacosx-version-min=#{SDK_VERSION}' /usr/bin/gcc -framework CoreServices -o "#{GEM_ROOT}/bin/fsevent_watch" fsevent_watch.c`
27
-
28
- raise "Compilation of fsevent_watch failed (see README)" unless File.executable?("#{GEM_ROOT}/bin/fsevent_watch")
13
+
14
+ emulate_extension_install('fsevent')
15
+
16
+ gem_root = File.expand_path(File.join('..', '..'))
17
+ darwin_verion = `uname -r`.to_i
18
+ sdk_verion = { 9 => '10.5', 10 => '10.6', 11 => '10.7' }[darwin_verion]
19
+
20
+ raise "Darwin #{darwin_verion} is not supported" unless sdk_verion
21
+
22
+ # Compile the actual fsevent_watch binary
23
+ system("CFLAGS='-isysroot /Developer/SDKs/MacOSX#{sdk_verion}.sdk -mmacosx-version-min=#{sdk_verion}' /usr/bin/gcc -framework CoreServices -o '#{gem_root}/bin/fsevent_watch' fsevent_watch.c")
24
+
25
+ unless File.executable?("#{gem_root}/bin/fsevent_watch")
26
+ raise "Compilation of fsevent_watch failed (see README)"
27
+ end
28
+ end
@@ -0,0 +1,11 @@
1
+ require 'formatters/rspec2_formatter'
2
+ require 'growl'
3
+
4
+ class GrowlFormatter < RSpec2Formatter
5
+
6
+ def dump_summary
7
+ super
8
+ Growl.notify rspactor_message, :title => rspactor_title, :icon => rspactor_image_path
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'formatters/rspec2_formatter'
2
+ require 'libnotify'
3
+
4
+ class LibnotifyFormatter < RSpec2Formatter
5
+
6
+ def dump_summary
7
+ super
8
+ Libnotify.show :body => rspactor_message, :summary => rspactor_title, :icon_path => rspactor_image_path
9
+ end
10
+
11
+ end
@@ -1,13 +1,22 @@
1
1
  require 'rspec/core/formatters/base_formatter'
2
- require 'growl'
3
2
 
4
- class GrowlFormatter < RSpec::Core::Formatters::ProgressFormatter
3
+ class RSpec2Formatter < RSpec::Core::Formatters::ProgressFormatter
5
4
 
6
- def dump_summary
7
- super
8
- failure_count = failed_examples.size
9
- pending_count = pending_examples.size
10
-
5
+ def rspactor_title
6
+ "RSpec results"
7
+ end
8
+
9
+ def rspactor_message
10
+ message = "#{@example_count} examples, #{failure_count} failures"
11
+ if pending_count > 0
12
+ message << " (#{pending_count} pending)"
13
+ end
14
+ message << "\nin #{format_seconds(duration)} seconds"
15
+ message
16
+ end
17
+
18
+ # failed | pending | success
19
+ def rspactor_image_path
11
20
  icon = if failure_count > 0
12
21
  'failed'
13
22
  elsif pending_count > 0
@@ -15,21 +24,17 @@ class GrowlFormatter < RSpec::Core::Formatters::ProgressFormatter
15
24
  else
16
25
  'success'
17
26
  end
18
-
19
- message = "#{@example_count} examples, #{failure_count} failures"
20
- if pending_count > 0
21
- message << " (#{pending_count} pending)"
22
- end
23
- message << "\nin #{format_seconds(duration)} seconds"
24
-
25
- Growl.notify message, :title => "RSpec results", :icon => image_path(icon)
27
+ File.expand_path(File.dirname(__FILE__) + "/images/#{icon}.png")
26
28
  end
27
29
 
28
30
  private
29
31
 
30
- # failed | pending | success
31
- def image_path(icon)
32
- File.expand_path(File.dirname(__FILE__) + "/../../images/#{icon}.png")
32
+ def failure_count
33
+ failed_examples.size
34
+ end
35
+
36
+ def pending_count
37
+ pending_examples.size
33
38
  end
34
39
 
35
40
  end
@@ -3,7 +3,7 @@ module RSpactor
3
3
  class << self
4
4
 
5
5
  def init_signal_traps
6
- # Ctrl-/
6
+ # Ctrl-\
7
7
  Signal.trap('QUIT') do
8
8
  RSpactor.listener.stop
9
9
  RSpactor.runner.start(:all => true)
@@ -11,9 +11,11 @@ module RSpactor
11
11
  end
12
12
  # Ctrl-C
13
13
  Signal.trap('INT') do
14
+ RSpactor.listener.stop
14
15
  if RSpactor.runner.run?
15
16
  UI.info "RSpec run canceled", :reset => true, :clear => RSpactor.options[:clear]
16
17
  RSpactor.runner.stop
18
+ RSpactor.listener.start
17
19
  else
18
20
  UI.info "Bye bye...", :reset => true
19
21
  abort("\n")
@@ -1,3 +1,5 @@
1
+ require 'sys/uname'
2
+
1
3
  module RSpactor
2
4
  class Listener
3
5
  EXTENSIONS = %w[rb erb builder haml yml]
@@ -13,7 +15,13 @@ module RSpactor
13
15
  end
14
16
 
15
17
  def start
16
- @pipe = IO.popen("#{bin_path}/fsevent_watch .")
18
+ @pipe = case Sys::Uname.sysname
19
+ when 'Darwin'
20
+ IO.popen("#{bin_path}/fsevent_watch .")
21
+ when 'Linux'
22
+ IO.popen("#{bin_path}/inotify_watch .")
23
+ end
24
+
17
25
  watch_change
18
26
  end
19
27
 
@@ -1,5 +1,3 @@
1
- require 'growl'
2
-
3
1
  module RSpactor
4
2
  class Runner
5
3
  attr_reader :pipe
@@ -40,7 +38,8 @@ module RSpactor
40
38
 
41
39
  def rspec_command(paths)
42
40
  cmd_parts = [paths.join(' ')]
43
- cmd_parts.unshift "--require #{File.dirname(__FILE__)}/../growl/growl_formatter.rb --format GrowlFormatter" if Growl.installed?
41
+ cmd_parts.unshift "--require #{File.dirname(__FILE__)}/../formatters/rspec2/growl_formatter.rb --format GrowlFormatter" if growl_installed?
42
+ cmd_parts.unshift "--require #{File.dirname(__FILE__)}/../formatters/rspec2/libnotify_formatter.rb --format LibnotifyFormatter" if notify_installed?
44
43
  cmd_parts.unshift "--color"
45
44
  cmd_parts.unshift "rspec"
46
45
  cmd_parts.unshift "bundle exec" if bundler?
@@ -51,5 +50,13 @@ module RSpactor
51
50
  File.exist?("./Gemfile")
52
51
  end
53
52
 
53
+ def growl_installed?
54
+ system 'which growlnotify > /dev/null 2>&1'
55
+ end
56
+
57
+ def notify_installed?
58
+ system 'which notify-send > /dev/null 2>&1'
59
+ end
60
+
54
61
  end
55
62
  end
@@ -1,3 +1,3 @@
1
1
  module RSpactor
2
- VERSION = "0.7.0.beta.1"
2
+ VERSION = "0.7.0.beta.2"
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspactor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196433
4
+ hash: 62196439
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
9
  - 0
10
10
  - beta
11
- - 1
12
- version: 0.7.0.beta.1
11
+ - 2
12
+ version: 0.7.0.beta.2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Thibaud Guillaume-Gentil
@@ -17,10 +17,13 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-06-30 00:00:00 +02:00
20
+ date: 2010-07-12 00:00:00 +02:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
+ prerelease: false
25
+ type: :runtime
26
+ name: trollop
24
27
  version_requirements: &id001 !ruby/object:Gem::Requirement
25
28
  none: false
26
29
  requirements:
@@ -32,29 +35,27 @@ dependencies:
32
35
  - 16
33
36
  - 2
34
37
  version: 1.16.2
35
- name: trollop
36
- prerelease: false
37
38
  requirement: *id001
38
- type: :runtime
39
39
  - !ruby/object:Gem::Dependency
40
+ prerelease: false
41
+ type: :runtime
42
+ name: sys-uname
40
43
  version_requirements: &id002 !ruby/object:Gem::Requirement
41
44
  none: false
42
45
  requirements:
43
46
  - - ">="
44
47
  - !ruby/object:Gem::Version
45
- hash: 62196479
48
+ hash: 55
46
49
  segments:
47
- - 2
48
50
  - 0
49
- - 0
50
- - beta
51
- - 14
52
- version: 2.0.0.beta.14
53
- name: rspec
54
- prerelease: false
51
+ - 8
52
+ - 4
53
+ version: 0.8.4
55
54
  requirement: *id002
56
- type: :runtime
57
55
  - !ruby/object:Gem::Dependency
56
+ prerelease: false
57
+ type: :runtime
58
+ name: growl
58
59
  version_requirements: &id003 !ruby/object:Gem::Requirement
59
60
  none: false
60
61
  requirements:
@@ -66,10 +67,23 @@ dependencies:
66
67
  - 0
67
68
  - 3
68
69
  version: 1.0.3
69
- name: growl
70
- prerelease: false
71
70
  requirement: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ prerelease: false
72
73
  type: :runtime
74
+ name: libnotify
75
+ version_requirements: &id004 !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ hash: 29
81
+ segments:
82
+ - 0
83
+ - 1
84
+ - 3
85
+ version: 0.1.3
86
+ requirement: *id004
73
87
  description: RSpactor is a command line tool to automatically run your changed specs (much like autotest)
74
88
  email:
75
89
  - thibaud@thibaud.me
@@ -80,11 +94,14 @@ extensions:
80
94
  extra_rdoc_files: []
81
95
 
82
96
  files:
97
+ - bin/inotify_watch
83
98
  - bin/rspactor
84
- - images/failed.png
85
- - images/pending.png
86
- - images/success.png
87
- - lib/growl/growl_formatter.rb
99
+ - lib/formatters/images/failed.png
100
+ - lib/formatters/images/pending.png
101
+ - lib/formatters/images/success.png
102
+ - lib/formatters/rspec2/growl_formatter.rb
103
+ - lib/formatters/rspec2/libnotify_formatter.rb
104
+ - lib/formatters/rspec2_formatter.rb
88
105
  - lib/rspactor/inspector.rb
89
106
  - lib/rspactor/interactor.rb
90
107
  - lib/rspactor/listener.rb
File without changes
File without changes
File without changes