jdbc-nuodb 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/.travis.yml +22 -0
- data/Gemfile +5 -0
- data/LICENSE +25 -0
- data/README.rdoc +98 -0
- data/Rakefile +168 -0
- data/jdbc-nuodb.gemspec +27 -0
- data/lib/jdbc/nuodb.rb +26 -0
- data/lib/nuodb-jdbc-1.0.0.jar +0 -0
- data/spec/data/.gitignore +0 -0
- data/spec/functional/connection_spec.rb +35 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/config.rb +41 -0
- data/spec/support/config.yml +9 -0
- data/spec/support/connection.rb +15 -0
- data/spec/unit/.gitignore +0 -0
- data/tasks/rspec.rb +48 -0
- data/tasks/stats.rb +24 -0
- metadata +179 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- jruby-head
|
5
|
+
|
6
|
+
env:
|
7
|
+
- NUODB_ROOT=/opt/nuodb
|
8
|
+
|
9
|
+
notifications:
|
10
|
+
recipients:
|
11
|
+
- buck.robert.j@gmail.com
|
12
|
+
- rbuck@nuodb.com
|
13
|
+
|
14
|
+
before_script:
|
15
|
+
- wget http://www.nuodb.com/latest/nuodb-1.0-GA.linux.x86_64.deb --output-document=/var/tmp/nuodb.deb
|
16
|
+
- sudo dpkg -i /var/tmp/nuodb.deb
|
17
|
+
|
18
|
+
script:
|
19
|
+
- NUODB_ROOT=/opt/nuodb bundle exec rake test install
|
20
|
+
|
21
|
+
after_script:
|
22
|
+
- sudo dpkg -r nuodb
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Copyright (c) 2012 - 2013, NuoDB, Inc.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright
|
10
|
+
notice, this list of conditions and the following disclaimer in the
|
11
|
+
documentation and/or other materials provided with the distribution.
|
12
|
+
* Neither the name of NuoDB, Inc. nor the names of its contributors may
|
13
|
+
be used to endorse or promote products derived from this software
|
14
|
+
without specific prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL NUODB, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
21
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
22
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
23
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
24
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
25
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
= NuoDB/JRuby Interface
|
2
|
+
|
3
|
+
{<img src="https://api.travis-ci.org/nuodb/jruby-jdbc-nuodb.png?branch=master" alt="Build Status" />}[http://travis-ci.org/nuodb/jruby-jdbc-nuodb]
|
4
|
+
{<img src="https://gemnasium.com/nuodb/jruby-jdbc-nuodb.png?travis" alt="Dependency Status" />}[https://gemnasium.com/nuodb/jruby-jdbc-nuodb]
|
5
|
+
{<img src="https://codeclimate.com/github/nuodb/jruby-jdbc-nuodb.png" />}[https://codeclimate.com/github/nuodb/jruby-jdbc-nuodb]
|
6
|
+
|
7
|
+
== DESCRIPTION
|
8
|
+
|
9
|
+
This is the official JRuby Gem for NuoDB. It is implemented as a JDBC driver.
|
10
|
+
|
11
|
+
It is a native Java driver that converts JDBC (Java Database Connectivity)
|
12
|
+
calls into the network protocol used by the NuoDB database.
|
13
|
+
|
14
|
+
== Usage
|
15
|
+
|
16
|
+
To make the driver accessible to JDBC and ActiveRecord code running in JRuby :
|
17
|
+
|
18
|
+
require 'jdbc/nuodb'
|
19
|
+
Jdbc::NuoDB.load_driver
|
20
|
+
|
21
|
+
== ENVIRONMENT SETUP
|
22
|
+
|
23
|
+
=== MAC
|
24
|
+
|
25
|
+
To set up JRuby on Mac, you may optimally install RVM and use that to install
|
26
|
+
JRuby, or you may also install it from the package installer available online
|
27
|
+
which requires additional environment setup.
|
28
|
+
|
29
|
+
For Mac, run the package installer available at:
|
30
|
+
|
31
|
+
http://jruby.org.s3.amazonaws.com/downloads/1.7.2/JRuby-1.7.2.dmg
|
32
|
+
|
33
|
+
Then update your path so that the Gem from JRuby is first on your path ahead
|
34
|
+
of the system installed ruby:
|
35
|
+
|
36
|
+
export PATH=/Library/Frameworks/JRuby.framework/Versions/Current/bin:$PATH
|
37
|
+
|
38
|
+
== BUILDING THE GEM
|
39
|
+
|
40
|
+
To compile and test run this command:
|
41
|
+
|
42
|
+
rake clean build spec
|
43
|
+
|
44
|
+
== INSTALLING THE GEM
|
45
|
+
|
46
|
+
gem install jdbc-nuodb-1.0.0.gem
|
47
|
+
|
48
|
+
Or from the source tree:
|
49
|
+
|
50
|
+
gem install pkg/jdbc-nuodb-1.0.0.gem
|
51
|
+
|
52
|
+
== TESTING THE GEM
|
53
|
+
|
54
|
+
Start up a minimal chorus as follows:
|
55
|
+
|
56
|
+
export NUODB_ROOT=/path/to/nuodb/install/directory
|
57
|
+
java -jar ${NUODB_ROOT}/jar/nuoagent.jar --broker &
|
58
|
+
${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz --verbose debug --archive /var/tmp/nuodb --initialize --force &
|
59
|
+
${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz &
|
60
|
+
|
61
|
+
Create a user in the database:
|
62
|
+
|
63
|
+
${NUODB_ROOT}/bin/nuosql test@localhost --user dba --password baz
|
64
|
+
> create user cloud password 'user';
|
65
|
+
> exit
|
66
|
+
|
67
|
+
Run the tests:
|
68
|
+
|
69
|
+
rake spec
|
70
|
+
|
71
|
+
== PUBLISHING THE GEM
|
72
|
+
|
73
|
+
=== TAGGING
|
74
|
+
|
75
|
+
Tag the product using tags per the SemVer specification; our tags have a v-prefix:
|
76
|
+
|
77
|
+
git tag -a v1.0.0 -m "SemVer Version: v1.0.0"
|
78
|
+
|
79
|
+
If you make a mistake, take it back quickly:
|
80
|
+
|
81
|
+
git tag -d v1.0.0
|
82
|
+
git push origin :refs/tags/v1.0.0
|
83
|
+
|
84
|
+
===PUBLISHING
|
85
|
+
|
86
|
+
Here are the commands used to publish:
|
87
|
+
|
88
|
+
gem push pkg/jdbc-nuodb-1.0.0.gem
|
89
|
+
|
90
|
+
== INSPECTING THE GEM
|
91
|
+
|
92
|
+
It is often useful to inspect the contents of a Gem before distribution.
|
93
|
+
To do this you dump the contents of a gem thus:
|
94
|
+
|
95
|
+
gem unpack pkg/jdbc-nuodb-1.0.0.gem
|
96
|
+
|
97
|
+
== REFERENCES
|
98
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2012 - 2013, NuoDB, Inc.
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer in the
|
12
|
+
# documentation and/or other materials provided with the distribution.
|
13
|
+
# * Neither the name of NuoDB, Inc. nor the names of its contributors may
|
14
|
+
# be used to endorse or promote products derived from this software
|
15
|
+
# without specific prior written permission.
|
16
|
+
#
|
17
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
18
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
+
# DISCLAIMED. IN NO EVENT SHALL NUODB, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
|
21
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
23
|
+
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
25
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
26
|
+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
#
|
28
|
+
|
29
|
+
require 'rubygems'
|
30
|
+
require 'rake'
|
31
|
+
require 'rake/clean'
|
32
|
+
require 'rake/testtask'
|
33
|
+
require 'date'
|
34
|
+
|
35
|
+
require 'bundler'
|
36
|
+
require 'bundler/gem_tasks'
|
37
|
+
|
38
|
+
require File.expand_path(File.dirname(__FILE__)) + "/spec/support/config"
|
39
|
+
require File.expand_path(File.dirname(__FILE__)) + "/tasks/rspec"
|
40
|
+
|
41
|
+
Bundler::GemHelper.install_tasks
|
42
|
+
|
43
|
+
load 'jdbc-nuodb.gemspec'
|
44
|
+
|
45
|
+
#############################################################################
|
46
|
+
#
|
47
|
+
# Helper functions
|
48
|
+
#
|
49
|
+
#############################################################################
|
50
|
+
|
51
|
+
def name
|
52
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
53
|
+
end
|
54
|
+
|
55
|
+
def version
|
56
|
+
require File.expand_path('../lib/jdbc/nuodb', __FILE__)
|
57
|
+
Jdbc::NuoDB::VERSION
|
58
|
+
end
|
59
|
+
|
60
|
+
def rubyforge_project
|
61
|
+
name
|
62
|
+
end
|
63
|
+
|
64
|
+
def date
|
65
|
+
Date.today.to_s
|
66
|
+
end
|
67
|
+
|
68
|
+
def gemspec_file
|
69
|
+
"#{name}.gemspec"
|
70
|
+
end
|
71
|
+
|
72
|
+
def gem_file
|
73
|
+
"#{name}-#{version}.gem"
|
74
|
+
end
|
75
|
+
|
76
|
+
def replace_header(head, header_name)
|
77
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'" }
|
78
|
+
end
|
79
|
+
|
80
|
+
#############################################################################
|
81
|
+
#
|
82
|
+
# Standard tasks
|
83
|
+
#
|
84
|
+
#############################################################################
|
85
|
+
|
86
|
+
CLEAN.include('pkg')
|
87
|
+
|
88
|
+
Dir['tasks/**/*.rb'].each { |file| load file }
|
89
|
+
|
90
|
+
namespace :nuodb do
|
91
|
+
|
92
|
+
task :install do
|
93
|
+
if ENV['NUODB_ROOT'].nil?
|
94
|
+
case RUBY_PLATFORM
|
95
|
+
when /linux/i
|
96
|
+
unless File.exists? '/etc/redhat-release'
|
97
|
+
puts %x(wget http://www.nuodb.com/latest/nuodb-1.0-GA.linux.x86_64.deb --output-document=/var/tmp/nuodb.deb)
|
98
|
+
puts %x(sudo dpkg -i /var/tmp/nuodb.deb)
|
99
|
+
end
|
100
|
+
else
|
101
|
+
puts "Unsupported platform '#{RUBY_PLATFORM}'. Supported platforms are BSD, DARWIN, SOLARIS, and LINUX."
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
task :remove do
|
107
|
+
if ENV['NUODB_ROOT'].nil?
|
108
|
+
case RUBY_PLATFORM
|
109
|
+
when /linux/i
|
110
|
+
unless File.exists? '/etc/redhat-release'
|
111
|
+
puts %x(sudo dpkg -r nuodb)
|
112
|
+
end
|
113
|
+
else
|
114
|
+
puts "Unsupported platform '#{RUBY_PLATFORM}'. Supported platforms are BSD, DARWIN, SOLARIS, and LINUX."
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
task :create_user do
|
120
|
+
#puts %x( echo "create user arunit password 'arunit';" | nuosql arunit@localhost --user dba --password baz )
|
121
|
+
end
|
122
|
+
|
123
|
+
task :start_server do
|
124
|
+
end
|
125
|
+
|
126
|
+
task :stop_server do
|
127
|
+
end
|
128
|
+
|
129
|
+
task :restart_server => [:stop_server, :start_server, :create_user]
|
130
|
+
end
|
131
|
+
|
132
|
+
task :spec => :build
|
133
|
+
|
134
|
+
task :default => :spec
|
135
|
+
|
136
|
+
#############################################################################
|
137
|
+
#
|
138
|
+
# Packaging tasks
|
139
|
+
#
|
140
|
+
#############################################################################
|
141
|
+
|
142
|
+
desc "Build #{gem_file} into the pkg directory"
|
143
|
+
task :build do
|
144
|
+
sh "mkdir -p pkg"
|
145
|
+
sh "gem build #{gemspec_file}"
|
146
|
+
sh "mv #{gem_file} pkg"
|
147
|
+
end
|
148
|
+
|
149
|
+
task :install => :build do
|
150
|
+
sh %{gem install pkg/#{name}-#{version}}
|
151
|
+
end
|
152
|
+
|
153
|
+
task :uninstall do
|
154
|
+
sh %{gem uninstall #{name} -x -v #{version}}
|
155
|
+
end
|
156
|
+
|
157
|
+
desc "Tags git with the latest gem version"
|
158
|
+
task :tag do
|
159
|
+
sh %{git tag v#{version}}
|
160
|
+
end
|
161
|
+
|
162
|
+
desc "Push gem packages"
|
163
|
+
task :push => :build do
|
164
|
+
sh "gem push pkg/#{name}*.gem"
|
165
|
+
end
|
166
|
+
|
167
|
+
desc "Release version #{version}"
|
168
|
+
task :release => [:tag, :push]
|
data/jdbc-nuodb.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jdbc/nuodb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'jdbc-nuodb'
|
8
|
+
spec.version = Jdbc::NuoDB::VERSION
|
9
|
+
spec.authors = ['Robert Buck']
|
10
|
+
spec.email = %w(rbuck@nuodb.com, support@nuodb.com)
|
11
|
+
spec.description = %q{JRuby JDBC driver for the NuoDB distributed database.}
|
12
|
+
spec.summary = %q{JRuby JDBC driver for NuoDB.}
|
13
|
+
spec.homepage = 'http://nuodb.github.com/jruby-jdbc-nuodb/'
|
14
|
+
spec.license = 'BSD'
|
15
|
+
|
16
|
+
spec.rdoc_options = %w(--charset=UTF-8)
|
17
|
+
spec.extra_rdoc_files = %w[README.rdoc LICENSE]
|
18
|
+
|
19
|
+
spec.files = `git ls-files`.split($\)
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = %w(lib)
|
22
|
+
|
23
|
+
spec.add_development_dependency('rake', '~> 10.0.3')
|
24
|
+
|
25
|
+
%w(rake).each { |gem| spec.add_development_dependency gem }
|
26
|
+
%w(rspec rspec-core rspec-expectations rspec-mocks).each { |gem| spec.add_development_dependency gem, "~> 2.11.0" }
|
27
|
+
end
|
data/lib/jdbc/nuodb.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Jdbc
|
2
|
+
module NuoDB
|
3
|
+
VERSION = "1.0.0"
|
4
|
+
|
5
|
+
def self.driver_jar
|
6
|
+
"nuodb-jdbc-#{VERSION.split('.')[0..2].join('.')}.jar"
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.load_driver(method = :load)
|
10
|
+
send method, driver_jar
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.driver_name
|
14
|
+
'com.nuodb.jdbc.Driver'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
if $VERBOSE && (JRUBY_VERSION.nil? rescue true)
|
20
|
+
warn "Jdbc-NuoDB is only for use with JRuby"
|
21
|
+
end
|
22
|
+
|
23
|
+
unless Java::JavaLang::Boolean.get_boolean("arjdbc.skip.autoload")
|
24
|
+
warn "Autoloading driver which is now deprecated. Set arjdbc.skip.autoload=true to disable autoload."
|
25
|
+
Jdbc::NuoDB::load_driver :require
|
26
|
+
end
|
Binary file
|
File without changes
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Jdbc::NuoDB do
|
4
|
+
before do
|
5
|
+
end
|
6
|
+
|
7
|
+
after do
|
8
|
+
end
|
9
|
+
|
10
|
+
context "creating a connection" do
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
end
|
14
|
+
|
15
|
+
after(:each) do
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should raise an SQLException when provided a database that cannot be connected to" do
|
19
|
+
lambda {
|
20
|
+
url = "jdbc:com.nuodb://noexist:48004/test?schema=test"
|
21
|
+
java.sql.DriverManager.getConnection(url)
|
22
|
+
}.should raise_error(java.sql.SQLException)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should not raise an SQLException when provided a database that can be connected to" do
|
26
|
+
lambda {
|
27
|
+
con_props = java.util.Properties.new
|
28
|
+
con_props.setProperty("user", "cloud")
|
29
|
+
con_props.setProperty("password", "user")
|
30
|
+
url = "jdbc:com.nuodb://localhost:48004/test?schema=test"
|
31
|
+
java.sql.DriverManager.getConnection(url, con_props)
|
32
|
+
}.should_not raise_error(java.sql.SQLException)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/rcov.opts
ADDED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift File.expand_path("../..", __FILE__)
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rspec/mocks'
|
5
|
+
|
6
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
7
|
+
$:.unshift(File.expand_path("../lib", __FILE__))
|
8
|
+
$:.unshift(File.dirname(__FILE__))
|
9
|
+
|
10
|
+
require 'java'
|
11
|
+
require 'jdbc/nuodb'
|
12
|
+
require 'support/config'
|
13
|
+
require 'support/connection'
|
14
|
+
|
15
|
+
#module JavaLang
|
16
|
+
# include_package 'java.lang'
|
17
|
+
#end
|
18
|
+
#
|
19
|
+
#module JavaSQL
|
20
|
+
# include_package 'java.sql'
|
21
|
+
#end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#require 'yaml'
|
2
|
+
#require 'fileutils'
|
3
|
+
#require 'pathname'
|
4
|
+
#
|
5
|
+
#SPEC_ROOT = File.expand_path(File.dirname(__FILE__))
|
6
|
+
#
|
7
|
+
#class Hash
|
8
|
+
# def symbolize_keys!
|
9
|
+
# keys.each do |key|
|
10
|
+
# self[(key.to_sym rescue key) || key] = delete(key)
|
11
|
+
# end
|
12
|
+
# self
|
13
|
+
# end
|
14
|
+
#end
|
15
|
+
#
|
16
|
+
#module BaseTest
|
17
|
+
# class << self
|
18
|
+
# def config
|
19
|
+
# @config ||= read_config
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# private
|
23
|
+
#
|
24
|
+
# def config_file
|
25
|
+
# Pathname.new(ENV['NUODB_CONFIG'] || File.join(SPEC_ROOT, 'config.yml'))
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# def read_config
|
29
|
+
# unless config_file.exist?
|
30
|
+
# FileUtils.cp(File.join(SPEC_ROOT, 'config.example.yml'), config_file)
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# erb = Erubis::Eruby.new(config_file.read)
|
34
|
+
# expand_config(YAML.parse(erb.result(binding)).transform)
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# def expand_config(config)
|
38
|
+
# config
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
#end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#require 'logger'
|
2
|
+
#
|
3
|
+
#module BaseTest
|
4
|
+
# def self.connection_name
|
5
|
+
# ENV['NUODB_CONN'] || config['default_connection']
|
6
|
+
# end
|
7
|
+
#
|
8
|
+
# def self.connection_config
|
9
|
+
# config['connections'][connection_name].symbolize_keys!
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# def self.connect
|
13
|
+
# NuoDB::Connection.new connection_config
|
14
|
+
# end
|
15
|
+
#end
|
File without changes
|
data/tasks/rspec.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
GEM_ROOT ||= File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
5
|
+
|
6
|
+
begin
|
7
|
+
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
|
10
|
+
task :default => :spec
|
11
|
+
|
12
|
+
desc "Run all specs in spec directory"
|
13
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
14
|
+
t.rspec_opts = ['--options', "\"#{GEM_ROOT}/.rspec\""]
|
15
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Run all rspec functional tests (in functional/ directory)"
|
19
|
+
RSpec::Core::RakeTask.new(:functional) do |t|
|
20
|
+
t.rspec_opts = ['--options', "\"#{GEM_ROOT}/spec/spec.opts\""]
|
21
|
+
t.pattern = FileList['spec/functional/**/*_spec.rb']
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Run all rspec unit tests (in unit/ directory)"
|
25
|
+
RSpec::Core::RakeTask.new(:spec_unit) do |t|
|
26
|
+
t.rspec_opts = ['--options', "\"#{GEM_ROOT}/.rspec\""]
|
27
|
+
t.pattern = FileList['spec/unit/**/*_spec.rb']
|
28
|
+
end
|
29
|
+
|
30
|
+
namespace :spec do
|
31
|
+
desc "Print Specdoc for all specs"
|
32
|
+
RSpec::Core::RakeTask.new(:doc) do |t|
|
33
|
+
t.rspec_opts = %w(--format specdoc --dry-run)
|
34
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
35
|
+
end
|
36
|
+
|
37
|
+
[:unit].each do |sub|
|
38
|
+
desc "Run the specs under spec/#{sub}"
|
39
|
+
RSpec::Core::RakeTask.new(sub) do |t|
|
40
|
+
t.rspec_opts = ['--options', "\"#{GEM_ROOT}/spec/spec.opts\""]
|
41
|
+
t.pattern = FileList["spec/#{sub}/**/*_spec.rb"]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
rescue LoadError
|
47
|
+
STDERR.puts "\n*** RSpec not available. (sudo) gem install rspec to run unit tests. ***\n\n"
|
48
|
+
end
|
data/tasks/stats.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
desc "Prints lines of code metrics"
|
2
|
+
task :stats do
|
3
|
+
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
4
|
+
|
5
|
+
FileList["lib/nuodb/**/*.rb", "ext/nuodb/*.cpp"].each { |file_name|
|
6
|
+
next if file_name =~ /vendor/
|
7
|
+
f = File.open(file_name)
|
8
|
+
|
9
|
+
while (line = f.gets)
|
10
|
+
lines += 1
|
11
|
+
next if line =~ /^\s*$/
|
12
|
+
next if line =~ /^\s*#/
|
13
|
+
codelines += 1
|
14
|
+
end
|
15
|
+
puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
|
16
|
+
|
17
|
+
total_lines += lines
|
18
|
+
total_codelines += codelines
|
19
|
+
|
20
|
+
lines, codelines = 0, 0
|
21
|
+
}
|
22
|
+
|
23
|
+
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jdbc-nuodb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robert Buck
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 10.0.3
|
21
|
+
none: false
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 10.0.3
|
27
|
+
none: false
|
28
|
+
prerelease: false
|
29
|
+
type: :development
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: !binary |-
|
37
|
+
MA==
|
38
|
+
none: false
|
39
|
+
requirement: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: !binary |-
|
44
|
+
MA==
|
45
|
+
none: false
|
46
|
+
prerelease: false
|
47
|
+
type: :development
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.11.0
|
55
|
+
none: false
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.11.0
|
61
|
+
none: false
|
62
|
+
prerelease: false
|
63
|
+
type: :development
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: rspec-core
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 2.11.0
|
71
|
+
none: false
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.11.0
|
77
|
+
none: false
|
78
|
+
prerelease: false
|
79
|
+
type: :development
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec-expectations
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - "~>"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 2.11.0
|
87
|
+
none: false
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 2.11.0
|
93
|
+
none: false
|
94
|
+
prerelease: false
|
95
|
+
type: :development
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rspec-mocks
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 2.11.0
|
103
|
+
none: false
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 2.11.0
|
109
|
+
none: false
|
110
|
+
prerelease: false
|
111
|
+
type: :development
|
112
|
+
description: JRuby JDBC driver for the NuoDB distributed database.
|
113
|
+
email:
|
114
|
+
- rbuck@nuodb.com,
|
115
|
+
- support@nuodb.com
|
116
|
+
executables: []
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files:
|
119
|
+
- README.rdoc
|
120
|
+
- LICENSE
|
121
|
+
files:
|
122
|
+
- ".gitignore"
|
123
|
+
- ".travis.yml"
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE
|
126
|
+
- README.rdoc
|
127
|
+
- Rakefile
|
128
|
+
- jdbc-nuodb.gemspec
|
129
|
+
- lib/jdbc/nuodb.rb
|
130
|
+
- lib/nuodb-jdbc-1.0.0.jar
|
131
|
+
- spec/data/.gitignore
|
132
|
+
- spec/functional/connection_spec.rb
|
133
|
+
- spec/rcov.opts
|
134
|
+
- spec/spec.opts
|
135
|
+
- spec/spec_helper.rb
|
136
|
+
- spec/support/config.rb
|
137
|
+
- spec/support/config.yml
|
138
|
+
- spec/support/connection.rb
|
139
|
+
- spec/unit/.gitignore
|
140
|
+
- tasks/rspec.rb
|
141
|
+
- tasks/stats.rb
|
142
|
+
homepage: http://nuodb.github.com/jruby-jdbc-nuodb/
|
143
|
+
licenses:
|
144
|
+
- BSD
|
145
|
+
post_install_message:
|
146
|
+
rdoc_options:
|
147
|
+
- "--charset=UTF-8"
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: !binary |-
|
155
|
+
MA==
|
156
|
+
none: false
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: !binary |-
|
162
|
+
MA==
|
163
|
+
none: false
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 1.8.24
|
167
|
+
signing_key:
|
168
|
+
specification_version: 3
|
169
|
+
summary: JRuby JDBC driver for NuoDB.
|
170
|
+
test_files:
|
171
|
+
- spec/data/.gitignore
|
172
|
+
- spec/functional/connection_spec.rb
|
173
|
+
- spec/rcov.opts
|
174
|
+
- spec/spec.opts
|
175
|
+
- spec/spec_helper.rb
|
176
|
+
- spec/support/config.rb
|
177
|
+
- spec/support/config.yml
|
178
|
+
- spec/support/connection.rb
|
179
|
+
- spec/unit/.gitignore
|