yogo-db 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +24 -0
- data/.rspec +1 -0
- data/Gemfile +36 -0
- data/Gemfile.lock +213 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +63 -0
- data/VERSION +1 -0
- data/config.ru +27 -0
- data/config/database.yml +19 -0
- data/config/datamapper.rb +9 -0
- data/features/step_definitions/yogo-db_steps.rb +0 -0
- data/features/support/env.rb +2 -0
- data/features/yogo-db.feature +9 -0
- data/lib/yogo-db.rb +4 -0
- data/lib/yogo/data/default_methods.rb +89 -0
- data/lib/yogo/data_app.rb +50 -0
- data/lib/yogo/model/schema.rb +138 -0
- data/lib/yogo/operations.rb +2 -0
- data/lib/yogo/operations/basic.rb +31 -0
- data/lib/yogo/operations/file.rb +44 -0
- data/lib/yogo/rack/model_lookup.rb +37 -0
- data/lib/yogo/schema_app.rb +43 -0
- data/spec/factories/schema.rb +5 -0
- data/spec/helpers/request_helper.rb +30 -0
- data/spec/model/schema_spec.rb +136 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/yogo/data_app_spec.rb +32 -0
- data/spec/yogo/model_lookup_spec.rb +78 -0
- data/spec/yogo/schema_app_spec.rb +105 -0
- data/yogo-db.gemspec +115 -0
- metadata +259 -0
data/.document
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
source :rubygems
|
2
|
+
gemspec
|
3
|
+
|
4
|
+
gem "yogo-datamapper", :git => "git://github.com/yogo/yogo-datamapper.git"
|
5
|
+
gem "yogo-operation", :git => "git://github.com/yogo/yogo-operation.git"
|
6
|
+
|
7
|
+
#
|
8
|
+
# Development and Test Dependencies
|
9
|
+
#
|
10
|
+
group :development, :test do
|
11
|
+
# Development gems
|
12
|
+
gem "racksh"
|
13
|
+
gem "sinatra-reloader"
|
14
|
+
gem "rake"
|
15
|
+
gem "jeweler"
|
16
|
+
gem "yard"
|
17
|
+
gem "yardstick"
|
18
|
+
|
19
|
+
# Testing gems
|
20
|
+
gem "rspec"
|
21
|
+
gem "rack-test"
|
22
|
+
gem "cucumber"
|
23
|
+
gem "autotest"
|
24
|
+
gem 'factory_girl'
|
25
|
+
|
26
|
+
# 1.9 vs 1.8 issues
|
27
|
+
platforms(:mri_19) do
|
28
|
+
gem "ruby-debug19", :require => "ruby-debug"
|
29
|
+
gem "rack-debug19", :require => "rack-debug"
|
30
|
+
end
|
31
|
+
|
32
|
+
platforms(:ruby_18) do
|
33
|
+
gem "ruby-debug"
|
34
|
+
gem "rack-debug"
|
35
|
+
end
|
36
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/yogo/yogo-datamapper.git
|
3
|
+
revision: 11174aae88ee017b99cee489dcf469eccb0b1771
|
4
|
+
specs:
|
5
|
+
yogo-datamapper (0.2.0)
|
6
|
+
dm-aggregates (~> 1.0.2)
|
7
|
+
dm-core (~> 1.0.2)
|
8
|
+
dm-is-remixable
|
9
|
+
dm-migrations
|
10
|
+
dm-timestamps
|
11
|
+
dm-types (~> 1.0.2)
|
12
|
+
dm-validations
|
13
|
+
yogo-operation
|
14
|
+
yogo-support
|
15
|
+
|
16
|
+
GIT
|
17
|
+
remote: git://github.com/yogo/yogo-operation.git
|
18
|
+
revision: 8e96667a97964f7de1dedfba40b44a4fa9c3ccdc
|
19
|
+
specs:
|
20
|
+
yogo-operation (0.2.0)
|
21
|
+
dataflow
|
22
|
+
yogo-support (~> 0.1.0)
|
23
|
+
|
24
|
+
PATH
|
25
|
+
remote: .
|
26
|
+
specs:
|
27
|
+
yogo-db (0.0.0)
|
28
|
+
activesupport
|
29
|
+
carrierwave
|
30
|
+
dm-core
|
31
|
+
dm-migrations
|
32
|
+
dm-postgres-adapter
|
33
|
+
dm-serializer
|
34
|
+
dm-sqlite-adapter
|
35
|
+
dm-timestamps
|
36
|
+
dm-validations
|
37
|
+
json
|
38
|
+
rack
|
39
|
+
sinatra
|
40
|
+
|
41
|
+
GEM
|
42
|
+
remote: http://rubygems.org/
|
43
|
+
specs:
|
44
|
+
activesupport (3.0.1)
|
45
|
+
addressable (2.2.2)
|
46
|
+
archive-tar-minitar (0.5.2)
|
47
|
+
autotest (4.4.1)
|
48
|
+
backports (1.18.2)
|
49
|
+
builder (2.1.2)
|
50
|
+
carrierwave (0.5.0)
|
51
|
+
activesupport (~> 3.0.0)
|
52
|
+
columnize (0.3.1)
|
53
|
+
cucumber (0.9.3)
|
54
|
+
builder (~> 2.1.2)
|
55
|
+
diff-lcs (~> 1.1.2)
|
56
|
+
gherkin (~> 2.2.9)
|
57
|
+
json (~> 1.4.6)
|
58
|
+
term-ansicolor (~> 1.0.5)
|
59
|
+
data_objects (0.10.2)
|
60
|
+
addressable (~> 2.1)
|
61
|
+
dataflow (0.3.1)
|
62
|
+
diff-lcs (1.1.2)
|
63
|
+
dm-aggregates (1.0.2)
|
64
|
+
dm-core (~> 1.0.2)
|
65
|
+
dm-core (1.0.2)
|
66
|
+
addressable (~> 2.2)
|
67
|
+
extlib (~> 0.9.15)
|
68
|
+
dm-do-adapter (1.0.2)
|
69
|
+
data_objects (~> 0.10.2)
|
70
|
+
dm-core (~> 1.0.2)
|
71
|
+
dm-is-remixable (1.0.2)
|
72
|
+
dm-core (~> 1.0.2)
|
73
|
+
dm-migrations (1.0.2)
|
74
|
+
dm-core (~> 1.0.2)
|
75
|
+
dm-postgres-adapter (1.0.2)
|
76
|
+
dm-do-adapter (~> 1.0.2)
|
77
|
+
do_postgres (~> 0.10.2)
|
78
|
+
dm-serializer (1.0.2)
|
79
|
+
dm-core (~> 1.0.2)
|
80
|
+
fastercsv (~> 1.5.3)
|
81
|
+
json_pure (~> 1.4)
|
82
|
+
dm-sqlite-adapter (1.0.2)
|
83
|
+
dm-do-adapter (~> 1.0.2)
|
84
|
+
do_sqlite3 (~> 0.10.2)
|
85
|
+
dm-timestamps (1.0.2)
|
86
|
+
dm-core (~> 1.0.2)
|
87
|
+
dm-types (1.0.2)
|
88
|
+
dm-core (~> 1.0.2)
|
89
|
+
fastercsv (~> 1.5.3)
|
90
|
+
json_pure (~> 1.4)
|
91
|
+
stringex (~> 1.1.0)
|
92
|
+
uuidtools (~> 2.1.1)
|
93
|
+
dm-validations (1.0.2)
|
94
|
+
dm-core (~> 1.0.2)
|
95
|
+
do_postgres (0.10.2)
|
96
|
+
data_objects (= 0.10.2)
|
97
|
+
do_sqlite3 (0.10.2)
|
98
|
+
data_objects (= 0.10.2)
|
99
|
+
extlib (0.9.15)
|
100
|
+
factory_girl (1.3.2)
|
101
|
+
fastercsv (1.5.3)
|
102
|
+
gemcutter (0.6.1)
|
103
|
+
gherkin (2.2.9)
|
104
|
+
json (~> 1.4.6)
|
105
|
+
term-ansicolor (~> 1.0.5)
|
106
|
+
git (1.2.5)
|
107
|
+
jeweler (1.4.0)
|
108
|
+
gemcutter (>= 0.1.0)
|
109
|
+
git (>= 1.2.5)
|
110
|
+
rubyforge (>= 2.0.0)
|
111
|
+
json (1.4.6)
|
112
|
+
json_pure (1.4.6)
|
113
|
+
linecache (0.43)
|
114
|
+
linecache19 (0.5.11)
|
115
|
+
ruby_core_source (>= 0.1.4)
|
116
|
+
monkey-lib (0.5.4)
|
117
|
+
backports
|
118
|
+
rack (1.2.1)
|
119
|
+
rack-debug (1.4.2)
|
120
|
+
rack (>= 1.0)
|
121
|
+
ruby-debug (>= 0.10)
|
122
|
+
rack-debug19 (1.4.2)
|
123
|
+
rack (>= 1.0)
|
124
|
+
ruby-debug19 (>= 0.11.6)
|
125
|
+
rack-test (0.5.6)
|
126
|
+
rack (>= 1.0)
|
127
|
+
racksh (0.9.8)
|
128
|
+
rack (>= 1.0)
|
129
|
+
rack-test (>= 0.5)
|
130
|
+
rake (0.8.7)
|
131
|
+
rspec (2.0.1)
|
132
|
+
rspec-core (~> 2.0.1)
|
133
|
+
rspec-expectations (~> 2.0.1)
|
134
|
+
rspec-mocks (~> 2.0.1)
|
135
|
+
rspec-core (2.0.1)
|
136
|
+
rspec-expectations (2.0.1)
|
137
|
+
diff-lcs (>= 1.1.2)
|
138
|
+
rspec-mocks (2.0.1)
|
139
|
+
rspec-core (~> 2.0.1)
|
140
|
+
rspec-expectations (~> 2.0.1)
|
141
|
+
ruby-debug (0.10.3)
|
142
|
+
columnize (>= 0.1)
|
143
|
+
ruby-debug-base (~> 0.10.3.0)
|
144
|
+
ruby-debug-base (0.10.3)
|
145
|
+
linecache (>= 0.3)
|
146
|
+
ruby-debug-base19 (0.11.24)
|
147
|
+
columnize (>= 0.3.1)
|
148
|
+
linecache19 (>= 0.5.11)
|
149
|
+
ruby_core_source (>= 0.1.4)
|
150
|
+
ruby-debug19 (0.11.6)
|
151
|
+
columnize (>= 0.3.1)
|
152
|
+
linecache19 (>= 0.5.11)
|
153
|
+
ruby-debug-base19 (>= 0.11.19)
|
154
|
+
ruby_core_source (0.1.4)
|
155
|
+
archive-tar-minitar (>= 0.5.2)
|
156
|
+
rubyforge (2.0.4)
|
157
|
+
json_pure (>= 1.1.7)
|
158
|
+
sinatra (1.1.0)
|
159
|
+
rack (~> 1.1)
|
160
|
+
tilt (~> 1.1)
|
161
|
+
sinatra-advanced-routes (0.5.1)
|
162
|
+
monkey-lib (~> 0.5.0)
|
163
|
+
sinatra (~> 1.0)
|
164
|
+
sinatra-sugar (~> 0.5.0)
|
165
|
+
sinatra-reloader (0.5.0)
|
166
|
+
sinatra (~> 1.0)
|
167
|
+
sinatra-advanced-routes (~> 0.5.0)
|
168
|
+
sinatra-sugar (0.5.0)
|
169
|
+
monkey-lib (~> 0.5.0)
|
170
|
+
sinatra (~> 1.0)
|
171
|
+
stringex (1.1.0)
|
172
|
+
term-ansicolor (1.0.5)
|
173
|
+
tilt (1.1)
|
174
|
+
uuidtools (2.1.1)
|
175
|
+
yard (0.6.1)
|
176
|
+
yardstick (0.1.0)
|
177
|
+
yard (~> 0.2)
|
178
|
+
yogo-support (0.1.1)
|
179
|
+
|
180
|
+
PLATFORMS
|
181
|
+
ruby
|
182
|
+
|
183
|
+
DEPENDENCIES
|
184
|
+
activesupport
|
185
|
+
autotest
|
186
|
+
carrierwave
|
187
|
+
cucumber
|
188
|
+
dm-core
|
189
|
+
dm-migrations
|
190
|
+
dm-postgres-adapter
|
191
|
+
dm-serializer
|
192
|
+
dm-sqlite-adapter
|
193
|
+
dm-timestamps
|
194
|
+
dm-validations
|
195
|
+
factory_girl
|
196
|
+
jeweler
|
197
|
+
json
|
198
|
+
rack
|
199
|
+
rack-debug
|
200
|
+
rack-debug19
|
201
|
+
rack-test
|
202
|
+
racksh
|
203
|
+
rake
|
204
|
+
rspec
|
205
|
+
ruby-debug
|
206
|
+
ruby-debug19
|
207
|
+
sinatra
|
208
|
+
sinatra-reloader
|
209
|
+
yard
|
210
|
+
yardstick
|
211
|
+
yogo-datamapper!
|
212
|
+
yogo-db!
|
213
|
+
yogo-operation!
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Ryan Heimbuch, Montana State University
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= yogo-db
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Ryan Heimbuch, Montana State University. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.setup
|
4
|
+
rescue LoadError
|
5
|
+
puts "Bundler is not intalled. Install with: gem install bundler"
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'jeweler'
|
9
|
+
Jeweler::Tasks.new do |gem|
|
10
|
+
gem.name = %q{yogo-db}
|
11
|
+
gem.authors = ["Ryan Heimbuch"]
|
12
|
+
gem.date = %q{2010-10-19}
|
13
|
+
gem.description = %q{Restful interface to yogo data components}
|
14
|
+
gem.email = %q{rheimbuch@gmail.com}
|
15
|
+
gem.homepage = %q{http://github.com/yogo/yogo-db}
|
16
|
+
gem.summary = %q{Yogo DB Rest components}
|
17
|
+
gem.add_dependency( %q<sinatra> )
|
18
|
+
gem.add_dependency( %q<rack> )
|
19
|
+
gem.add_dependency( %q<activesupport> )
|
20
|
+
gem.add_dependency( %q<dm-core> )
|
21
|
+
gem.add_dependency( %q<dm-migrations> )
|
22
|
+
gem.add_dependency( %q<dm-serializer> )
|
23
|
+
gem.add_dependency( %q<dm-timestamps> )
|
24
|
+
gem.add_dependency( %q<dm-validations> )
|
25
|
+
gem.add_dependency( %q<dm-sqlite-adapter> )
|
26
|
+
gem.add_dependency( %q<dm-postgres-adapter> )
|
27
|
+
# gem.add_dependency( %q<yogo-operation> )
|
28
|
+
# gem.add_dependency( %q<yogo-datamapper> )
|
29
|
+
gem.add_dependency( %q<json> )
|
30
|
+
gem.add_dependency( %q<carrierwave> )
|
31
|
+
end
|
32
|
+
|
33
|
+
begin
|
34
|
+
require 'rspec/core/rake_task'
|
35
|
+
RSpec::Core::RakeTask.new(:spec)
|
36
|
+
|
37
|
+
desc 'Run all examples using rcov'
|
38
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
39
|
+
spec.rcov = true
|
40
|
+
spec.rcov_opts = %[-Ilib -Ispec --exclude "mocks,expectations,gems/*,spec/resources,spec/lib,spec/spec_helper.rb,db/*,/Library/Ruby/*,config/*"]
|
41
|
+
spec.rcov_opts << %[--no-html --aggregate coverage.data]
|
42
|
+
end
|
43
|
+
rescue LoadError
|
44
|
+
puts "RSpec not installed. Install with: bundle install"
|
45
|
+
end
|
46
|
+
|
47
|
+
begin
|
48
|
+
require 'cucumber/rake/task'
|
49
|
+
Cucumber::Rake::Task.new(:features)
|
50
|
+
rescue LoadError
|
51
|
+
task :features do
|
52
|
+
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
begin
|
57
|
+
require 'yard'
|
58
|
+
YARD::Rake::YardocTask.new
|
59
|
+
rescue LoadError
|
60
|
+
task :yardoc do
|
61
|
+
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
62
|
+
end
|
63
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
data/config.ru
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Standard requirements for Bundler management
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
5
|
+
|
6
|
+
# Load the bundler gemset
|
7
|
+
Bundler.require(:default, ENV['RACK_ENV'] || :development )
|
8
|
+
|
9
|
+
# Mess with load paths
|
10
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
11
|
+
|
12
|
+
# Configure DataMapper
|
13
|
+
require 'config/datamapper'
|
14
|
+
|
15
|
+
# Load Application pieces
|
16
|
+
require 'yogo/rack/model_lookup'
|
17
|
+
require 'yogo/schema_app'
|
18
|
+
require 'yogo/data_app'
|
19
|
+
|
20
|
+
# Load the Application Version
|
21
|
+
APP_VERSION = IO.readlines(File.join(File.dirname(__FILE__), 'VERSION'))[0]
|
22
|
+
|
23
|
+
# Make the model lookup map
|
24
|
+
use Yogo::Rack::ModelLookup, :paths => ['schema', 'data'], :scope => lambda{ |*args| return Schema }
|
25
|
+
|
26
|
+
# Run the app
|
27
|
+
run Rack::Cascade.new([Yogo::SchemaApp, Yogo::DataApp])
|
data/config/database.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# This is only for this particular app
|
2
|
+
|
3
|
+
development:
|
4
|
+
adapter: postgres
|
5
|
+
database: yogo_development
|
6
|
+
host: localhost
|
7
|
+
|
8
|
+
test:
|
9
|
+
adapter: postgres
|
10
|
+
database: yogo_test
|
11
|
+
host: localhost
|
12
|
+
|
13
|
+
# development:
|
14
|
+
# adapter: sqlite3
|
15
|
+
# database: db/devlopment.sqlite3
|
16
|
+
#
|
17
|
+
# test:
|
18
|
+
# adapter: sqlite3
|
19
|
+
# database: db/test.sqlite3
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#
|
2
|
+
# DataMapper Configuration
|
3
|
+
#
|
4
|
+
|
5
|
+
databases = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'config', 'database.yml'))
|
6
|
+
|
7
|
+
DataMapper::Model.raise_on_save_failure = true
|
8
|
+
DataMapper::Logger.new('log/datamapper.log', :debug)
|
9
|
+
DataMapper.setup(:default, databases[ENV['RACK_ENV'] || 'development'])
|