summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.rspec1
-rw-r--r--Gemfile.lock2
-rw-r--r--Rakefile38
-rw-r--r--lib/oxidized/node.rb11
-rw-r--r--oxidized.gemspec2
5 files changed, 35 insertions, 19 deletions
diff --git a/.rspec b/.rspec
deleted file mode 100644
index 53607ea..0000000
--- a/.rspec
+++ /dev/null
@@ -1 +0,0 @@
---colour
diff --git a/Gemfile.lock b/Gemfile.lock
index cd39511..f9034e8 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- oxidized (0.0.18)
+ oxidized (0.0.20)
grit
net-ssh
sequel
diff --git a/Rakefile b/Rakefile
index 6801079..2e3c604 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,35 +1,47 @@
begin
+ require 'rake/testtask'
require 'bundler'
- require 'rspec/core/rake_task'
Bundler.setup
rescue LoadError
- warn 'missing dependencies'
+ warn 'bunler missing'
exit 42
end
gemspec = eval(File.read(Dir['*.gemspec'].first))
+file = [gemspec.name, gemspec.version].join('-') + '.gem'
-desc 'Validate the gemspec'
+desc 'Validate gemspec'
task :gemspec do
gemspec.validate
end
-RSpec::Core::RakeTask.new(:spec)
+desc 'Run minitest'
+task :test do
+ Rake::TestTask.new do |t|
+ t.libs.push "lib"
+ t.test_files = FileList['spec/*_spec.rb']
+ t.verbose = true
+ end
+end
-desc "Build gem locally"
-#task :build => [:spec, :gemspec] do
-task :build => [:gemspec] do
+desc 'Build gem'
+task :build do
system "gem build #{gemspec.name}.gemspec"
- FileUtils.mkdir_p "gems"
- FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "gems"
+ FileUtils.mkdir_p 'gems'
+ FileUtils.mv file, 'gems'
end
-desc "Install gem locally"
+desc 'Install gem'
task :install => :build do
- system "sudo sh -c \'umask 022; gem install gems/#{gemspec.name}-#{gemspec.version}\'"
+ system "sudo -E sh -c \'umask 022; gem install gems/#{file}\'"
end
-desc "Clean automatically generated files"
+desc 'Remove gems'
task :clean do
- FileUtils.rm_rf "gems"
+ FileUtils.rm_rf 'gems'
+end
+
+desc 'Push to rubygems'
+task :push do
+ system "gem push gems/#{file}"
end
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index 5f09096..05a926c 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -44,9 +44,14 @@ module Oxidized
if input.connect self
input.get
end
- rescue *rescue_fail.keys.flatten => err
- level = rescue_fail[err.class]
- Log.send(level, '%s raised %s with msg "%s"' % [self.ip, err.class, err.message])
+ rescue *rescue_fail.keys => err
+ resc = ''
+ if not level = rescue_fail[err.class]
+ resc = err.class.ancestors.find{|e|rescue_fail.keys.include? e}
+ level = rescue_fail[resc]
+ resc = " (rescued #{resc})"
+ end
+ Log.send(level, '%s raised %s%s with msg "%s"' % [self.ip, err.class, resc, err.message])
return false
end
end
diff --git a/oxidized.gemspec b/oxidized.gemspec
index 1394f77..cd324f1 100644
--- a/oxidized.gemspec
+++ b/oxidized.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'oxidized'
- s.version = '0.0.19'
+ s.version = '0.0.20'
s.platform = Gem::Platform::RUBY
s.authors = [ 'Saku Ytti' ]
s.email = %w( saku@ytti.fi )