Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove ruby <1.8.7 support

  • Loading branch information...
commit 68fbb895a1f7c1a6b86591203c9d2c72173c3907 1 parent def4af9
@jeremyevans authored
View
12 Rakefile
@@ -118,23 +118,15 @@ begin
end
end
- sc = spec_with_cov = lambda do |name, files, d|
+ spec_with_cov = lambda do |name, files, d, &b|
spec.call(name, files, d)
t = spec.call("#{name}_cov", files, "#{d} with coverage")
t.rcov = true
t.rcov_opts = File.read("spec/rcov.opts").split("\n")
+ b.call(t) if b
t
end
- if RUBY_VERSION >= '1.8.7'
- eval <<-END
- spec_with_cov = lambda do |*x, &b|
- t = sc.call(*x)
- b.call(t) if b
- end
- END
- end
-
task :default => [:spec]
spec_with_cov.call("spec", Dir["spec/{core,model}/*_spec.rb"], "Run core and model specs"){|t| t.rcov_opts.concat(%w'--exclude "lib/sequel/adapters/([a-ln-z]|m[a-np-z])"')}
spec.call("spec_core", Dir["spec/core/*_spec.rb"], "Run core specs")
View
1  lib/sequel/core.rb
@@ -1,4 +1,3 @@
-warn 'Sequel support for ruby <1.8.7 is deprecated and will be removed in 3.35.0' if RUBY_VERSION < '1.8.7'
%w'bigdecimal date thread time uri'.each{|f| require f}
# Top level module for Sequel
View
29 lib/sequel/dataset/sql.rb
@@ -279,7 +279,6 @@ def self.clause_methods(type, clauses)
UPDATE_CLAUSE_METHODS = clause_methods(:update, %w'update table set where')
USING = ' USING ('.freeze
VALUES = " VALUES ".freeze
- V187 = '1.8.7'.freeze
V190 = '1.9.0'.freeze
WHERE = " WHERE ".freeze
@@ -558,15 +557,11 @@ def placeholder_literal_string_sql_append(sql, pls)
sql << PAREN_OPEN if pls.parens
if args.is_a?(Hash)
re = /:(#{args.keys.map{|k| Regexp.escape(k.to_s)}.join('|')})\b/
- if RUBY_VERSION >= V187
- loop do
- previous, q, str = str.partition(re)
- sql << previous
- literal_append(sql, args[($1||q[1..-1].to_s).to_sym]) unless q.empty?
- break if str.empty?
- end
- else
- sql << str.gsub(re){literal(args[$1.to_sym])}
+ loop do
+ previous, q, str = str.partition(re)
+ sql << previous
+ literal_append(sql, args[($1||q[1..-1].to_s).to_sym]) unless q.empty?
+ break if str.empty?
end
elsif str.is_a?(Array)
len = args.length
@@ -576,15 +571,11 @@ def placeholder_literal_string_sql_append(sql, pls)
end
else
i = -1
- if RUBY_VERSION >= V187
- loop do
- previous, q, str = str.partition(QUESTION_MARK)
- sql << previous
- literal_append(sql, args.at(i+=1)) unless q.empty?
- break if str.empty?
- end
- else
- sql << str.gsub(QUESTION_MARK_RE){literal(args.at(i+=1))}
+ loop do
+ previous, q, str = str.partition(QUESTION_MARK)
+ sql << previous
+ literal_append(sql, args.at(i+=1)) unless q.empty?
+ break if str.empty?
end
end
sql << PAREN_CLOSE if pls.parens
View
17 lib/sequel/model/associations.rb
@@ -1047,20 +1047,9 @@ def def_association_dataset_methods(opts)
def_association_method(opts)
end
- # Adds the association method to the association methods module. Be backwards
- # compatible with ruby 1.8.6, which doesn't support blocks taking block arguments.
- if RUBY_VERSION >= '1.8.7'
- class_eval <<-END, __FILE__, __LINE__+1
- def def_association_method(opts)
- association_module_def(opts.association_method, opts){|*dynamic_opts, &block| load_associated_objects(opts, dynamic_opts[0], &block)}
- end
- END
- else
- class_eval <<-END, __FILE__, __LINE__+1
- def def_association_method(opts)
- association_module_def(opts.association_method, opts){|*dynamic_opts| load_associated_objects(opts, dynamic_opts[0])}
- end
- END
+ # Adds the association method to the association methods module.
+ def def_association_method(opts)
+ association_module_def(opts.association_method, opts){|*dynamic_opts, &block| load_associated_objects(opts, dynamic_opts[0], &block)}
end
# Configures many_to_many association reflection and adds the related association methods
View
22 lib/sequel/model/base.rb
@@ -295,21 +295,6 @@ def def_dataset_method(*args, &block)
end
end
- module_eval(if RUBY_VERSION < '1.8.7'
- <<-END
- def def_model_dataset_method_block(arg)
- meta_def(arg){|*args| dataset.send(arg, *args)}
- end
- END
- else
- <<-END
- def def_model_dataset_method_block(arg)
- meta_def(arg){|*args, &block| dataset.send(arg, *args, &block)}
- end
- END
- end, __FILE__, __LINE__ - 4)
- private :def_model_dataset_method_block
-
# Finds a single record according to the supplied filter.
# You are encouraged to use Model.[] or Model.first instead of this method.
#
@@ -685,6 +670,13 @@ def def_column_accessor(*columns)
end
end
+ # Define a model method that calls the dataset method with the same name,
+ # only used for methods with names that can't be presented directly in
+ # ruby code.
+ def def_model_dataset_method_block(arg)
+ meta_def(arg){|*args, &block| dataset.send(arg, *args, &block)}
+ end
+
# Get the schema from the database, fall back on checking the columns
# via the database if that will return inaccurate results or if
# it raises an error.
View
2  sequel.gemspec
@@ -12,7 +12,7 @@ SEQUEL_GEMSPEC = Gem::Specification.new do |s|
s.author = "Jeremy Evans"
s.email = "code@jeremyevans.net"
s.homepage = "http://sequel.rubyforge.org"
- s.required_ruby_version = ">= 1.8.4"
+ s.required_ruby_version = ">= 1.8.7"
s.files = %w(MIT-LICENSE CHANGELOG README.rdoc Rakefile) + Dir["{bin,doc,spec,lib}/**/*"]
s.require_path = "lib"
s.bindir = 'bin'
View
4 spec/extensions/arbitrary_servers_spec.rb
@@ -1,6 +1,5 @@
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
-if RUBY_VERSION >= '1.8.7'
describe "arbtirary servers" do
before do
@db = Sequel.mock(:servers=>{})
@@ -109,6 +108,3 @@
'SELECT * FROM t -- {:host=>"b"}', 'SELECT * FROM t -- {:host=>"a"}', 'SELECT * FROM t', 'SELECT * FROM t -- {:host=>"c"}', 'SELECT * FROM t']
end
end
-else
- skip_warn "arbitrary_servers plugin: only works on ruby 1.8.7+"
-end
View
14 spec/extensions/named_timezones_spec.rb
@@ -35,14 +35,12 @@
Sequel.database_timezone.should == @tz_out
end
- unless RUBY_VERSION == '1.8.6' && RUBY_PLATFORM =~ /win/
- it "should convert datetimes going into the database to named database_timezone" do
- ds = @db[:a]
- def ds.supports_timestamp_timezones?; true; end
- def ds.supports_timestamp_usecs?; false; end
- ds.insert([@dt, DateTime.civil(2009,6,1,3,20,30,-7/24.0), DateTime.civil(2009,6,1,6,20,30,-1/6.0)])
- @db.sqls.should == ["INSERT INTO a VALUES ('2009-06-01 06:20:30-0400', '2009-06-01 06:20:30-0400', '2009-06-01 06:20:30-0400')"]
- end
+ it "should convert datetimes going into the database to named database_timezone" do
+ ds = @db[:a]
+ def ds.supports_timestamp_timezones?; true; end
+ def ds.supports_timestamp_usecs?; false; end
+ ds.insert([@dt, DateTime.civil(2009,6,1,3,20,30,-7/24.0), DateTime.civil(2009,6,1,6,20,30,-1/6.0)])
+ @db.sqls.should == ["INSERT INTO a VALUES ('2009-06-01 06:20:30-0400', '2009-06-01 06:20:30-0400', '2009-06-01 06:20:30-0400')"]
end
it "should convert datetimes coming out of the database from database_timezone to application_timezone" do
View
10 spec/integration/associations_test.rb
@@ -693,12 +693,10 @@ class ::Tag < Sequel::Model(@db)
@album.artist(proc{|ds| ds.exclude(:id=>@artist.id)}).should == nil
@album.artist(proc{|ds| ds.filter(:id=>@artist.id)}).should == @artist
- if RUBY_VERSION >= '1.8.7'
- @artist.albums{|ds| ds.exclude(:id=>@album.id)}.should == []
- @artist.albums{|ds| ds.filter(:id=>@album.id)}.should == [@album]
- @album.artist{|ds| ds.exclude(:id=>@artist.id)}.should == nil
- @album.artist{|ds| ds.filter(:id=>@artist.id)}.should == @artist
- end
+ @artist.albums{|ds| ds.exclude(:id=>@album.id)}.should == []
+ @artist.albums{|ds| ds.filter(:id=>@album.id)}.should == [@album]
+ @album.artist{|ds| ds.exclude(:id=>@artist.id)}.should == nil
+ @album.artist{|ds| ds.filter(:id=>@artist.id)}.should == @artist
end
specify "should handle dynamic callbacks for eager loading via eager and eager_graph" do
View
4 spec/model/associations_spec.rb
@@ -382,7 +382,7 @@ class Parent < Sequel::Model; end
MODEL_DB.sqls.should == ["SELECT * FROM nodes WHERE ((nodes.id = 234) AND (name > 'M')) LIMIT 1"]
end
- it "should use a block given to the association method as a callback on ruby 1.8.7+" do
+ it "should use a block given to the association method as a callback" do
@c2.many_to_one :parent, :class => @c2
d = @c2.create(:id => 1)
@@ -391,7 +391,7 @@ class Parent < Sequel::Model; end
d.associations[:parent] = 42
d.parent{|ds| ds.filter{name > 'M'}}.should_not == 42
MODEL_DB.sqls.should == ["SELECT * FROM nodes WHERE ((nodes.id = 234) AND (name > 'M')) LIMIT 1"]
- end if RUBY_VERSION >= '1.8.7'
+ end
it "should have the setter add to the reciprocal one_to_many cached association list if it exists" do
@c2.many_to_one :parent, :class => @c2
Please sign in to comment.
Something went wrong with that request. Please try again.