tconsole 1.1.0pre4 → 1.1.0pre5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tconsole.rb CHANGED
@@ -47,7 +47,7 @@ module TConsole
47
47
 
48
48
  # set up the config
49
49
  config = Config.configure
50
- config.trace = true if argv.include?("--trace")
50
+ config.trace_execution = true if argv.include?("--trace")
51
51
 
52
52
  socket_path = "/tmp/tconsole.#{Process.pid}"
53
53
 
@@ -55,6 +55,7 @@ module TConsole
55
55
  while running
56
56
  # ignore ctrl-c during load, since things can get kind of messy if we don't
57
57
 
58
+ config.trace("Forking test server.")
58
59
  server_pid = fork do
59
60
  begin
60
61
  server = Server.new(config)
@@ -69,27 +70,34 @@ module TConsole
69
70
  # Wait for the server to be fully started
70
71
  wait_until = Time.now + 10
71
72
  until(File.exist?(socket_path) || Time.now > wait_until)
73
+ config.trace("Waiting on DRb socket to become available.")
72
74
  sleep(1)
73
75
  end
74
76
 
75
77
  # Set up our client connection to the server
78
+ config.trace("Connecting to testing server.")
76
79
  DRb.start_service
77
80
  server = DRbObject.new_with_uri("drbunix:#{socket_path}")
78
81
 
79
82
  loaded = false
80
83
  until loaded || Time.now > wait_until
81
- # Give drb a second to get set up
82
- sleep(1)
83
-
84
84
  begin
85
+ config.trace("Attempting to load environment.")
85
86
  running = server.load_environment
86
87
  loaded = true
87
- rescue
88
+ rescue => e
89
+ config.trace("Could not load environment: #{e.message}")
90
+ config.trace("==== Backtrace ====")
91
+ config.trace(e.backtrace.join("\n"))
92
+ config.trace("==== End Backtrace ====")
88
93
  loaded = false
89
94
  rescue Interrupt
90
95
  # do nothing if we get an interrupt
91
96
  puts "Interrupted in client"
92
97
  end
98
+
99
+ # Give drb a second to get set up
100
+ sleep(1)
93
101
  end
94
102
 
95
103
  if !loaded
@@ -97,6 +105,7 @@ module TConsole
97
105
  puts "Couldn't connect to test environment. Exiting."
98
106
  exit(1)
99
107
  end
108
+ config.trace("Environment loaded successfully.")
100
109
 
101
110
  running = console.read_and_execute(server) if running
102
111
 
@@ -1,7 +1,7 @@
1
1
  module TConsole
2
2
  class Config
3
3
  # Lets us know if we should include trace output
4
- attr_accessor :trace
4
+ attr_accessor :trace_execution
5
5
 
6
6
  # Test directory for the app we're testing
7
7
  attr_accessor :test_dir
@@ -13,7 +13,7 @@ module TConsole
13
13
  attr_accessor :preload_paths
14
14
 
15
15
  def initialize
16
- self.trace = false
16
+ self.trace_execution = false
17
17
  self.test_dir = "./test"
18
18
  self.include_paths = ["./test", "./lib"]
19
19
  self.preload_paths = []
@@ -22,7 +22,7 @@ module TConsole
22
22
  end
23
23
 
24
24
  def trace?
25
- self.trace
25
+ self.trace_execution
26
26
  end
27
27
 
28
28
  # Code to run before loading the environment
@@ -90,5 +90,10 @@ module TConsole
90
90
  def self.is_rails?
91
91
  @rails ||= !!File.exist?("./config/application.rb")
92
92
  end
93
+
94
+ # Outputs trace message if our config allows it
95
+ def trace(message)
96
+ puts "[tconsole trace] #{message}" if trace?
97
+ end
93
98
  end
94
99
  end
@@ -1,3 +1,3 @@
1
1
  module TConsole
2
- VERSION = "1.1.0pre4"
2
+ VERSION = "1.1.0pre5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tconsole
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0pre4
4
+ version: 1.1.0pre5
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: term-ansicolor
16
- requirement: &70233285449540 !ruby/object:Gem::Requirement
16
+ requirement: &70182278628260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.0.7
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70233285449540
24
+ version_requirements: *70182278628260
25
25
  description: ! " tconsole allows Rails developers to easily and quickly run their
26
26
  tests as a whole or in subsets. It forks the testing processes from\n a preloaded
27
27
  test environment to ensure that developers don't have to reload their entire Rails