torquespec 0.2.6 → 0.2.7

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.
@@ -6,19 +6,22 @@ module TorqueSpec
6
6
  class Daemon
7
7
 
8
8
  def initialize(opts={})
9
- puts "JC: create daemon opts=#{opts}"
10
- @argv = opts['argv'].to_a
9
+ puts "JC: create daemon opts=#{opts.inspect}"
10
+ dir = opts['pwd'].to_s
11
+ raise "The 'pwd' option must contain a valid directory name" unless dir.any? && File.exist?(dir)
12
+ Dir.chdir( dir ) do
13
+ RSpec::Core::Runner.disable_autorun! # avoid a bunch of at_exit finalizer errors
14
+ @options = RSpec::Core::ConfigurationOptions.new( opts['argv'].to_a )
15
+ @options.parse_options
11
16
 
12
- @options = RSpec::Core::ConfigurationOptions.new(@argv)
13
- @options.parse_options
17
+ @configuration = RSpec::configuration
18
+ @world = RSpec::world
14
19
 
15
- @configuration = RSpec::configuration
16
- @world = RSpec::world
17
-
18
- @options.configure(@configuration)
19
- @configuration.load_spec_files
20
- @configuration.configure_mock_framework
21
- @configuration.configure_expectation_framework
20
+ @options.configure(@configuration)
21
+ @configuration.load_spec_files
22
+ @configuration.configure_mock_framework
23
+ @configuration.configure_expectation_framework
24
+ end
22
25
  end
23
26
 
24
27
  def start
@@ -30,22 +30,16 @@ module TorqueSpec
30
30
  end
31
31
 
32
32
  # A somewhat hackish way of exposing client-side gems to the server-side daemon
33
- #
34
- # TODO: Fix it so I don't include old versions of TorqueSpec
35
- #
36
33
  def self.rubylib
37
- Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), "../../..", "*{spec,diff-lcs}*/lib"))).join(":")
34
+ here = File.dirname(__FILE__)
35
+ rspec_libs = Dir.glob(File.expand_path(File.join(here, "../../..", "*{rspec,diff-lcs}*/lib")))
36
+ this_lib = File.expand_path(File.join(here, ".."))
37
+ rspec_libs.unshift( this_lib ).join(":")
38
38
  end
39
39
 
40
- # The way client-side specs are passed to the daemon
41
- #
42
- # TODO: This won't work because we need to pass ARGV to the daemon,
43
- # and we can't just map its items to their expanded path, e.g. -l
44
- # 42, so we must pass (ARGV || spec) and Dir.pwd so that the daemon
45
- # may initialize itself within that directory.
46
- #
47
- def self.specs
48
- RSpec::configuration.files_to_run.map {|f| File.expand_path(f) }.inspect
40
+ # We must initialize the daemon with the same params as passed to the client
41
+ def self.argv
42
+ ( ARGV.empty? ? [ 'spec' ] : ARGV ).inspect
49
43
  end
50
44
  end
51
45
 
@@ -1,3 +1,3 @@
1
1
  module TorqueSpec
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
@@ -7,7 +7,8 @@ remote_describe "in-container tests" do
7
7
  root: #{File.dirname(__FILE__)}/../apps/simple
8
8
  services:
9
9
  TorqueSpec::Daemon:
10
- argv: #{ARGV.map{|x|File.expand_path(x)}.inspect}
10
+ argv: #{TorqueSpec.argv}
11
+ pwd: #{Dir.pwd}
11
12
  environment:
12
13
  RUBYLIB: #{TorqueSpec.rubylib}
13
14
  END
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torquespec
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 6
10
- version: 0.2.6
9
+ - 7
10
+ version: 0.2.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Crossley
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-06-08 00:00:00 -04:00
19
+ date: 2011-06-09 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency