amalgalite 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/HISTORY.md +6 -0
- data/Rakefile +7 -7
- data/TODO.md +0 -1
- data/ext/amalgalite/c/extconf.rb +2 -1
- data/ext/amalgalite/c/sqlite3.c +33693 -19401
- data/ext/amalgalite/c/sqlite3.h +596 -213
- data/ext/amalgalite/c/sqlite3ext.h +74 -4
- data/lib/amalgalite/version.rb +1 -1
- data/spec/database_spec.rb +3 -3
- data/spec/spec_helper.rb +5 -0
- data/spec/sqlite3/version_spec.rb +10 -10
- data/spec/version_spec.rb +1 -1
- data/tasks/custom.rake +11 -8
- data/tasks/default.rake +33 -63
- data/tasks/extension.rake +2 -2
- data/tasks/this.rb +17 -20
- metadata +43 -43
@@ -28,7 +28,7 @@ typedef struct sqlite3_api_routines sqlite3_api_routines;
|
|
28
28
|
** WARNING: In order to maintain backwards compatibility, add new
|
29
29
|
** interfaces to the end of this structure only. If you insert new
|
30
30
|
** interfaces in the middle of this structure, then older different
|
31
|
-
** versions of SQLite will not be able to load each
|
31
|
+
** versions of SQLite will not be able to load each other's shared
|
32
32
|
** libraries!
|
33
33
|
*/
|
34
34
|
struct sqlite3_api_routines {
|
@@ -236,11 +236,42 @@ struct sqlite3_api_routines {
|
|
236
236
|
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
|
237
237
|
int (*vtab_config)(sqlite3*,int op,...);
|
238
238
|
int (*vtab_on_conflict)(sqlite3*);
|
239
|
+
/* Version 3.7.16 and later */
|
240
|
+
int (*close_v2)(sqlite3*);
|
241
|
+
const char *(*db_filename)(sqlite3*,const char*);
|
242
|
+
int (*db_readonly)(sqlite3*,const char*);
|
243
|
+
int (*db_release_memory)(sqlite3*);
|
244
|
+
const char *(*errstr)(int);
|
245
|
+
int (*stmt_busy)(sqlite3_stmt*);
|
246
|
+
int (*stmt_readonly)(sqlite3_stmt*);
|
247
|
+
int (*stricmp)(const char*,const char*);
|
248
|
+
int (*uri_boolean)(const char*,const char*,int);
|
249
|
+
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
|
250
|
+
const char *(*uri_parameter)(const char*,const char*);
|
251
|
+
char *(*vsnprintf)(int,char*,const char*,va_list);
|
252
|
+
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
|
253
|
+
/* Version 3.8.7 and later */
|
254
|
+
int (*auto_extension)(void(*)(void));
|
255
|
+
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
|
256
|
+
void(*)(void*));
|
257
|
+
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
|
258
|
+
void(*)(void*),unsigned char);
|
259
|
+
int (*cancel_auto_extension)(void(*)(void));
|
260
|
+
int (*load_extension)(sqlite3*,const char*,const char*,char**);
|
261
|
+
void *(*malloc64)(sqlite3_uint64);
|
262
|
+
sqlite3_uint64 (*msize)(void*);
|
263
|
+
void *(*realloc64)(void*,sqlite3_uint64);
|
264
|
+
void (*reset_auto_extension)(void);
|
265
|
+
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
|
266
|
+
void(*)(void*));
|
267
|
+
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
|
268
|
+
void(*)(void*), unsigned char);
|
269
|
+
int (*strglob)(const char*,const char*);
|
239
270
|
};
|
240
271
|
|
241
272
|
/*
|
242
273
|
** The following macros redefine the API routines so that they are
|
243
|
-
** redirected
|
274
|
+
** redirected through the global sqlite3_api structure.
|
244
275
|
**
|
245
276
|
** This header file is also used by the loadext.c source file
|
246
277
|
** (part of the main SQLite library - not an extension) so that
|
@@ -439,9 +470,48 @@ struct sqlite3_api_routines {
|
|
439
470
|
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
|
440
471
|
#define sqlite3_vtab_config sqlite3_api->vtab_config
|
441
472
|
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
|
473
|
+
/* Version 3.7.16 and later */
|
474
|
+
#define sqlite3_close_v2 sqlite3_api->close_v2
|
475
|
+
#define sqlite3_db_filename sqlite3_api->db_filename
|
476
|
+
#define sqlite3_db_readonly sqlite3_api->db_readonly
|
477
|
+
#define sqlite3_db_release_memory sqlite3_api->db_release_memory
|
478
|
+
#define sqlite3_errstr sqlite3_api->errstr
|
479
|
+
#define sqlite3_stmt_busy sqlite3_api->stmt_busy
|
480
|
+
#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
|
481
|
+
#define sqlite3_stricmp sqlite3_api->stricmp
|
482
|
+
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
|
483
|
+
#define sqlite3_uri_int64 sqlite3_api->uri_int64
|
484
|
+
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
|
485
|
+
#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf
|
486
|
+
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
|
487
|
+
/* Version 3.8.7 and later */
|
488
|
+
#define sqlite3_auto_extension sqlite3_api->auto_extension
|
489
|
+
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
|
490
|
+
#define sqlite3_bind_text64 sqlite3_api->bind_text64
|
491
|
+
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
|
492
|
+
#define sqlite3_load_extension sqlite3_api->load_extension
|
493
|
+
#define sqlite3_malloc64 sqlite3_api->malloc64
|
494
|
+
#define sqlite3_msize sqlite3_api->msize
|
495
|
+
#define sqlite3_realloc64 sqlite3_api->realloc64
|
496
|
+
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
|
497
|
+
#define sqlite3_result_blob64 sqlite3_api->result_blob64
|
498
|
+
#define sqlite3_result_text64 sqlite3_api->result_text64
|
499
|
+
#define sqlite3_strglob sqlite3_api->strglob
|
442
500
|
#endif /* SQLITE_CORE */
|
443
501
|
|
444
|
-
#
|
445
|
-
|
502
|
+
#ifndef SQLITE_CORE
|
503
|
+
/* This case when the file really is being compiled as a loadable
|
504
|
+
** extension */
|
505
|
+
# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
|
506
|
+
# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v;
|
507
|
+
# define SQLITE_EXTENSION_INIT3 \
|
508
|
+
extern const sqlite3_api_routines *sqlite3_api;
|
509
|
+
#else
|
510
|
+
/* This case when the file is being statically linked into the
|
511
|
+
** application */
|
512
|
+
# define SQLITE_EXTENSION_INIT1 /*no-op*/
|
513
|
+
# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
|
514
|
+
# define SQLITE_EXTENSION_INIT3 /*no-op*/
|
515
|
+
#endif
|
446
516
|
|
447
517
|
#endif /* _SQLITE3EXT_H_ */
|
data/lib/amalgalite/version.rb
CHANGED
data/spec/database_spec.rb
CHANGED
@@ -59,7 +59,7 @@ describe Amalgalite::Database do
|
|
59
59
|
|
60
60
|
it "closes normally" do
|
61
61
|
db = Amalgalite::Database.new( SpecInfo.test_db )
|
62
|
-
|
62
|
+
expect { db.close }.not_to raise_error
|
63
63
|
end
|
64
64
|
|
65
65
|
it "returns the id of the last inserted row" do
|
@@ -255,7 +255,7 @@ describe Amalgalite::Database do
|
|
255
255
|
rescue MyExceptionTest
|
256
256
|
db.transaction("EXCLUSIVE") { }
|
257
257
|
end
|
258
|
-
}.should_not raise_error
|
258
|
+
}.should_not raise_error
|
259
259
|
end
|
260
260
|
|
261
261
|
describe "#define_function" do
|
@@ -503,7 +503,7 @@ describe Amalgalite::Database do
|
|
503
503
|
|
504
504
|
it "imports batch statements" do
|
505
505
|
db = Amalgalite::Database.new(":memory:")
|
506
|
-
db.import("CREATE TABLE things(stuff TEXT); INSERT INTO things (stuff) VALUES (\"foobar\");").should
|
506
|
+
db.import("CREATE TABLE things(stuff TEXT); INSERT INTO things (stuff) VALUES (\"foobar\");").should be_truthy
|
507
507
|
db.first_value_from("SELECT stuff FROM things").should == "foobar"
|
508
508
|
end
|
509
509
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rspec'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
require 'amalgalite'
|
4
5
|
require Amalgalite::Paths.spec_path( "iso_3166_database.rb" )
|
@@ -20,6 +21,10 @@ class SpecInfo
|
|
20
21
|
end
|
21
22
|
|
22
23
|
RSpec.configure do |config|
|
24
|
+
config.expect_with :rspec do |c|
|
25
|
+
c.syntax = [:should, :expect]
|
26
|
+
end
|
27
|
+
|
23
28
|
config.before(:all) do
|
24
29
|
SpecInfo.make_master_iso_db
|
25
30
|
end
|
@@ -3,20 +3,20 @@ require 'amalgalite/sqlite3/version'
|
|
3
3
|
|
4
4
|
describe "Amalgalite::SQLite3::Version" do
|
5
5
|
it "should have the sqlite3 version" do
|
6
|
-
Amalgalite::SQLite3::VERSION.
|
7
|
-
Amalgalite::SQLite3::Version.to_s.
|
8
|
-
Amalgalite::SQLite3::Version.runtime_version.
|
6
|
+
expect(Amalgalite::SQLite3::VERSION).to match(/\d\.\d\.\d/)
|
7
|
+
expect(Amalgalite::SQLite3::Version.to_s).to match( /\d\.\d\.\d/ )
|
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(3008007)
|
11
|
+
Amalgalite::SQLite3::Version.runtime_version_number.should eql(3008007)
|
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(
|
16
|
-
Amalgalite::SQLite3::Version.to_a.
|
14
|
+
Amalgalite::SQLite3::Version::MINOR.should eql(8)
|
15
|
+
Amalgalite::SQLite3::Version::RELEASE.should eql(7)
|
16
|
+
expect(Amalgalite::SQLite3::Version.to_a.size).to eql(3)
|
17
17
|
|
18
|
-
Amalgalite::SQLite3::Version.compiled_version.should be == "3.7.
|
19
|
-
Amalgalite::SQLite3::Version.compiled_version_number.should be ==
|
18
|
+
Amalgalite::SQLite3::Version.compiled_version.should be == "3.8.7.4"
|
19
|
+
Amalgalite::SQLite3::Version.compiled_version_number.should be == 3008007
|
20
20
|
Amalgalite::SQLite3::Version.compiled_matches_runtime?.should be == true
|
21
21
|
end
|
22
22
|
end
|
data/spec/version_spec.rb
CHANGED
data/tasks/custom.rake
CHANGED
@@ -56,13 +56,16 @@ namespace :util do
|
|
56
56
|
puts api_todo.keys.sort.join("\n")
|
57
57
|
end
|
58
58
|
|
59
|
-
desc "Download and integrate
|
60
|
-
task :update_sqlite do
|
59
|
+
desc "Download and integrate a version of sqlite"
|
60
|
+
task :update_sqlite, [:version,:year] do |task, args|
|
61
|
+
version = args[:version] or abort "A version of SQLite please `rake #{task.name}[version,year]`"
|
62
|
+
version_year = args[:year] or abort "The Year #{version} was released please `rake #{task.name}[version,year]`"
|
63
|
+
|
61
64
|
require 'uri'
|
62
|
-
require '
|
65
|
+
require 'open-uri'
|
63
66
|
require 'zip'
|
64
67
|
|
65
|
-
parts =
|
68
|
+
parts = version.split(".")
|
66
69
|
next_version = [ parts.shift.to_s ]
|
67
70
|
parts.each do |p|
|
68
71
|
next_version << "#{"%02d" % p }"
|
@@ -71,14 +74,14 @@ namespace :util do
|
|
71
74
|
|
72
75
|
next_version = next_version.join('')
|
73
76
|
|
74
|
-
|
75
|
-
url = ::URI.parse("http://sqlite.org/sqlite-amalgamation-#{next_version}.zip")
|
77
|
+
url = ::URI.parse("http://sqlite.org/#{version_year}/sqlite-amalgamation-#{next_version}.zip")
|
76
78
|
puts "downloading #{url.to_s} ..."
|
77
79
|
file = "tmp/#{File.basename( url.path ) }"
|
78
80
|
FileUtils.mkdir "tmp" unless File.directory?( "tmp" )
|
79
81
|
File.open( file, "wb+") do |f|
|
80
|
-
|
81
|
-
|
82
|
+
open(url) do |input|
|
83
|
+
f.write( input.read )
|
84
|
+
end
|
82
85
|
end
|
83
86
|
|
84
87
|
puts "extracting..."
|
data/tasks/default.rake
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# vim: syntax=ruby
|
2
2
|
require 'rake/clean'
|
3
|
+
require 'digest'
|
3
4
|
#------------------------------------------------------------------------------
|
4
5
|
# If you want to Develop on this project just run 'rake develop' and you'll
|
5
6
|
# have all you need to get going. If you want to use bundler for development,
|
@@ -9,39 +10,24 @@ namespace :develop do
|
|
9
10
|
|
10
11
|
# Install all the development and runtime dependencies of this gem using the
|
11
12
|
# gemspec.
|
12
|
-
task :default do
|
13
|
+
task :default => 'Gemfile' do
|
13
14
|
require 'rubygems/dependency_installer'
|
14
|
-
installer = Gem::DependencyInstaller.new
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
puts "Installing gem depedencies needed for development"
|
19
|
-
This.platform_gemspec.dependencies.each do |dep|
|
20
|
-
if dep.matching_specs.empty? then
|
21
|
-
puts "Installing : #{dep}"
|
22
|
-
installer.install dep
|
23
|
-
else
|
24
|
-
puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
|
25
|
-
end
|
26
|
-
end
|
15
|
+
installer = ::Gem::DependencyInstaller.new
|
16
|
+
puts "Installing bundler..."
|
17
|
+
installer.install 'bundler'
|
18
|
+
sh 'bundle install'
|
27
19
|
puts "\n\nNow run 'rake test'"
|
28
20
|
end
|
29
21
|
|
30
22
|
# Create a Gemfile that just references the gemspec
|
31
23
|
file 'Gemfile' => :gemspec do
|
32
24
|
File.open( "Gemfile", "w+" ) do |f|
|
33
|
-
f.puts
|
25
|
+
f.puts "# DO NOT EDIT - This file is automatically generated"
|
26
|
+
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
27
|
+
f.puts 'source "https://rubygems.org/"'
|
34
28
|
f.puts 'gemspec'
|
35
29
|
end
|
36
30
|
end
|
37
|
-
|
38
|
-
desc "Create a bundler Gemfile"
|
39
|
-
task :using_bundler => 'Gemfile' do
|
40
|
-
puts "Now you can 'bundle'"
|
41
|
-
end
|
42
|
-
|
43
|
-
# Gemfiles are build artifacts
|
44
|
-
CLOBBER << FileList['Gemfile*']
|
45
31
|
end
|
46
32
|
desc "Boostrap development"
|
47
33
|
task :develop => "develop:default"
|
@@ -50,19 +36,18 @@ task :develop => "develop:default"
|
|
50
36
|
# Minitest - standard TestTask
|
51
37
|
#------------------------------------------------------------------------------
|
52
38
|
begin
|
39
|
+
require 'rake/testtask'
|
40
|
+
Rake::TestTask.new( :test ) do |t|
|
41
|
+
t.ruby_opts = %w[ -w -rubygems ]
|
42
|
+
t.libs = %w[ lib spec test ]
|
43
|
+
t.pattern = "{test,spec}/**/{test_*,*_spec}.rb"
|
44
|
+
end
|
45
|
+
|
53
46
|
require 'rspec/core/rake_task'
|
54
|
-
RSpec::Core::RakeTask.new( :
|
47
|
+
RSpec::Core::RakeTask.new( :spec ) do |t|
|
55
48
|
t.ruby_opts = %w[ -w ]
|
56
49
|
t.rspec_opts = %w[ --color --format documentation ]
|
57
50
|
end
|
58
|
-
|
59
|
-
# require 'rake/testtask'
|
60
|
-
# Rake::TestTask.new( :test ) do |t|
|
61
|
-
# t.ruby_opts = %w[ -w -rubygems ]
|
62
|
-
# t.libs = %w[ lib spec ]
|
63
|
-
# t.pattern = "spec/**/*_spec.rb"
|
64
|
-
# end
|
65
|
-
#
|
66
51
|
task :test_requirements
|
67
52
|
task :test => :test_requirements
|
68
53
|
task :default => :test
|
@@ -85,7 +70,7 @@ begin
|
|
85
70
|
t.rdoc_files.include( FileList['*.{rdoc,md,txt}'], FileList['ext/**/*.c'],
|
86
71
|
FileList['lib/**/*.rb'] )
|
87
72
|
end
|
88
|
-
rescue LoadError
|
73
|
+
rescue StandardError, LoadError
|
89
74
|
This.task_warning( 'rdoc' )
|
90
75
|
end
|
91
76
|
|
@@ -93,31 +78,16 @@ end
|
|
93
78
|
# Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
|
94
79
|
# for the moment only rcov is listed.
|
95
80
|
#------------------------------------------------------------------------------
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
t.verbose = true
|
103
|
-
t.rcov_opts << "-x ^/" # remove all the global files
|
104
|
-
t.rcov_opts << "--sort coverage" # so we see the worst files at the top
|
105
|
-
end
|
106
|
-
rescue LoadError
|
107
|
-
This.task_warning( 'rcov' )
|
108
|
-
end
|
109
|
-
else
|
110
|
-
begin
|
111
|
-
require 'simplecov'
|
112
|
-
desc 'Run tests with code coverage'
|
113
|
-
task :coverage do
|
114
|
-
ENV['COVERAGE'] = 'true'
|
115
|
-
Rake::Task[:test].execute
|
116
|
-
end
|
117
|
-
CLOBBER << FileList["coverage"]
|
118
|
-
rescue LoadError
|
119
|
-
This.task_warning( 'simplecov' )
|
81
|
+
begin
|
82
|
+
require 'simplecov'
|
83
|
+
desc 'Run tests with code coverage'
|
84
|
+
task :coverage do
|
85
|
+
ENV['COVERAGE'] = 'true'
|
86
|
+
Rake::Task[:test].execute
|
120
87
|
end
|
88
|
+
CLOBBER << 'coverage' if File.directory?( 'coverage' )
|
89
|
+
rescue LoadError
|
90
|
+
This.task_warning( 'simplecov' )
|
121
91
|
end
|
122
92
|
|
123
93
|
#------------------------------------------------------------------------------
|
@@ -182,9 +152,10 @@ namespace :fixme do
|
|
182
152
|
end
|
183
153
|
|
184
154
|
def outdated_fixme_files
|
185
|
-
local_fixme_files.
|
155
|
+
local_fixme_files.select do |local|
|
186
156
|
upstream = fixme_project_path( local )
|
187
|
-
|
157
|
+
upstream.exist? &&
|
158
|
+
( Digest::SHA256.file( local ) != Digest::SHA256.file( upstream ) )
|
188
159
|
end
|
189
160
|
end
|
190
161
|
|
@@ -228,19 +199,18 @@ task :fixme => "fixme:default"
|
|
228
199
|
desc "Build the #{This.name}.gemspec file"
|
229
200
|
task :gemspec do
|
230
201
|
File.open( This.gemspec_file, "wb+" ) do |f|
|
202
|
+
f.puts "# DO NOT EDIT - This file is automatically generated"
|
203
|
+
f.puts "# Make changes to Manifest.txt and/or Rakefile and regenerate"
|
231
204
|
f.write This.platform_gemspec.to_ruby
|
232
205
|
end
|
233
206
|
end
|
234
207
|
|
235
|
-
# the gemspec is also a dev artifact and should not be kept around.
|
236
|
-
CLOBBER << This.gemspec_file.to_s
|
237
|
-
|
238
208
|
# .rbc files from ruby 2.0
|
239
209
|
CLOBBER << FileList["**/*.rbc"]
|
240
210
|
|
241
211
|
# The standard gem packaging task, everyone has it.
|
242
212
|
require 'rubygems/package_task'
|
243
|
-
Gem::PackageTask.new( This.platform_gemspec ) do
|
213
|
+
::Gem::PackageTask.new( This.platform_gemspec ) do
|
244
214
|
# nothing
|
245
215
|
end
|
246
216
|
|
data/tasks/extension.rake
CHANGED
@@ -24,7 +24,7 @@ begin
|
|
24
24
|
ext.gem_spec = This.ruby_gemspec
|
25
25
|
|
26
26
|
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
|
27
|
-
ext.cross_platform = 'i386-
|
27
|
+
ext.cross_platform = 'i386-mingw32' # forces the Windows platform instead of the default one
|
28
28
|
# configure options only for cross compile
|
29
29
|
end
|
30
30
|
end
|
@@ -35,4 +35,4 @@ rescue LoadError
|
|
35
35
|
end
|
36
36
|
|
37
37
|
CLOBBER << FileList["lib/**/*.{jar,so,bundle}"]
|
38
|
-
CLOBBER << FileList["lib/#{This.name}/{1.8,1.9,2.0}/"]
|
38
|
+
CLOBBER << FileList["lib/#{This.name}/{1.8,1.9,2.0,2.1,2.2}/"]
|
data/tasks/this.rb
CHANGED
@@ -13,7 +13,7 @@ class ThisProject
|
|
13
13
|
attr_accessor :email
|
14
14
|
|
15
15
|
# The homepage of this project
|
16
|
-
attr_accessor :homepage
|
16
|
+
attr_accessor :homepage
|
17
17
|
|
18
18
|
# The regex of files to exclude from the manifest
|
19
19
|
attr_accessor :exclude_from_manifest
|
@@ -25,7 +25,11 @@ class ThisProject
|
|
25
25
|
#
|
26
26
|
# Yields self
|
27
27
|
def initialize(&block)
|
28
|
-
@exclude_from_manifest =
|
28
|
+
@exclude_from_manifest = Regexp.union(/\.(git|DS_Store)/,
|
29
|
+
/^(doc|coverage|pkg|tmp|Gemfile(\.lock)?)/,
|
30
|
+
/^[^\/]+\.gemspec/,
|
31
|
+
/\.(swp|jar|bundle|so|rvmrc|travis.yml)$/,
|
32
|
+
/~$/)
|
29
33
|
@gemspecs = Hash.new
|
30
34
|
yield self if block_given?
|
31
35
|
end
|
@@ -119,7 +123,7 @@ class ThisProject
|
|
119
123
|
|
120
124
|
# Internal: Returns the gemspace associated with the current ruby platform
|
121
125
|
def platform_gemspec
|
122
|
-
gemspecs
|
126
|
+
gemspecs.fetch(platform) { This.ruby_gemspec }
|
123
127
|
end
|
124
128
|
|
125
129
|
def core_gemspec
|
@@ -132,6 +136,7 @@ class ThisProject
|
|
132
136
|
|
133
137
|
spec.summary = summary
|
134
138
|
spec.description = description
|
139
|
+
spec.license = license
|
135
140
|
|
136
141
|
spec.files = manifest
|
137
142
|
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
@@ -140,6 +145,8 @@ class ThisProject
|
|
140
145
|
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc|md)$/)
|
141
146
|
spec.rdoc_options = [ "--main" , 'README.md',
|
142
147
|
"--markup", "tomdoc" ]
|
148
|
+
|
149
|
+
spec.required_ruby_version = '>= 1.9.3'
|
143
150
|
end
|
144
151
|
end
|
145
152
|
|
@@ -166,20 +173,6 @@ class ThisProject
|
|
166
173
|
return spec
|
167
174
|
end
|
168
175
|
|
169
|
-
# Internal: Set the recovery gem development dependency
|
170
|
-
#
|
171
|
-
# These are dynamically set since they cannot be hard coded as there is
|
172
|
-
# no way to ship them correctly in the gemspec
|
173
|
-
#
|
174
|
-
# Returns nothing.
|
175
|
-
def set_coverage_gem
|
176
|
-
if RUBY_VERSION < "1.9.0"
|
177
|
-
platform_gemspec.add_development_dependency( 'rcov', '~> 1.0.0' )
|
178
|
-
else
|
179
|
-
platform_gemspec.add_development_dependency( 'simplecov', '~> 0.7.1' )
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
176
|
# Internal: Return the platform of ThisProject at the current moment in time.
|
184
177
|
def platform
|
185
178
|
(RUBY_PLATFORM == "java") ? 'java' : Gem::Platform::RUBY
|
@@ -189,17 +182,21 @@ class ThisProject
|
|
189
182
|
def description_section
|
190
183
|
section_of( 'README.md', 'DESCRIPTION')
|
191
184
|
end
|
192
|
-
|
193
|
-
|
185
|
+
|
186
|
+
# Internal: Return the summary text from the README
|
194
187
|
def summary
|
195
188
|
description_section.first
|
196
189
|
end
|
197
190
|
|
198
|
-
# Internal: Return the full description text from the
|
191
|
+
# Internal: Return the full description text from the README
|
199
192
|
def description
|
200
193
|
description_section.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
|
201
194
|
end
|
202
195
|
|
196
|
+
def license
|
197
|
+
"ISC"
|
198
|
+
end
|
199
|
+
|
203
200
|
# Internal: The path to the gemspec file
|
204
201
|
def gemspec_file
|
205
202
|
project_path( "#{ name }.gemspec" )
|