lg_pod_plugin 1.1.6.6 → 1.1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/command/command.rb +1 -0
- data/lib/command/doctor.rb +31 -0
- data/lib/command/init.rb +36 -8
- data/lib/command/install.rb +1 -1
- data/lib/command/update.rb +1 -1
- data/lib/lg_pod_plugin/config/l_config.rb +6 -19
- data/lib/lg_pod_plugin/db/database.rb +116 -110
- data/lib/lg_pod_plugin/downloader/downloader.rb +7 -6
- data/lib/lg_pod_plugin/downloader/l_cache.rb +11 -2
- data/lib/lg_pod_plugin/downloader/overload_cache.rb +329 -0
- data/lib/lg_pod_plugin/downloader/request.rb +32 -32
- data/lib/lg_pod_plugin/git/gitlab_api.rb +102 -5
- data/lib/lg_pod_plugin/installer/PodDownload +0 -0
- data/lib/lg_pod_plugin/installer/install.rb +1 -4
- data/lib/lg_pod_plugin/installer/main.rb +0 -1
- data/lib/lg_pod_plugin/installer/project.rb +2 -7
- data/lib/lg_pod_plugin/net/l_uri.rb +0 -7
- data/lib/lg_pod_plugin/pod/release-pod.rb +11 -42
- data/lib/lg_pod_plugin/utils/l_util.rb +9 -9
- data/lib/lg_pod_plugin/version.rb +1 -1
- data/lib/lg_pod_plugin.rb +1 -0
- metadata +29 -119
- data/lib/sqlite3-1.5.3-arm64-darwin/API_CHANGES.md +0 -49
- data/lib/sqlite3-1.5.3-arm64-darwin/CHANGELOG.md +0 -462
- data/lib/sqlite3-1.5.3-arm64-darwin/CONTRIBUTING.md +0 -24
- data/lib/sqlite3-1.5.3-arm64-darwin/ChangeLog.cvs +0 -88
- data/lib/sqlite3-1.5.3-arm64-darwin/README.md +0 -235
- data/lib/sqlite3-1.5.3-arm64-darwin/dependencies.yml +0 -14
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.c +0 -274
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.h +0 -12
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.c +0 -168
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.h +0 -15
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.c +0 -853
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.h +0 -17
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.c +0 -98
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.h +0 -8
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/extconf.rb +0 -251
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3.c +0 -163
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3_ruby.h +0 -48
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.c +0 -442
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.h +0 -16
- data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.md +0 -431
- data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb +0 -145
- data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.yml +0 -426
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.2/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/constants.rb +0 -50
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/database.rb +0 -741
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/errors.rb +0 -35
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/pragmas.rb +0 -595
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/resultset.rb +0 -187
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/statement.rb +0 -145
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/translator.rb +0 -118
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/value.rb +0 -57
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/version.rb +0 -23
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3.rb +0 -15
- data/lib/sqlite3-1.5.3-arm64-darwin/test/helper.rb +0 -27
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_backup.rb +0 -33
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_collation.rb +0 -82
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database.rb +0 -545
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_flags.rb +0 -95
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readonly.rb +0 -36
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readwrite.rb +0 -41
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb +0 -44
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_encoding.rb +0 -155
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration.rb +0 -507
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_aggregate.rb +0 -336
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_open_close.rb +0 -30
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_pending.rb +0 -115
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_resultset.rb +0 -142
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_statement.rb +0 -194
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb +0 -37
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_sqlite3.rb +0 -30
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement.rb +0 -263
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement_execute.rb +0 -35
- data/lib/sqlite3-1.5.3-x86_64-darwin/API_CHANGES.md +0 -49
- data/lib/sqlite3-1.5.3-x86_64-darwin/CHANGELOG.md +0 -462
- data/lib/sqlite3-1.5.3-x86_64-darwin/CONTRIBUTING.md +0 -24
- data/lib/sqlite3-1.5.3-x86_64-darwin/ChangeLog.cvs +0 -88
- data/lib/sqlite3-1.5.3-x86_64-darwin/README.md +0 -235
- data/lib/sqlite3-1.5.3-x86_64-darwin/dependencies.yml +0 -14
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.c +0 -274
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.h +0 -12
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.c +0 -168
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.h +0 -15
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.c +0 -853
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.h +0 -17
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.c +0 -98
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.h +0 -8
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/extconf.rb +0 -251
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3.c +0 -163
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3_ruby.h +0 -48
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.c +0 -442
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.h +0 -16
- data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.md +0 -431
- data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.rb +0 -145
- data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.yml +0 -426
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.2/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/constants.rb +0 -50
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/database.rb +0 -741
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/errors.rb +0 -35
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/pragmas.rb +0 -595
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/resultset.rb +0 -187
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/statement.rb +0 -145
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/translator.rb +0 -118
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/value.rb +0 -57
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/version.rb +0 -23
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3.rb +0 -15
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/helper.rb +0 -27
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_backup.rb +0 -33
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_collation.rb +0 -82
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database.rb +0 -545
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_flags.rb +0 -95
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readonly.rb +0 -36
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readwrite.rb +0 -41
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_deprecated.rb +0 -44
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_encoding.rb +0 -155
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration.rb +0 -507
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_aggregate.rb +0 -336
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_open_close.rb +0 -30
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_pending.rb +0 -115
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_resultset.rb +0 -142
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_statement.rb +0 -194
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb +0 -37
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_sqlite3.rb +0 -30
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement.rb +0 -263
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement_execute.rb +0 -35
@@ -1,17 +0,0 @@
|
|
1
|
-
#ifndef SQLITE3_DATABASE_RUBY
|
2
|
-
#define SQLITE3_DATABASE_RUBY
|
3
|
-
|
4
|
-
#include <sqlite3_ruby.h>
|
5
|
-
|
6
|
-
struct _sqlite3Ruby {
|
7
|
-
sqlite3 *db;
|
8
|
-
};
|
9
|
-
|
10
|
-
typedef struct _sqlite3Ruby sqlite3Ruby;
|
11
|
-
typedef sqlite3Ruby * sqlite3RubyPtr;
|
12
|
-
|
13
|
-
void init_sqlite3_database();
|
14
|
-
void set_sqlite3_func_result(sqlite3_context * ctx, VALUE result);
|
15
|
-
VALUE sqlite3val2rb(sqlite3_value * val);
|
16
|
-
|
17
|
-
#endif
|
@@ -1,98 +0,0 @@
|
|
1
|
-
#include <sqlite3_ruby.h>
|
2
|
-
|
3
|
-
void rb_sqlite3_raise(sqlite3 * db, int status)
|
4
|
-
{
|
5
|
-
VALUE klass = Qnil;
|
6
|
-
|
7
|
-
/* Consider only lower 8 bits, to work correctly when
|
8
|
-
extended result codes are enabled. */
|
9
|
-
switch(status & 0xff) {
|
10
|
-
case SQLITE_OK:
|
11
|
-
return;
|
12
|
-
break;
|
13
|
-
case SQLITE_ERROR:
|
14
|
-
klass = rb_path2class("SQLite3::SQLException");
|
15
|
-
break;
|
16
|
-
case SQLITE_INTERNAL:
|
17
|
-
klass = rb_path2class("SQLite3::InternalException");
|
18
|
-
break;
|
19
|
-
case SQLITE_PERM:
|
20
|
-
klass = rb_path2class("SQLite3::PermissionException");
|
21
|
-
break;
|
22
|
-
case SQLITE_ABORT:
|
23
|
-
klass = rb_path2class("SQLite3::AbortException");
|
24
|
-
break;
|
25
|
-
case SQLITE_BUSY:
|
26
|
-
klass = rb_path2class("SQLite3::BusyException");
|
27
|
-
break;
|
28
|
-
case SQLITE_LOCKED:
|
29
|
-
klass = rb_path2class("SQLite3::LockedException");
|
30
|
-
break;
|
31
|
-
case SQLITE_NOMEM:
|
32
|
-
klass = rb_path2class("SQLite3::MemoryException");
|
33
|
-
break;
|
34
|
-
case SQLITE_READONLY:
|
35
|
-
klass = rb_path2class("SQLite3::ReadOnlyException");
|
36
|
-
break;
|
37
|
-
case SQLITE_INTERRUPT:
|
38
|
-
klass = rb_path2class("SQLite3::InterruptException");
|
39
|
-
break;
|
40
|
-
case SQLITE_IOERR:
|
41
|
-
klass = rb_path2class("SQLite3::IOException");
|
42
|
-
break;
|
43
|
-
case SQLITE_CORRUPT:
|
44
|
-
klass = rb_path2class("SQLite3::CorruptException");
|
45
|
-
break;
|
46
|
-
case SQLITE_NOTFOUND:
|
47
|
-
klass = rb_path2class("SQLite3::NotFoundException");
|
48
|
-
break;
|
49
|
-
case SQLITE_FULL:
|
50
|
-
klass = rb_path2class("SQLite3::FullException");
|
51
|
-
break;
|
52
|
-
case SQLITE_CANTOPEN:
|
53
|
-
klass = rb_path2class("SQLite3::CantOpenException");
|
54
|
-
break;
|
55
|
-
case SQLITE_PROTOCOL:
|
56
|
-
klass = rb_path2class("SQLite3::ProtocolException");
|
57
|
-
break;
|
58
|
-
case SQLITE_EMPTY:
|
59
|
-
klass = rb_path2class("SQLite3::EmptyException");
|
60
|
-
break;
|
61
|
-
case SQLITE_SCHEMA:
|
62
|
-
klass = rb_path2class("SQLite3::SchemaChangedException");
|
63
|
-
break;
|
64
|
-
case SQLITE_TOOBIG:
|
65
|
-
klass = rb_path2class("SQLite3::TooBigException");
|
66
|
-
break;
|
67
|
-
case SQLITE_CONSTRAINT:
|
68
|
-
klass = rb_path2class("SQLite3::ConstraintException");
|
69
|
-
break;
|
70
|
-
case SQLITE_MISMATCH:
|
71
|
-
klass = rb_path2class("SQLite3::MismatchException");
|
72
|
-
break;
|
73
|
-
case SQLITE_MISUSE:
|
74
|
-
klass = rb_path2class("SQLite3::MisuseException");
|
75
|
-
break;
|
76
|
-
case SQLITE_NOLFS:
|
77
|
-
klass = rb_path2class("SQLite3::UnsupportedException");
|
78
|
-
break;
|
79
|
-
case SQLITE_AUTH:
|
80
|
-
klass = rb_path2class("SQLite3::AuthorizationException");
|
81
|
-
break;
|
82
|
-
case SQLITE_FORMAT:
|
83
|
-
klass = rb_path2class("SQLite3::FormatException");
|
84
|
-
break;
|
85
|
-
case SQLITE_RANGE:
|
86
|
-
klass = rb_path2class("SQLite3::RangeException");
|
87
|
-
break;
|
88
|
-
case SQLITE_NOTADB:
|
89
|
-
klass = rb_path2class("SQLite3::NotADatabaseException");
|
90
|
-
break;
|
91
|
-
default:
|
92
|
-
klass = rb_eRuntimeError;
|
93
|
-
}
|
94
|
-
|
95
|
-
klass = rb_exc_new2(klass, sqlite3_errmsg(db));
|
96
|
-
rb_iv_set(klass, "@code", INT2FIX(status));
|
97
|
-
rb_exc_raise(klass);
|
98
|
-
}
|
@@ -1,251 +0,0 @@
|
|
1
|
-
require "mkmf"
|
2
|
-
require "mini_portile2"
|
3
|
-
require "yaml"
|
4
|
-
|
5
|
-
module Sqlite3
|
6
|
-
module ExtConf
|
7
|
-
ENV_ALLOWLIST = ["CC", "CFLAGS", "LDFLAGS", "LIBS", "CPPFLAGS", "LT_SYS_LIBRARY_PATH", "CPP"]
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def configure
|
11
|
-
configure_cross_compiler
|
12
|
-
|
13
|
-
if system_libraries?
|
14
|
-
message "Building sqlite3-ruby using system #{libname}.\n"
|
15
|
-
configure_system_libraries
|
16
|
-
else
|
17
|
-
message "Building sqlite3-ruby using packaged sqlite3.\n"
|
18
|
-
configure_packaged_libraries
|
19
|
-
end
|
20
|
-
|
21
|
-
configure_extension
|
22
|
-
|
23
|
-
create_makefile('sqlite3/sqlite3_native')
|
24
|
-
end
|
25
|
-
|
26
|
-
def configure_cross_compiler
|
27
|
-
RbConfig::CONFIG["CC"] = RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"]
|
28
|
-
ENV["CC"] = RbConfig::CONFIG["CC"]
|
29
|
-
end
|
30
|
-
|
31
|
-
def system_libraries?
|
32
|
-
sqlcipher? || enable_config("system-libraries")
|
33
|
-
end
|
34
|
-
|
35
|
-
def libname
|
36
|
-
sqlcipher? ? "sqlcipher" : "sqlite3"
|
37
|
-
end
|
38
|
-
|
39
|
-
def sqlcipher?
|
40
|
-
with_config("sqlcipher") ||
|
41
|
-
with_config("sqlcipher-dir") ||
|
42
|
-
with_config("sqlcipher-include") ||
|
43
|
-
with_config("sqlcipher-lib")
|
44
|
-
end
|
45
|
-
|
46
|
-
def configure_system_libraries
|
47
|
-
pkg_config(libname)
|
48
|
-
append_cppflags("-DUSING_SQLCIPHER") if sqlcipher?
|
49
|
-
end
|
50
|
-
|
51
|
-
def configure_packaged_libraries
|
52
|
-
minimal_recipe.tap do |recipe|
|
53
|
-
recipe.configure_options += ["--enable-shared=no", "--enable-static=yes"]
|
54
|
-
ENV.to_h.tap do |env|
|
55
|
-
additional_cflags = [
|
56
|
-
"-fPIC", # needed for linking the static library into a shared library
|
57
|
-
"-O2", # see https://github.com/sparklemotion/sqlite3-ruby/issues/335 for some benchmarks
|
58
|
-
]
|
59
|
-
env["CFLAGS"] = [env["CFLAGS"], additional_cflags].flatten.join(" ")
|
60
|
-
recipe.configure_options += env.select { |k,v| ENV_ALLOWLIST.include?(k) }
|
61
|
-
.map { |key, value| "#{key}=#{value.strip}" }
|
62
|
-
end
|
63
|
-
|
64
|
-
unless File.exist?(File.join(recipe.target, recipe.host, recipe.name, recipe.version))
|
65
|
-
recipe.cook
|
66
|
-
end
|
67
|
-
recipe.activate
|
68
|
-
|
69
|
-
# on macos, pkg-config will not return --cflags without this
|
70
|
-
ENV["PKG_CONFIG_ALLOW_SYSTEM_CFLAGS"] = "t"
|
71
|
-
|
72
|
-
lib_path = File.join(recipe.path, "lib")
|
73
|
-
pcfile = File.join(lib_path, "pkgconfig", "sqlite3.pc")
|
74
|
-
abort_pkg_config("pkg_config") unless pkg_config(pcfile)
|
75
|
-
|
76
|
-
# see https://bugs.ruby-lang.org/issues/18490
|
77
|
-
flags = xpopen(["pkg-config", "--libs", "--static", pcfile], err: [:child, :out], &:read)
|
78
|
-
abort_pkg_config("xpopen") unless $?.success?
|
79
|
-
flags = flags.split
|
80
|
-
|
81
|
-
# see https://github.com/flavorjones/mini_portile/issues/118
|
82
|
-
"-L#{lib_path}".tap do |lib_path_flag|
|
83
|
-
flags.prepend(lib_path_flag) unless flags.include?(lib_path_flag)
|
84
|
-
end
|
85
|
-
|
86
|
-
flags.each { |flag| append_ldflags(flag) }
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def configure_extension
|
91
|
-
if Gem::Requirement.new("< 2.7").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
92
|
-
append_cppflags("-DTAINTING_SUPPORT")
|
93
|
-
end
|
94
|
-
|
95
|
-
if find_header("sqlite3.h")
|
96
|
-
# noop
|
97
|
-
elsif sqlcipher? && find_header("sqlcipher/sqlite3.h")
|
98
|
-
append_cppflags("-DUSING_SQLCIPHER_INC_SUBDIR")
|
99
|
-
else
|
100
|
-
abort_could_not_find("sqlite3.h")
|
101
|
-
end
|
102
|
-
|
103
|
-
abort_could_not_find(libname) unless find_library(libname, "sqlite3_libversion_number", "sqlite3.h")
|
104
|
-
|
105
|
-
# Functions defined in 1.9 but not 1.8
|
106
|
-
have_func('rb_proc_arity')
|
107
|
-
|
108
|
-
# Functions defined in 2.1 but not 2.0
|
109
|
-
have_func('rb_integer_pack')
|
110
|
-
|
111
|
-
# These functions may not be defined
|
112
|
-
have_func('sqlite3_initialize')
|
113
|
-
have_func('sqlite3_backup_init')
|
114
|
-
have_func('sqlite3_column_database_name')
|
115
|
-
have_func('sqlite3_enable_load_extension')
|
116
|
-
have_func('sqlite3_load_extension')
|
117
|
-
|
118
|
-
unless have_func('sqlite3_open_v2') # https://www.sqlite.org/releaselog/3_5_0.html
|
119
|
-
abort("\nPlease use a version of SQLite3 >= 3.5.0\n\n")
|
120
|
-
end
|
121
|
-
|
122
|
-
have_func('sqlite3_prepare_v2')
|
123
|
-
have_type('sqlite3_int64', 'sqlite3.h')
|
124
|
-
have_type('sqlite3_uint64', 'sqlite3.h')
|
125
|
-
end
|
126
|
-
|
127
|
-
def minimal_recipe
|
128
|
-
MiniPortile.new(libname, sqlite3_config[:version]).tap do |recipe|
|
129
|
-
recipe.files = sqlite3_config[:files]
|
130
|
-
recipe.target = File.join(package_root_dir, "ports")
|
131
|
-
recipe.patch_files = Dir[File.join(package_root_dir, "patches", "*.patch")].sort
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def package_root_dir
|
136
|
-
File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
137
|
-
end
|
138
|
-
|
139
|
-
def sqlite3_config
|
140
|
-
mini_portile_config[:sqlite3]
|
141
|
-
end
|
142
|
-
|
143
|
-
def mini_portile_config
|
144
|
-
# TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true
|
145
|
-
YAML.load_file(File.join(package_root_dir, "dependencies.yml"))
|
146
|
-
end
|
147
|
-
|
148
|
-
def abort_could_not_find(missing)
|
149
|
-
abort("\nCould not find #{missing}.\nPlease visit https://github.com/sparklemotion/sqlite3-ruby for installation instructions.\n\n")
|
150
|
-
end
|
151
|
-
|
152
|
-
def abort_pkg_config(id)
|
153
|
-
abort("\nCould not configure the build properly (#{id}). Please install either the `pkg-config` utility or the `pkg-config` rubygem.\n\n")
|
154
|
-
end
|
155
|
-
|
156
|
-
def cross_build?
|
157
|
-
enable_config("cross-build")
|
158
|
-
end
|
159
|
-
|
160
|
-
def download
|
161
|
-
minimal_recipe.download
|
162
|
-
end
|
163
|
-
|
164
|
-
def print_help
|
165
|
-
print(<<~TEXT)
|
166
|
-
USAGE: ruby #{$PROGRAM_NAME} [options]
|
167
|
-
|
168
|
-
Flags that are always valid:
|
169
|
-
|
170
|
-
--disable-system-libraries
|
171
|
-
Use the packaged libraries, and ignore the system libraries.
|
172
|
-
(This is the default behavior.)
|
173
|
-
|
174
|
-
--enable-system-libraries
|
175
|
-
Use system libraries instead of building and using the packaged libraries.
|
176
|
-
|
177
|
-
--with-sqlcipher
|
178
|
-
Use libsqlcipher instead of libsqlite3.
|
179
|
-
(Implies `--enable-system-libraries`.)
|
180
|
-
|
181
|
-
--help
|
182
|
-
Display this message.
|
183
|
-
|
184
|
-
|
185
|
-
Flags only used when using system libraries:
|
186
|
-
|
187
|
-
General (applying to all system libraries):
|
188
|
-
|
189
|
-
--with-opt-dir=DIRECTORY
|
190
|
-
Look for headers and libraries in DIRECTORY.
|
191
|
-
|
192
|
-
--with-opt-lib=DIRECTORY
|
193
|
-
Look for libraries in DIRECTORY.
|
194
|
-
|
195
|
-
--with-opt-include=DIRECTORY
|
196
|
-
Look for headers in DIRECTORY.
|
197
|
-
|
198
|
-
Related to sqlcipher:
|
199
|
-
|
200
|
-
--with-sqlcipher-dir=DIRECTORY
|
201
|
-
Look for sqlcipher headers and library in DIRECTORY.
|
202
|
-
(Implies `--with-sqlcipher` and `--enable-system-libraries`.)
|
203
|
-
|
204
|
-
--with-sqlcipher-lib=DIRECTORY
|
205
|
-
Look for sqlcipher library in DIRECTORY.
|
206
|
-
(Implies `--with-sqlcipher` and `--enable-system-libraries`.)
|
207
|
-
|
208
|
-
--with-sqlcipher-include=DIRECTORY
|
209
|
-
Look for sqlcipher headers in DIRECTORY.
|
210
|
-
(Implies `--with-sqlcipher` and `--enable-system-libraries`.)
|
211
|
-
|
212
|
-
|
213
|
-
Flags only used when building and using the packaged libraries:
|
214
|
-
|
215
|
-
--enable-cross-build
|
216
|
-
Enable cross-build mode. (You probably do not want to set this manually.)
|
217
|
-
|
218
|
-
|
219
|
-
Environment variables used for compiling the C extension:
|
220
|
-
|
221
|
-
CC
|
222
|
-
Use this path to invoke the compiler instead of `RbConfig::CONFIG['CC']`
|
223
|
-
|
224
|
-
|
225
|
-
Environment variables passed through to the compilation of packaged libraries:
|
226
|
-
|
227
|
-
CC
|
228
|
-
CPPFLAGS
|
229
|
-
CFLAGS
|
230
|
-
LDFLAGS
|
231
|
-
LIBS
|
232
|
-
LT_SYS_LIBRARY_PATH
|
233
|
-
CPP
|
234
|
-
|
235
|
-
TEXT
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
if arg_config("--help")
|
242
|
-
Sqlite3::ExtConf.print_help
|
243
|
-
exit!(0)
|
244
|
-
end
|
245
|
-
|
246
|
-
if arg_config("--download-dependencies")
|
247
|
-
Sqlite3::ExtConf.download
|
248
|
-
exit!(0)
|
249
|
-
end
|
250
|
-
|
251
|
-
Sqlite3::ExtConf.configure
|
@@ -1,163 +0,0 @@
|
|
1
|
-
#include <sqlite3_ruby.h>
|
2
|
-
|
3
|
-
VALUE mSqlite3;
|
4
|
-
VALUE cSqlite3Blob;
|
5
|
-
|
6
|
-
int bignum_to_int64(VALUE value, sqlite3_int64 *result)
|
7
|
-
{
|
8
|
-
#ifdef HAVE_RB_INTEGER_PACK
|
9
|
-
const int nails = 0;
|
10
|
-
int t = rb_integer_pack(value, result, 1, sizeof(*result), nails,
|
11
|
-
INTEGER_PACK_NATIVE_BYTE_ORDER|
|
12
|
-
INTEGER_PACK_2COMP);
|
13
|
-
switch (t) {
|
14
|
-
case -2: case +2:
|
15
|
-
return 0;
|
16
|
-
case +1:
|
17
|
-
if (!nails) {
|
18
|
-
if (*result < 0) return 0;
|
19
|
-
}
|
20
|
-
break;
|
21
|
-
case -1:
|
22
|
-
if (!nails) {
|
23
|
-
if (*result >= 0) return 0;
|
24
|
-
}
|
25
|
-
else {
|
26
|
-
*result += INT64_MIN;
|
27
|
-
}
|
28
|
-
break;
|
29
|
-
}
|
30
|
-
return 1;
|
31
|
-
#else
|
32
|
-
# ifndef RBIGNUM_LEN
|
33
|
-
# define RBIGNUM_LEN(x) RBIGNUM(x)->len
|
34
|
-
# endif
|
35
|
-
const long len = RBIGNUM_LEN(value);
|
36
|
-
if (len == 0) {
|
37
|
-
*result = 0;
|
38
|
-
return 1;
|
39
|
-
}
|
40
|
-
if (len > 63 / (SIZEOF_BDIGITS * CHAR_BIT) + 1) return 0;
|
41
|
-
if (len == 63 / (SIZEOF_BDIGITS * CHAR_BIT) + 1) {
|
42
|
-
const BDIGIT *digits = RBIGNUM_DIGITS(value);
|
43
|
-
BDIGIT blast = digits[len-1];
|
44
|
-
BDIGIT bmax = (BDIGIT)1UL << (63 % (CHAR_BIT * SIZEOF_BDIGITS));
|
45
|
-
if (blast > bmax) return 0;
|
46
|
-
if (blast == bmax) {
|
47
|
-
if (RBIGNUM_POSITIVE_P(value)) {
|
48
|
-
return 0;
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
long i = len-1;
|
52
|
-
while (i) {
|
53
|
-
if (digits[--i]) return 0;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}
|
58
|
-
*result = (sqlite3_int64)NUM2LL(value);
|
59
|
-
return 1;
|
60
|
-
#endif
|
61
|
-
}
|
62
|
-
|
63
|
-
static VALUE libversion(VALUE UNUSED(klass))
|
64
|
-
{
|
65
|
-
return INT2NUM(sqlite3_libversion_number());
|
66
|
-
}
|
67
|
-
|
68
|
-
static VALUE using_sqlcipher(VALUE UNUSED(klass))
|
69
|
-
{
|
70
|
-
#ifdef USING_SQLCIPHER
|
71
|
-
return Qtrue;
|
72
|
-
#else
|
73
|
-
return Qfalse;
|
74
|
-
#endif
|
75
|
-
}
|
76
|
-
|
77
|
-
/* Returns the compile time setting of the SQLITE_THREADSAFE flag.
|
78
|
-
* See: https://www.sqlite.org/c3ref/threadsafe.html
|
79
|
-
*/
|
80
|
-
static VALUE threadsafe_p(VALUE UNUSED(klass))
|
81
|
-
{
|
82
|
-
return INT2NUM(sqlite3_threadsafe());
|
83
|
-
}
|
84
|
-
|
85
|
-
void init_sqlite3_constants()
|
86
|
-
{
|
87
|
-
VALUE mSqlite3Constants;
|
88
|
-
VALUE mSqlite3Open;
|
89
|
-
|
90
|
-
mSqlite3Constants = rb_define_module_under(mSqlite3, "Constants");
|
91
|
-
|
92
|
-
/* sqlite3_open_v2 flags for Database::new */
|
93
|
-
mSqlite3Open = rb_define_module_under(mSqlite3Constants, "Open");
|
94
|
-
|
95
|
-
/* symbols = IO.readlines('sqlite3.h').map { |n| /\A#define\s+(SQLITE_OPEN_\w+)\s/ =~ n && $1 }.compact
|
96
|
-
* pad = symbols.map(&:length).max - 9
|
97
|
-
* symbols.each { |s| printf %Q{ rb_define_const(mSqlite3Open, %-#{pad}s INT2FIX(#{s}));\n}, '"' + s[12..-1] + '",' }
|
98
|
-
*/
|
99
|
-
rb_define_const(mSqlite3Open, "READONLY", INT2FIX(SQLITE_OPEN_READONLY));
|
100
|
-
rb_define_const(mSqlite3Open, "READWRITE", INT2FIX(SQLITE_OPEN_READWRITE));
|
101
|
-
rb_define_const(mSqlite3Open, "CREATE", INT2FIX(SQLITE_OPEN_CREATE));
|
102
|
-
rb_define_const(mSqlite3Open, "DELETEONCLOSE", INT2FIX(SQLITE_OPEN_DELETEONCLOSE));
|
103
|
-
rb_define_const(mSqlite3Open, "EXCLUSIVE", INT2FIX(SQLITE_OPEN_EXCLUSIVE));
|
104
|
-
rb_define_const(mSqlite3Open, "MAIN_DB", INT2FIX(SQLITE_OPEN_MAIN_DB));
|
105
|
-
rb_define_const(mSqlite3Open, "TEMP_DB", INT2FIX(SQLITE_OPEN_TEMP_DB));
|
106
|
-
rb_define_const(mSqlite3Open, "TRANSIENT_DB", INT2FIX(SQLITE_OPEN_TRANSIENT_DB));
|
107
|
-
rb_define_const(mSqlite3Open, "MAIN_JOURNAL", INT2FIX(SQLITE_OPEN_MAIN_JOURNAL));
|
108
|
-
rb_define_const(mSqlite3Open, "TEMP_JOURNAL", INT2FIX(SQLITE_OPEN_TEMP_JOURNAL));
|
109
|
-
rb_define_const(mSqlite3Open, "SUBJOURNAL", INT2FIX(SQLITE_OPEN_SUBJOURNAL));
|
110
|
-
rb_define_const(mSqlite3Open, "MASTER_JOURNAL", INT2FIX(SQLITE_OPEN_MASTER_JOURNAL));
|
111
|
-
rb_define_const(mSqlite3Open, "NOMUTEX", INT2FIX(SQLITE_OPEN_NOMUTEX));
|
112
|
-
rb_define_const(mSqlite3Open, "FULLMUTEX", INT2FIX(SQLITE_OPEN_FULLMUTEX));
|
113
|
-
#ifdef SQLITE_OPEN_AUTOPROXY
|
114
|
-
/* SQLITE_VERSION_NUMBER>=3007002 */
|
115
|
-
rb_define_const(mSqlite3Open, "AUTOPROXY", INT2FIX(SQLITE_OPEN_AUTOPROXY));
|
116
|
-
rb_define_const(mSqlite3Open, "SHAREDCACHE", INT2FIX(SQLITE_OPEN_SHAREDCACHE));
|
117
|
-
rb_define_const(mSqlite3Open, "PRIVATECACHE", INT2FIX(SQLITE_OPEN_PRIVATECACHE));
|
118
|
-
rb_define_const(mSqlite3Open, "WAL", INT2FIX(SQLITE_OPEN_WAL));
|
119
|
-
#endif
|
120
|
-
#ifdef SQLITE_OPEN_URI
|
121
|
-
/* SQLITE_VERSION_NUMBER>=3007007 */
|
122
|
-
rb_define_const(mSqlite3Open, "URI", INT2FIX(SQLITE_OPEN_URI));
|
123
|
-
#endif
|
124
|
-
#ifdef SQLITE_OPEN_MEMORY
|
125
|
-
/* SQLITE_VERSION_NUMBER>=3007013 */
|
126
|
-
rb_define_const(mSqlite3Open, "MEMORY", INT2FIX(SQLITE_OPEN_MEMORY));
|
127
|
-
#endif
|
128
|
-
}
|
129
|
-
|
130
|
-
void Init_sqlite3_native()
|
131
|
-
{
|
132
|
-
/*
|
133
|
-
* SQLite3 is a wrapper around the popular database
|
134
|
-
* sqlite[http://sqlite.org].
|
135
|
-
*
|
136
|
-
* For an example of usage, see SQLite3::Database.
|
137
|
-
*/
|
138
|
-
mSqlite3 = rb_define_module("SQLite3");
|
139
|
-
|
140
|
-
/* A class for differentiating between strings and blobs, when binding them
|
141
|
-
* into statements.
|
142
|
-
*/
|
143
|
-
cSqlite3Blob = rb_define_class_under(mSqlite3, "Blob", rb_cString);
|
144
|
-
|
145
|
-
/* Initialize the sqlite3 library */
|
146
|
-
#ifdef HAVE_SQLITE3_INITIALIZE
|
147
|
-
sqlite3_initialize();
|
148
|
-
#endif
|
149
|
-
|
150
|
-
init_sqlite3_constants();
|
151
|
-
init_sqlite3_database();
|
152
|
-
init_sqlite3_statement();
|
153
|
-
#ifdef HAVE_SQLITE3_BACKUP_INIT
|
154
|
-
init_sqlite3_backup();
|
155
|
-
#endif
|
156
|
-
rb_define_singleton_method(mSqlite3, "sqlcipher?", using_sqlcipher, 0);
|
157
|
-
rb_define_singleton_method(mSqlite3, "libversion", libversion, 0);
|
158
|
-
rb_define_singleton_method(mSqlite3, "threadsafe", threadsafe_p, 0);
|
159
|
-
rb_define_const(mSqlite3, "SQLITE_VERSION", rb_str_new2(SQLITE_VERSION));
|
160
|
-
rb_define_const(mSqlite3, "SQLITE_VERSION_NUMBER", INT2FIX(SQLITE_VERSION_NUMBER));
|
161
|
-
rb_define_const(mSqlite3, "SQLITE_LOADED_VERSION", rb_str_new2(sqlite3_libversion()));
|
162
|
-
|
163
|
-
}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#ifndef SQLITE3_RUBY
|
2
|
-
#define SQLITE3_RUBY
|
3
|
-
|
4
|
-
#include <ruby.h>
|
5
|
-
|
6
|
-
#ifdef UNUSED
|
7
|
-
#elif defined(__GNUC__)
|
8
|
-
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
|
9
|
-
#elif defined(__LCLINT__)
|
10
|
-
# define UNUSED(x) /*@unused@*/ x
|
11
|
-
#else
|
12
|
-
# define UNUSED(x) x
|
13
|
-
#endif
|
14
|
-
|
15
|
-
#include <ruby/encoding.h>
|
16
|
-
|
17
|
-
#define USASCII_P(_obj) (rb_enc_get_index(_obj) == rb_usascii_encindex())
|
18
|
-
#define UTF8_P(_obj) (rb_enc_get_index(_obj) == rb_utf8_encindex())
|
19
|
-
#define UTF16_LE_P(_obj) (rb_enc_get_index(_obj) == rb_enc_find_index("UTF-16LE"))
|
20
|
-
#define UTF16_BE_P(_obj) (rb_enc_get_index(_obj) == rb_enc_find_index("UTF-16BE"))
|
21
|
-
#define SQLITE3_UTF8_STR_NEW2(_obj) \
|
22
|
-
(rb_enc_associate_index(rb_str_new2(_obj), rb_utf8_encindex()))
|
23
|
-
|
24
|
-
#ifdef USING_SQLCIPHER_INC_SUBDIR
|
25
|
-
# include <sqlcipher/sqlite3.h>
|
26
|
-
#else
|
27
|
-
# include <sqlite3.h>
|
28
|
-
#endif
|
29
|
-
|
30
|
-
#ifndef HAVE_TYPE_SQLITE3_INT64
|
31
|
-
typedef sqlite_int64 sqlite3_int64;
|
32
|
-
#endif
|
33
|
-
|
34
|
-
#ifndef HAVE_TYPE_SQLITE3_UINT64
|
35
|
-
typedef sqlite_uint64 sqlite3_uint64;
|
36
|
-
#endif
|
37
|
-
|
38
|
-
extern VALUE mSqlite3;
|
39
|
-
extern VALUE cSqlite3Blob;
|
40
|
-
|
41
|
-
#include <database.h>
|
42
|
-
#include <statement.h>
|
43
|
-
#include <exception.h>
|
44
|
-
#include <backup.h>
|
45
|
-
|
46
|
-
int bignum_to_int64(VALUE big, sqlite3_int64 *result);
|
47
|
-
|
48
|
-
#endif
|