bives 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDBiZWJmYmRmZTMxNmFkNGIxZTg3ZDQ1ZGZmZTI5YjMyNjM2YmJiYQ==
5
+ data.tar.gz: !binary |-
6
+ ZDgxMTg5MTgyOTk4ZGVhMTI1OGIyMjU5ODU1NjRkNDUzNWQ1ZjQwYg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDgwZDY5MjhlOTk5MDQzZDYwZmRjOWYzNTQyM2E2YzFkOWE4ZTdkYjAzMWY0
10
+ Mjk2M2I4MDBlYjdkNmY5MjdlYmE0Yjc3MDkxZTNkYTM5YjYxNjIxNGI3OGY3
11
+ MjIxZGZjOTU0ODI2MjFkMzRmMWRiOGQ3MmNmOTBjOGQ1OTU5YzA=
12
+ data.tar.gz: !binary |-
13
+ ZDhiODFhYzNmYTFmNDRkODllMDVkMTY2ZGZmZDg4NjY1ZWEzYjEwMGFmNmU4
14
+ NWNjMTcwZGY4ZTQ3MmYxMDc2MzZlZjUyYmMwNmMzNjhjMWI5YzgwMDdhMzg2
15
+ OTBkNWU3N2MzNzdmZWI2ZWY4OGFiZjQ2ODJlY2U3YmI4Mzc2ZmI=
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea/
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ bives
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p484
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bevis.gemspec
4
+ gemspec
5
+
6
+ gem "open4","1.3.0"
7
+ gem "minitest"
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Stuart Owen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Bevis
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'bevis'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install bevis
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bives.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bives/version'
5
+ require "bundler/gem_tasks"
6
+
7
+ require 'rake/testtask'
8
+
9
+ Rake::TestTask.new do |t|
10
+ t.libs << 'lib/bives'
11
+ t.test_files = FileList['test/*_test.rb']
12
+ t.verbose = true
13
+ end
14
+
15
+ Gem::Specification.new do |spec|
16
+ spec.name = "bives"
17
+ spec.version = Bives::VERSION
18
+ spec.authors = ["Stuart Owen"]
19
+ spec.email = ["stuart.owen@manchester.ac.uk"]
20
+ spec.description = %q{Ruby wrapper for the BiVeS model version comparison tool}
21
+ spec.summary = %q{Ruby wrapper to interface with the BiVeS model version comparison tool - http://sems.uni-rostock.de/projects/bives/}
22
+ spec.homepage = ""
23
+ spec.license = "MIT"
24
+
25
+ spec.files = `git ls-files`.split($/)
26
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
27
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency "rake"
32
+ end
33
+
34
+
35
+
36
+
@@ -0,0 +1,3 @@
1
+ module Bives
2
+ VERSION = "0.1"
3
+ end
data/lib/bives.rb ADDED
@@ -0,0 +1,40 @@
1
+ require_relative "bives/version"
2
+ require 'open4'
3
+
4
+ module Bives
5
+ JAR_FILENAME = "BiVeS-1.1.2-SNAPSHOT-fat.jar"
6
+ JAR_FILEPATH = File.join File.dirname(__FILE__),"jars","#{JAR_FILENAME}"
7
+
8
+ def self.included(mod)
9
+ unless File.exist?(JAR_FILEPATH)
10
+ raise "Jar file #{JAR_FILEPATH} not found"
11
+ end
12
+ end
13
+
14
+ def compare file1,file2,opts=["reportHtml"]
15
+ cmd_opts = opts.collect{|o| "--#{o}"}.join(" ")
16
+ command = "java -jar #{JAR_FILEPATH} #{cmd_opts} #{file1} #{file2}"
17
+
18
+ err_message = ""
19
+ output = ""
20
+ status = Open4::popen4(command) do |pid, stdin, stdout, stderr|
21
+
22
+
23
+ while ((line = stdout.gets) != nil) do
24
+ output << line
25
+ end
26
+ stdout.close
27
+
28
+ while ((line=stderr.gets)!= nil) do
29
+ err_message << line
30
+ end
31
+ stderr.close
32
+ end
33
+
34
+ if status.to_i != 0
35
+ raise err_message
36
+ end
37
+
38
+ output.strip
39
+ end
40
+ end
@@ -0,0 +1,21 @@
1
+ require 'minitest/unit'
2
+ require "minitest/autorun"
3
+ require_relative '../lib/bives'
4
+
5
+ class BivesTest < MiniTest::Unit::TestCase
6
+ include Bives
7
+
8
+ def setup
9
+ @potato1 = File.expand_path('../models/potato1.xml', __FILE__)
10
+ @potato2 = File.expand_path('../models/potato2.xml', __FILE__)
11
+
12
+ assert File.exist?(@potato1)
13
+ assert File.exist?(@potato2)
14
+ end
15
+
16
+ def test_compare
17
+ #puts compare(@potato1, @potato2)
18
+ puts compare(@potato1,@potato2,["reportHtml"])
19
+ end
20
+
21
+ end