nuodb 1.0.0.rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ *.bundle
2
+ *.log
3
+ *.o
4
+ *.so
5
+ ext/nuodb/Makefile
6
+ pkg
7
+ tmp
8
+ .idea
data/AUTHORS ADDED
@@ -0,0 +1,4 @@
1
+ # Authors ordered by first contribution.
2
+
3
+ Dave Meppelink <davemepp@gmail.com>
4
+
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
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group(:development, :test) do
6
+ gem 'rake'
7
+ gem 'rake-compiler'
8
+ gem 'rdoc'
9
+ end
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 1.0.0
2
+
3
+ First release of the NuoDB API gem.
4
+
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,10 @@
1
+ COPYING
2
+ History.txt
3
+ Manifest.txt
4
+ README.md
5
+ Rakefile
6
+ ext/nuodb/extconf.rb
7
+ ext/nuodb/nuodb.cpp
8
+ lib/nuodb.rb
9
+ lib/nuodb/version.rb
10
+ test/test_nuodb.rb
data/README.rdoc ADDED
@@ -0,0 +1,77 @@
1
+ = NuoDB/Ruby Interface
2
+
3
+ == DESCRIPTION
4
+
5
+ This is the NuoDB API module for Ruby. It integrates the NuoDB C++
6
+ library into Ruby.
7
+
8
+ == BUILDING THE GEM
9
+
10
+ To compile and test run this command:
11
+
12
+ rake build
13
+
14
+ == INSTALLING THE GEM
15
+
16
+ NUODB_ROOT=/Users/rbuck/tmp/nuodb gem install nuodb-1.0.0-rc.1.gem
17
+
18
+ Or from the source tree:
19
+
20
+ NUODB_ROOT=/Users/rbuck/tmp/nuodb gem install pkg/nuodb-1.0.0-rc.1.gem
21
+
22
+ == TESTING THE GEM
23
+
24
+ Start up a minimal chorus as follows:
25
+
26
+ java -jar nuoagent.jar --broker &
27
+ ./nuodb --chorus test --password bar --dba-user dba --dba-password baz &
28
+
29
+ Create a user in the database:
30
+
31
+ ./nuosql test@localhost --user dba --password baz
32
+ > create user cloud password 'user';
33
+ > exit
34
+
35
+ Run the tests:
36
+
37
+ rake test
38
+
39
+ == PUBLISHING THE GEM
40
+
41
+ === TAGGING
42
+
43
+ Tag the product using tags per the SemVer specification; our tags have a v-prefix:
44
+
45
+ git tag -a v1.0.0.rc.1 -m "SemVer Version: v1.0.0-rc.1"
46
+
47
+ If you make a mistake, take it back quickly:
48
+
49
+ git tag -d v1.0.0.rc.1
50
+ git push origin :refs/tags/v1.0.0.rc.1
51
+
52
+ ===PUBLISHING
53
+
54
+ Here are the commands used to publish:
55
+
56
+ gem push pkg/nuodb-1.0.0.rc.1.gem
57
+
58
+ If you bugger it up, pull it back quickly, or cause grief for users:
59
+
60
+ npm unpublish db-nuodb@1.0.0.RC.1
61
+
62
+ To view published versions:
63
+
64
+ npm view db-nuodb
65
+
66
+ == INSPECTING THE GEM
67
+
68
+ It is often useful to inspect the contents of a Gem before distribution.
69
+ To do this you dump the contents of a gem thus:
70
+
71
+ gem unpack pkg/nuodb-1.0.0.rc.1.gem
72
+
73
+ == INSPECTING THE EXPORTED SYMBOLS
74
+
75
+ nm -gU ext/nuodb/nuodb.bundle
76
+
77
+ == REFERENCES
data/Rakefile ADDED
@@ -0,0 +1,146 @@
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/nuodb/version', __FILE__)
48
+ 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
+ CLEAN.include('ext/**/*{.o,.log,.so,.bundle}')
98
+ CLEAN.include('ext/**/Makefile')
99
+ CLEAN.include('lib/**/*{.so,.bundle}')
100
+
101
+ require 'rdoc/task'
102
+ Rake::RDocTask.new do |rdoc|
103
+ rdoc.rdoc_dir = 'rdoc'
104
+ rdoc.title = "#{name} #{version}"
105
+ rdoc.rdoc_files.include('README*')
106
+ rdoc.rdoc_files.include('lib/**/*.rb')
107
+ end
108
+
109
+ file "lib/#{name}/#{name}.#{so_ext}" => Dir.glob("ext/#{name}/*{.rb,.c}") do
110
+ Dir.chdir("ext/#{name}") do
111
+ # this does essentially the same thing
112
+ # as what RubyGems does
113
+ ruby "extconf.rb"
114
+ sh "make"
115
+ end
116
+ cp "ext/#{name}/#{name}.#{so_ext}", "lib/#{name}"
117
+ end
118
+
119
+ task :test => "lib/#{name}/#{name}.#{so_ext}"
120
+
121
+ Rake::TestTask.new do |t|
122
+ t.libs << 'test'
123
+ end
124
+
125
+ task :default => :test
126
+
127
+ #############################################################################
128
+ #
129
+ # Packaging tasks
130
+ #
131
+ #############################################################################
132
+
133
+ desc "Build #{gem_file} into the pkg directory"
134
+ task :build do
135
+ sh "mkdir -p pkg"
136
+ sh "gem build #{gemspec_file}"
137
+ sh "mv #{gem_file} pkg"
138
+ end
139
+
140
+ task :install => :build do
141
+ sh %{gem install pkg/#{name}-#{version} --no-rdoc --no-ri}
142
+ end
143
+
144
+ task :uninstall do
145
+ sh %{gem uninstall #{name} -x -v #{version}}
146
+ end
@@ -0,0 +1,152 @@
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 'fileutils'
30
+ require 'pathname'
31
+ require 'mkmf'
32
+ require 'find'
33
+
34
+ nuodb_include = nil
35
+ nuodb_lib64 = nil
36
+
37
+ case RUBY_PLATFORM
38
+ when /solaris|sunos/i
39
+ have_library('stdc++')
40
+ $CC = "gcc"
41
+ $CXX = "g++"
42
+ $LIBS << " -lstdc++ -lc"
43
+ end
44
+
45
+ def dylib_extension
46
+ case RUBY_PLATFORM
47
+ when /bsd/i, /darwin/i
48
+ # extras here...
49
+ 'dylib'
50
+ when /linux/i, /solaris|sunos/i
51
+ # extras here...
52
+ 'so'
53
+ else
54
+ puts "Unsupported platform '#{RUBY_PLATFORM}'. Supported platforms are BSD, DARWIN, SOLARIS, and LINUX."
55
+ raise
56
+ end
57
+ end
58
+
59
+ def nuodb_home?(path)
60
+ unless path.nil?
61
+ incl = File.join(path, 'include')
62
+ libs = File.join(path, 'lib64')
63
+ if File.directory? incl and File.directory? libs
64
+ [incl, libs]
65
+ else
66
+ [nil, nil]
67
+ end
68
+ end
69
+ end
70
+
71
+ def nuodb_srcs?(path)
72
+ if File.directory? path
73
+ entries = Dir.entries path
74
+ if entries.include? 'CMakeLists.txt'
75
+ remote_dir = File.join(path, 'Remote')
76
+ dylib_paths = []
77
+ Find.find(remote_dir) do |file|
78
+ if File.file? file
79
+ basename = "libNuoRemote.#{dylib_extension}"
80
+ dylib_paths << file unless file !~ /#{basename}/
81
+ end
82
+ end
83
+ [File.join(path, 'Remote'), File.dirname(dylib_paths[0])] unless dylib_paths.length == 0
84
+ else
85
+ pathname = Pathname.new path
86
+ nuodb_srcs? File.expand_path("..", path) unless pathname.root?
87
+ end
88
+ end
89
+ end
90
+
91
+ if nuodb_include.nil? and nuodb_lib64.nil?
92
+ nuodb_include, nuodb_lib64 = nuodb_home? ENV['NUODB_ROOT']
93
+ end
94
+
95
+ # Like other package managers, gems do not install from the source directory
96
+ # even if they are installed from a local .gem file. Because of this we need
97
+ # to provide a fake NUODB_ROOT when building the gems within our source tree
98
+ # so that the installation process can find build artifacts and sources; the
99
+ # section below handles this special case so that we can run our test suites.
100
+
101
+ if nuodb_include.nil? and nuodb_lib64.nil?
102
+ nuodb_include, nuodb_lib64 = nuodb_srcs? ENV['NUODB_ROOT']
103
+ end
104
+
105
+ # Lastly we fall back to detecting the location of installed product against
106
+ # which we compile and link.
107
+
108
+ if nuodb_include.nil? and nuodb_lib64.nil?
109
+ nuodb_include, nuodb_lib64 = nuodb_home? '/opt/nuodb'
110
+ end
111
+
112
+ def dir_exists? (path)
113
+ !path.nil? and File.directory? path
114
+ end
115
+
116
+ unless dir_exists? nuodb_include and dir_exists? nuodb_lib64
117
+ puts
118
+ puts "Neither NUODB_ROOT is set, nor is NuoDB installed to /opt/nuodb platform. Please set NUODB_ROOT to refer to NuoDB installation directory."
119
+ exit(false)
120
+ end
121
+
122
+ dir_config('nuodb', nuodb_include, nuodb_lib64)
123
+ have_library("NuoRemote") or raise
124
+
125
+ if have_header('stdint.h') then
126
+ $CPPFLAGS << " -DHAVE_STDINT_H"
127
+ end
128
+
129
+ if CONFIG['warnflags']
130
+ CONFIG['warnflags'].slice!(/-Wdeclaration-after-statement/)
131
+ CONFIG['warnflags'].slice!(/-Wimplicit-function-declaration/)
132
+ end
133
+
134
+ case RUBY_PLATFORM
135
+ when /bsd/i, /darwin/i, /linux/i, /solaris|sunos/i
136
+ case RUBY_PLATFORM
137
+ when /bsd/i, /darwin/i
138
+ # extras here...
139
+ $LDFLAGS << " -Xlinker -rpath -Xlinker #{nuodb_lib64}"
140
+ when /linux/i
141
+ # extras here...
142
+ $LDFLAGS << " -Wl,-rpath,'$$ORIGIN'"
143
+ when /solaris|sunos/i
144
+ # extras here...
145
+ $LDFLAGS << " -Wl,-rpath,'$$ORIGIN' -m64"
146
+ else
147
+ puts
148
+ end
149
+ else
150
+ end
151
+
152
+ create_makefile('nuodb/nuodb')