sequel-postgres-schemata 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c3baadea6707d157ec0c50c2e223aacb31671f1
4
- data.tar.gz: 9cfc10fdaa7b92232d204afcc7f862c0f0eebae8
3
+ metadata.gz: d37a44aec26c81236ec3faed93d070e979470d24
4
+ data.tar.gz: 8f45729d8dfb844871fe82fb87fe2b5887675c56
5
5
  SHA512:
6
- metadata.gz: 77250f06ee7ff9dfcd424e3ab07cd6f76262a9839c0726fd158b15dbde6863d02c9adb5c89e1addef2c759f0d388259b58142f98afbd7768d481f87d6440e76b
7
- data.tar.gz: 090d1f42b1e25f709a6f93aaf6ff02a89edf34a816da51414ac8d2a7bbafafeb5fa3df8250c3eb91cda60116f13a2c2fcc2d8701f8401e8d7b6dc39866f8fadc
6
+ metadata.gz: 97eae6ecccd8c8244812da30778488380b8f8feb947fea5f544e521dc3726af14d53f8f8e74f4026d347cb6d570ea8cf8e4824e27d6ef2f80b8551b68d0653cf
7
+ data.tar.gz: 2845aa0d56e81c4f164836d51210f1c10cf0661f5a6ed1ac59e33f4fc2af39d0dacef095d1258a89e55e90f14fc394ecd638452ca258b67e256ef1a6e0cefc43
@@ -18,7 +18,7 @@ module Sequel
18
18
  def search_path
19
19
  metadata_dataset.with_sql(SHOW_SEARCH_PATH).
20
20
  single_value.scan(SCHEMA_SCAN_RE).flatten.
21
- map{|s|s.sub(SCHEMA_SUB_RE, '\1').gsub('""', '"').to_sym}
21
+ map{|s|s.strip.sub(SCHEMA_SUB_RE, '\1').gsub('""', '"').to_sym}
22
22
  end
23
23
 
24
24
  # Sets the search path. Starting with Postgres 9.2 it can contain
@@ -54,7 +54,7 @@ module Sequel
54
54
  private
55
55
 
56
56
  SHOW_SEARCH_PATH = "SHOW search_path".freeze
57
- SCHEMA_SCAN_RE = /(?<=\A|, )(".*?"|.*?)(?=, |\z)/.freeze
57
+ SCHEMA_SCAN_RE = /(?<=\A|,)(".*?"|.*?)(?=,|\z)/.freeze
58
58
  SCHEMA_SUB_RE = /\A"(.*)"\z/.freeze
59
59
  RENAME_SCHEMA_SQL = 'ALTER SCHEMA "%s" RENAME TO "%s"'.freeze
60
60
  end
@@ -1,7 +1,7 @@
1
1
  module Sequel
2
2
  module Postgres
3
3
  module Schemata
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  describe Sequel::Postgres::Schemata do
4
4
 
5
5
  let(:db) { Sequel::connect adapter: 'postgres', search_path: %w(foo public) }
6
+ let(:plain_db) { Sequel::connect adapter: 'postgres' }
6
7
 
7
8
  describe "#schemata" do
8
9
  it "lists all existing schematas" do
@@ -16,6 +17,10 @@ describe Sequel::Postgres::Schemata do
16
17
  it "returns the search path" do
17
18
  db.search_path.should == %i(foo public)
18
19
  end
20
+
21
+ it "correctly handles the default list" do
22
+ expect(plain_db.search_path).to eq(%i($user public))
23
+ end
19
24
  end
20
25
 
21
26
  describe "#search_path=" do
@@ -44,9 +49,9 @@ describe Sequel::Postgres::Schemata do
44
49
  db.search_path.should == %i(bar baz)
45
50
  end
46
51
 
47
- it "quotes the string list" do
48
- db.search_path = %w(bar, baz)
49
- db.search_path.should == %i(bar, baz)
52
+ it "quotes the string list correctly" do
53
+ db.search_path = ["bar\" ',", "baz"]
54
+ db.search_path.should == [:"bar\" ',", :baz]
50
55
  end
51
56
  end
52
57
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-postgres-schemata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafał Rzepecki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-07 00:00:00.000000000 Z
11
+ date: 2014-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -125,3 +125,4 @@ summary: Postgres schema manipulation
125
125
  test_files:
126
126
  - spec/schemata_spec.rb
127
127
  - spec/spec_helper.rb
128
+ has_rdoc: