biomart 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/biomart.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{biomart}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Darren Oakley"]
9
- s.date = %q{2009-08-29}
9
+ s.date = %q{2009-10-21}
10
10
  s.description = %q{A ruby API for interacting with Biomart services.}
11
11
  s.email = ["daz.oakley@gmail.com"]
12
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
data/lib/biomart.rb CHANGED
@@ -7,7 +7,7 @@ require "rubygems"
7
7
  require "builder"
8
8
 
9
9
  module Biomart
10
- VERSION = "0.1.0"
10
+ VERSION = "0.1.1"
11
11
 
12
12
  # This is the base Biomart error/exception class. Rescue it if
13
13
  # you want to catch any exceptions that this code might raise.
@@ -137,6 +137,13 @@ module Biomart
137
137
  return biomart_xml
138
138
  end
139
139
 
140
+ # Simple heartbeat function to test that a Biomart server is online.
141
+ # Returns true/false.
142
+ def alive?
143
+ server = Biomart::Server.new( @url )
144
+ return server.alive?
145
+ end
146
+
140
147
  private
141
148
 
142
149
  # Utility function to retrieve and process the configuration
@@ -52,6 +52,19 @@ module Biomart
52
52
  return @datasets
53
53
  end
54
54
 
55
+ # Simple heartbeat function to test that a Biomart server is online.
56
+ # Returns true/false.
57
+ def alive?
58
+ begin
59
+ @databases = {} # reset the databases store
60
+ self.list_databases
61
+ rescue Biomart::BiomartError => e
62
+ return false
63
+ else
64
+ return true
65
+ end
66
+ end
67
+
55
68
  private
56
69
 
57
70
  # Utility method to do the webservice call to the biomart server
data/test/test_biomart.rb CHANGED
@@ -96,9 +96,16 @@ class BiomartTest < Test::Unit::TestCase
96
96
 
97
97
  context "The Biomart module" do
98
98
  setup do
99
- @not_biomart = Biomart::Server.new('http://www.sanger.ac.uk')
100
- @htgt_targ = @htgt.datasets["htgt_targ"]
101
- @bad_dataset = Biomart::Dataset.new( "http://www.sanger.ac.uk/htgt/biomart", { :name => "wibble" } )
99
+ @not_biomart = Biomart::Server.new( "http://www.sanger.ac.uk" )
100
+ @htgt_targ = @htgt.datasets["htgt_targ"]
101
+ @bad_dataset = Biomart::Dataset.new( "http://www.sanger.ac.uk/htgt/biomart", { :name => "wibble" } )
102
+ @good_biomart = Biomart::Server.new( "http://www.sanger.ac.uk/htgt/biomart" )
103
+ end
104
+
105
+ should "allow you to ping a server" do
106
+ assert( @good_biomart.alive?, "A good biomart does not respond 'true' to .alive?." )
107
+ assert( @htgt_targ.alive?, "A good biomart datasetdoes not respond 'true' to .alive?." )
108
+ assert_equal( false, @not_biomart.alive?, "A non-biomart server does not respond 'false' to .alive?." )
102
109
  end
103
110
 
104
111
  should "handle user/configuration errors (i.e. incorrect URLs etc)" do
data/test/test_helper.rb CHANGED
@@ -6,4 +6,4 @@ rescue LoadError
6
6
  end
7
7
 
8
8
  $:.unshift(File.dirname(__FILE__) + '/../lib')
9
- require 'Biomart'
9
+ require 'biomart'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biomart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Oakley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-29 00:00:00 +01:00
12
+ date: 2009-10-21 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency