specjour 0.3.0.rc1 → 0.3.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/History.markdown CHANGED
@@ -1,7 +1,19 @@
1
1
  History
2
2
  =======
3
3
 
4
- ## 0.3.0.rc1 / thor
4
+ ## 0.3.0.rc2 / thor
5
+
6
+ * [fixed] Cucumber compatibility with 0.8.5
7
+
8
+ * [fixed] The before\_fork hook did not work in the rc1 because the custom hooks
9
+ were loaded by the worker (after fork). We could have the manager preload the app
10
+ but then you'll have stale managers. Instead, custom hooks are now located in
11
+ the .specjour/hooks.rb file, essentially living outside of your application.
12
+
13
+ * [changed] The generated rsyncd.conf now syncs the .specjour directory
14
+ allowing hooks to be loaded by managers and workers.
15
+
16
+ ## 0.3.0.rc1 / 2010-07-12
5
17
 
6
18
  * [removed] Rake tasks have been removed, use the command-line instead.
7
19
 
data/README.markdown CHANGED
@@ -57,47 +57,37 @@ Specjour contains ActiveRecord hooks that clear database tables before running t
57
57
 
58
58
  ## Custom Hooks
59
59
  Specjour allows you to hook in to the test process on a per-machine and
60
- per-worker level through the before_fork and after_fork configuration blocks.
60
+ per-worker level through the before\_fork and after\_fork configuration blocks.
61
61
  If the default ActiveRecord hook doesn't set up the database properly for your
62
- test suite, override it with a custom after_fork hook.
62
+ test suite, override it with a custom after\_fork hook.
63
63
 
64
- # config/initializers/specjour.rb
65
- Rails.configuration.after_initialize do
64
+ # .specjour/hooks.rb
66
65
 
67
- # Modify the way you use bundler
68
- Specjour::Configuration.before_fork = lambda do
69
- # TODO: not working as advertised
70
- system('bundle install --without production')
71
- end
72
-
73
- # Modify your database setup
74
- Specjour::Configuration.after_fork = lambda do
75
- # custom database setup here
76
- end
66
+ # Modify the way you use bundler
67
+ Specjour::Configuration.before_fork = lambda do
68
+ system('bundle install --without production')
69
+ end
77
70
 
71
+ # Modify your database setup
72
+ Specjour::Configuration.after_fork = lambda do
73
+ # custom database setup here
78
74
  end
79
75
 
80
76
  A preparation hook is run when `specjour prepare` is invoked. This hook allows
81
77
  you to run arbitrary code on all of the listening workers. By default, it drops
82
78
  and recreates the database on all workers.
83
79
 
84
- Rails.configuration.after_initialize do
85
-
86
- # Modify preparation
87
- Specjour::Configuration.prepare = lambda do
88
- # custom preparation code
89
- end
80
+ # .specjour/hooks.rb
90
81
 
82
+ # Modify preparation
83
+ Specjour::Configuration.prepare = lambda do
84
+ # custom preparation code
91
85
  end
92
86
 
93
87
  ## Only listen to supported projects
94
- By default, a manager will listen to all projects trying to distribute specs over the network. Sometimes you'll only want a manager to respond to one specific spec suite. You can accomplish this with the `--projects` flag.
95
-
96
- $ specjour listen --projects bizconf # only run specs for the bizconf project
97
-
98
- You could also listen to multiple projects:
88
+ By default, a manager will listen to the project in the current directory. If you want to listen for multiple projects, use the `--projects` flag.
99
89
 
100
- $ specjour listen --projects bizconf,workbeast # only run specs for the bizconf and workbeast projects
90
+ $ specjour listen --projects bizconf workbeast # run specs for the bizconf and workbeast projects
101
91
 
102
92
  ## Customize what gets rsync'd
103
93
  The standard rsync configuration file may be too broad for your
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0.rc1
1
+ 0.3.0.rc2
data/lib/specjour/cli.rb CHANGED
@@ -24,7 +24,7 @@ module Specjour
24
24
 
25
25
  default_task :dispatch
26
26
 
27
- class_option :log, :aliases => "-l", :type => :boolean, :desc => "Print debug messages to $stdout"
27
+ class_option :log, :aliases => "-l", :type => :boolean, :desc => "Print debug messages to $stderr"
28
28
 
29
29
  desc "listen", "Advertise availability to run specs\nDefaults to current directory"
