specjour 0.3.0.rc7 → 0.3.0.rc8

Sign up to get free protection for your applications and to get access to all the features.
data/History.markdown CHANGED
@@ -1,6 +1,15 @@
1
1
  History
2
2
  =======
3
3
 
4
+ ## 0.3.0.rc8 / 2010-08-13
5
+
6
+ * [fixed] Custom hooks now load in Ruby 1.9.2
7
+ * [fixed] Specjour prepare correctly recreates the db
8
+
9
+ * [added] Support for loading test DB from SQL file
10
+ (config.active_record.schema_format = :sql)
11
+ * [added] Rsync failures raise Specjour::Error
12
+
4
13
  ## 0.3.0.rc7 / 2010-08-09
5
14
 
6
15
  * [fixed] Distributing absolute paths to remote machines.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0.rc7
1
+ 0.3.0.rc8
data/bin/specjour CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'specjour'
3
3
 
4
+ $PROGRAM_NAME = File.basename(__FILE__)
4
5
  Specjour::CLI.start
data/lib/specjour/cli.rb CHANGED
@@ -18,11 +18,16 @@ module Specjour
18
18
  super(original_args)
19
19
  end
20
20
 
21
+
21
22
  default_task :dispatch
22
23
 
23
24
  class_option :log, :aliases => "-l", :type => :boolean, :desc => "Print debug messages to $stderr"
24
25
 
25
- desc "listen", "Advertise availability to run specs\nDefaults to current directory"
26
+
27
+ desc "listen", "Wait for incoming tests"
28
+ long_desc <<-D
29
+ Advertise availability to run tests for the current directory.
30
+ D
26
31
  worker_option
27
32
  method_option :projects, :aliases => "-p", :type => :array, :desc => "Projects supported by this listener"
28
33
  def listen
@@ -32,7 +37,7 @@ module Specjour
32
37
  Specjour::Manager.new(args).start
33
38
  end
34
39
 
35
- desc "dispatch [PROJECT_PATH]", "Run specs in this project"
40
+ desc "dispatch [PROJECT_PATH]", "Run tests in the current directory"
36
41
  worker_option
37
42
  dispatcher_option
38
43
  def dispatch(path = Dir.pwd)
@@ -42,7 +47,11 @@ module Specjour
42
47
  Specjour::Dispatcher.new(args).start
43
48
  end
44
49
 
45
- desc "prepare [PROJECT_PATH]", "Run the prepare block on all listening workers"
50
+ desc "prepare [PROJECT_PATH]", "Prepare all listening workers"
51
+ long_desc <<-D
52
+ Run the Specjour::Configuration.prepare block on all listening workers.
53
+ Defaults to dropping and schema loading the database.
54
+ D
46
55
  worker_option
47
56
  dispatcher_option
48
57
  def prepare(path = Dir.pwd)
@@ -53,7 +62,7 @@ module Specjour
53
62
  Specjour::Dispatcher.new(args).start
54
63
  end
55
64
 
56
- desc "version", "Show the version of specjour"
65
+ desc "version", "Show the current version"
57
66
  def version
58
67
  puts Specjour::VERSION
59
68
  end
@@ -8,6 +8,7 @@ module Specjour
8
8
  else
9
9
  load 'tasks/misc.rake'
10
10
  load 'tasks/databases.rake'
11
+ Rake::Task["db:structure:dump"].clear
11
12
  end
12
13
 
13
14
  extend self
@@ -20,7 +21,7 @@ module Specjour
20
21
  connect_to_database
21
22
  if pending_migrations?
22
23
  puts "Migrating schema for database #{ENV['TEST_ENV_NUMBER']}..."
23
- Rake::Task['db:test:load'].invoke
24
+ schema_load_task.invoke
24
25
  else
25
26
  purge_tables
26
27
  end
@@ -29,6 +30,7 @@ module Specjour
29
30
  protected
30
31
 
31
32
  def connect_to_database
33
+ ActiveRecord::Base.remove_connection
32
34
  connection
33
35
  rescue # assume the database doesn't exist
34
36
  Rake::Task['db:create'].invoke
@@ -50,6 +52,10 @@ module Specjour
50
52
  ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations.any?
51
53
  end
52
54
 
55
+ def schema_load_task
56
+ Rake::Task[{ :sql => "db:test:clone_structure", :ruby => "db:test:load" }[ActiveRecord::Base.schema_format]]
57
+ end
58
+
53
59
  def tables_to_purge
54
60
  connection.tables - ['schema_migrations']
55
61
  end
@@ -77,7 +77,7 @@ module Specjour
77
77
  end
78
78
 
79
79
  def fetch_manager(uri)
80
- Timeout.timeout(8) do
80
+ Timeout.timeout(1) do
81
81
  manager = DRbObject.new_with_uri(uri.to_s)
82
82
  if !managers.include?(manager) && manager.available_for?(project_alias)
83
83
  add_manager(manager)
@@ -86,12 +86,12 @@ module Specjour
86
86
  rescue Timeout::Error
87
87
  Specjour.logger.debug "Timeout: couldn't connect to manager at #{uri}"
88
88
  rescue DRb::DRbConnError => e
89
- Specjour.logger.debug "DRb error at #{uri}: #{e.backtrace.join("\n")}"
89
+ Specjour.logger.debug "#{e.message}: #{e.backtrace.join("\n")}"
90
90
  retry
91
91
  end
92
92
 
93
93
  def fork_local_manager
94
- puts "No remote managers found, starting a local manager..."
94
+ puts "No listeners found on this machine, starting one..."
95
95
  manager_options = {:worker_size => options[:worker_size], :registered_projects => [project_alias]}
96
96
  manager = Manager.start_quietly manager_options
97
97
  fetch_manager(manager.drb_uri)
@@ -107,7 +107,7 @@ module Specjour
107
107
 
108
108
  def gather_remote_managers
109
109
  browser = DNSSD::Service.new
110
- Timeout.timeout(2) do
110
+ Timeout.timeout(1) do
111
111
  browser.browse '_druby._tcp' do |reply|
112
112
  if reply.flags.add?
113
113
  resolve_reply(reply)
@@ -123,7 +123,7 @@ module Specjour
123
123
  end
124
124
 
125
125
  def no_local_managers?
126
- !managers.any? {|m| m.hostname == hostname}
126
+ managers.none? {|m| m.hostname == hostname}
127
127
  end
128
128
 
129
129
  def printer
@@ -95,7 +95,9 @@ module Specjour
95
95
  end
96
96
 
97
97
  def sync
98
- cmd "rsync -aL --delete --port=8989 #{dispatcher_uri.host}::#{project_name} #{project_path}"
98
+ unless cmd "rsync -aL --delete --port=8989 #{dispatcher_uri.host}::#{project_name} #{project_path}"
99
+ raise Error, "Rsync Failed."
100
+ end
99
101
  end
100
102
 
101
103
  protected
@@ -5,7 +5,7 @@ module Specjour
5
5
 
6
6
  # Corresponds to the version of specjour that changed the configuration
7
7
  # file.
8
- CONFIG_VERSION = "0.3.0.rc2".freeze
8
+ CONFIG_VERSION = "0.3.0.rc8".freeze
9
9
  CONFIG_FILE_NAME = "rsyncd.conf"
10
10
  PID_FILE_NAME = "rsyncd.pid"
11
11
 
@@ -101,7 +101,7 @@ pid file = ./.specjour/#{PID_FILE_NAME}
101
101
 
102
102
  [#{project_name}]
103
103
  path = .
104
- exclude = .git* .specjour/rsync* doc tmp/* log script
104
+ exclude = .git* .specjour/rsync* doc tmp/* log
105
105
  CONFIG
106
106
  end
107
107
  end
@@ -1,5 +1,7 @@
1
1
  module Specjour
2
2
  module SocketHelper
3
+ Socket.do_not_reverse_lookup = true
4
+
3
5
  def ip_from_hostname(hostname)
4
6
  Socket.getaddrinfo(hostname, nil, Socket::AF_INET, Socket::SOCK_STREAM).first.fetch(3)
5
7
  end
data/lib/specjour.rb CHANGED
@@ -28,8 +28,8 @@ module Specjour
28
28
  autoload :Cucumber, 'specjour/cucumber'
29
29
  autoload :Rspec, 'specjour/rspec'
30
30
 
31
- VERSION = "0.3.0.rc7".freeze
32
- HOOKS_PATH = ".specjour/hooks.rb"
31
+ VERSION = "0.3.0.rc8".freeze
32
+ HOOKS_PATH = "./.specjour/hooks.rb"
33
33
 
34
34
  class << self
35
35
  attr_accessor :interrupted
data/specjour.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{specjour}
8
- s.version = "0.3.0.rc7"
8
+ s.version = "0.3.0.rc8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sandro Turriate"]
12
- s.date = %q{2010-09-09}
12
+ s.date = %q{2010-09-13}
13
13
  s.default_executable = %q{specjour}
14
14
  s.description = %q{Distribute your spec suite amongst your LAN via Bonjour.}
15
15
  s.email = %q{sandro.turriate@gmail.com}
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specjour
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 977940561
4
5
  prerelease: true
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
9
  - 0
9
- - rc7
10
- version: 0.3.0.rc7
10
+ - rc8
11
+ version: 0.3.0.rc8
11
12
  platform: ruby
12
13
  authors:
13
14
  - Sandro Turriate
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-09-09 00:00:00 -04:00
19
+ date: 2010-09-13 00:00:00 -04:00
19
20
  default_executable: specjour
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -26,6 +27,7 @@ dependencies:
26
27
  requirements:
27
28
  - - "="
28
29
  - !ruby/object:Gem::Version
30
+ hash: 19
29
31
  segments:
30
32
  - 1
31
33
  - 3
@@ -41,6 +43,7 @@ dependencies:
41
43
  requirements:
42
44
  - - ">="
43
45
  - !ruby/object:Gem::Version
46
+ hash: 39
44
47
  segments:
45
48
  - 0
46
49
  - 14
@@ -56,6 +59,7 @@ dependencies:
56
59
  requirements:
57
60
  - - "="
58
61
  - !ruby/object:Gem::Version
62
+ hash: 27
59
63
  segments:
60
64
  - 1
61
65
  - 3
@@ -71,6 +75,7 @@ dependencies:
71
75
  requirements:
72
76
  - - ">="
73
77
  - !ruby/object:Gem::Version
78
+ hash: 33
74
79
  segments:
75
80
  - 0
76
81
  - 10
@@ -86,6 +91,7 @@ dependencies:
86
91
  requirements:
87
92
  - - ">="
88
93
  - !ruby/object:Gem::Version
94
+ hash: 13
89
95
  segments:
90
96
  - 0
91
97
  - 5
@@ -101,6 +107,7 @@ dependencies:
101
107
  requirements:
102
108
  - - ">="
103
109
  - !ruby/object:Gem::Version
110
+ hash: 7
104
111
  segments:
105
112
  - 1
106
113
  - 4
@@ -180,6 +187,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
187
  requirements:
181
188
  - - ">="
182
189
  - !ruby/object:Gem::Version
190
+ hash: 3
183
191
  segments:
184
192
  - 0
185
193
  version: "0"
@@ -188,6 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
196
  requirements:
189
197
  - - ">"
190
198
  - !ruby/object:Gem::Version
199
+ hash: 25
191
200
  segments:
192
201
  - 1
193
202
  - 3