scottmotte-dm-core 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/Rakefile +62 -0
- data/spec/spec_helper.rb +103 -0
- metadata +215 -0
data/.gitignore
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
require 'spec/rake/spectask'
|
5
|
+
require 'merb-core'
|
6
|
+
require 'merb-core/tasks/merb'
|
7
|
+
require 'merb-core/test/tasks/spectasks'
|
8
|
+
|
9
|
+
|
10
|
+
begin
|
11
|
+
require 'jeweler'
|
12
|
+
Jeweler::Tasks.new do |gem|
|
13
|
+
gem.name = "merb_auth_slice_multisite"
|
14
|
+
gem.summary = %Q{add multisite/subdomain functionality to your merb app on top of merb-auth}
|
15
|
+
gem.email = "scott@scottmotte.com"
|
16
|
+
gem.homepage = "http://github.com/scottmotte/merb_auth_slice_multisite"
|
17
|
+
gem.authors = ["scottmotte"]
|
18
|
+
|
19
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
+
end
|
21
|
+
rescue LoadError
|
22
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'rake/testtask'
|
26
|
+
Rake::TestTask.new(:test) do |test|
|
27
|
+
test.libs << 'lib' << 'test'
|
28
|
+
test.pattern = 'test/**/*_test.rb'
|
29
|
+
test.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
begin
|
33
|
+
require 'rcov/rcovtask'
|
34
|
+
Rcov::RcovTask.new do |test|
|
35
|
+
test.libs << 'test'
|
36
|
+
test.pattern = 'test/**/*_test.rb'
|
37
|
+
test.verbose = true
|
38
|
+
end
|
39
|
+
rescue LoadError
|
40
|
+
task :rcov do
|
41
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
if File.exist?('VERSION.yml')
|
48
|
+
config = YAML.load(File.read('VERSION.yml'))
|
49
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
50
|
+
else
|
51
|
+
version = ""
|
52
|
+
end
|
53
|
+
|
54
|
+
rdoc.rdoc_dir = 'rdoc'
|
55
|
+
rdoc.title = "merb_auth_slice_multisite #{version}"
|
56
|
+
rdoc.rdoc_files.include('README*')
|
57
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
desc 'Default: run spec examples'
|
62
|
+
task :default => 'spec'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'merb-core'
|
3
|
+
require 'merb-slices'
|
4
|
+
require 'spec'
|
5
|
+
require 'dm-core'
|
6
|
+
require 'dm-validations'
|
7
|
+
|
8
|
+
# Add merb_auth_slice_multisite.rb to the search path
|
9
|
+
Merb::Plugins.config[:merb_slices][:auto_register] = true
|
10
|
+
Merb::Plugins.config[:merb_slices][:search_path] = File.join(File.dirname(__FILE__), '..', 'lib', 'merb_auth_slice_multisite.rb')
|
11
|
+
|
12
|
+
# Require merb_auth_slice_multisite.rb explicitly so any dependencies are loaded
|
13
|
+
require Merb::Plugins.config[:merb_slices][:search_path]
|
14
|
+
|
15
|
+
# Using Merb.root below makes sure that the correct root is set for
|
16
|
+
# - testing standalone, without being installed as a gem and no host application
|
17
|
+
# - testing from within the host application; its root will be used
|
18
|
+
Merb.start_environment(
|
19
|
+
:testing => true,
|
20
|
+
:adapter => 'runner',
|
21
|
+
:environment => ENV['MERB_ENV'] || 'test',
|
22
|
+
:session_store => 'memory'
|
23
|
+
)
|
24
|
+
|
25
|
+
module Merb
|
26
|
+
module Test
|
27
|
+
module SliceHelper
|
28
|
+
|
29
|
+
# The absolute path to the current slice
|
30
|
+
def current_slice_root
|
31
|
+
@current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
32
|
+
end
|
33
|
+
|
34
|
+
# Whether the specs are being run from a host application or standalone
|
35
|
+
def standalone?
|
36
|
+
Merb.root == ::MerbAuthSliceMultisite.root
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Spec::Runner.configure do |config|
|
44
|
+
config.include(Merb::Test::ViewHelper)
|
45
|
+
config.include(Merb::Test::RouteHelper)
|
46
|
+
config.include(Merb::Test::ControllerHelper)
|
47
|
+
config.include(Merb::Test::SliceHelper)
|
48
|
+
|
49
|
+
config.before(:all) do
|
50
|
+
DataMapper.auto_migrate! if Merb.orm == :datamapper
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# You can add your own helpers here
|
55
|
+
#
|
56
|
+
Merb::Test.add_helpers do
|
57
|
+
def mount_slice
|
58
|
+
Merb::Router.prepare { add_slice(:MerbAuthSliceMultisite, "merb_auth_slice_multisite") } if standalone?
|
59
|
+
end
|
60
|
+
|
61
|
+
def dismount_slice
|
62
|
+
Merb::Router.reset! if standalone?
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# =============================================================================
|
67
|
+
# SITE STUFF
|
68
|
+
# =============================================================================
|
69
|
+
def valid_site_attributes(options = {})
|
70
|
+
{
|
71
|
+
:domain => 'http://www.example.org',
|
72
|
+
:subdomain => 'example',
|
73
|
+
:id => 1
|
74
|
+
}.merge(options)
|
75
|
+
end
|
76
|
+
|
77
|
+
def valid_second_site_attributes(options = {})
|
78
|
+
{
|
79
|
+
:domain => 'http://www.example2.org',
|
80
|
+
:subdomain => 'example2',
|
81
|
+
:active => true,
|
82
|
+
:id => 2
|
83
|
+
}.merge(options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def valid_third_site_attributes(options = {})
|
87
|
+
{
|
88
|
+
:domain => 'http://www.example3.org',
|
89
|
+
:subdomain => 'example3',
|
90
|
+
:active => true,
|
91
|
+
:id => 3
|
92
|
+
}.merge(options)
|
93
|
+
end
|
94
|
+
|
95
|
+
# =============================================================================
|
96
|
+
# USER STUFF - see init.rb for where this gets spoofed
|
97
|
+
# =============================================================================
|
98
|
+
def valid_user_attributes(options = {})
|
99
|
+
{ :login => 'fred',
|
100
|
+
:email => 'fred@example.com',
|
101
|
+
:site_id => 1
|
102
|
+
}.merge(options)
|
103
|
+
end
|
metadata
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scottmotte-dm-core
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.10
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Kubb
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-01-19 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: data_objects
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.11
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: extlib
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.10
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: addressable
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.0.1
|
44
|
+
version:
|
45
|
+
description: Faster, Better, Simpler.
|
46
|
+
email:
|
47
|
+
- dan.kubb@gmail.com
|
48
|
+
executables: []
|
49
|
+
|
50
|
+
extensions: []
|
51
|
+
|
52
|
+
extra_rdoc_files:
|
53
|
+
- History.txt
|
54
|
+
- Manifest.txt
|
55
|
+
- README.txt
|
56
|
+
files:
|
57
|
+
- .autotest
|
58
|
+
- .gitignore
|
59
|
+
- CONTRIBUTING
|
60
|
+
- FAQ
|
61
|
+
- History.txt
|
62
|
+
- MIT-LICENSE
|
63
|
+
- Manifest.txt
|
64
|
+
- QUICKLINKS
|
65
|
+
- README.txt
|
66
|
+
- Rakefile
|
67
|
+
- SPECS
|
68
|
+
- TODO
|
69
|
+
- dm-core.gemspec
|
70
|
+
- lib/dm-core.rb
|
71
|
+
- lib/dm-core/adapters.rb
|
72
|
+
- lib/dm-core/adapters/abstract_adapter.rb
|
73
|
+
- lib/dm-core/adapters/data_objects_adapter.rb
|
74
|
+
- lib/dm-core/adapters/in_memory_adapter.rb
|
75
|
+
- lib/dm-core/adapters/mysql_adapter.rb
|
76
|
+
- lib/dm-core/adapters/postgres_adapter.rb
|
77
|
+
- lib/dm-core/adapters/sqlite3_adapter.rb
|
78
|
+
- lib/dm-core/associations.rb
|
79
|
+
- lib/dm-core/associations/many_to_many.rb
|
80
|
+
- lib/dm-core/associations/many_to_one.rb
|
81
|
+
- lib/dm-core/associations/one_to_many.rb
|
82
|
+
- lib/dm-core/associations/one_to_one.rb
|
83
|
+
- lib/dm-core/associations/relationship.rb
|
84
|
+
- lib/dm-core/associations/relationship_chain.rb
|
85
|
+
- lib/dm-core/auto_migrations.rb
|
86
|
+
- lib/dm-core/collection.rb
|
87
|
+
- lib/dm-core/dependency_queue.rb
|
88
|
+
- lib/dm-core/hook.rb
|
89
|
+
- lib/dm-core/identity_map.rb
|
90
|
+
- lib/dm-core/is.rb
|
91
|
+
- lib/dm-core/logger.rb
|
92
|
+
- lib/dm-core/migrations/destructive_migrations.rb
|
93
|
+
- lib/dm-core/migrator.rb
|
94
|
+
- lib/dm-core/model.rb
|
95
|
+
- lib/dm-core/naming_conventions.rb
|
96
|
+
- lib/dm-core/property.rb
|
97
|
+
- lib/dm-core/property_set.rb
|
98
|
+
- lib/dm-core/query.rb
|
99
|
+
- lib/dm-core/repository.rb
|
100
|
+
- lib/dm-core/resource.rb
|
101
|
+
- lib/dm-core/scope.rb
|
102
|
+
- lib/dm-core/support.rb
|
103
|
+
- lib/dm-core/support/array.rb
|
104
|
+
- lib/dm-core/support/assertions.rb
|
105
|
+
- lib/dm-core/support/errors.rb
|
106
|
+
- lib/dm-core/support/kernel.rb
|
107
|
+
- lib/dm-core/support/symbol.rb
|
108
|
+
- lib/dm-core/transaction.rb
|
109
|
+
- lib/dm-core/type.rb
|
110
|
+
- lib/dm-core/type_map.rb
|
111
|
+
- lib/dm-core/types.rb
|
112
|
+
- lib/dm-core/types/boolean.rb
|
113
|
+
- lib/dm-core/types/discriminator.rb
|
114
|
+
- lib/dm-core/types/object.rb
|
115
|
+
- lib/dm-core/types/paranoid_boolean.rb
|
116
|
+
- lib/dm-core/types/paranoid_datetime.rb
|
117
|
+
- lib/dm-core/types/serial.rb
|
118
|
+
- lib/dm-core/types/text.rb
|
119
|
+
- lib/dm-core/version.rb
|
120
|
+
- script/all
|
121
|
+
- script/performance.rb
|
122
|
+
- script/profile.rb
|
123
|
+
- spec/integration/association_spec.rb
|
124
|
+
- spec/integration/association_through_spec.rb
|
125
|
+
- spec/integration/associations/many_to_many_spec.rb
|
126
|
+
- spec/integration/associations/many_to_one_spec.rb
|
127
|
+
- spec/integration/associations/one_to_many_spec.rb
|
128
|
+
- spec/integration/auto_migrations_spec.rb
|
129
|
+
- spec/integration/collection_spec.rb
|
130
|
+
- spec/integration/data_objects_adapter_spec.rb
|
131
|
+
- spec/integration/dependency_queue_spec.rb
|
132
|
+
- spec/integration/model_spec.rb
|
133
|
+
- spec/integration/mysql_adapter_spec.rb
|
134
|
+
- spec/integration/postgres_adapter_spec.rb
|
135
|
+
- spec/integration/property_spec.rb
|
136
|
+
- spec/integration/query_spec.rb
|
137
|
+
- spec/integration/repository_spec.rb
|
138
|
+
- spec/integration/resource_spec.rb
|
139
|
+
- spec/integration/sqlite3_adapter_spec.rb
|
140
|
+
- spec/integration/sti_spec.rb
|
141
|
+
- spec/integration/strategic_eager_loading_spec.rb
|
142
|
+
- spec/integration/transaction_spec.rb
|
143
|
+
- spec/integration/type_spec.rb
|
144
|
+
- spec/lib/logging_helper.rb
|
145
|
+
- spec/lib/mock_adapter.rb
|
146
|
+
- spec/lib/model_loader.rb
|
147
|
+
- spec/lib/publicize_methods.rb
|
148
|
+
- spec/models/content.rb
|
149
|
+
- spec/models/vehicles.rb
|
150
|
+
- spec/models/zoo.rb
|
151
|
+
- spec/spec.opts
|
152
|
+
- spec/spec_helper.rb
|
153
|
+
- spec/unit/adapters/abstract_adapter_spec.rb
|
154
|
+
- spec/unit/adapters/adapter_shared_spec.rb
|
155
|
+
- spec/unit/adapters/data_objects_adapter_spec.rb
|
156
|
+
- spec/unit/adapters/in_memory_adapter_spec.rb
|
157
|
+
- spec/unit/adapters/postgres_adapter_spec.rb
|
158
|
+
- spec/unit/associations/many_to_many_spec.rb
|
159
|
+
- spec/unit/associations/many_to_one_spec.rb
|
160
|
+
- spec/unit/associations/one_to_many_spec.rb
|
161
|
+
- spec/unit/associations/one_to_one_spec.rb
|
162
|
+
- spec/unit/associations/relationship_spec.rb
|
163
|
+
- spec/unit/associations_spec.rb
|
164
|
+
- spec/unit/auto_migrations_spec.rb
|
165
|
+
- spec/unit/collection_spec.rb
|
166
|
+
- spec/unit/data_mapper_spec.rb
|
167
|
+
- spec/unit/identity_map_spec.rb
|
168
|
+
- spec/unit/is_spec.rb
|
169
|
+
- spec/unit/migrator_spec.rb
|
170
|
+
- spec/unit/model_spec.rb
|
171
|
+
- spec/unit/naming_conventions_spec.rb
|
172
|
+
- spec/unit/property_set_spec.rb
|
173
|
+
- spec/unit/property_spec.rb
|
174
|
+
- spec/unit/query_spec.rb
|
175
|
+
- spec/unit/repository_spec.rb
|
176
|
+
- spec/unit/resource_spec.rb
|
177
|
+
- spec/unit/scope_spec.rb
|
178
|
+
- spec/unit/transaction_spec.rb
|
179
|
+
- spec/unit/type_map_spec.rb
|
180
|
+
- spec/unit/type_spec.rb
|
181
|
+
- tasks/ci.rb
|
182
|
+
- tasks/dm.rb
|
183
|
+
- tasks/doc.rb
|
184
|
+
- tasks/gemspec.rb
|
185
|
+
- tasks/hoe.rb
|
186
|
+
- tasks/install.rb
|
187
|
+
has_rdoc: true
|
188
|
+
homepage: http://datamapper.org
|
189
|
+
post_install_message:
|
190
|
+
rdoc_options:
|
191
|
+
- --main
|
192
|
+
- README.txt
|
193
|
+
require_paths:
|
194
|
+
- lib
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: "0"
|
200
|
+
version:
|
201
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: "0"
|
206
|
+
version:
|
207
|
+
requirements: []
|
208
|
+
|
209
|
+
rubyforge_project: datamapper
|
210
|
+
rubygems_version: 1.2.0
|
211
|
+
signing_key:
|
212
|
+
specification_version: 2
|
213
|
+
summary: An Object/Relational Mapper for Ruby
|
214
|
+
test_files: []
|
215
|
+
|