30
30
  worker_option
@@ -5,6 +5,7 @@ class Specjour::Cucumber::Preloader
5
5
  step_mother = cli.class.step_mother
6
6
 
7
7
  step_mother.log = cli.configuration.log
8
+ step_mother.options = cli.configuration.options
8
9
  step_mother.load_code_files(cli.configuration.support_to_load)
9
10
  step_mother.after_configuration(cli.configuration)
10
11
  features = step_mother.load_plain_text_features(cli.configuration.feature_files)
@@ -38,7 +38,7 @@ module Specjour
38
38
  def dispatch
39
39
  suspend_bonjour do
40
40
  sync
41
- in_project { Configuration.before_fork.call }
41
+ execute_before_fork
42
42
  dispatch_workers
43
43
  end
44
44
  end
@@ -109,6 +109,13 @@ module Specjour
109
109
  system command
110
110
  end
111
111
 
112
+ def execute_before_fork
113
+ in_project do
114
+ Specjour.load_custom_hooks
115
+ Configuration.before_fork.call
116
+ end
117
+ end
118
+
112
119
  def suspend_bonjour(&block)
113
120
  bonjour_service.stop
114
121
  block.call
@@ -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.2.3".freeze
8
+ CONFIG_VERSION = "0.3.0.rc2".freeze
9
9
  CONFIG_FILE_NAME = "rsyncd.conf"
10
10
  PID_FILE_NAME = "rsyncd.pid"
11
11
 
@@ -56,13 +56,13 @@ module Specjour
56
56
  end
57
57
 
58
58
  def check_config_version
59
- File.read(config_file) =~ /\A# (\d+.\d+.\d+)/
59
+ File.read(config_file) =~ /\A# (\d.\d.\d[.rc\d]*)/
60
60
  if out_of_date? Regexp.last_match(1)
61
61
  $stderr.puts <<-WARN
62
62
 
63
63
  Specjour has made changes to the way #{CONFIG_FILE_NAME} is generated.
64
- Back up '#{config_file}'
65
- and re-run the dispatcher to generate the new config file.
64
+ Back up '#{config_file}',
65
+ remove it, and re-run the dispatcher to generate the new config file.
66
66
 
67
67
  WARN
68
68
  end
@@ -101,7 +101,7 @@ pid file = ./.specjour/#{PID_FILE_NAME}
101
101
 
102
102
  [#{project_name}]
103
103
  path = .
104
- exclude = .git* .specjour doc tmp/* log script
104
+ exclude = .git* .specjour/rsync* doc tmp/* log script
105
105
  CONFIG
106
106
  end
107
107
  end
@@ -19,6 +19,7 @@ module Specjour
19
19
  self.printer_uri = options[:printer_uri]
20
20
  set_env_variables
21
21
  Dir.chdir(project_path)
22
+ Specjour.load_custom_hooks
22
23
  end
23
24
 
24
25
  def printer_uri=(val)
data/lib/specjour.rb CHANGED
@@ -28,7 +28,8 @@ module Specjour
28
28
  autoload :Cucumber, 'specjour/cucumber'
29
29
  autoload :Rspec, 'specjour/rspec'
30
30
 
31
- VERSION = "0.3.0.rc1".freeze
31
+ VERSION = "0.3.0.rc2".freeze
32
+ HOOKS_PATH = ".specjour/hooks.rb"
32
33
 
33
34
  def self.logger
34
35
  @logger ||= new_logger
@@ -44,6 +45,10 @@ module Specjour
44
45
  logger.level != Logger::UNKNOWN
45
46
  end
46
47
 
48
+ def self.load_custom_hooks
49
+ require HOOKS_PATH if File.exists?(HOOKS_PATH)
50
+ end
51
+
47
52
  Error = Class.new(StandardError)
48
53
  PROGRAM_NAME = $PROGRAM_NAME # keep a reference of the original program name
49
54
 
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.rc1"
8
+ s.version = "0.3.0.rc2"
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-07-12}
12
+ s.date = %q{2010-07-14}
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specjour
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940566
4
+ hash: 977940567
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
9
  - 0
10
- - rc1
11
- version: 0.3.0.rc1
10
+ - rc2
11
+ version: 0.3.0.rc2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Sandro Turriate
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-07-12 00:00:00 -04:00
19
+ date: 2010-07-14 00:00:00 -04:00
20
20
  default_executable: specjour
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency