dm-mysql-adapter 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## Rubinius
17
+ *.rbc
18
+
19
+ ## PROJECT::GENERAL
20
+ *.gem
21
+ coverage
22
+ rdoc
23
+ pkg
24
+ tmp
25
+ doc
26
+ log
27
+ .yardoc
28
+ measurements
29
+
30
+ ## BUNDLER
31
+ .bundle
32
+ Gemfile.local
33
+ Gemfile.lock
34
+
35
+ ## PROJECT::SPECIFIC
36
+ spec/db/
data/Gemfile ADDED
@@ -0,0 +1,87 @@
1
+ # If you're working on more than one datamapper gem at a time, then it's
2
+ # recommended to create a local Gemfile and use this instead of the git
3
+ # sources. This will make sure that you are developing against your
4
+ # other local datamapper sources that you currently work on. Gemfile.local
5
+ # will behave identically to the standard Gemfile apart from the fact that
6
+ # it fetches the gems from local paths. This means that you can use the
7
+ # same environment variables, like ADAPTER when running bundle commands.
8
+ # Gemfile.local is added to .gitignore, so you don't need to worry about
9
+ # accidentally checking local development paths into git.
10
+ #
11
+ # bundle exec rake local_gemfile
12
+ #
13
+ # will give you a Gemfile.local file that points to your local clones of
14
+ # the various datamapper gems. It's assumed that all datamapper repo clones
15
+ # reside in the same directory. You can use the Gemfile.local like so for
16
+ # running any bundle command:
17
+ #
18
+ # BUNDLE_GEMFILE=Gemfile.local bundle foo
19
+ #
20
+ # To speed up running bundle tasks, it's recommended to run
21
+ #
22
+ # bundle lock
23
+ #
24
+ # after running 'bundle install' for the first time. This will make 'bundle exec' run
25
+ # a lot faster compared to the unlocked version. With an unlocked bundle you would
26
+ # typically just run 'bundle install' from time to time to fetch the latest sources from
27
+ # upstream. When you locked your bundle, you need to run
28
+ #
29
+ # bundle install --relock
30
+ #
31
+ # to make sure to fetch the latest updates and then lock the bundle again. Gemfile.lock
32
+ # is added to the .gitignore file, so you don't need to worry about accidentally checking
33
+ # it into version control.
34
+
35
+ source 'http://rubygems.org'
36
+
37
+ DATAMAPPER = 'git://github.com/datamapper'
38
+ DM_VERSION = '~> 1.0.0.rc1'
39
+ DO_VERSION = '~> 0.10.2'
40
+
41
+ group :runtime do # Runtime dependencies (as in the gemspec)
42
+
43
+ gem 'do_mysql', DO_VERSION, :git => "#{DATAMAPPER}/do.git"
44
+ gem 'dm-do-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-do-adapter.git"
45
+
46
+ end
47
+
48
+ group(:development) do # Development dependencies (as in the gemspec)
49
+
50
+ gem 'dm-migrations', DM_VERSION, :git => "#{DATAMAPPER}/dm-migrations.git"
51
+
52
+ gem 'rake', '~> 0.8.7'
53
+ gem 'rspec', '~> 1.3'
54
+ gem 'jeweler', '~> 1.4'
55
+
56
+ end
57
+
58
+ group :datamapper do # We need this because we want to pin these dependencies to their git master sources
59
+
60
+ if ENV['EXTLIB']
61
+ gem 'extlib', '~> 0.9.15', :git => "#{DATAMAPPER}/extlib.git", :require => nil
62
+ else
63
+ gem 'activesupport', '~> 3.0.0.beta3', :git => 'git://github.com/rails/rails.git', :require => nil
64
+ end
65
+
66
+ gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
67
+ gem 'data_objects', DO_VERSION, :git => "#{DATAMAPPER}/do.git"
68
+
69
+ plugins = ENV['PLUGINS'] || ENV['PLUGIN']
70
+ plugins = (plugins.to_s.gsub(',',' ').split(' ') + ['dm-migrations']).uniq
71
+
72
+ plugins.each do |plugin|
73
+ gem plugin, DM_VERSION, :git => "#{DATAMAPPER}/#{plugin}.git"
74
+ end
75
+
76
+ end
77
+
78
+ group :quality do # These gems contain rake tasks that check the quality of the source code
79
+
80
+ gem 'metric_fu', '~> 1.3'
81
+ gem 'rcov', '~> 0.9.7'
82
+ gem 'reek', '~> 1.2.7'
83
+ gem 'roodi', '~> 2.1'
84
+ gem 'yard', '~> 0.5'
85
+ gem 'yardstick', '~> 0.1'
86
+
87
+ end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Dan Kubb
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.
@@ -0,0 +1,3 @@
1
+ = dm-mysql-adapter
2
+
3
+ A MySQL Adapter for DataMapper
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+
6
+ require 'jeweler'
7
+
8
+ Jeweler::Tasks.new do |gem|
9
+ gem.name = 'dm-mysql-adapter'
10
+ gem.summary = 'MySQL Adapter for DataMapper'
11
+ gem.description = gem.summary
12
+ gem.authors = ["Dan Kubb"]
13
+ gem.email = %q{dan.kubb@gmail.com}
14
+ gem.homepage = 'http://github.com/datamapper/dm-mysql-adapter'
15
+
16
+ gem.add_dependency 'do_mysql', '~> 0.10.1'
17
+ gem.add_dependency 'dm-do-adapter', '~> 1.0.0.rc1'
18
+
19
+ gem.add_development_dependency 'rspec', '~> 1.3'
20
+ end
21
+
22
+ Jeweler::GemcutterTasks.new
23
+
24
+ FileList['tasks/**/*.rake'].each { |task| import task }
25
+ rescue LoadError
26
+ puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
27
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0.rc1
@@ -0,0 +1,68 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{dm-mysql-adapter}
8
+ s.version = "1.0.0.rc1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Dan Kubb"]
12
+ s.date = %q{2010-05-19}
13
+ s.description = %q{MySQL Adapter for DataMapper}
14
+ s.email = %q{dan.kubb@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "Gemfile",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "dm-mysql-adapter.gemspec",
27
+ "lib/dm-mysql-adapter.rb",
28
+ "lib/dm-mysql-adapter/adapter.rb",
29
+ "lib/dm-mysql-adapter/spec/setup.rb",
30
+ "spec/adapter_spec.rb",
31
+ "spec/rcov.opts",
32
+ "spec/spec.opts",
33
+ "spec/spec_helper.rb",
34
+ "tasks/local_gemfile.rake",
35
+ "tasks/spec.rake",
36
+ "tasks/yard.rake",
37
+ "tasks/yardstick.rake"
38
+ ]
39
+ s.homepage = %q{http://github.com/datamapper/dm-mysql-adapter}
40
+ s.rdoc_options = ["--charset=UTF-8"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = %q{1.3.6}
43
+ s.summary = %q{MySQL Adapter for DataMapper}
44
+ s.test_files = [
45
+ "spec/adapter_spec.rb",
46
+ "spec/spec_helper.rb"
47
+ ]
48
+
49
+ if s.respond_to? :specification_version then
50
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
51
+ s.specification_version = 3
52
+
53
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
54
+ s.add_runtime_dependency(%q<do_mysql>, ["~> 0.10.1"])
55
+ s.add_runtime_dependency(%q<dm-do-adapter>, ["~> 1.0.0.rc1"])
56
+ s.add_development_dependency(%q<rspec>, ["~> 1.3"])
57
+ else
58
+ s.add_dependency(%q<do_mysql>, ["~> 0.10.1"])
59
+ s.add_dependency(%q<dm-do-adapter>, ["~> 1.0.0.rc1"])
60
+ s.add_dependency(%q<rspec>, ["~> 1.3"])
61
+ end
62
+ else
63
+ s.add_dependency(%q<do_mysql>, ["~> 0.10.1"])
64
+ s.add_dependency(%q<dm-do-adapter>, ["~> 1.0.0.rc1"])
65
+ s.add_dependency(%q<rspec>, ["~> 1.3"])
66
+ end
67
+ end
68
+
@@ -0,0 +1 @@
1
+ require 'dm-mysql-adapter/adapter'
@@ -0,0 +1,47 @@
1
+ require 'do_mysql'
2
+ require 'dm-do-adapter'
3
+
4
+ module DataMapper
5
+ module Adapters
6
+
7
+ class MysqlAdapter < DataObjectsAdapter
8
+
9
+ module SQL #:nodoc:
10
+
11
+ IDENTIFIER_MAX_LENGTH = 64
12
+
13
+ private
14
+
15
+ # @api private
16
+ def supports_default_values? #:nodoc:
17
+ false
18
+ end
19
+
20
+ # @api private
21
+ def supports_subquery?(query, source_key, target_key, qualify)
22
+ # TODO: renable once query does not include target_model for deletes and updates
23
+ # query.limit.nil?
24
+
25
+ false
26
+ end
27
+
28
+ # @api private
29
+ def regexp_operator(operand)
30
+ 'REGEXP'
31
+ end
32
+
33
+ # @api private
34
+ def quote_name(name)
35
+ "`#{name[0, self.class::IDENTIFIER_MAX_LENGTH].gsub('`', '``')}`"
36
+ end
37
+
38
+ end
39
+
40
+ include SQL
41
+
42
+ end
43
+
44
+ const_added(:MysqlAdapter)
45
+
46
+ end
47
+ end
@@ -0,0 +1,15 @@
1
+ require 'dm-mysql-adapter'
2
+ require 'dm-core/spec/setup'
3
+
4
+ module DataMapper
5
+ module Spec
6
+ module Adapters
7
+
8
+ class MysqlAdapter < Adapter
9
+ end
10
+
11
+ use MysqlAdapter
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ require 'dm-core/spec/shared/adapter_spec'
4
+ require 'dm-do-adapter/spec/shared_spec'
5
+
6
+ require 'dm-migrations'
7
+ require 'dm-mysql-adapter/spec/setup'
8
+
9
+ ENV['ADAPTER'] = 'mysql'
10
+ ENV['ADAPTER_SUPPORTS'] = 'all'
11
+
12
+ describe "DataMapper::Adapters::MysqlAdapter" do
13
+
14
+ before :all do
15
+ @adapter = DataMapper::Spec.adapter
16
+ @repository = DataMapper.repository(@adapter.name)
17
+ end
18
+
19
+ it_should_behave_like "An Adapter"
20
+ it_should_behave_like "A DataObjects Adapter"
21
+
22
+ end
@@ -0,0 +1,5 @@
1
+ --exclude "spec"
2
+ --sort coverage
3
+ --callsites
4
+ --xrefs
5
+ --text-summary
@@ -0,0 +1,3 @@
1
+ --colour
2
+ --loadby random
3
+ --backtrace
@@ -0,0 +1,5 @@
1
+ require 'dm-core/spec/lib/pending_helpers'
2
+
3
+ Spec::Runner.configure do |config|
4
+ config.include(DataMapper::Spec::PendingHelpers)
5
+ end
@@ -0,0 +1,18 @@
1
+ desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
2
+ task :local_gemfile do |t|
3
+
4
+ root = Pathname(__FILE__).dirname.parent
5
+ datamapper = root.parent
6
+
7
+ source_regex = /DATAMAPPER = 'git:\/\/github.com\/datamapper'/
8
+ gem_source_regex = /:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/
9
+
10
+ root.join('Gemfile.local').open('w') do |f|
11
+ root.join('Gemfile').open.each do |line|
12
+ line.sub!(source_regex, "DATAMAPPER = '#{datamapper}'")
13
+ line.sub!(gem_source_regex, ':path => "#{DATAMAPPER}/\1"')
14
+ f.puts line
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,38 @@
1
+ spec_defaults = lambda do |spec|
2
+ spec.pattern = 'spec/**/*_spec.rb'
3
+ spec.libs << 'lib' << 'spec'
4
+ spec.spec_opts << '--options' << 'spec/spec.opts'
5
+ end
6
+
7
+ begin
8
+ require 'spec/rake/spectask'
9
+
10
+ Spec::Rake::SpecTask.new(:spec, &spec_defaults)
11
+ rescue LoadError
12
+ task :spec do
13
+ abort 'rspec is not available. In order to run spec, you must: gem install rspec'
14
+ end
15
+ end
16
+
17
+ begin
18
+ require 'rcov'
19
+ require 'spec/rake/verify_rcov'
20
+
21
+ Spec::Rake::SpecTask.new(:rcov) do |rcov|
22
+ spec_defaults.call(rcov)
23
+ rcov.rcov = true
24
+ rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
25
+ end
26
+
27
+ RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov|
28
+ rcov.threshold = 100
29
+ end
30
+ rescue LoadError
31
+ %w[ rcov verify_rcov ].each do |name|
32
+ task name do
33
+ abort "rcov is not available. In order to run #{name}, you must: gem install rcov"
34
+ end
35
+ end
36
+ end
37
+
38
+ task :default => :spec
@@ -0,0 +1,9 @@
1
+ begin
2
+ require 'yard'
3
+
4
+ YARD::Rake::YardocTask.new
5
+ rescue LoadError
6
+ task :yard do
7
+ abort 'YARD is not available. In order to run yard, you must: gem install yard'
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ begin
2
+ require 'pathname'
3
+ require 'yardstick/rake/measurement'
4
+ require 'yardstick/rake/verify'
5
+
6
+ # yardstick_measure task
7
+ Yardstick::Rake::Measurement.new
8
+
9
+ # verify_measurements task
10
+ Yardstick::Rake::Verify.new do |verify|
11
+ verify.threshold = 100
12
+ end
13
+ rescue LoadError
14
+ %w[ yardstick_measure verify_measurements ].each do |name|
15
+ task name.to_s do
16
+ abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
17
+ end
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dm-mysql-adapter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: true
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ - rc1
10
+ version: 1.0.0.rc1
11
+ platform: ruby
12
+ authors:
13
+ - Dan Kubb
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-05-19 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: do_mysql
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 10
31
+ - 1
32
+ version: 0.10.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: dm-do-adapter
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 1
44
+ - 0
45
+ - 0
46
+ - rc1
47
+ version: 1.0.0.rc1
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: rspec
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 1
59
+ - 3
60
+ version: "1.3"
61
+ type: :development
62
+ version_requirements: *id003
63
+ description: MySQL Adapter for DataMapper
64
+ email: dan.kubb@gmail.com
65
+ executables: []
66
+
67
+ extensions: []
68
+
69
+ extra_rdoc_files:
70
+ - LICENSE
71
+ - README.rdoc
72
+ files:
73
+ - .gitignore
74
+ - Gemfile
75
+ - LICENSE
76
+ - README.rdoc
77
+ - Rakefile
78
+ - VERSION
79
+ - dm-mysql-adapter.gemspec
80
+ - lib/dm-mysql-adapter.rb
81
+ - lib/dm-mysql-adapter/adapter.rb
82
+ - lib/dm-mysql-adapter/spec/setup.rb
83
+ - spec/adapter_spec.rb
84
+ - spec/rcov.opts
85
+ - spec/spec.opts
86
+ - spec/spec_helper.rb
87
+ - tasks/local_gemfile.rake
88
+ - tasks/spec.rake
89
+ - tasks/yard.rake
90
+ - tasks/yardstick.rake
91
+ has_rdoc: true
92
+ homepage: http://github.com/datamapper/dm-mysql-adapter
93
+ licenses: []
94
+
95
+ post_install_message:
96
+ rdoc_options:
97
+ - --charset=UTF-8
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">"
110
+ - !ruby/object:Gem::Version
111
+ segments:
112
+ - 1
113
+ - 3
114
+ - 1
115
+ version: 1.3.1
116
+ requirements: []
117
+
118
+ rubyforge_project:
119
+ rubygems_version: 1.3.6
120
+ signing_key:
121
+ specification_version: 3
122
+ summary: MySQL Adapter for DataMapper
123
+ test_files:
124
+ - spec/adapter_spec.rb
125
+ - spec/spec_helper.rb