dm-sqlite-adapter 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -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_sqlite3', 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.
data/Rakefile ADDED
@@ -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-sqlite-adapter'
10
+ gem.summary = 'Sqlite3 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-sqlite-adapter'
15
+
16
+ gem.add_dependency 'do_sqlite3', '~> 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,66 @@
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-sqlite-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{Sqlite3 Adapter for DataMapper}
14
+ s.email = %q{dan.kubb@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "Gemfile",
21
+ "LICENSE",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "dm-sqlite-adapter.gemspec",
25
+ "lib/dm-sqlite-adapter.rb",
26
+ "lib/dm-sqlite-adapter/adapter.rb",
27
+ "lib/dm-sqlite-adapter/spec/setup.rb",
28
+ "spec/adapter_spec.rb",
29
+ "spec/rcov.opts",
30
+ "spec/spec.opts",
31
+ "spec/spec_helper.rb",
32
+ "tasks/local_gemfile.rake",
33
+ "tasks/spec.rake",
34
+ "tasks/yard.rake",
35
+ "tasks/yardstick.rake"
36
+ ]
37
+ s.homepage = %q{http://github.com/datamapper/dm-sqlite-adapter}
38
+ s.rdoc_options = ["--charset=UTF-8"]
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = %q{1.3.6}
41
+ s.summary = %q{Sqlite3 Adapter for DataMapper}
42
+ s.test_files = [
43
+ "spec/adapter_spec.rb",
44
+ "spec/spec_helper.rb"
45
+ ]
46
+
47
+ if s.respond_to? :specification_version then
48
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
+ s.specification_version = 3
50
+
51
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
52
+ s.add_runtime_dependency(%q<do_sqlite3>, ["~> 0.10.1"])
53
+ s.add_runtime_dependency(%q<dm-do-adapter>, ["~> 1.0.0.rc1"])
54
+ s.add_development_dependency(%q<rspec>, ["~> 1.3"])
55
+ else
56
+ s.add_dependency(%q<do_sqlite3>, ["~> 0.10.1"])
57
+ s.add_dependency(%q<dm-do-adapter>, ["~> 1.0.0.rc1"])
58
+ s.add_dependency(%q<rspec>, ["~> 1.3"])
59
+ end
60
+ else
61
+ s.add_dependency(%q<do_sqlite3>, ["~> 0.10.1"])
62
+ s.add_dependency(%q<dm-do-adapter>, ["~> 1.0.0.rc1"])
63
+ s.add_dependency(%q<rspec>, ["~> 1.3"])
64
+ end
65
+ end
66
+
@@ -0,0 +1 @@
1
+ require 'dm-sqlite-adapter/adapter'
@@ -0,0 +1,20 @@
1
+ require 'do_sqlite3'
2
+ require 'dm-do-adapter'
3
+
4
+ module DataMapper
5
+ module Adapters
6
+
7
+ class SqliteAdapter < DataObjectsAdapter
8
+
9
+ # @api private
10
+ def supports_subquery?(query, source_key, target_key, qualify)
11
+ # SQLite3 cannot match a subquery against more than one column
12
+ source_key.size == 1 && target_key.size == 1
13
+ end
14
+
15
+ end
16
+
17
+ const_added(:SqliteAdapter)
18
+
19
+ end
20
+ end
@@ -0,0 +1,25 @@
1
+ require 'dm-sqlite-adapter'
2
+ require 'dm-core/spec/setup'
3
+
4
+ require 'tempfile'
5
+
6
+ module DataMapper
7
+ module Spec
8
+ module Adapters
9
+
10
+ class SqliteAdapter < Adapter
11
+ def connection_uri
12
+ if name == :default
13
+ "sqlite3::memory:"
14
+ else
15
+ # sqlite doesn't support two in memory dbs
16
+ "sqlite3://#{Dir.tmpdir}/#{storage_name}.db"
17
+ end
18
+ end
19
+ end
20
+
21
+ use SqliteAdapter
22
+
23
+ end
24
+ end
25
+ 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-sqlite-adapter/spec/setup'
8
+
9
+ ENV['ADAPTER'] = 'sqlite'
10
+ ENV['ADAPTER_SUPPORTS'] = 'all'
11
+
12
+ describe 'DataMapper::Adapters::SqliteAdapter' 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
data/spec/rcov.opts ADDED
@@ -0,0 +1,5 @@
1
+ --exclude "spec"
2
+ --sort coverage
3
+ --callsites
4
+ --xrefs
5
+ --text-summary
data/spec/spec.opts ADDED
@@ -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
data/tasks/spec.rake ADDED
@@ -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
data/tasks/yard.rake ADDED
@@ -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,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dm-sqlite-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_sqlite3
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: Sqlite3 Adapter for DataMapper
64
+ email: dan.kubb@gmail.com
65
+ executables: []
66
+
67
+ extensions: []
68
+
69
+ extra_rdoc_files:
70
+ - LICENSE
71
+ files:
72
+ - .gitignore
73
+ - Gemfile
74
+ - LICENSE
75
+ - Rakefile
76
+ - VERSION
77
+ - dm-sqlite-adapter.gemspec
78
+ - lib/dm-sqlite-adapter.rb
79
+ - lib/dm-sqlite-adapter/adapter.rb
80
+ - lib/dm-sqlite-adapter/spec/setup.rb
81
+ - spec/adapter_spec.rb
82
+ - spec/rcov.opts
83
+ - spec/spec.opts
84
+ - spec/spec_helper.rb
85
+ - tasks/local_gemfile.rake
86
+ - tasks/spec.rake
87
+ - tasks/yard.rake
88
+ - tasks/yardstick.rake
89
+ has_rdoc: true
90
+ homepage: http://github.com/datamapper/dm-sqlite-adapter
91
+ licenses: []
92
+
93
+ post_install_message:
94
+ rdoc_options:
95
+ - --charset=UTF-8
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">"
108
+ - !ruby/object:Gem::Version
109
+ segments:
110
+ - 1
111
+ - 3
112
+ - 1
113
+ version: 1.3.1
114
+ requirements: []
115
+
116
+ rubyforge_project:
117
+ rubygems_version: 1.3.6
118
+ signing_key:
119
+ specification_version: 3
120
+ summary: Sqlite3 Adapter for DataMapper
121
+ test_files:
122
+ - spec/adapter_spec.rb
123
+ - spec/spec_helper.rb