fat_table 0.2.11 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e55116f769d702af90918ed1bff4e9d8589d02d746da47d599d3bc155bbd033
4
- data.tar.gz: f415408bfb6af7a2752b4f0f9d8d9b80407dd6062a1ba3ff85088886bd23c743
3
+ metadata.gz: f7870805173324438b3a4c2416e4f59fc3830cd7dc9272b30237cfa1a9ac9d20
4
+ data.tar.gz: 31e1d6f2c8fdabe9459850e8ca1c570028c63eec1c0c2f61a030421e943d9d66
5
5
  SHA512:
6
- metadata.gz: e3344a48f676d18c6e68ff460af5b697b19b8ebba6343d2a604ba62fc65d228b2e6f5563bcbfe7cf852d31db1fe20e9cc7f7952f75c4e6c09a2eb29a8211c9cd
7
- data.tar.gz: 615a248fc73a49ca5caad56c12569aa3686aa3450393c4a1305de657fc5a6809a34b1a135a84298373fb49f5fb8461af375abe2d6880319b0a49e9e5ccbd1c2e
6
+ metadata.gz: fd60f7879416e544c64c2e1d0efdc4cd349bf496a9c907bf7814d0ddc62c2b170ec46cc9bdb1d241fde7f50c6434233b0b2f4609adce5ec8c2073f32f52fd36e
7
+ data.tar.gz: f493a05c1b17640a41fffa5bceda6ff01047391a5f9ccb15abca1508e54a2701193912d2a6f5fc40d707b80209c93cf3c1524fd60f9cc55bdb9518b9383a3fec
data/.gitignore CHANGED
@@ -13,6 +13,7 @@
13
13
  .rspec_status
14
14
  /README.pdf
15
15
  /README.tex
16
+ /README.md
16
17
  /README.synctex.gz
17
18
  /_minted*
18
19
  /auto/
@@ -24,3 +25,4 @@
24
25
  /GRTAGS
25
26
  /GTAGS
26
27
  /TAGS
28
+ /README.pyg
@@ -2,6 +2,7 @@ language: ruby
2
2
  before_install:
3
3
  - sudo apt-get -qq update
4
4
  - sudo apt-get install -y texlive-latex-base texlive-latex-recommended
5
+ - gem install pg
5
6
  # before_script:
6
7
  # - createdb -U travis travis
7
8
  after_failure:
@@ -13,9 +14,9 @@ bundler_args: --without debug
13
14
  services:
14
15
  - postgresql
15
16
  rvm:
16
- - 2.3
17
17
  - 2.4
18
18
  - 2.5
19
19
  - 2.6
20
20
  - 2.7
21
21
  - ruby-head
22
+ - truffleruby
data/README.org CHANGED
@@ -44,17 +44,6 @@ buffer as an org-table, ready for processing by other code blocks.
44
44
 
45
45
  * Installation
46
46
 
47
- ** Prerequisites
48
- The ~fat_table~ gem depends on several libraries being available for building,
49
- mostly those concerned with accessing databases. On an ubuntu system, the
50
- following packages should be installed before you install the ~fat_table~ gem:
51
-
52
- - ruby-dev
53
- - build-essential
54
- - libsqlite3-dev
55
- - libpq-dev
56
- - libmysqlclient-dev
57
-
58
47
  ** Installing the gem
59
48
 
60
49
  Add this line to your application's Gemfile:
@@ -526,9 +515,17 @@ or strings that can be parsed into one of the permissible column types.
526
515
 
527
516
  *** From SQL queries
528
517
 
529
- Another way to initialize a ~FatTable~ table is with the results of a SQL query.
530
- ~FatTable~ uses the ~sequel~ gem to query databases. You must first set the
531
- database parameters to be used for the queries.
518
+ Another way to initialize a ~FatTable~ table is with the results of a SQL
519
+ query. Before you can connect to a database, you need to make sure that the required
520
+ adapter for your database is installed. ~FatTable~ uses the ~sequel~ gem
521
+ under the hood, so any database that it supports can be used. For example, if
522
+ you are accessing a Postgres database, you must install the ~pg~ gem with
523
+
524
+ #+begin_src sh
525
+ $ gem install pg
526
+ #+end_src
527
+
528
+ You must first set the database parameters to be used for the queries.
532
529
 
