activerecord-nuodb-adapter 1.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.buildpath +5 -0
- data/.gitignore +3 -0
- data/AUTHORS +4 -0
- data/COPYING +25 -0
- data/Gemfile +9 -0
- data/History.txt +4 -0
- data/LICENSE +26 -0
- data/Manifest.txt +11 -0
- data/README.rdoc +69 -0
- data/Rakefile +134 -0
- data/activerecord-nuodb-adapter.gemspec +25 -0
- data/lib/active_record/connection_adapters/nuodb/version.rb +35 -0
- data/lib/active_record/connection_adapters/nuodb_adapter.rb +778 -0
- data/lib/activerecord-nuodb-adapter.rb +29 -0
- data/lib/arel/visitors/nuodb.rb +55 -0
- data/test/test_simple.rb +181 -0
- metadata +130 -0
data/.buildpath
ADDED
data/.gitignore
ADDED
data/AUTHORS
ADDED
data/COPYING
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Copyright (c) 2012, 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/Gemfile
ADDED
data/History.txt
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2012, 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.
|
26
|
+
|
data/Manifest.txt
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
COPYING
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.md
|
5
|
+
Rakefile
|
6
|
+
lib/active_record/connection_adapters/nuodb/database_statements.rb
|
7
|
+
lib/active_record/connection_adapters/nuodb/version.rb
|
8
|
+
lib/active_record/connection_adapters/nuodb_adapter.rb
|
9
|
+
lib/activerecord-nuodb-adapter.rb
|
10
|
+
lib/arel/visitors/nuodb.rb
|
11
|
+
test/simple.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
= Ruby ActiveRecord NuoDB Adapter
|
2
|
+
|
3
|
+
== DESCRIPTION
|
4
|
+
|
5
|
+
This is the NuoDB ActiveRecord Adapter.
|
6
|
+
|
7
|
+
== BUILDING THE GEM
|
8
|
+
|
9
|
+
To compile and test run this command:
|
10
|
+
|
11
|
+
rake clean build
|
12
|
+
|
13
|
+
== INSTALLING THE GEM
|
14
|
+
|
15
|
+
gem install activerecord-nuodb-adapter-1.0.0.rc.1.gem
|
16
|
+
|
17
|
+
Or from the source tree:
|
18
|
+
|
19
|
+
gem install pkg/activerecord-nuodb-adapter-1.0.0.rc.1.gem
|
20
|
+
|
21
|
+
Or you can do this using Rake:
|
22
|
+
|
23
|
+
rake clean build uninstall install
|
24
|
+
|
25
|
+
== TESTING THE GEM
|
26
|
+
|
27
|
+
Start up a minimal chorus as follows:
|
28
|
+
|
29
|
+
java -jar ${NUODB_ROOT}/jar/nuoagent.jar --broker &
|
30
|
+
${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz &
|
31
|
+
|
32
|
+
Create a user in the database:
|
33
|
+
|
34
|
+
${NUODB_ROOT}/bin/nuosql test@localhost --user dba --password baz
|
35
|
+
> create user cloud password 'user';
|
36
|
+
> exit
|
37
|
+
|
38
|
+
Run the tests:
|
39
|
+
|
40
|
+
rake test
|
41
|
+
|
42
|
+
== PUBLISHING THE GEM
|
43
|
+
|
44
|
+
=== TAGGING
|
45
|
+
|
46
|
+
Tag the product using tags per the SemVer specification; our tags have a v-prefix:
|
47
|
+
|
48
|
+
git tag -a v1.0.0-rc.1 -m "SemVer Version: v1.0.0-rc.1"
|
49
|
+
git push --tags
|
50
|
+
|
51
|
+
If you make a mistake, take it back quickly:
|
52
|
+
|
53
|
+
git tag -d v1.0.0-rc.1
|
54
|
+
git push origin :refs/tags/v1.0.0-rc.1
|
55
|
+
|
56
|
+
===PUBLISHING
|
57
|
+
|
58
|
+
Here are the commands used to publish:
|
59
|
+
|
60
|
+
gem push pkg/nuodb-1.0.0.rc.1.gem
|
61
|
+
|
62
|
+
== INSPECTING THE GEM
|
63
|
+
|
64
|
+
It is often useful to inspect the contents of a Gem before distribution.
|
65
|
+
To do this you dump the contents of a gem thus:
|
66
|
+
|
67
|
+
gem unpack pkg/activerecord-nuodb-adapter-1.0.0.rc.1.gem
|
68
|
+
|
69
|
+
== REFERENCES
|
data/Rakefile
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2012, 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 'rdoc/task'
|
34
|
+
require 'date'
|
35
|
+
|
36
|
+
#############################################################################
|
37
|
+
#
|
38
|
+
# Helper functions
|
39
|
+
#
|
40
|
+
#############################################################################
|
41
|
+
|
42
|
+
def name
|
43
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
44
|
+
end
|
45
|
+
|
46
|
+
def version
|
47
|
+
require File.expand_path('../lib/active_record/connection_adapters/nuodb/version', __FILE__)
|
48
|
+
ActiveRecord::ConnectionAdapters::NuoDB::VERSION
|
49
|
+
end
|
50
|
+
|
51
|
+
def rubyforge_project
|
52
|
+
name
|
53
|
+
end
|
54
|
+
|
55
|
+
def date
|
56
|
+
Date.today.to_s
|
57
|
+
end
|
58
|
+
|
59
|
+
def gemspec_file
|
60
|
+
"#{name}.gemspec"
|
61
|
+
end
|
62
|
+
|
63
|
+
def gem_file
|
64
|
+
"#{name}-#{version}.gem"
|
65
|
+
end
|
66
|
+
|
67
|
+
def replace_header(head, header_name)
|
68
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'" }
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
def so_ext
|
73
|
+
case RUBY_PLATFORM
|
74
|
+
when /bsd/i, /darwin/i
|
75
|
+
# extras here...
|
76
|
+
@sh_extension = 'bundle'
|
77
|
+
when /linux/i
|
78
|
+
# extras here...
|
79
|
+
@sh_extension = 'so'
|
80
|
+
when /solaris|sunos/i
|
81
|
+
# extras here...
|
82
|
+
@sh_extension = 'so'
|
83
|
+
else
|
84
|
+
puts
|
85
|
+
puts "Unsupported platform '#{RUBY_PLATFORM}'. Supported platforms are BSD, DARWIN, and LINUX."
|
86
|
+
exit
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
#############################################################################
|
91
|
+
#
|
92
|
+
# Standard tasks
|
93
|
+
#
|
94
|
+
#############################################################################
|
95
|
+
|
96
|
+
CLEAN.include('pkg')
|
97
|
+
|
98
|
+
require 'rdoc/task'
|
99
|
+
Rake::RDocTask.new do |rdoc|
|
100
|
+
rdoc.rdoc_dir = 'rdoc'
|
101
|
+
rdoc.title = "#{name} #{version}"
|
102
|
+
rdoc.rdoc_files.include('README*')
|
103
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
104
|
+
end
|
105
|
+
|
106
|
+
Rake::TestTask.new do |t|
|
107
|
+
t.libs << 'test'
|
108
|
+
t.test_files = FileList['test/test*.rb']
|
109
|
+
end
|
110
|
+
|
111
|
+
task :default => :test
|
112
|
+
|
113
|
+
#############################################################################
|
114
|
+
#
|
115
|
+
# Packaging tasks
|
116
|
+
#
|
117
|
+
#############################################################################
|
118
|
+
|
119
|
+
GEM_NAME = "activerecord-nuodb-adapter"
|
120
|
+
|
121
|
+
desc "Build #{gem_file} into the pkg directory"
|
122
|
+
task :build do
|
123
|
+
sh "mkdir -p pkg"
|
124
|
+
sh "gem build #{gemspec_file}"
|
125
|
+
sh "mv #{gem_file} pkg"
|
126
|
+
end
|
127
|
+
|
128
|
+
task :install => :build do
|
129
|
+
sh %{gem install pkg/#{GEM_NAME}-#{ActiveRecord::ConnectionAdapters::NuoDB::VERSION} --no-rdoc --no-ri}
|
130
|
+
end
|
131
|
+
|
132
|
+
task :uninstall do
|
133
|
+
sh %{gem uninstall #{GEM_NAME} -x -v #{ActiveRecord::ConnectionAdapters::NuoDB::VERSION}}
|
134
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/active_record/connection_adapters/nuodb/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'activerecord-nuodb-adapter'
|
6
|
+
gem.version = ActiveRecord::ConnectionAdapters::NuoDB::VERSION
|
7
|
+
gem.authors = ['Robert Buck']
|
8
|
+
gem.email = %w(support@nuodb.com)
|
9
|
+
gem.description = %q{An adapter for ActiveRecord and AREL to support the NuoDB distributed database backend.}
|
10
|
+
gem.summary = %q{ActiveRecord adapter with AREL support for NuoDB.}
|
11
|
+
gem.homepage = 'http://nuodb.github.com/ruby-activerecord-nuodb-adapter/'
|
12
|
+
gem.license = 'BSD'
|
13
|
+
|
14
|
+
gem.rdoc_options = %w(--charset=UTF-8)
|
15
|
+
gem.extra_rdoc_files = %w[README.rdoc]
|
16
|
+
|
17
|
+
gem.add_dependency('activerecord', '~> 3.2.8')
|
18
|
+
gem.add_development_dependency('rake', '~> 0.9')
|
19
|
+
gem.add_development_dependency('rdoc', '~> 3.10')
|
20
|
+
gem.add_dependency('nuodb', '~> 1.0.0.rc.1')
|
21
|
+
|
22
|
+
gem.files = `git ls-files`.split($\)
|
23
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
24
|
+
gem.require_paths = %w(lib)
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2012, 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
|
+
module ActiveRecord
|
30
|
+
module ConnectionAdapters
|
31
|
+
module NuoDB
|
32
|
+
VERSION = '1.0.0.rc.1'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|