furnish 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ * 0.0.4 (03/25/2013)
2
+ * Support for FURNISH_DEBUG environment variable for test suites.
3
+ * Ruby 2.0.0-p0 Compatibility Fixes
4
+ * Documentation is RDoc 4.0 compatible.
5
+
1
6
  * 0.0.3 (03/21/2013)
2
7
  * Fix an issue where state wasn't tracked for provisioners themselves after the provisioning process had started.
3
8
 
data/Rakefile CHANGED
@@ -10,7 +10,8 @@ end
10
10
 
11
11
  RDoc::Task.new do |rdoc|
12
12
  rdoc.title = "Furnish: A novel way to do virtual machine provisioning"
13
- rdoc.rdoc_files.include("lib/**/*.rb")
13
+ rdoc.main = "README.md"
14
+ rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
14
15
  rdoc.rdoc_files -= ["lib/furnish/version.rb"]
15
16
  if ENV["RDOC_COVER"]
16
17
  rdoc.options << "-C"
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_development_dependency 'minitest', '~> 4.5.0'
24
24
  gem.add_development_dependency 'guard-minitest'
25
25
  gem.add_development_dependency 'guard-rake'
26
- gem.add_development_dependency 'rdoc'
26
+ gem.add_development_dependency 'rdoc', '~> 4'
27
27
  gem.add_development_dependency 'rb-fsevent'
28
28
  gem.add_development_dependency 'simplecov'
29
29
  end
@@ -89,13 +89,17 @@ module Furnish
89
89
  # if_debug is synchronized over the logger's mutex.
90
90
  #
91
91
  def if_debug(level=1, else_block=nil, &block)
92
- @write_mutex.synchronize do
92
+ run = lambda do
93
93
  if debug_level >= level and block
94
94
  io.instance_eval(&block)
95
95
  elsif else_block
96
96
  io.instance_eval(&else_block)
97
97
  end
98
98
  end
99
+
100
+ @write_mutex.synchronize { run.call }
101
+ rescue ThreadError
102
+ run.call
99
103
  end
100
104
 
101
105
  #
@@ -104,7 +108,10 @@ module Furnish
104
108
  #
105
109
  def method_missing(sym, *args)
106
110
  raise NoMethodError, "#{io.inspect} has no method #{sym}" unless io.respond_to?(sym)
107
- @write_mutex.synchronize { io.__send__(sym, *args) }
111
+ run = lambda { io.__send__(sym, *args) }
112
+ @write_mutex.synchronize { run.call }
113
+ rescue ThreadError
114
+ run.call
108
115
  end
109
116
  end
110
117
  end
@@ -14,20 +14,31 @@ module Furnish
14
14
  # The basic case initializes furnish and the logger in a safe way in setup,
15
15
  # and cleans up in teardown.
16
16
  #
17
+ # If FURNISH_DEBUG is present in the environment, the output of the furnish
18
+ # log will be presented to the standard error. Otherwise, it is sent a log
19
+ # file.
20
+ #
17
21
  class TestCase < MiniTest::Unit::TestCase
18
22
  def setup # :nodoc:
19
23
  @tempfiles ||= []
20
24
  file = Tempfile.new('furnish_db')
21
25
  @tempfiles.push(file)
22
- logfile = Tempfile.new('furnish_log')
23
- @tempfiles.push(logfile)
24
- Furnish.logger = Furnish::Logger.new(logfile, 3)
26
+ if ENV["FURNISH_DEBUG"]
27
+ Furnish.logger = Furnish::Logger.new($stderr, 3)
28
+ else
29
+ logfile = Tempfile.new('furnish_log')
30
+ @tempfiles.push(logfile)
31
+ Furnish.logger = Furnish::Logger.new(logfile, 3)
32
+ end
25
33
  Furnish.init(file.path)
26
34
  return file
27
35
  end
28
36
 
29
37
  def teardown # :nodoc:
30
- Furnish.logger.close
38
+ unless ENV["FURNISH_DEBUG"]
39
+ Furnish.logger.close
40
+ end
41
+
31
42
  Furnish.shutdown
32
43
  @tempfiles.each do |file|
33
44
  file.unlink
@@ -1,4 +1,4 @@
1
1
  module Furnish
2
2
  # The current version of Furnish.
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
@@ -19,6 +19,12 @@ class TestProvisionerGroup < Furnish::TestCase
19
19
  end
20
20
 
21
21
  def test_up_down
22
+ if ENV["FURNISH_DEBUG"]
23
+ $stderr.puts "Testing logging, output muted"
24
+ require 'stringio'
25
+ Furnish.logger = Furnish::Logger.new(StringIO.new, 3)
26
+ end
27
+
22
28
  store = Palsy::Object.new('dummy')
23
29
  dummy = Dummy.new
24
30
  pg = Furnish::ProvisionerGroup.new(dummy, 'blarg')
@@ -46,6 +52,6 @@ class TestProvisionerGroup < Furnish::TestCase
46
52
  assert_raises(RuntimeError, "Could not deprovision #{pg.name}/#{dummy.class.name}") { pg.shutdown }
47
53
  pg.shutdown(true)
48
54
  sleep 0.1 # wait for flush
49
- assert_match(%r!Deprovision #{dummy.class.name}/#{pg.name} had errors:!, File.binread(Furnish.logger.path))
55
+ assert_match(%r!Deprovision #{dummy.class.name}/#{pg.name} had errors:!, Furnish.logger.string)
50
56
  end
51
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: furnish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-21 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: palsy
@@ -96,17 +96,17 @@ dependencies:
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
- - - ! '>='
99
+ - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: '4'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - ! '>='
107
+ - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: '4'
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: rb-fsevent
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -184,12 +184,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
184
  - - ! '>='
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
+ segments:
188
+ - 0
189
+ hash: 2505276676287387659
187
190
  required_rubygems_version: !ruby/object:Gem::Requirement
188
191
  none: false
189
192
  requirements:
190
193
  - - ! '>='
191
194
  - !ruby/object:Gem::Version
192
195
  version: '0'
196
+ segments:
197
+ - 0
198
+ hash: 2505276676287387659
193
199
  requirements: []
194
200
  rubyforge_project:
195
201
  rubygems_version: 1.8.25