Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some more rake tasks work, and sequel_model version 0.2.

  • Loading branch information...
commit cc7ecf4fbc3d360ff78297aee3097a321fd67b5e 1 parent ec0af70
@ciconia ciconia authored
View
18 Rakefile
@@ -112,3 +112,21 @@ Spec::Rake::SpecTask.new("spec_no_cov") do |t|
t.spec_opts = File.read("sequel_core/spec/spec.opts").split("\n")
end
+##############################################################################
+# Statistics
+##############################################################################
+
+STATS_DIRECTORIES = [
+ %w(core_code sequel_core/lib/),
+ %w(core_spec sequel_core/spec/),
+ %w(model_code sequel_model/lib/),
+ %w(model_spec sequel_model/spec/)
+].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) }
+
+desc "Report code statistics (KLOCs, etc) from the application"
+task :stats do
+ require "sequel_core/extra/stats"
+ verbose = true
+ CodeStatistics.new(*STATS_DIRECTORIES).to_s
+end
+
View
4 sequel_core/CHANGELOG
@@ -1,4 +1,4 @@
-=== 1.0 (2007-01-02)
+=== 1.0 (2008-01-02)
* Removed deprecated adapter stubs.
@@ -12,7 +12,7 @@
* Fixed error behavior when parse_tree or ruby2ruby are not available.
-=== 0.5.0.2 (2007-01-01)
+=== 0.5.0.2 (2008-01-01)
* Fixed String#to_time to raise error correctly for invalid time stamps.
View
10 sequel_model/CHANGELOG
@@ -1,4 +1,12 @@
-=== SVN
+=== 0.2 (2008-01-02)
+
+* Removed deprecated Model.recreate_table method.
+
+* Removed deprecated :class and :on options from one_to_many macro.
+
+* Removed deprecated :class option from one_to_one macro.
+
+* Removed deprecated Model#pkey method.
* Changed dependency to sequel_core.
View
6 sequel_model/lib/sequel_model/record.rb
@@ -158,12 +158,6 @@ def primary_key
@primary_key ||= self.class.primary_key
end
- # Returns value for primary key.
- def pkey
- warn "Model#pkey is deprecated. Please use Model#pk instead."
- @pkey ||= @values[self.class.primary_key]
- end
-
# Returns the primary key value identifying the model instance. Stock implementation.
def pk
@pk ||= @values[:id]
View
18 sequel_model/lib/sequel_model/relations.rb
@@ -28,12 +28,6 @@ class Model
# node.producer_id #=> 1234
#
def self.one_to_one(name, opts)
- # deprecation
- if opts[:class]
- warn "The :class option has been deprecated. Please use :from instead."
- opts[:from] = opts[:class]
- end
-
from = opts[:from]
from || (raise Error, "No association source defined (use :from option)")
key = opts[:key] || (name.to_s + ID_POSTFIX).to_sym
@@ -80,18 +74,6 @@ def self.one_to_one(name, opts)
# one_to_many :books, :from => Book, :key => :author_id
#
def self.one_to_many(name, opts)
- # deprecation
- if opts[:class]
- warn "The :class option has been deprecated. Please use :from instead."
- opts[:from] = opts[:class]
- end
- # deprecation
- if opts[:on]
- warn "The :on option has been deprecated. Please use :key instead."
- opts[:key] = opts[:on]
- end
-
-
from = opts[:from]
from || (raise Error, "No association source defined (use :from option)")
key = opts[:key] || (self.to_s + ID_POSTFIX).to_sym
View
6 sequel_model/lib/sequel_model/schema.rb
@@ -44,11 +44,5 @@ def self.create_table!
drop_table if table_exists?
create_table
end
-
- # Deprecated, use create_table! instead.
- def self.recreate_table
- warn "Model.recreate_table is deprecated. Please use Model.create_table! instead."
- create_table!
- end
end
end
View
18 sequel_model/spec/record_spec.rb
@@ -249,25 +249,7 @@ def columns
end
end
-describe "Model#pkey" do # deprecated
- before(:each) do
- @m = Class.new(Sequel::Model)
- end
-
- it "should by default return the value of the :id column" do
- m = @m.new(:id => 111, :x => 2, :y => 3)
- m.pkey.should == 111
- end
-
- it "should be return the primary key value for custom primary key" do
- @m.set_primary_key :x
- m = @m.new(:id => 111, :x => 2, :y => 3)
- m.pkey.should == 2
- end
-end
-
describe "Model#pk_hash" do
-
before(:each) do
@m = Class.new(Sequel::Model)
end
View
28 sequel_model/spec/relations_spec.rb
@@ -38,16 +38,6 @@ def update(values)
$sqls.should == ["SELECT * FROM nodes WHERE (id = 234) LIMIT 1"]
end
- it "should accept deprecated class option" do
- @c2.one_to_one :parent, :class => MODEL_DB[:xyz]
-
- d = @c2.new(:id => 1, :parent_id => 789)
- p = d.parent
- p.class.should == Hash
-
- MODEL_DB.sqls.should == ["SELECT * FROM xyz WHERE (id = 789) LIMIT 1"]
- end
-
it "should use explicit key if given" do
@c2.one_to_one :parent, :from => @c2, :key => :blah
@@ -131,24 +121,6 @@ def update(values)
a.sql.should == 'SELECT * FROM attributes WHERE (node_id = 1234)'
end
- it "should accept deprecated class option" do
- @c2.one_to_many :attributes, :class => MODEL_DB[:xyz], :key => :node_id
-
- n = @c2.new(:id => 1234)
- a = n.attributes
- a.should be_a_kind_of(Sequel::Dataset)
- a.sql.should == 'SELECT * FROM xyz WHERE (node_id = 1234)'
- end
-
- it "should accept deprecated on option" do
- @c2.one_to_many :attributes, :from => MODEL_DB[:xyz], :on => :node_id
-
- n = @c2.new(:id => 1234)
- a = n.attributes
- a.should be_a_kind_of(Sequel::Dataset)
- a.sql.should == 'SELECT * FROM xyz WHERE (node_id = 1234)'
- end
-
it "should support plain dataset in the from option" do
@c2.one_to_many :attributes, :from => MODEL_DB[:xyz], :key => :node_id
View
15 sequel_model/spec/schema_spec.rb
@@ -67,18 +67,3 @@
end
end
-
-describe Sequel::Model, "recreate_table" do
-
- before(:each) do
- MODEL_DB.reset
- @model = Class.new(Sequel::Model(:items))
- end
-
- it "should raise a depreciation warning and then call create_table!" do
- @model.should_receive(:warn)
- @model.should_receive(:create_table!).and_return(true)
- @model.recreate_table
- end
-
-end
Please sign in to comment.
Something went wrong with that request. Please try again.