poefy-sqlite3 0.1.0 → 1.1.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 +4 -4
- data/lib/poefy/sqlite3.rb +3 -3
- data/lib/poefy/sqlite3/version.rb +2 -2
- data/poefy-sqlite3.gemspec +1 -1
- data/spec/poefy_sqlite3_spec.rb +54 -39
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8806b7669ce6afbcea42c28575acb64b355e021a
|
4
|
+
data.tar.gz: b15888762fcb9e759934545eb8f634bfbe5cd8b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de5980e39718fdf884bac2c715915ed88ac7296a8150843e14af004caab42fd9c72e080ff383ec2eb7dba2326591e532b167cf172a3f6cbfd948bf7e4b79779a
|
7
|
+
data.tar.gz: e330587bdbe424830769e1b7b6104fad7b305a4aef621d3864556968c1204705b868bff5e907fb39a259cb2c236c00b9cb796480f14a176e588ad8f32583433a
|
data/lib/poefy/sqlite3.rb
CHANGED
@@ -231,9 +231,9 @@ module Poefy
|
|
231
231
|
@sproc[key] = db.prepare value
|
232
232
|
end
|
233
233
|
rescue
|
234
|
-
|
235
|
-
|
236
|
-
|
234
|
+
msg = "ERROR: Database table structure is invalid." +
|
235
|
+
"\n Please manually DROP the corrupt table and recreate it."
|
236
|
+
raise Poefy::StructureInvalid.new(msg)
|
237
237
|
end
|
238
238
|
|
239
239
|
# Find rhymes and counts greater than a certain length.
|
data/poefy-sqlite3.gemspec
CHANGED
@@ -26,6 +26,6 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_development_dependency('rspec', '~> 3.0')
|
27
27
|
s.add_development_dependency('ruby_rhymes', '~> 0.1')
|
28
28
|
|
29
|
-
s.add_runtime_dependency('poefy', '~> 1.
|
29
|
+
s.add_runtime_dependency('poefy', '~> 1.1', '>= 1.1.0')
|
30
30
|
s.add_runtime_dependency('sqlite3', '~> 1.3', '>= 1.3.13')
|
31
31
|
end
|
data/spec/poefy_sqlite3_spec.rb
CHANGED
@@ -119,26 +119,31 @@ describe Poefy::Poem, "-- SQLite" do
|
|
119
119
|
|
120
120
|
describe ":rhyme option" do
|
121
121
|
|
122
|
-
describe "should
|
122
|
+
describe "should raise Poefy::MissingFormOrRhyme" do
|
123
123
|
it "blank, no argument" do
|
124
|
-
|
125
|
-
|
124
|
+
expect {
|
125
|
+
@poefy.poem
|
126
|
+
}.to raise_error(Poefy::MissingFormOrRhyme)
|
126
127
|
end
|
127
128
|
it "({ })" do
|
128
|
-
|
129
|
-
|
129
|
+
expect {
|
130
|
+
@poefy.poem ({ })
|
131
|
+
}.to raise_error(Poefy::MissingFormOrRhyme)
|
130
132
|
end
|
131
133
|
it "({ rhyme: nil })" do
|
132
|
-
|
133
|
-
|
134
|
+
expect {
|
135
|
+
@poefy.poem ({ rhyme: nil })
|
136
|
+
}.to raise_error(Poefy::MissingFormOrRhyme)
|
134
137
|
end
|
135
138
|
it "({ rhyme: ' ' })" do
|
136
|
-
|
137
|
-
|
139
|
+
expect {
|
140
|
+
@poefy.poem ({ rhyme: ' ' })
|
141
|
+
}.to raise_error(Poefy::MissingFormOrRhyme)
|
138
142
|
end
|
139
143
|
it "({ rhyme: '' })" do
|
140
|
-
|
141
|
-
|
144
|
+
expect {
|
145
|
+
@poefy.poem ({ rhyme: '' })
|
146
|
+
}.to raise_error(Poefy::MissingFormOrRhyme)
|
142
147
|
end
|
143
148
|
end
|
144
149
|
|
@@ -165,23 +170,25 @@ describe Poefy::Poem, "-- SQLite" do
|
|
165
170
|
end
|
166
171
|
end
|
167
172
|
|
168
|
-
describe "should
|
173
|
+
describe "should raise error if can't parse rhyme string" do
|
169
174
|
rhymes = %w{a1 b1 ab1 Ab1 AAAAABb1 1 1111 1122 11221 ;;::1. }
|
170
175
|
rhymes += ['AA Bb1','11 11','11 1 1','..1.']
|
171
176
|
rhymes.each do |i|
|
172
177
|
it "({ rhyme: '#{i}' })" do
|
173
|
-
|
174
|
-
|
178
|
+
expect {
|
179
|
+
@poefy.poem ({ rhyme: i })
|
180
|
+
}.to raise_error(Poefy::RhymeError)
|
175
181
|
end
|
176
182
|
end
|
177
183
|
end
|
178
184
|
|
179
|
-
describe "should
|
185
|
+
describe "should raise error if can't complete rhyme string" do
|
180
186
|
rhymes = %w{aaaaaa abcd aaaaabbbbb}
|
181
187
|
rhymes.each do |i|
|
182
188
|
it "({ rhyme: '#{i}' })" do
|
183
|
-
|
184
|
-
|
189
|
+
expect {
|
190
|
+
@poefy.poem ({ rhyme: i })
|
191
|
+
}.to raise_error(Poefy::NotEnoughData)
|
185
192
|
end
|
186
193
|
end
|
187
194
|
end
|
@@ -201,12 +208,13 @@ describe Poefy::Poem, "-- SQLite" do
|
|
201
208
|
end
|
202
209
|
end
|
203
210
|
|
204
|
-
describe "should
|
211
|
+
describe "should raise error if can't complete repeating rhyme string" do
|
205
212
|
lines = 200
|
206
213
|
it "({ rhyme: ('A'..'D').to_a.map { |i| i * #{lines} }.join })" do
|
207
214
|
rhyme = ('A'..'D').to_a.map { |i| i * lines }.join
|
208
|
-
|
209
|
-
|
215
|
+
expect {
|
216
|
+
@poefy.poem ({ rhyme: rhyme })
|
217
|
+
}.to raise_error(Poefy::NotEnoughData)
|
210
218
|
end
|
211
219
|
end
|
212
220
|
|
@@ -221,29 +229,34 @@ describe Poefy::Poem, "-- SQLite" do
|
|
221
229
|
end
|
222
230
|
end
|
223
231
|
|
224
|
-
describe "should
|
232
|
+
describe "should raise error if given a named form it can't fulfil" do
|
225
233
|
it "({ form: 'sonnet' })" do
|
226
|
-
|
227
|
-
|
234
|
+
expect {
|
235
|
+
@poefy.poem ({ form: 'sonnet' })
|
236
|
+
}.to raise_error(Poefy::NotEnoughData)
|
228
237
|
end
|
229
238
|
it "({ form: :villanelle })" do
|
230
|
-
|
231
|
-
|
239
|
+
expect {
|
240
|
+
@poefy.poem ({ form: 'villanelle' })
|
241
|
+
}.to raise_error(Poefy::NotEnoughData)
|
232
242
|
end
|
233
243
|
end
|
234
244
|
|
235
|
-
describe "should
|
245
|
+
describe "should raise error if given a junk named form" do
|
236
246
|
it "({ form: 'sonnet_junk' })" do
|
237
|
-
|
238
|
-
|
247
|
+
expect {
|
248
|
+
@poefy.poem ({ form: 'sonnet_junk' })
|
249
|
+
}.to raise_error(Poefy::MissingFormOrRhyme)
|
239
250
|
end
|
240
251
|
it "({ form: :not_a_form })" do
|
241
|
-
|
242
|
-
|
252
|
+
expect {
|
253
|
+
@poefy.poem ({ form: :not_a_form })
|
254
|
+
}.to raise_error(Poefy::MissingFormOrRhyme)
|
243
255
|
end
|
244
256
|
it "({ form: :not_a_form, indent: '0010' })" do
|
245
|
-
|
246
|
-
|
257
|
+
expect {
|
258
|
+
@poefy.poem ({ form: :not_a_form, indent: '0010' })
|
259
|
+
}.to raise_error(Poefy::MissingFormOrRhyme)
|
247
260
|
end
|
248
261
|
end
|
249
262
|
|
@@ -308,11 +321,12 @@ describe Poefy::Poem, "-- SQLite" do
|
|
308
321
|
expect(poem.count).to be 14
|
309
322
|
end
|
310
323
|
end
|
311
|
-
describe "should
|
324
|
+
describe "should raise Poefy::NotEnoughData" do
|
312
325
|
it "({ form: :sonnet, acrostic: 'qqqqqqqqqqqqqq' })" do
|
313
|
-
|
314
|
-
|
315
|
-
|
326
|
+
expect {
|
327
|
+
@poefy.poem ({ form: :sonnet,
|
328
|
+
acrostic: 'qqqqqqqqqqqqqq' })
|
329
|
+
}.to raise_error(Poefy::NotEnoughData)
|
316
330
|
end
|
317
331
|
end
|
318
332
|
end
|
@@ -336,12 +350,13 @@ describe Poefy::Poem, "-- SQLite" do
|
|
336
350
|
end
|
337
351
|
end
|
338
352
|
|
339
|
-
describe "should
|
353
|
+
describe "should raise Poefy::NotEnoughData" do
|
340
354
|
forms_fail.each do |form|
|
341
355
|
it "({ form: #{form} })" do
|
342
356
|
4.times do
|
343
|
-
|
344
|
-
|
357
|
+
expect {
|
358
|
+
@poefy.poem ({ form: form })
|
359
|
+
}.to raise_error(Poefy::NotEnoughData)
|
345
360
|
end
|
346
361
|
end
|
347
362
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poefy-sqlite3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Thompson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,20 +72,20 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.1'
|
76
76
|
- - ">="
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 1.
|
78
|
+
version: 1.1.0
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - "~>"
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '1.
|
85
|
+
version: '1.1'
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 1.
|
88
|
+
version: 1.1.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: sqlite3
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|