amalgalite 1.6.3-x86-mingw32 → 1.8.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +26 -0
- data/LICENSE +1 -1
- data/README.md +3 -2
- data/Rakefile +9 -8
- data/ext/amalgalite/c/amalgalite_constants.c +207 -1
- data/ext/amalgalite/c/amalgalite_database.c +80 -70
- data/ext/amalgalite/c/extconf.rb +8 -0
- data/ext/amalgalite/c/gen_constants.rb +23 -0
- data/ext/amalgalite/c/sqlite3.c +51527 -28444
- data/ext/amalgalite/c/sqlite3.h +2193 -990
- data/ext/amalgalite/c/sqlite3ext.h +77 -0
- data/lib/amalgalite/2.4/amalgalite.so +0 -0
- data/lib/amalgalite/2.5/amalgalite.so +0 -0
- data/lib/amalgalite/2.6/amalgalite.so +0 -0
- data/lib/amalgalite/2.7/amalgalite.so +0 -0
- data/lib/amalgalite/3.0/amalgalite.so +0 -0
- data/lib/amalgalite/3.1/amalgalite.so +0 -0
- data/lib/amalgalite/aggregate.rb +6 -0
- data/lib/amalgalite/csv_table_importer.rb +3 -2
- data/lib/amalgalite/database.rb +2 -53
- data/lib/amalgalite/profile_tap.rb +2 -2
- data/lib/amalgalite/taps/io.rb +5 -2
- data/lib/amalgalite/trace_tap.rb +1 -1
- data/lib/amalgalite/version.rb +1 -1
- data/spec/aggregate_spec.rb +4 -0
- data/spec/database_spec.rb +12 -15
- data/spec/sqlite3/version_spec.rb +7 -7
- data/tasks/custom.rake +7 -8
- data/tasks/default.rake +13 -9
- data/tasks/extension.rake +12 -22
- data/tasks/this.rb +5 -5
- metadata +41 -35
- data/lib/amalgalite/2.2/amalgalite.so +0 -0
- data/lib/amalgalite/2.3/amalgalite.so +0 -0
@@ -319,6 +319,46 @@ struct sqlite3_api_routines {
|
|
319
319
|
void(*xDestroy)(void*));
|
320
320
|
/* Version 3.26.0 and later */
|
321
321
|
const char *(*normalized_sql)(sqlite3_stmt*);
|
322
|
+
/* Version 3.28.0 and later */
|
323
|
+
int (*stmt_isexplain)(sqlite3_stmt*);
|
324
|
+
int (*value_frombind)(sqlite3_value*);
|
325
|
+
/* Version 3.30.0 and later */
|
326
|
+
int (*drop_modules)(sqlite3*,const char**);
|
327
|
+
/* Version 3.31.0 and later */
|
328
|
+
sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64);
|
329
|
+
const char *(*uri_key)(const char*,int);
|
330
|
+
const char *(*filename_database)(const char*);
|
331
|
+
const char *(*filename_journal)(const char*);
|
332
|
+
const char *(*filename_wal)(const char*);
|
333
|
+
/* Version 3.32.0 and later */
|
334
|
+
const char *(*create_filename)(const char*,const char*,const char*,
|
335
|
+
int,const char**);
|
336
|
+
void (*free_filename)(const char*);
|
337
|
+
sqlite3_file *(*database_file_object)(const char*);
|
338
|
+
/* Version 3.34.0 and later */
|
339
|
+
int (*txn_state)(sqlite3*,const char*);
|
340
|
+
/* Version 3.36.1 and later */
|
341
|
+
sqlite3_int64 (*changes64)(sqlite3*);
|
342
|
+
sqlite3_int64 (*total_changes64)(sqlite3*);
|
343
|
+
/* Version 3.37.0 and later */
|
344
|
+
int (*autovacuum_pages)(sqlite3*,
|
345
|
+
unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
|
346
|
+
void*, void(*)(void*));
|
347
|
+
/* Version 3.38.0 and later */
|
348
|
+
int (*error_offset)(sqlite3*);
|
349
|
+
int (*vtab_rhs_value)(sqlite3_index_info*,int,sqlite3_value**);
|
350
|
+
int (*vtab_distinct)(sqlite3_index_info*);
|
351
|
+
int (*vtab_in)(sqlite3_index_info*,int,int);
|
352
|
+
int (*vtab_in_first)(sqlite3_value*,sqlite3_value**);
|
353
|
+
int (*vtab_in_next)(sqlite3_value*,sqlite3_value**);
|
354
|
+
/* Version 3.39.0 and later */
|
355
|
+
int (*deserialize)(sqlite3*,const char*,unsigned char*,
|
356
|
+
sqlite3_int64,sqlite3_int64,unsigned);
|
357
|
+
unsigned char *(*serialize)(sqlite3*,const char *,sqlite3_int64*,
|
358
|
+
unsigned int);
|
359
|
+
const char *(*db_name)(sqlite3*,int);
|
360
|
+
/* Version 3.40.0 and later */
|
361
|
+
int (*value_encoding)(sqlite3_value*);
|
322
362
|
};
|
323
363
|
|
324
364
|
/*
|
@@ -608,6 +648,43 @@ typedef int (*sqlite3_loadext_entry)(
|
|
608
648
|
#define sqlite3_create_window_function sqlite3_api->create_window_function
|
609
649
|
/* Version 3.26.0 and later */
|
610
650
|
#define sqlite3_normalized_sql sqlite3_api->normalized_sql
|
651
|
+
/* Version 3.28.0 and later */
|
652
|
+
#define sqlite3_stmt_isexplain sqlite3_api->stmt_isexplain
|
653
|
+
#define sqlite3_value_frombind sqlite3_api->value_frombind
|
654
|
+
/* Version 3.30.0 and later */
|
655
|
+
#define sqlite3_drop_modules sqlite3_api->drop_modules
|
656
|
+
/* Version 3.31.0 and later */
|
657
|
+
#define sqlite3_hard_heap_limit64 sqlite3_api->hard_heap_limit64
|
658
|
+
#define sqlite3_uri_key sqlite3_api->uri_key
|
659
|
+
#define sqlite3_filename_database sqlite3_api->filename_database
|
660
|
+
#define sqlite3_filename_journal sqlite3_api->filename_journal
|
661
|
+
#define sqlite3_filename_wal sqlite3_api->filename_wal
|
662
|
+
/* Version 3.32.0 and later */
|
663
|
+
#define sqlite3_create_filename sqlite3_api->create_filename
|
664
|
+
#define sqlite3_free_filename sqlite3_api->free_filename
|
665
|
+
#define sqlite3_database_file_object sqlite3_api->database_file_object
|
666
|
+
/* Version 3.34.0 and later */
|
667
|
+
#define sqlite3_txn_state sqlite3_api->txn_state
|
668
|
+
/* Version 3.36.1 and later */
|
669
|
+
#define sqlite3_changes64 sqlite3_api->changes64
|
670
|
+
#define sqlite3_total_changes64 sqlite3_api->total_changes64
|
671
|
+
/* Version 3.37.0 and later */
|
672
|
+
#define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages
|
673
|
+
/* Version 3.38.0 and later */
|
674
|
+
#define sqlite3_error_offset sqlite3_api->error_offset
|
675
|
+
#define sqlite3_vtab_rhs_value sqlite3_api->vtab_rhs_value
|
676
|
+
#define sqlite3_vtab_distinct sqlite3_api->vtab_distinct
|
677
|
+
#define sqlite3_vtab_in sqlite3_api->vtab_in
|
678
|
+
#define sqlite3_vtab_in_first sqlite3_api->vtab_in_first
|
679
|
+
#define sqlite3_vtab_in_next sqlite3_api->vtab_in_next
|
680
|
+
/* Version 3.39.0 and later */
|
681
|
+
#ifndef SQLITE_OMIT_DESERIALIZE
|
682
|
+
#define sqlite3_deserialize sqlite3_api->deserialize
|
683
|
+
#define sqlite3_serialize sqlite3_api->serialize
|
684
|
+
#endif
|
685
|
+
#define sqlite3_db_name sqlite3_api->db_name
|
686
|
+
/* Version 3.40.0 and later */
|
687
|
+
#define sqlite3_value_encoding sqlite3_api->value_encoding
|
611
688
|
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
612
689
|
|
613
690
|
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/amalgalite/aggregate.rb
CHANGED
@@ -13,6 +13,7 @@ module Amalgalite
|
|
13
13
|
# implementation you must:
|
14
14
|
#
|
15
15
|
# * implement _initalize_ with 0 arguments
|
16
|
+
# * call super() in your _initialize_ method
|
16
17
|
# * set the @arity data member
|
17
18
|
# * set the @name data member
|
18
19
|
# * implement _step_ with arity of +@arity+
|
@@ -25,6 +26,7 @@ module Amalgalite
|
|
25
26
|
# attr_accessor :words
|
26
27
|
#
|
27
28
|
# def initialize
|
29
|
+
# super
|
28
30
|
# @name = 'unique_word_count'
|
29
31
|
# @arity = 1
|
30
32
|
# @words = Hash.new { |h,k| h[k] = 0 }
|
@@ -50,6 +52,10 @@ module Amalgalite
|
|
50
52
|
# The arity of the SQL function
|
51
53
|
attr_accessor :arity
|
52
54
|
|
55
|
+
def initialize
|
56
|
+
@_exception = nil
|
57
|
+
end
|
58
|
+
|
53
59
|
# finalize should return the final value of the aggregate function
|
54
60
|
def finalize
|
55
61
|
raise NotImplementedError, "Aggregate#finalize must be implemented"
|
@@ -15,14 +15,15 @@ module Amalgalite
|
|
15
15
|
@database = database
|
16
16
|
@table_name = table_name
|
17
17
|
@table = @database.schema.tables[@table_name]
|
18
|
-
@options = options
|
18
|
+
@options = options.dup
|
19
|
+
@encoding = options.delete("encoding") || "UTF-8"
|
19
20
|
validate
|
20
21
|
end
|
21
22
|
|
22
23
|
def run
|
23
24
|
@database.transaction do |db|
|
24
25
|
db.prepare( insert_sql ) do |stmt|
|
25
|
-
::CSV.foreach( @csv_path, @options ) do |row|
|
26
|
+
::CSV.foreach( @csv_path, "r:#{@encoding}", **@options ) do |row|
|
26
27
|
stmt.execute( row )
|
27
28
|
end
|
28
29
|
end
|
data/lib/amalgalite/database.rb
CHANGED
@@ -339,7 +339,6 @@ module Amalgalite
|
|
339
339
|
#
|
340
340
|
def clear_taps!
|
341
341
|
self.trace_tap = nil
|
342
|
-
self.profile_tap = nil
|
343
342
|
end
|
344
343
|
|
345
344
|
##
|
@@ -393,20 +392,19 @@ module Amalgalite
|
|
393
392
|
#
|
394
393
|
# db.trace_tap = nil
|
395
394
|
#
|
396
|
-
# This will
|
395
|
+
# This will unregister the trace tap
|
397
396
|
#
|
398
397
|
#
|
399
398
|
def trace_tap=( tap_obj )
|
400
399
|
|
401
400
|
# unregister any previous trace tap
|
402
401
|
#
|
403
|
-
|
402
|
+
if !@trace_tap.nil? then
|
404
403
|
@trace_tap.trace( 'unregistered as trace tap' )
|
405
404
|
@trace_tap = nil
|
406
405
|
end
|
407
406
|
return @trace_tap if tap_obj.nil?
|
408
407
|
|
409
|
-
|
410
408
|
# wrap the tap if we need to
|
411
409
|
#
|
412
410
|
if tap_obj.respond_to?( 'trace' ) then
|
@@ -424,55 +422,6 @@ module Amalgalite
|
|
424
422
|
@trace_tap.trace( 'registered as trace tap' )
|
425
423
|
end
|
426
424
|
|
427
|
-
|
428
|
-
##
|
429
|
-
# call-seq:
|
430
|
-
# db.profile_tap = obj
|
431
|
-
#
|
432
|
-
# Register a profile tap.
|
433
|
-
#
|
434
|
-
# Registering a profile tap means that the +obj+ registered will have its
|
435
|
-
# +profile+ method called with an Integer and a String parameter every time
|
436
|
-
# a profile event happens. The Integer is the number of nanoseconds it took
|
437
|
-
# for the String (SQL) to execute in wall-clock time.
|
438
|
-
#
|
439
|
-
# That is, every time a profile event happens in SQLite the following is
|
440
|
-
# invoked:
|
441
|
-
#
|
442
|
-
# obj.profile( str, int )
|
443
|
-
#
|
444
|
-
# For instance:
|
445
|
-
#
|
446
|
-
# db.profile_tap = Amalgalite::ProfileTap.new( logger, 'debug' )
|
447
|
-
#
|
448
|
-
# This will register an instance of ProfileTap, which wraps an logger object.
|
449
|
-
# On each +profile+ event the ProfileTap#profile method will be called
|
450
|
-
# which in turn will call <tt>logger.debug<tt> with a formatted string containing
|
451
|
-
# the String and Integer from the profile event.
|
452
|
-
#
|
453
|
-
# db.profile_tap = nil
|
454
|
-
#
|
455
|
-
# This will unregister the profile tap
|
456
|
-
#
|
457
|
-
#
|
458
|
-
def profile_tap=( tap_obj )
|
459
|
-
|
460
|
-
# unregister any previous profile tap
|
461
|
-
unless @profile_tap.nil?
|
462
|
-
@profile_tap.profile( 'unregistered as profile tap', 0.0 )
|
463
|
-
@profile_tap = nil
|
464
|
-
end
|
465
|
-
return @profile_tap if tap_obj.nil?
|
466
|
-
|
467
|
-
if tap_obj.respond_to?( 'profile' ) then
|
468
|
-
@profile_tap = tap_obj
|
469
|
-
else
|
470
|
-
raise Amalgalite::Error, "#{tap_obj.class.name} cannot be used to tap. It has no 'profile' method"
|
471
|
-
end
|
472
|
-
@api.register_profile_tap( @profile_tap )
|
473
|
-
@profile_tap.profile( 'registered as profile tap', 0.0 )
|
474
|
-
end
|
475
|
-
|
476
425
|
##
|
477
426
|
# call-seq:
|
478
427
|
# db.type_map = DefaultMap.new
|
@@ -120,8 +120,8 @@ module Amalgalite
|
|
120
120
|
# time information.
|
121
121
|
#
|
122
122
|
def profile( msg, time )
|
123
|
-
|
124
|
-
|
123
|
+
msg = msg.gsub(/\s+/,' ')
|
124
|
+
unless sampler = @samplers[msg]
|
125
125
|
sampler = @samplers[msg] = ProfileSampler.new( msg )
|
126
126
|
end
|
127
127
|
sampler.sample( time )
|
data/lib/amalgalite/taps/io.rb
CHANGED
@@ -9,7 +9,7 @@ require 'stringio'
|
|
9
9
|
module Amalgalite
|
10
10
|
module Taps
|
11
11
|
#
|
12
|
-
# An IOTap is an easy way to send all top information to
|
12
|
+
# An IOTap is an easy way to send all top information to any IO based
|
13
13
|
# object. Both profile and trace tap information can be captured
|
14
14
|
# This means you can send the events to STDOUT with:
|
15
15
|
#
|
@@ -20,14 +20,17 @@ module Amalgalite
|
|
20
20
|
|
21
21
|
attr_reader :profile_tap
|
22
22
|
attr_reader :io
|
23
|
+
attr_reader :trace_count
|
23
24
|
|
24
25
|
def initialize( io )
|
25
26
|
@io = io
|
26
27
|
@profile_tap = ProfileTap.new( self, 'output_profile_event' )
|
28
|
+
@trace_count = 0
|
27
29
|
end
|
28
30
|
|
29
31
|
def trace( msg )
|
30
|
-
|
32
|
+
@trace_count += 1
|
33
|
+
io.puts msg
|
31
34
|
end
|
32
35
|
|
33
36
|
# need a profile method, it routes through the profile tap which calls back
|
data/lib/amalgalite/trace_tap.rb
CHANGED
@@ -19,7 +19,7 @@ module Amalgalite
|
|
19
19
|
attr_reader :delegate_method
|
20
20
|
|
21
21
|
def initialize( wrapped_obj, send_to = 'trace' )
|
22
|
-
unless wrapped_obj.respond_to?( send_to )
|
22
|
+
unless wrapped_obj.respond_to?( send_to )
|
23
23
|
raise Amalgalite::Error, "#{wrapped_obj.class.name} does not respond to #{send_to.to_s} "
|
24
24
|
end
|
25
25
|
|
data/lib/amalgalite/version.rb
CHANGED
data/spec/aggregate_spec.rb
CHANGED
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
class AggregateTest1 < ::Amalgalite::Aggregate
|
4
4
|
def initialize
|
5
|
+
super
|
5
6
|
@name = 'atest1'
|
6
7
|
@arity = -1
|
7
8
|
@count = 0
|
@@ -96,6 +97,7 @@ describe "Aggregate SQL Functions" do
|
|
96
97
|
it "handles an error being thrown during the step function" do
|
97
98
|
class AggregateTest5 < AggregateTest1
|
98
99
|
def initialize
|
100
|
+
super
|
99
101
|
@name = "atest5"
|
100
102
|
@arity = -1
|
101
103
|
@count = 0
|
@@ -117,6 +119,7 @@ describe "Aggregate SQL Functions" do
|
|
117
119
|
it "handles an error being thrown during the finalize function" do
|
118
120
|
class AggregateTest6 < AggregateTest1
|
119
121
|
def initialize
|
122
|
+
super
|
120
123
|
@name = "atest6"
|
121
124
|
@count = 0
|
122
125
|
@arity = -1
|
@@ -131,6 +134,7 @@ describe "Aggregate SQL Functions" do
|
|
131
134
|
|
132
135
|
it "handles an error being thrown during initialization in the C extension" do
|
133
136
|
class AggregateTest7 < AggregateTest1
|
137
|
+
@called = false
|
134
138
|
def self.called?
|
135
139
|
if @called then
|
136
140
|
raise "Initialization error!"
|
data/spec/database_spec.rb
CHANGED
@@ -119,9 +119,13 @@ describe Amalgalite::Database do
|
|
119
119
|
sql = "CREATE TABLE trace_test( x, y, z)"
|
120
120
|
s = db.trace_tap = ::Amalgalite::Taps::StringIO.new
|
121
121
|
db.execute( sql )
|
122
|
-
|
122
|
+
escaped_sql= Regexp.quote(sql)
|
123
|
+
db.trace_tap.string.should match(/registered as trace tap/)
|
124
|
+
db.trace_tap.string.should match(/#{escaped_sql}/)
|
125
|
+
s.trace_count.should eql(2)
|
123
126
|
db.trace_tap = nil
|
124
|
-
s.
|
127
|
+
s.trace_count.should eql(3)
|
128
|
+
s.string.should match(/unregistered as trace tap/)
|
125
129
|
end
|
126
130
|
|
127
131
|
it "raises an exception if the wrong type of object is used for tracing" do
|
@@ -129,18 +133,13 @@ describe Amalgalite::Database do
|
|
129
133
|
lambda { db.trace_tap = Object.new }.should raise_error(Amalgalite::Error)
|
130
134
|
end
|
131
135
|
|
132
|
-
it "raises an exception if the wrong type of object is used for profile" do
|
133
|
-
db = Amalgalite::Database.new( SpecInfo.test_db )
|
134
|
-
lambda { db.profile_tap = Object.new }.should raise_error(Amalgalite::Error)
|
135
|
-
end
|
136
|
-
|
137
136
|
it "profiles the execution of code" do
|
138
137
|
db = Amalgalite::Database.new( SpecInfo.test_db )
|
139
|
-
s = db.
|
138
|
+
s = db.trace_tap = ::Amalgalite::Taps::StringIO.new
|
140
139
|
db.execute_batch( @schema )
|
141
|
-
db.
|
142
|
-
db.
|
143
|
-
s.string.should =~ /unregistered as
|
140
|
+
db.trace_tap.samplers.size.should eql(5)
|
141
|
+
db.trace_tap = nil
|
142
|
+
s.string.should =~ /unregistered as trace tap/
|
144
143
|
end
|
145
144
|
|
146
145
|
it "#execute yields each row when called with a block" do
|
@@ -167,13 +166,11 @@ describe Amalgalite::Database do
|
|
167
166
|
|
168
167
|
it "can clear all registered taps" do
|
169
168
|
db = Amalgalite::Database.new( SpecInfo.test_db )
|
170
|
-
s = db.
|
171
|
-
db.trace_tap = s
|
169
|
+
s = db.trace_tap = ::Amalgalite::Taps::StringIO.new
|
172
170
|
db.execute_batch( @schema )
|
173
|
-
db.
|
171
|
+
db.trace_tap.samplers.size.should eql(5)
|
174
172
|
db.clear_taps!
|
175
173
|
s.string.should =~ /unregistered as trace tap/m
|
176
|
-
s.string.should =~ /unregistered as profile tap/m
|
177
174
|
end
|
178
175
|
|
179
176
|
it "allows nested transactions even if SQLite under the covers does not" do
|
@@ -7,21 +7,21 @@ describe "Amalgalite::SQLite3::Version" do
|
|
7
7
|
expect(Amalgalite::SQLite3::Version.to_s).to match( /\d+\.\d+\.\d+/ )
|
8
8
|
expect(Amalgalite::SQLite3::Version.runtime_version).to match( /\d+\.\d+\.\d+/ )
|
9
9
|
|
10
|
-
Amalgalite::SQLite3::Version.to_i.should eql(
|
11
|
-
Amalgalite::SQLite3::Version.runtime_version_number.should eql(
|
10
|
+
Amalgalite::SQLite3::Version.to_i.should eql(3040001)
|
11
|
+
Amalgalite::SQLite3::Version.runtime_version_number.should eql(3040001)
|
12
12
|
|
13
13
|
Amalgalite::SQLite3::Version::MAJOR.should eql(3)
|
14
|
-
Amalgalite::SQLite3::Version::MINOR.should eql(
|
15
|
-
Amalgalite::SQLite3::Version::RELEASE.should eql(
|
14
|
+
Amalgalite::SQLite3::Version::MINOR.should eql(40)
|
15
|
+
Amalgalite::SQLite3::Version::RELEASE.should eql(1)
|
16
16
|
expect(Amalgalite::SQLite3::Version.to_a.size).to eql(3)
|
17
17
|
|
18
|
-
Amalgalite::SQLite3::Version.compiled_version.should be == "3.
|
19
|
-
Amalgalite::SQLite3::Version.compiled_version_number.should be ==
|
18
|
+
Amalgalite::SQLite3::Version.compiled_version.should be == "3.40.1"
|
19
|
+
Amalgalite::SQLite3::Version.compiled_version_number.should be == 3040001
|
20
20
|
Amalgalite::SQLite3::Version.compiled_matches_runtime?.should be == true
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should have the sqlite3 source id" do
|
24
|
-
source_id = "
|
24
|
+
source_id = "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24"
|
25
25
|
Amalgalite::SQLite3::Version.compiled_source_id.should be == source_id
|
26
26
|
Amalgalite::SQLite3::Version.runtime_source_id.should be == source_id
|
27
27
|
end
|
data/tasks/custom.rake
CHANGED
@@ -63,7 +63,7 @@ namespace :util do
|
|
63
63
|
|
64
64
|
require 'uri'
|
65
65
|
require 'open-uri'
|
66
|
-
require 'zip'
|
66
|
+
require 'archive/zip'
|
67
67
|
|
68
68
|
parts = version.split(".")
|
69
69
|
next_version = [ parts.shift.to_s ]
|
@@ -79,22 +79,21 @@ namespace :util do
|
|
79
79
|
file = "tmp/#{File.basename( url.path ) }"
|
80
80
|
FileUtils.mkdir "tmp" unless File.directory?( "tmp" )
|
81
81
|
File.open( file, "wb+") do |f|
|
82
|
-
open
|
82
|
+
url.open do |input|
|
83
83
|
f.write( input.read )
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
puts "extracting..."
|
88
88
|
upstream_files = %w[ sqlite3.h sqlite3.c sqlite3ext.h ]
|
89
|
-
Zip
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
bname = File.basename( entry.name )
|
89
|
+
Archive::Zip.open( file ) do |archive|
|
90
|
+
archive.each do |entry|
|
91
|
+
next unless entry.file?
|
92
|
+
bname = File.basename( entry.zip_path)
|
94
93
|
if upstream_files.include?( bname ) then
|
95
94
|
dest_file = File.join( "ext", "amalgalite", "c", bname )
|
96
95
|
puts "updating #{dest_file}"
|
97
|
-
entry.extract( dest_file
|
96
|
+
entry.extract(file_path: dest_file)
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|
data/tasks/default.rake
CHANGED
@@ -39,7 +39,11 @@ begin
|
|
39
39
|
require 'rspec/core/rake_task'
|
40
40
|
RSpec::Core::RakeTask.new( :test ) do |t|
|
41
41
|
t.ruby_opts = %w[ -w ]
|
42
|
-
t.rspec_opts = %w[
|
42
|
+
t.rspec_opts = %w[
|
43
|
+
--color
|
44
|
+
--format documentation
|
45
|
+
--format RspecJunitFormatter --out tmp/report.xml
|
46
|
+
]
|
43
47
|
end
|
44
48
|
task :test_requirements
|
45
49
|
task :test => :test_requirements
|
@@ -157,7 +161,7 @@ namespace :fixme do
|
|
157
161
|
end
|
158
162
|
|
159
163
|
desc "See if the fixme tools are outdated"
|
160
|
-
task :outdated
|
164
|
+
task :outdated do
|
161
165
|
if fixme_up_to_date? then
|
162
166
|
puts "Fixme files are up to date."
|
163
167
|
else
|
@@ -168,7 +172,7 @@ namespace :fixme do
|
|
168
172
|
end
|
169
173
|
|
170
174
|
desc "Update outdated fixme files"
|
171
|
-
task :update
|
175
|
+
task :update do
|
172
176
|
if fixme_up_to_date? then
|
173
177
|
puts "Fixme files are already up to date."
|
174
178
|
else
|
@@ -199,7 +203,7 @@ task :gemspec do
|
|
199
203
|
end
|
200
204
|
|
201
205
|
# .rbc files from ruby 2.0
|
202
|
-
CLOBBER <<
|
206
|
+
CLOBBER << "**/*.rbc"
|
203
207
|
|
204
208
|
# The standard gem packaging task, everyone has it.
|
205
209
|
require 'rubygems/package_task'
|
@@ -211,19 +215,19 @@ end
|
|
211
215
|
# Release - the steps we go through to do a final release, this is pulled from
|
212
216
|
# a compbination of mojombo's rakegem, hoe and hoe-git
|
213
217
|
#
|
214
|
-
# 1) make sure we are on the
|
218
|
+
# 1) make sure we are on the main branch
|
215
219
|
# 2) make sure there are no uncommitted items
|
216
220
|
# 3) check the manifest and make sure all looks good
|
217
221
|
# 4) build the gem
|
218
222
|
# 5) do an empty commit to have the commit message of the version
|
219
223
|
# 6) tag that commit as the version
|
220
|
-
# 7) push
|
224
|
+
# 7) push main
|
221
225
|
# 8) push the tag
|
222
226
|
# 7) pus the gem
|
223
227
|
#------------------------------------------------------------------------------
|
224
228
|
task :release_check do
|
225
|
-
unless `git branch` =~ /^\*
|
226
|
-
abort "You must be on the
|
229
|
+
unless `git branch` =~ /^\* main/
|
230
|
+
abort "You must be on the main branch to release!"
|
227
231
|
end
|
228
232
|
unless `git status` =~ /^nothing to commit/m
|
229
233
|
abort "Nope, sorry, you have unfinished business"
|
@@ -234,7 +238,7 @@ desc "Create tag v#{This.version}, build and push #{This.platform_gemspec.full_n
|
|
234
238
|
task :release => [ :release_check, 'manifest:check', :gem ] do
|
235
239
|
sh "git commit --allow-empty -a -m 'Release #{This.version}'"
|
236
240
|
sh "git tag -a -m 'v#{This.version}' v#{This.version}"
|
237
|
-
sh "git push origin
|
241
|
+
sh "git push origin main"
|
238
242
|
sh "git push origin v#{This.version}"
|
239
243
|
sh "gem push pkg/#{This.platform_gemspec.full_name}.gem"
|
240
244
|
end
|
data/tasks/extension.rake
CHANGED
@@ -6,27 +6,17 @@
|
|
6
6
|
# in your top level rakefile
|
7
7
|
begin
|
8
8
|
require 'rake/extensiontask'
|
9
|
-
|
9
|
+
Rake::ExtensionTask.new( This.name ) do |ext|
|
10
|
+
ext.ext_dir = File.join( 'ext', This.name, "c" )
|
11
|
+
ext.lib_dir = File.join( 'lib', This.name )
|
12
|
+
ext.gem_spec = This.ruby_gemspec
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
else
|
20
|
-
|
21
|
-
Rake::ExtensionTask.new( This.name ) do |ext|
|
22
|
-
ext.ext_dir = File.join( 'ext', This.name, "c" )
|
23
|
-
ext.lib_dir = File.join( 'lib', This.name )
|
24
|
-
ext.gem_spec = This.ruby_gemspec
|
25
|
-
|
26
|
-
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
|
27
|
-
ext.cross_platform = %w[x86-mingw32 x64-mingw32] # forces the Windows platform instead of the default one
|
28
|
-
# configure options only for cross compile
|
29
|
-
end
|
14
|
+
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
|
15
|
+
ext.cross_platform = %w[
|
16
|
+
x86-mingw32
|
17
|
+
x64-mingw-ucrt
|
18
|
+
x64-mingw32
|
19
|
+
]
|
30
20
|
end
|
31
21
|
|
32
22
|
task :test_requirements => :compile
|
@@ -34,5 +24,5 @@ rescue LoadError
|
|
34
24
|
This.task_warning( 'extension' )
|
35
25
|
end
|
36
26
|
|
37
|
-
CLOBBER <<
|
38
|
-
CLOBBER <<
|
27
|
+
CLOBBER << "lib/**/*.{jar,so,bundle}"
|
28
|
+
CLOBBER << "lib/#{This.name}/{1,2,3}.*/"
|
data/tasks/this.rb
CHANGED
@@ -25,10 +25,10 @@ class ThisProject
|
|
25
25
|
#
|
26
26
|
# Yields self
|
27
27
|
def initialize(&block)
|
28
|
-
@exclude_from_manifest = Regexp.union(/\.(git|DS_Store|
|
29
|
-
/^(doc|coverage|pkg|tmp
|
28
|
+
@exclude_from_manifest = Regexp.union(/\.(git|DS_Store|semaphore)/,
|
29
|
+
/^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)/,
|
30
30
|
/^[^\/]+\.gemspec/,
|
31
|
-
/\.(swp|jar|bundle|so|rvmrc|travis.yml|byebug_history)$/,
|
31
|
+
/\.(swp|jar|bundle|so|rvmrc|travis.yml|byebug_history|fossa.yml|ruby-version)$/,
|
32
32
|
/~$/)
|
33
33
|
@gemspecs = Hash.new
|
34
34
|
yield self if block_given?
|
@@ -135,7 +135,7 @@ class ThisProject
|
|
135
135
|
spec.homepage = homepage
|
136
136
|
|
137
137
|
spec.summary = summary
|
138
|
-
spec.description =
|
138
|
+
spec.description = summary
|
139
139
|
spec.license = license
|
140
140
|
|
141
141
|
spec.files = manifest
|
@@ -185,7 +185,7 @@ class ThisProject
|
|
185
185
|
|
186
186
|
# Internal: Return the summary text from the README
|
187
187
|
def summary
|
188
|
-
description_section.first
|
188
|
+
description_section.first.gsub(/\s+/, ' ')
|
189
189
|
end
|
190
190
|
|
191
191
|
# Internal: Return the full description text from the README
|