sqlite_magic 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +3 -0
- data/README.md +4 -3
- data/lib/sqlite_magic.rb +2 -0
- data/lib/sqlite_magic/version.rb +1 -1
- data/spec/lib/sqlite_magic_spec.rb +10 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjUyMTQxNjFkYzcyMzYwNTZhNTVjNWJlNGQ3NDk5NTE1MjUwMjQ4ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTA4MzE1NjBmMmRhYWJiNDhlY2U2YmNmOTAzMmFkYTRlMzA1YjI3OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTY3NWMyYzZiNTgzMzk1ZGUyNzg3ZDYzODNkMWI4ZTBiNjc1ZDA0NDU3NWM4
|
10
|
+
N2ExZWU5YzgwYmIzNGVlMjM0YTFlMDA4ZWU4NzM1YjczZDI2OGVmMWFjMWUz
|
11
|
+
MGFiZDRiZDZhZGRmMmI0MmIzZTM2M2JlNmY1OTZiYzFlYjRhYmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjcxM2Y1NjAwY2Y1MWU0Mjg3NzM5NmJkZTU2Y2RkM2U1NzViOWUyM2QxMzUz
|
14
|
+
NzI3OWU5MGE3ZjgzZTE4NjI4NDM1YTgwMGJkNGEyODE1MjJmN2Q0OTlkNGYw
|
15
|
+
NmE4ZDI5ZWRhODhiY2I4ZTA2MWI4ZjFkYWQzZGViMDEwMGNhYTU=
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SqliteMagic
|
2
2
|
[![Build Status](https://travis-ci.org/openc/sqlite_magic.png)](https://travis-ci.org/openc/sqlite_magic)
|
3
|
-
Experimental abstraction and refactoring of sqlite utility methods from
|
3
|
+
Experimental abstraction and refactoring of sqlite utility methods from
|
4
4
|
scraperwiki-ruby gem
|
5
5
|
Note: Not all functionality has yet been duplicated, and this may not work for
|
6
6
|
you. Developed and tested on Ruby 1.9.3
|
@@ -24,8 +24,9 @@ Or install it yourself as:
|
|
24
24
|
TODO: Write usage instructions here
|
25
25
|
|
26
26
|
## Changes
|
27
|
-
Allow options to be passed when initializing connection (which will be passed to Sqlite)
|
28
|
-
insert\_or\_update
|
27
|
+
* Allow options to be passed when initializing connection (which will be passed to Sqlite)
|
28
|
+
* insert\_or\_update now defers to #save\_data when hitting error (which caused a problem when missing field)
|
29
|
+
* busy_timeout can now be set in options
|
29
30
|
|
30
31
|
## Contributing
|
31
32
|
|
data/lib/sqlite_magic.rb
CHANGED
@@ -12,7 +12,9 @@ module SqliteMagic
|
|
12
12
|
class Connection
|
13
13
|
attr_reader :database
|
14
14
|
def initialize(db_loc='sqlite.db', options={})
|
15
|
+
busy_timeout = options.delete(:busy_timeout)
|
15
16
|
@database = SQLite3::Database.new(db_loc, options)
|
17
|
+
@database.busy_timeout = busy_timeout if busy_timeout
|
16
18
|
end
|
17
19
|
|
18
20
|
def add_columns(tbl_name, col_names)
|
data/lib/sqlite_magic/version.rb
CHANGED
@@ -46,6 +46,13 @@ describe SqliteMagic do
|
|
46
46
|
connection = SqliteMagic::Connection.new
|
47
47
|
connection.instance_variable_get(:@database).should == @dummy_db
|
48
48
|
end
|
49
|
+
|
50
|
+
it "should set busy_timeout if passed as options when opening Sqlite3 db" do
|
51
|
+
SQLite3::Database.should_receive(:new).with('path/to/mynew.db', {}).and_return(@dummy_db)
|
52
|
+
@dummy_db.should_receive(:busy_timeout=).with(12345)
|
53
|
+
connection = SqliteMagic::Connection.new('path/to/mynew.db', :busy_timeout => 12345)
|
54
|
+
end
|
55
|
+
|
49
56
|
end
|
50
57
|
|
51
58
|
it "should have #database accessor" do
|
@@ -345,12 +352,12 @@ describe SqliteMagic do
|
|
345
352
|
|
346
353
|
describe '#verbose?' do
|
347
354
|
it 'should return false if ENV["VERBOSE"] not set' do
|
348
|
-
@connection.verbose?.should
|
355
|
+
@connection.verbose?.should be_falsy
|
349
356
|
end
|
350
357
|
|
351
|
-
it 'should return
|
358
|
+
it 'should return true if ENV["VERBOSE"] set' do
|
352
359
|
ENV["VERBOSE"] = 'foo'
|
353
|
-
@connection.verbose?.should
|
360
|
+
@connection.verbose?.should be_truthy
|
354
361
|
ENV["VERBOSE"] = nil # reset
|
355
362
|
end
|
356
363
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqlite_magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Taggart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.4.
|
109
|
+
rubygems_version: 2.4.8
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Sprinkles some magic onto Sqlite3 gem
|