hypostasis 0.0.2
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/.travis.yml +51 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +59 -0
- data/Rakefile +10 -0
- data/hypostasis.gemspec +26 -0
- data/lib/hypostasis.rb +4 -0
- data/lib/hypostasis/connection.rb +23 -0
- data/lib/hypostasis/namespace.rb +17 -0
- data/lib/hypostasis/version.rb +3 -0
- data/test/connection_spec.rb +17 -0
- data/test/minitest_helper.rb +14 -0
- data/test/namespace_spec.rb +14 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 490693935730e28be31a446231221acbfab3ad1b
|
4
|
+
data.tar.gz: 43b5d9cface98769d770318c6f864708bf27d417
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6e126c676cd74dff9dae11c287b7fde193c159df9e1e64a55407e7248f548359ce57a693cf8c167e79c40bfacc7c4add9f03b58cdb799d46ef753ea44553a0ec
|
7
|
+
data.tar.gz: 268813a84afba95aaec59ed7bc6a017ebe3762fe32d50e2613d3009c5730cdf38d91e8853d4a01e1623107c1559a96da86ffbcd1fbca5a4242d6968b9e5277f3
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0
|
data/.travis.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.9.3
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.0
|
6
|
+
- ruby-head
|
7
|
+
- jruby-19mode
|
8
|
+
- jruby-head
|
9
|
+
jdk:
|
10
|
+
- openjdk6
|
11
|
+
- openjdk7
|
12
|
+
- oraclejdk7
|
13
|
+
- oraclejdk8
|
14
|
+
matrix:
|
15
|
+
exclude:
|
16
|
+
- rvm: 1.9.3
|
17
|
+
jdk: openjdk6
|
18
|
+
- rvm: 1.9.3
|
19
|
+
jdk: oraclejdk7
|
20
|
+
- rvm: 1.9.3
|
21
|
+
jdk: oraclejdk8
|
22
|
+
- rvm: 2.0.0
|
23
|
+
jdk: openjdk6
|
24
|
+
- rvm: 2.0.0
|
25
|
+
jdk: oraclejdk7
|
26
|
+
- rvm: 2.0.0
|
27
|
+
jdk: oraclejdk8
|
28
|
+
- rvm: 2.1.0
|
29
|
+
jdk: openjdk6
|
30
|
+
- rvm: 2.1.0
|
31
|
+
jdk: oraclejdk7
|
32
|
+
- rvm: 2.1.0
|
33
|
+
jdk: oraclejdk8
|
34
|
+
- rvm: ruby-head
|
35
|
+
jdk: openjdk6
|
36
|
+
- rvm: ruby-head
|
37
|
+
jdk: oraclejdk7
|
38
|
+
- rvm: ruby-head
|
39
|
+
jdk: oraclejdk8
|
40
|
+
allow_failures:
|
41
|
+
- rvm: ruby-head
|
42
|
+
- rvm: jruby-head
|
43
|
+
- jdk: oraclejdk8
|
44
|
+
before_install:
|
45
|
+
- wget https://foundationdb.com/downloads/I_accept_the_FoundationDB_Community_License_Agreement/1.0.1/foundationdb-clients_1.0.1-1_amd64.deb
|
46
|
+
- wget https://foundationdb.com/downloads/I_accept_the_FoundationDB_Community_License_Agreement/1.0.1/foundationdb-server_1.0.1-1_amd64.deb
|
47
|
+
- sudo dpkg -i foundationdb-clients_1.0.1-1_amd64.deb
|
48
|
+
- sudo dpkg -i foundationdb-server_1.0.1-1_amd64.deb
|
49
|
+
addons:
|
50
|
+
code_climate:
|
51
|
+
repo_token: 8bd71907fa5f14a405d4adade4ddd62dc4c7d5a2470e025f5c6899fc32ac2898
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 James Thompson
|
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,59 @@
|
|
1
|
+
# Hypostasis
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/hypostasis)
|
4
|
+
[](https://travis-ci.org/hypostasis/hypostasis)
|
5
|
+
[](https://codeclimate.com/repos/52d192fa6956802453000df7/feed)
|
6
|
+
[](https://codeclimate.com/repos/52d192fa6956802453000df7/feed)
|
7
|
+
[](https://gemnasium.com/hypostasis/hypostasis)
|
8
|
+
|
9
|
+
Hypostasis is a layer for FoundationDB that supports multiple data models on
|
10
|
+
top of the incredibly powerful key-value system provided by FoundationDB. The
|
11
|
+
goal of Hypostasis is to provide robust ways of representing different kinds of
|
12
|
+
application data in Ruby and mapping them to FoundationDB cleanly.
|
13
|
+
|
14
|
+
## Data Models
|
15
|
+
|
16
|
+
Applications have many different ways of representing data, some work well with
|
17
|
+
relational approaches, and some work better with document-oriented ones. Since
|
18
|
+
FoundationDB doesn't enforce a rigid data model it is possible to support a
|
19
|
+
variety of data models while using the same underlying storage system, provided
|
20
|
+
by FoundationDB. The data models Hypostasis currently aims to support are the
|
21
|
+
following:
|
22
|
+
|
23
|
+
* Document-Oriented
|
24
|
+
* Simple Key-Value (Wrapper for naked FoundationDB)
|
25
|
+
* Relational (an RDBMS without SQL)
|
26
|
+
* Column-Oriented (like Cassandra without CQL)
|
27
|
+
|
28
|
+
The initial focus will be on the Document-Oriented and simple Key-Value models.
|
29
|
+
|
30
|
+
## Installation
|
31
|
+
|
32
|
+
Add this line to your application's Gemfile:
|
33
|
+
|
34
|
+
gem 'hypostasis'
|
35
|
+
|
36
|
+
And then execute:
|
37
|
+
|
38
|
+
$ bundle
|
39
|
+
|
40
|
+
Or install it yourself as:
|
41
|
+
|
42
|
+
$ gem install hypostasis
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
|
46
|
+
Hypostasis is still very much Alpha quality software, only suitable for
|
47
|
+
experimentation. But, feel free to play around with it. Documentation will be
|
48
|
+
written to define how to use the various data models provided by Hypostasis as
|
49
|
+
the project matures and the APIs stabilize.
|
50
|
+
|
51
|
+
Until then, we suggest reading the code and the tests.
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
1. Fork it
|
56
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
57
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
58
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
59
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/hypostasis.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'hypostasis/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'hypostasis'
|
8
|
+
spec.version = Hypostasis::VERSION
|
9
|
+
spec.authors = ['James Thompson']
|
10
|
+
spec.email = %w{james@plainprograms.com}
|
11
|
+
spec.description = %q{A layer for FoundationDB providing multiple data models for Ruby.}
|
12
|
+
spec.summary = %q{A layer for FoundationDB providing multiple data models for Ruby.}
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = %w{lib}
|
20
|
+
|
21
|
+
spec.add_dependency 'fdb', '= 1.0.1'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'minitest', '~> 5.2.0'
|
26
|
+
end
|
data/lib/hypostasis.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'fdb'
|
2
|
+
|
3
|
+
FDB.api_version 100
|
4
|
+
|
5
|
+
class Hypostasis::Connection
|
6
|
+
attr_reader :database
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@database = FDB.open
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(key)
|
13
|
+
database[key.to_s]
|
14
|
+
end
|
15
|
+
|
16
|
+
def set(key, value)
|
17
|
+
(database[key.to_s] = value.to_s) == value.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def unset(key)
|
21
|
+
database.clear(key).nil?
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Hypostasis::Connection do
|
4
|
+
let(:subject) { Hypostasis::Connection.new }
|
5
|
+
|
6
|
+
it { subject.must_respond_to :get }
|
7
|
+
it { subject.must_respond_to :set }
|
8
|
+
it { subject.must_respond_to :unset }
|
9
|
+
|
10
|
+
it 'supports simple getting and setting' do
|
11
|
+
subject.get('test_key').nil?.must_equal true
|
12
|
+
subject.set('test_key', 'test_value').must_equal true
|
13
|
+
subject.get('test_key').must_equal 'test_value'
|
14
|
+
subject.unset('test_key').must_equal true
|
15
|
+
subject.get('test_key').nil?.must_equal true
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
if ENV['CI']
|
2
|
+
require 'codeclimate-test-reporter'
|
3
|
+
CodeClimate::TestReporter.start
|
4
|
+
else
|
5
|
+
require 'simplecov'
|
6
|
+
SimpleCov.start do
|
7
|
+
add_filter '/test/'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
12
|
+
require 'hypostasis'
|
13
|
+
|
14
|
+
require 'minitest/autorun'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Hypostasis::Namespace do
|
4
|
+
let(:subject) { Hypostasis::Namespace.new('demonstration', :document) }
|
5
|
+
|
6
|
+
it { subject.must_respond_to :name }
|
7
|
+
it { subject.name.must_equal 'demonstration' }
|
8
|
+
|
9
|
+
it { subject.must_respond_to :data_model }
|
10
|
+
it { subject.data_model.must_equal :document }
|
11
|
+
|
12
|
+
it "sets 'hypostasis/config/namespaces/demonstration' key"
|
13
|
+
it "sets 'hypostasis/config/namespaces/demonstration/data_model' key"
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hypostasis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Thompson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fdb
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 5.2.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 5.2.0
|
69
|
+
description: A layer for FoundationDB providing multiple data models for Ruby.
|
70
|
+
email:
|
71
|
+
- james@plainprograms.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .ruby-version
|
78
|
+
- .travis.yml
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- hypostasis.gemspec
|
84
|
+
- lib/hypostasis.rb
|
85
|
+
- lib/hypostasis/connection.rb
|
86
|
+
- lib/hypostasis/namespace.rb
|
87
|
+
- lib/hypostasis/version.rb
|
88
|
+
- test/connection_spec.rb
|
89
|
+
- test/minitest_helper.rb
|
90
|
+
- test/namespace_spec.rb
|
91
|
+
homepage: ''
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.1.11
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: A layer for FoundationDB providing multiple data models for Ruby.
|
115
|
+
test_files:
|
116
|
+
- test/connection_spec.rb
|
117
|
+
- test/minitest_helper.rb
|
118
|
+
- test/namespace_spec.rb
|