dm-core 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +29 -0
- data/.document +5 -0
- data/.gitignore +27 -0
- data/LICENSE +20 -0
- data/{README.txt → README.rdoc} +14 -3
- data/Rakefile +23 -22
- data/VERSION +1 -0
- data/dm-core.gemspec +201 -10
- data/lib/dm-core.rb +32 -23
- data/lib/dm-core/adapters.rb +0 -1
- data/lib/dm-core/adapters/data_objects_adapter.rb +230 -151
- data/lib/dm-core/adapters/mysql_adapter.rb +7 -8
- data/lib/dm-core/adapters/oracle_adapter.rb +39 -59
- data/lib/dm-core/adapters/postgres_adapter.rb +0 -1
- data/lib/dm-core/adapters/sqlite3_adapter.rb +5 -0
- data/lib/dm-core/adapters/sqlserver_adapter.rb +114 -0
- data/lib/dm-core/adapters/yaml_adapter.rb +0 -5
- data/lib/dm-core/associations/many_to_many.rb +118 -56
- data/lib/dm-core/associations/many_to_one.rb +48 -21
- data/lib/dm-core/associations/one_to_many.rb +8 -30
- data/lib/dm-core/associations/one_to_one.rb +1 -5
- data/lib/dm-core/associations/relationship.rb +89 -97
- data/lib/dm-core/collection.rb +299 -184
- data/lib/dm-core/core_ext/enumerable.rb +28 -0
- data/lib/dm-core/core_ext/kernel.rb +0 -2
- data/lib/dm-core/migrations.rb +314 -170
- data/lib/dm-core/model.rb +97 -66
- data/lib/dm-core/model/descendant_set.rb +1 -1
- data/lib/dm-core/model/hook.rb +0 -3
- data/lib/dm-core/model/property.rb +7 -10
- data/lib/dm-core/model/relationship.rb +79 -26
- data/lib/dm-core/model/scope.rb +3 -4
- data/lib/dm-core/property.rb +152 -90
- data/lib/dm-core/property_set.rb +18 -37
- data/lib/dm-core/query.rb +452 -153
- data/lib/dm-core/query/conditions/comparison.rb +266 -173
- data/lib/dm-core/query/conditions/operation.rb +499 -57
- data/lib/dm-core/query/direction.rb +0 -3
- data/lib/dm-core/query/operator.rb +0 -4
- data/lib/dm-core/query/path.rb +10 -12
- data/lib/dm-core/query/sort.rb +4 -10
- data/lib/dm-core/repository.rb +10 -6
- data/lib/dm-core/resource.rb +343 -148
- data/lib/dm-core/spec/adapter_shared_spec.rb +17 -1
- data/lib/dm-core/spec/data_objects_adapter_shared_spec.rb +277 -17
- data/lib/dm-core/support/chainable.rb +0 -2
- data/lib/dm-core/support/equalizer.rb +27 -3
- data/lib/dm-core/transaction.rb +75 -75
- data/lib/dm-core/type.rb +19 -5
- data/lib/dm-core/types/discriminator.rb +4 -4
- data/lib/dm-core/types/object.rb +2 -7
- data/lib/dm-core/types/paranoid_boolean.rb +8 -2
- data/lib/dm-core/types/paranoid_datetime.rb +8 -2
- data/lib/dm-core/version.rb +1 -1
- data/script/performance.rb +7 -7
- data/script/profile.rb +6 -6
- data/spec/lib/collection_helpers.rb +2 -2
- data/spec/lib/pending_helpers.rb +22 -3
- data/spec/lib/rspec_immediate_feedback_formatter.rb +1 -0
- data/spec/public/associations/many_to_many_spec.rb +6 -4
- data/spec/public/associations/many_to_one_spec.rb +10 -1
- data/spec/public/associations/many_to_one_with_boolean_cpk_spec.rb +39 -0
- data/spec/public/associations/one_to_many_spec.rb +4 -3
- data/spec/public/associations/one_to_one_spec.rb +19 -1
- data/spec/public/associations/one_to_one_with_boolean_cpk_spec.rb +45 -0
- data/spec/public/collection_spec.rb +4 -3
- data/spec/public/migrations_spec.rb +144 -0
- data/spec/public/model/relationship_spec.rb +115 -55
- data/spec/public/model_spec.rb +13 -13
- data/spec/public/property/object_spec.rb +106 -0
- data/spec/public/property_spec.rb +18 -14
- data/spec/public/resource_spec.rb +10 -1
- data/spec/public/sel_spec.rb +16 -49
- data/spec/public/setup_spec.rb +1 -1
- data/spec/public/shared/association_collection_shared_spec.rb +6 -14
- data/spec/public/shared/collection_finder_shared_spec.rb +267 -0
- data/spec/public/shared/collection_shared_spec.rb +214 -217
- data/spec/public/shared/finder_shared_spec.rb +259 -365
- data/spec/public/shared/resource_shared_spec.rb +524 -248
- data/spec/public/transaction_spec.rb +27 -3
- data/spec/public/types/discriminator_spec.rb +1 -1
- data/spec/rcov.opts +6 -0
- data/spec/semipublic/adapters/sqlserver_adapter_spec.rb +17 -0
- data/spec/semipublic/associations/many_to_one_spec.rb +3 -20
- data/spec/semipublic/associations_spec.rb +2 -2
- data/spec/semipublic/collection_spec.rb +0 -32
- data/spec/semipublic/model_spec.rb +96 -0
- data/spec/semipublic/property_spec.rb +3 -3
- data/spec/semipublic/query/conditions/comparison_spec.rb +1719 -0
- data/spec/semipublic/query/conditions/operation_spec.rb +1292 -0
- data/spec/semipublic/query_spec.rb +1285 -144
- data/spec/semipublic/resource_spec.rb +0 -24
- data/spec/semipublic/shared/resource_shared_spec.rb +103 -38
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +15 -6
- data/tasks/ci.rake +1 -0
- data/tasks/metrics.rake +37 -0
- data/tasks/spec.rake +41 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +19 -0
- metadata +99 -29
- data/CONTRIBUTING +0 -51
- data/FAQ +0 -93
- data/History.txt +0 -27
- data/MIT-LICENSE +0 -22
- data/Manifest.txt +0 -121
- data/QUICKLINKS +0 -11
- data/SPECS +0 -35
- data/TODO +0 -1
- data/spec/semipublic/query/conditions_spec.rb +0 -528
- data/tasks/ci.rb +0 -24
- data/tasks/dm.rb +0 -58
- data/tasks/doc.rb +0 -17
- data/tasks/gemspec.rb +0 -23
- data/tasks/hoe.rb +0 -45
- data/tasks/install.rb +0 -18
data/tasks/ci.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
desc 'Run metric_fu'
|
2
|
-
task :ci do
|
3
|
-
# sudo gem install jscruggs-metric_fu -s http://gems.github.com
|
4
|
-
require 'metric_fu'
|
5
|
-
|
6
|
-
MetricFu::Configuration.run do |config|
|
7
|
-
specs = Pathname.glob(ENV['FILES'] || (ROOT + 'spec/**/*_spec.rb').to_s).sort.map { |file| file.to_s }
|
8
|
-
|
9
|
-
config.rcov = {
|
10
|
-
:test_files => specs,
|
11
|
-
:rcov_opts => [
|
12
|
-
'--sort coverage',
|
13
|
-
'--no-html',
|
14
|
-
'--text-coverage',
|
15
|
-
'--no-color',
|
16
|
-
'--profile',
|
17
|
-
'--exclude spec',
|
18
|
-
"`which spec` -- #{specs.join(' ')}",
|
19
|
-
],
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
Rake::Task['metrics:all'].invoke
|
24
|
-
end
|
data/tasks/dm.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'spec/rake/spectask'
|
2
|
-
require 'spec/rake/verify_rcov'
|
3
|
-
|
4
|
-
task :default => 'spec'
|
5
|
-
|
6
|
-
RCov::VerifyTask.new(:verify_rcov => :rcov) do |config|
|
7
|
-
config.threshold = 88.1 # Make sure you have rcov 0.7 or higher!
|
8
|
-
end
|
9
|
-
|
10
|
-
def run_spec(name, files, rcov)
|
11
|
-
Spec::Rake::SpecTask.new(name) do |config|
|
12
|
-
config.spec_opts << '--options' << ROOT + 'spec/spec.opts'
|
13
|
-
config.spec_files = Pathname.glob(ENV['FILES'] || files.to_s).map { |file| file.to_s }
|
14
|
-
config.rcov = rcov
|
15
|
-
config.rcov_opts << '--exclude' << 'spec'
|
16
|
-
config.rcov_opts << '--text-summary'
|
17
|
-
config.rcov_opts << '--sort' << 'coverage'
|
18
|
-
config.rcov_opts << '--only-uncovered'
|
19
|
-
config.rcov_opts << '--profile'
|
20
|
-
#config.rcov_opts << '-w' # TODO: make sure it runs with warnings enabled
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
public_specs = ROOT + 'spec/public/**/*_spec.rb'
|
25
|
-
semipublic_specs = ROOT + 'spec/semipublic/**/*_spec.rb'
|
26
|
-
all_specs = ROOT + 'spec/**/*_spec.rb'
|
27
|
-
|
28
|
-
desc 'Run all specifications'
|
29
|
-
run_spec('spec', all_specs, false)
|
30
|
-
|
31
|
-
desc 'Run all specifications with rcov'
|
32
|
-
run_spec('rcov', all_specs, true)
|
33
|
-
|
34
|
-
namespace :spec do
|
35
|
-
desc 'Run public specifications'
|
36
|
-
run_spec('public', public_specs, false)
|
37
|
-
|
38
|
-
desc 'Run semipublic specifications'
|
39
|
-
run_spec('semipublic', semipublic_specs, false)
|
40
|
-
end
|
41
|
-
|
42
|
-
namespace :rcov do
|
43
|
-
desc 'Run public specifications with rcov'
|
44
|
-
run_spec('public', public_specs, true)
|
45
|
-
|
46
|
-
desc 'Run semipublic specifications with rcov'
|
47
|
-
run_spec('semipublic', semipublic_specs, true)
|
48
|
-
end
|
49
|
-
|
50
|
-
desc 'Run all comparisons with ActiveRecord'
|
51
|
-
task :perf do
|
52
|
-
sh ROOT + 'script/performance.rb'
|
53
|
-
end
|
54
|
-
|
55
|
-
desc 'Profile DataMapper'
|
56
|
-
task :profile do
|
57
|
-
sh ROOT + 'script/profile.rb'
|
58
|
-
end
|
data/tasks/doc.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# when yard's ready, it'll have to come back, but for now...
|
2
|
-
Rake::RDocTask.new('doc') do |config|
|
3
|
-
config.rdoc_dir = 'doc'
|
4
|
-
config.title = 'DataMapper - Ruby Object Relational Mapper'
|
5
|
-
config.options = %w[ --line-numbers --inline-source --all ]
|
6
|
-
config.rdoc_files.include('README.txt', 'QUICKLINKS', 'FAQ', 'lib/**/**/*.rb')
|
7
|
-
end
|
8
|
-
|
9
|
-
begin
|
10
|
-
require 'yard'
|
11
|
-
|
12
|
-
YARD::Rake::YardocTask.new('yardoc') do |config|
|
13
|
-
config.files << 'lib/**/*.rb'
|
14
|
-
end
|
15
|
-
rescue LoadError
|
16
|
-
# yard not installed
|
17
|
-
end
|
data/tasks/gemspec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
desc 'Generate gemspec'
|
2
|
-
task :gemspec do
|
3
|
-
# Clean up extraneous files before checking manifest
|
4
|
-
%x[rake clean]
|
5
|
-
|
6
|
-
# Check the manifest before generating the gemspec
|
7
|
-
manifest = %x[rake check_manifest]
|
8
|
-
manifest.gsub!("(in /usr/local/projects/dm/dm-core)\n", '')
|
9
|
-
|
10
|
-
unless manifest.empty?
|
11
|
-
print "\n", '#' * 68, "\n"
|
12
|
-
print <<-EOS
|
13
|
-
Manifest.txt is not up-to-date. Please review the changes below.
|
14
|
-
If the changes are correct, run 'rake check_manifest | patch'
|
15
|
-
and then run this command again.
|
16
|
-
EOS
|
17
|
-
print '#' * 68, "\n\n"
|
18
|
-
puts manifest
|
19
|
-
else
|
20
|
-
%x[rake debug_gem > #{GEM_NAME}.gemspec]
|
21
|
-
puts "Successfully created gemspec for #{GEM_NAME}!"
|
22
|
-
end
|
23
|
-
end
|
data/tasks/hoe.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'hoe'
|
2
|
-
|
3
|
-
@config_file = '~/.rubyforge/user-config.yml'
|
4
|
-
@config = nil
|
5
|
-
RUBYFORGE_USERNAME = 'unknown'
|
6
|
-
def rubyforge_username
|
7
|
-
unless @config
|
8
|
-
begin
|
9
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
10
|
-
rescue
|
11
|
-
puts <<-EOS
|
12
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
13
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
14
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
15
|
-
EOS
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
end
|
19
|
-
RUBYFORGE_USERNAME.replace @config['username']
|
20
|
-
end
|
21
|
-
|
22
|
-
# Remove hoe dependency
|
23
|
-
class Hoe
|
24
|
-
def extra_dev_deps
|
25
|
-
@extra_dev_deps.reject! { |dep| dep[0] == 'hoe' }
|
26
|
-
@extra_dev_deps
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Don't use Hoe's test task
|
31
|
-
Hoe.plugins.delete(:test)
|
32
|
-
|
33
|
-
hoe = Hoe.spec(GEM_NAME) do
|
34
|
-
developer(AUTHOR, EMAIL)
|
35
|
-
|
36
|
-
self.version = GEM_VERSION
|
37
|
-
self.description = PROJECT_DESCRIPTION
|
38
|
-
self.summary = PROJECT_SUMMARY
|
39
|
-
self.url = PROJECT_URL
|
40
|
-
|
41
|
-
self.rubyforge_name = PROJECT_NAME
|
42
|
-
|
43
|
-
self.clean_globs |= %w[ {coverage,doc,log,tmp} **/*.{log,db} profile_results.* **/.DS_Store spec/db ]
|
44
|
-
self.extra_deps |= GEM_DEPENDENCIES
|
45
|
-
end
|
data/tasks/install.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
WIN32 = (RUBY_PLATFORM =~ /win32|mingw|bccwin|cygwin/) rescue nil
|
2
|
-
SUDO = WIN32 ? '' : ('sudo' unless ENV['SUDOLESS'])
|
3
|
-
|
4
|
-
def sudo_gem(cmd)
|
5
|
-
sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
|
6
|
-
end
|
7
|
-
|
8
|
-
if WIN32
|
9
|
-
desc "Install #{GEM_NAME}"
|
10
|
-
task :install => :gem do
|
11
|
-
sudo_gem "install --no-rdoc --no-ri pkg/#{GEM_NAME}-#{GEM_VERSION}.gem"
|
12
|
-
end
|
13
|
-
else
|
14
|
-
desc "Install #{GEM_NAME}"
|
15
|
-
task :install => :package do
|
16
|
-
sudo_gem "install --no-rdoc --no-ri pkg/#{GEM_NAME}-#{GEM_VERSION}.gem"
|
17
|
-
end
|
18
|
-
end
|