sbf-dm-sqlite-adapter 1.3.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90a82bc1fc70c79e4570860b670e3798f4c25b61264e24311bd8399248125e1a
4
+ data.tar.gz: e8907c7b33217a54f49401efbb499006ffc799577adef671d73b6e6075eac6c0
5
+ SHA512:
6
+ metadata.gz: '054718c30e76481ffb004b949f847551c75f540874309f077e772e8faf15e7437ba10034c092e0208f4e981c33c668ea48bcec998d72d5059b11e13822d8c837'
7
+ data.tar.gz: f0d396ea641fbf78d12a5013e92e47e99101c338f03a76cbe415bdc899918da1b00579c093571ea2d057b40653041cca5b8f4478e6ce8bf25ca62d542458af98
data/.gitignore ADDED
@@ -0,0 +1,38 @@
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
+ ## RubyMine
20
+ .idea
21
+
22
+ ## PROJECT::GENERAL
23
+ *.gem
24
+ coverage
25
+ rdoc
26
+ pkg
27
+ tmp
28
+ doc
29
+ log
30
+ .yardoc
31
+ measurements
32
+
33
+ ## BUNDLER
34
+ .bundle
35
+ Gemfile.*
36
+
37
+ ## PROJECT::SPECIFIC
38
+ spec/db/
data/Gemfile ADDED
@@ -0,0 +1,60 @@
1
+ require 'pathname'
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ SOURCE = ENV.fetch('SOURCE', :git).to_sym
8
+ REPO_POSTFIX = SOURCE == :path ? '' : '.git'
9
+ DATAMAPPER = (SOURCE == :path) ? Pathname(__FILE__).dirname.parent : 'https://github.com/firespring'
10
+ DM_VERSION = '~> 1.3.0.beta'
11
+ DO_VERSION = '~> 0.10.17'
12
+ CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master')
13
+
14
+ options = {}
15
+ options[:branch] = CURRENT_BRANCH unless SOURCE == :path
16
+
17
+ do_options = {}
18
+ # DO_GIT is for the DataObjects repo which is not managed with thor in the same way as the rest of the gems. It is possible to have SOURCE configured
19
+ # as path while datamapper-do should use git. Configure these options separately.
20
+ if ENV['DO_GIT'] == 'true'
21
+ do_options[:branch] = CURRENT_BRANCH
22
+ do_options[:git] = "#{DATAMAPPER}/datamapper-do#{REPO_POSTFIX}"
23
+ end
24
+
25
+ gem 'sbf-do_sqlite3', DO_VERSION, do_options.dup
26
+
27
+ options[SOURCE] = "#{DATAMAPPER}/dm-do-adapter#{REPO_POSTFIX}"
28
+ gem 'sbf-dm-do-adapter', DM_VERSION, options.dup
29
+
30
+ group :development do
31
+ options[SOURCE] = "#{DATAMAPPER}/dm-migrations#{REPO_POSTFIX}"
32
+ gem 'sbf-dm-migrations', DM_VERSION, options.dup
33
+ end
34
+
35
+ platforms :mri_18 do
36
+ group :quality do
37
+
38
+ gem 'rcov', '~> 0.9.9'
39
+ gem 'yard', '~> 0.6'
40
+ gem 'yardstick', '~> 0.2'
41
+
42
+ end
43
+ end
44
+
45
+ group :datamapper do
46
+
47
+ options[SOURCE] = "#{DATAMAPPER}/dm-core#{REPO_POSTFIX}"
48
+ gem 'sbf-dm-core', DM_VERSION, options.dup
49
+
50
+ gem 'sbf-data_objects', DO_VERSION, do_options.dup
51
+
52
+ plugins = ENV['PLUGINS'] || ENV['PLUGIN']
53
+ plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
54
+
55
+ plugins.each do |plugin|
56
+ options[SOURCE] = "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}"
57
+ gem "sbf-#{plugin}", DM_VERSION, options.dup
58
+ end
59
+
60
+ end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 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,4 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ FileList['tasks/**/*.rake'].each { |task| import task }
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path('../lib/dm-sqlite-adapter/version', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = 'sbf-dm-sqlite-adapter'
7
+ gem.summary = 'Sqlite3 Adapter for DataMapper'
8
+ gem.description = gem.summary
9
+ gem.email = 'dan.kubb@gmail.com'
10
+ gem.homepage = 'http://datamapper.org'
11
+ gem.authors = [ 'Dan Kubb' ]
12
+
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.test_files = `git ls-files -- {spec}/*`.split("\n")
15
+ gem.extra_rdoc_files = %w[ LICENSE ]
16
+
17
+ gem.require_paths = %w[ lib ]
18
+ gem.version = DataMapper::SqliteAdapter::VERSION
19
+
20
+ gem.add_runtime_dependency('sbf-dm-do-adapter', [ '~> 1.3.0.beta' ])
21
+ gem.add_runtime_dependency('sbf-do_sqlite3', [ '~> 0.10.17' ])
22
+
23
+ gem.add_development_dependency('sbf-dm-migrations', [ '~> 1.3.0.beta' ])
24
+ gem.add_development_dependency('rake', [ '~> 0.9.2' ])
25
+ gem.add_development_dependency('rspec', [ '~> 1.3.2' ])
26
+ end
@@ -0,0 +1,42 @@
1
+ require 'do_sqlite3'
2
+ require 'dm-do-adapter'
3
+
4
+ module DataMapper
5
+ module Adapters
6
+
7
+ class SqliteAdapter < DataObjectsAdapter
8
+
9
+ def initialize(name, options)
10
+ super(name, normalize_options(options))
11
+ end
12
+
13
+ # @api private
14
+ def supports_subquery?(query, source_key, target_key, qualify)
15
+ # SQLite3 cannot match a subquery against more than one column
16
+ source_key.size == 1 && target_key.size == 1
17
+ end
18
+
19
+ def normalize_options(options)
20
+ # TODO Once do_sqlite3 accepts both a Pathname or a String,
21
+ # normalizing database and path won't be necessary anymore
22
+ # Clean out all the 'path-like' parameters in the options hash
23
+ # ensuring there can only be one.
24
+ # Also make sure a blank value can't possibly mask a non-blank one
25
+ path = nil
26
+ [:path, 'path', :database, 'database'].each do |key|
27
+ db = options.delete(key)
28
+ unless db.nil?
29
+ normalized_db = db.to_s # no Symbol#empty? on 1.8.7(ish) rubies
30
+ path ||= normalized_db unless normalized_db.empty?
31
+ end
32
+ end
33
+
34
+ options.update(:adapter => 'sqlite3', :path => path)
35
+ end
36
+
37
+ end
38
+
39
+ const_added(:SqliteAdapter)
40
+
41
+ end
42
+ 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,5 @@
1
+ module DataMapper
2
+ module SqliteAdapter
3
+ VERSION = '1.3.0.beta'
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require 'dm-sqlite-adapter/adapter'
@@ -0,0 +1,55 @@
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
+ let(:adapter) { DataMapper::Spec.adapter }
15
+ let(:repository) { DataMapper.repository(adapter.name) }
16
+
17
+ it_should_behave_like 'An Adapter'
18
+ it_should_behave_like 'A DataObjects Adapter'
19
+
20
+ describe 'with "sqlite" as adapter name' do
21
+ subject { DataMapper::Adapters::SqliteAdapter.new(:default, { :adapter => 'sqlite' }) }
22
+ it { subject.options[:adapter].should == 'sqlite3' }
23
+ end
24
+
25
+ describe 'with "sqlite3" as adapter name' do
26
+ subject { DataMapper::Adapters::SqliteAdapter.new(:default, { :adapter => 'sqlite3' }) }
27
+ it { subject.options[:adapter].should == 'sqlite3' }
28
+ end
29
+
30
+ describe 'with "database" given as Symbol' do
31
+ subject { DataMapper::Adapters::SqliteAdapter.new(:default, { :adapter => 'sqlite', :database => :name }) }
32
+ it { subject.options[:path].should == 'name' }
33
+ end
34
+
35
+ describe 'with "path" given as Symbol' do
36
+ subject { DataMapper::Adapters::SqliteAdapter.new(:default, { :adapter => 'sqlite', :path => :name }) }
37
+ it { subject.options[:path].should == 'name' }
38
+ end
39
+
40
+ describe 'with "database" given as String' do
41
+ subject { DataMapper::Adapters::SqliteAdapter.new(:default, { :adapter => 'sqlite', 'database' => :name }) }
42
+ it { subject.options[:path].should == 'name' }
43
+ end
44
+
45
+ describe 'with "path" given as String' do
46
+ subject { DataMapper::Adapters::SqliteAdapter.new(:default, { :adapter => 'sqlite', 'path' => :name }) }
47
+ it { subject.options[:path].should == 'name' }
48
+ end
49
+
50
+ describe 'with blank "path" and "database" given as Symbol' do
51
+ subject { DataMapper::Adapters::SqliteAdapter.new(:default, { :adapter => 'sqlite', 'path' => '', :database => :name }) }
52
+ it { subject.options[:path].should == 'name' }
53
+ end
54
+
55
+ 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
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,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sbf-dm-sqlite-adapter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0.beta
5
+ platform: ruby
6
+ authors:
7
+ - Dan Kubb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-10-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sbf-dm-do-adapter
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.0.beta
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.0.beta
27
+ - !ruby/object:Gem::Dependency
28
+ name: sbf-do_sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.17
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.10.17
41
+ - !ruby/object:Gem::Dependency
42
+ name: sbf-dm-migrations
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.0.beta
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.0.beta
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.3.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.3.2
83
+ description: Sqlite3 Adapter for DataMapper
84
+ email: dan.kubb@gmail.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files:
88
+ - LICENSE
89
+ files:
90
+ - ".gitignore"
91
+ - Gemfile
92
+ - LICENSE
93
+ - Rakefile
94
+ - dm-sqlite-adapter.gemspec
95
+ - lib/dm-sqlite-adapter.rb
96
+ - lib/dm-sqlite-adapter/adapter.rb
97
+ - lib/dm-sqlite-adapter/spec/setup.rb
98
+ - lib/dm-sqlite-adapter/version.rb
99
+ - spec/adapter_spec.rb
100
+ - spec/rcov.opts
101
+ - spec/spec.opts
102
+ - spec/spec_helper.rb
103
+ - tasks/spec.rake
104
+ - tasks/yard.rake
105
+ - tasks/yardstick.rake
106
+ homepage: http://datamapper.org
107
+ licenses: []
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">"
121
+ - !ruby/object:Gem::Version
122
+ version: 1.3.1
123
+ requirements: []
124
+ rubygems_version: 3.4.10
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: Sqlite3 Adapter for DataMapper
128
+ test_files: []