sqlbible 1.3.3 → 1.3.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
  SHA256:
3
- metadata.gz: 9766fb43d793d07864c2de0ddbc6df73883f6d606498776e0f4c323e75440618
4
- data.tar.gz: 906e690a19110464e8e2a42511eadc1e29eefc7b0fcd216e8fc7d999f2fa1706
3
+ metadata.gz: 21260f096b6235ac423d8406a10afe1b83f39765585bb3788489877da458c7d5
4
+ data.tar.gz: 747c638f0ed836cf25995b7b58659c79501bacb0b5d1e8198e5ef29d6b1aeab1
5
5
  SHA512:
6
- metadata.gz: ace4dd9751b380f6b61f95ad16b9929f6a0f88e141ebd6c3c19e35a2b8e0b4d8720383a79048c70c2de6b4a8f2fe9c109e090ba5d9c4fccaebe3afc101d3c9e4
7
- data.tar.gz: 4fed2ba4ad46cd2bc47a017c2a1b8c6c13b086cf77c8467f16cbcbd0551a652f21b0e68252913d647a6a1e943de34d6cef0c96df47b0e6f268b950d3839bd19e
6
+ metadata.gz: a6ff9efb6a3d602bfde16a4824ef8b92fa4e19d6f71d7fac7c8e7d06365b66540f23026d4bd945c879563910734eb860b595ffc4e19faa0b9d7ed38f5e0658d7
7
+ data.tar.gz: f46ccb07c1abad4264d31fdf5189a1e0ec60f95a3649bf7b8234733662a59a45ca6e77b743622b89a217af54e5230e95bfba32b9984ce9c2a832df2b1326c52d
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  class Sqlbible
5
- VERSION = '1.3.3'
5
+ VERSION = '1.3.4'
6
6
  end
data/lib/sqlbible.rb CHANGED
@@ -12,10 +12,7 @@ class Sqlbible
12
12
  attr_reader :db_filename
13
13
 
14
14
  def initialize db_name
15
- @db_filename = Sqlbible.resolve_db_filename(db_name)
16
- unless File.exist? @db_filename
17
- fail ArgumentError, format('database %s not found, file %s does not exist', db_name, @db_filename)
18
- end
15
+ @db_filename = Sqlbible.resolve_db_filename(db_name, check_existence: true)
19
16
  @db = SQLite3::Database.new(@db_filename)
20
17
  @db.enable_load_extension(true)
21
18
  pcre_extension_file = ENV['SQLITE_PCRE_EXTENSION']
@@ -112,11 +109,11 @@ class Sqlbible
112
109
  select_schema_major_minor(db).join('.')
113
110
  end
114
111
 
115
- def resolve_db_filename db_name
112
+ def resolve_db_filename db_name, check_existence: false
116
113
  db_name = db_name.to_s
117
114
  if File.basename(db_name, '.sqlbible') == db_name
118
115
  fn = File.join(bibles_dir, format('%s.sqlbible', db_name))
119
- unless bible_names.include?(db_name)
116
+ if check_existence && !File.exist?(fn)
120
117
  msg = format('database %s not found, file %s does not exist', db_name, fn)
121
118
  sc = DidYouMean::SpellChecker.new(dictionary: bible_names)
122
119
  res = sc.correct(db_name)
@@ -125,10 +122,13 @@ class Sqlbible
125
122
  end
126
123
  fail ArgumentError, msg
127
124
  end
128
- fn
129
125
  else
130
- db_name
126
+ fn = db_name
127
+ if check_existence && !File.exist?(fn)
128
+ fail ArgumentError, format('file %s does not exist', fn)
129
+ end
131
130
  end
131
+ fn
132
132
  end
133
133
 
134
134
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlbible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Friedrich
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2024-12-20 00:00:00.000000000 Z
10
+ date: 2024-12-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: did_you_mean
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
- rubygems_version: 3.6.1
127
+ rubygems_version: 3.7.0.dev
128
128
  specification_version: 4
129
129
  summary: Library for bibles as SQLite databases
130
130
  test_files: []