533
530
  #+BEGIN_SRC ruby
534
531
  # This automatically requires sequel.
@@ -77,9 +77,7 @@ Gem::Specification.new do |spec|
77
77
 
78
78
  spec.add_runtime_dependency 'activesupport', '>3.0'
79
79
  spec.add_runtime_dependency 'fat_core', '>= 4.1'
80
- spec.add_runtime_dependency 'mysql2'
81
- spec.add_runtime_dependency 'pg'
82
80
  spec.add_runtime_dependency 'rainbow'
83
81
  spec.add_runtime_dependency 'sequel'
84
- spec.add_runtime_dependency 'sqlite3'
82
+ spec.add_runtime_dependency 'gem-path'
85
83
  end
@@ -24,6 +24,15 @@ module FatTable
24
24
  require 'fat_table/db_handle'
25
25
  require 'fat_table/errors'
26
26
 
27
+ # Add paths for common db gems to the load paths
28
+ %w[pg mysql2 sqlite].each do |gem_name|
29
+ path = Dir.glob("#{ENV['GEM_HOME']}/gems/#{gem_name}*").sort.last
30
+ if path
31
+ path = File.join(path, 'lib')
32
+ $: << path unless $:.include?(path)
33
+ end
34
+ end
35
+
27
36
  # Valid output formats as symbols.
28
37
  FORMATS = %i[psv aoa aoh latex org term text].freeze
29
38
 
@@ -20,8 +20,9 @@ module FatTable
20
20
  #
21
21
  # +adapter+::
22
22
  # One of 'pg' (for Postgresql), 'mysql' or 'mysql2' (for Mysql), or
23
- # 'sqlite' (for SQLite3) to specify the +Sequel+ driver to use. You may
24
- # have to install the driver to make this work. By default use 'Pg'.
23
+ # 'sqlite' (for SQLite3) (or any other adapter supported by the +Sequel+
24
+ # gem) to specify the driver to use. You may have to install the
25
+ # appropriate driver to make this work.
25
26
  #
26
27
  # +database+::
27
28
  # The name of the database to access. There is no default for this.
@@ -55,8 +56,17 @@ module FatTable
55
56
  # Set the dsn for Sequel
56
57
  begin
57
58
  self.handle = Sequel.connect(args)
58
- rescue Sequel::Error => ex
59
- raise TransientError, "#{args}: #{ex}"
59
+ rescue Sequel::AdapterNotFound => ex
60
+ case ex.to_s
61
+ when /pg/
62
+ raise TransientError, 'You need to install the postgres adapter pg'
63
+ when /mysql/
64
+ raise TransientError, 'You need to install the mysql adapter'
65
+ when /sqlite/
66
+ raise TransientError, 'You need to install the sqlite adapter'
67
+ else
68
+ raise ex
69
+ end
60
70
  end
61
71
  handle
62
72
  end
@@ -1,4 +1,4 @@
1
1
  module FatTable
2
2
  # The current version of FatTable
3
- VERSION = '0.2.11'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-29 00:00:00.000000000 Z
11
+ date: 2020-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -192,34 +192,6 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '4.1'
195
- - !ruby/object:Gem::Dependency
196
- name: mysql2
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
- type: :runtime
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: pg
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :runtime
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
195
  - !ruby/object:Gem::Dependency
224
196
  name: rainbow
225
197
  requirement: !ruby/object:Gem::Requirement
@@ -249,7 +221,7 @@ dependencies:
249
221
  - !ruby/object:Gem::Version
250
222
  version: '0'
251
223
  - !ruby/object:Gem::Dependency
252
- name: sqlite3
224
+ name: gem-path
253
225
  requirement: !ruby/object:Gem::Requirement
254
226
  requirements:
255
227
  - - ">="
@@ -349,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
321
  - !ruby/object:Gem::Version
350
322
  version: '0'
351
323
  requirements: []
352
- rubygems_version: 3.1.2
324
+ rubygems_version: 3.0.3
353
325
  signing_key:
354
326
  specification_version: 4
355
327
  summary: Provides tools for working with tables as a data type.