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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjEzZTViZTI2MTgwOTRiODQ4YzEzYzQyN2FkY2I0YmQ1Yjg4YzEzNA==
4
+ YjUyMTQxNjFkYzcyMzYwNTZhNTVjNWJlNGQ3NDk5NTE1MjUwMjQ4ZQ==
5
5
  data.tar.gz: !binary |-
6
- ZWIxMGEzZTliNWRiODI5MTFlYTNmYTQxOWYwZDJjOTAzZjliZWEzYQ==
6
+ YTA4MzE1NjBmMmRhYWJiNDhlY2U2YmNmOTAzMmFkYTRlMzA1YjI3OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzU4M2IwZGQ5ZTRiYmY1NzdmMTFjN2UzY2QyMTkxMzk0NTNhNzMwYzBiMGM5
10
- MzRhNjcyZDBiZDgwYmY2ZjdmM2FmODhhNTBjYTY3MDY4MTdjYzliYzUyMGY5
11
- MjY2MjdiM2I0NDIzOGU2MTVmMjg2YWFlOTNhMzFmYjUzMjYyNjg=
9
+ YTY3NWMyYzZiNTgzMzk1ZGUyNzg3ZDYzODNkMWI4ZTBiNjc1ZDA0NDU3NWM4
10
+ N2ExZWU5YzgwYmIzNGVlMjM0YTFlMDA4ZWU4NzM1YjczZDI2OGVmMWFjMWUz
11
+ MGFiZDRiZDZhZGRmMmI0MmIzZTM2M2JlNmY1OTZiYzFlYjRhYmU=
12
12
  data.tar.gz: !binary |-
13
- NzkxMDI5MTQ1YzhhN2U1NDJiMzA2ZGQ3ZWI5NzVmYTJlZmUzYzNhZWI3Y2Q4
14
- YzkyZWViZGFlZjZjNDY3YjU0OTNmYTk0MmUzMjEwMWM1MTc3YzdjMGFjODhi
15
- OGU2M2EzZDZkYWViY2QzOGJhZGRmY2UyYTdjOWU4NmYxNTY0Y2M=
13
+ NjcxM2Y1NjAwY2Y1MWU0Mjg3NzM5NmJkZTU2Y2RkM2U1NzViOWUyM2QxMzUz
14
+ NzI3OWU5MGE3ZjgzZTE4NjI4NDM1YTgwMGJkNGEyODE1MjJmN2Q0OTlkNGYw
15
+ NmE4ZDI5ZWRhODhiY2I4ZTA2MWI4ZjFkYWQzZGViMDEwMGNhYTU=
@@ -3,6 +3,9 @@ rvm:
3
3
  # - "1.8.7"
4
4
  - "1.9.2"
5
5
  - "1.9.3"
6
+ - "2.0.0"
7
+ - "2.1.0"
8
+ - "2.2.0"
6
9
  # - jruby-18mode # JRuby in 1.8 mode
7
10
  # - jruby-19mode # JRuby in 1.9 mode
8
11
  # - rbx-18mode
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 no defers to #save\_data when hitting error (which caused a problem when missing field)
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
 
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module SqliteMagic
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -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 be_false
355
+ @connection.verbose?.should be_falsy
349
356
  end
350
357
 
351
- it 'should return false if ENV["VERBOSE"] set' do
358
+ it 'should return true if ENV["VERBOSE"] set' do
352
359
  ENV["VERBOSE"] = 'foo'
353
- @connection.verbose?.should be_true
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.5
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-05-08 00:00:00.000000000 Z
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.5
109
+ rubygems_version: 2.4.8
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Sprinkles some magic onto Sqlite3 gem