sequel_tools 0.1.13 → 0.1.14

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
  SHA256:
3
- metadata.gz: dbc03d963faeda496049e1e3a8cc111bb68a18eeca2986b9b18a872280c6520a
4
- data.tar.gz: c498ec036d519fcc585e39c7dd32af341884138b108bf0baf08e7f5da73cd0bb
3
+ metadata.gz: 06cfd2214117b4cdfb808527ff3c611d55e3c661270460f04cf8f9b87effb60e
4
+ data.tar.gz: 0ab06e31e27d5781b820c783a10f41c9a54eb12df033611be3fdfad1fabbc896
5
5
  SHA512:
6
- metadata.gz: 65dc15bc47c0eba4f5fa067bc8ee521bebe3926a7e423e3dd9d1b7b5bda0ea65ea2cb925edc41ceac8e9e762df276873f92ce00a0687638e0e42b347b7c4d076
7
- data.tar.gz: 84a43de92472aaca2c48814b2a92f8305711103bc4c402d31e8ddc5fd3e6047ec1b11e3a70f408fae2f1a10e7d0665befaba7ec346db1b9ae5c9dc330bdc32ca
6
+ metadata.gz: e9a44d46447c25dfd7380286812e32725f958aac419b02a6d8d3e38a83a421186762a539e3b5ed3c61de81580ad8752de911a046ad69817395b18f63a37f0d5d
7
+ data.tar.gz: 9fd7486aae118ff74d43bb0d797778d26d7dab0b93b69c2e0dcb4f49fc986da9d5ea3913b205e7844b71f4e6f41635451cb1d4f08c1d51d4d3afb8942dc7fb4f
data/README.md CHANGED
@@ -127,7 +127,7 @@ PGPASSWORD=$DBPASSWORD
127
127
  psql
128
128
  ```
129
129
 
130
- Then you may pass `shell_command: '~/bin/opensql'` to `SequelTools.base_config`.
130
+ Then you may set `shell_command: '~/bin/opensql'` in config.
131
131
 
132
132
  Alternatively you can define the `shell_#{dbadapter}` action if you prefer. Take a look at
133
133
  the implementation for `shell_postgres` to see how to do that. If you want to share that action
@@ -8,8 +8,8 @@ class SequelTools::ActionsManager
8
8
  psql = c[:psql]
9
9
  env = {
10
10
  'PGDATABASE' => c[:dbname],
11
- 'PGHOST' => c[:dbhost],
12
- 'PGPORT' => c[:dbport].to_s,
11
+ 'PGHOST' => c[:dbhost] || 'localhost',
12
+ 'PGPORT' => (c[:dbport] || 5432).to_s,
13
13
  'PGUSER' => c[:username],
14
14
  'PGPASSWORD' => c[:password].to_s,
15
15
  }
@@ -9,9 +9,14 @@ module SequelTools
9
9
  uri_parts = []
10
10
  uri_parts << 'jdbc:' if RUBY_PLATFORM == 'java'
11
11
  uri_parts << "#{c[:jdbc_adapter] || c[:dbadapter]}://"
12
- uri_parts << c[:dbhost]
13
- uri_parts << ':' << c[:dbport] if c[:dbport]
14
- uri_parts << '/' << dbname
12
+ host = c[:dbhost]
13
+ host ||= 'localhost' unless (c[:dbadapter] == 'sqlite') || c[:no_dbhost]
14
+ if host
15
+ uri_parts << host
16
+ uri_parts << ':' << c[:dbport] if c[:dbport]
17
+ uri_parts << '/'
18
+ end
19
+ uri_parts << dbname
15
20
  if user = c[:username]
16
21
  uri_parts << '?user=' << user
17
22
  uri_parts << '&password=' << c[:password] if c[:password]
@@ -7,12 +7,14 @@ class PgHelper
7
7
  Tempfile.open 'pgpass' do |file|
8
8
  c = config
9
9
  file.chmod 0600
10
- file.write "#{c[:dbhost]}:#{c[:dbport]}:#{c[:dbname]}:#{c[:username]}:#{c[:password]}"
10
+ host = c[:dbhost] || 'localhost'
11
+ port = c[:dbport] || '5432'
12
+ file.write "#{host}:#{port}:#{c[:dbname]}:#{c[:username]}:#{c[:password]}"
11
13
  file.close
12
14
  env = {
13
15
  'PGDATABASE' => connect_database || c[:dbname],
14
- 'PGHOST' => c[:dbhost],
15
- 'PGPORT' => c[:dbport].to_s,
16
+ 'PGHOST' => host,
17
+ 'PGPORT' => port.to_s,
16
18
  'PGUSER' => c[:username],
17
19
  'PGPASSFILE' => file.path
18
20
  }
@@ -1,5 +1,5 @@
1
1
  # frozen-string-literal: true
2
2
 
3
3
  module SequelTools
4
- VERSION = '0.1.13'
4
+ VERSION = '0.1.14'
5
5
  end
data/lib/sequel_tools.rb CHANGED
@@ -12,7 +12,7 @@ module SequelTools
12
12
  schema_location: 'db/migrations/schema.sql',
13
13
  seeds_location: 'db/seeds.rb',
14
14
  dbname: nil,
15
- dbhost: 'localhost',
15
+ dbhost: nil,
16
16
  dbadapter: 'postgres',
17
17
  dbport: nil,
18
18
  username: nil,
@@ -24,7 +24,7 @@ module SequelTools
24
24
  extra_tables_in_dump: nil,
25
25
  } # unfrozen on purpose so that one might want to update the defaults
26
26
 
27
- REQUIRED_KEYS = [ :dbadapter, :dbname, :username ]
27
+ REQUIRED_KEYS = [ :dbadapter, :dbname ]
28
28
  class MissingConfigError < StandardError; end
29
29
  def self.base_config(extra_config = {})
30
30
  config = DEFAULT_CONFIG.merge extra_config
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Rosenfeld Rosas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-20 00:00:00.000000000 Z
11
+ date: 2022-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel