pk-merb_sequel 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -8,7 +8,7 @@ and Gem to allow faster and more independent release cycle to keep up with the
8
8
  Sequel monthly releases.
9
9
 
10
10
  Plug-in should be compatible with Merb 0.9.9 and higher and Sequel 1.4.0 and
11
- higher including 2.x and incoming <b>3.x</b>.
11
+ higher including 2.x.x and incoming <b>3.0.0</b>.
12
12
 
13
13
  <b>Any issues please report to http://github.com/pk/merb_sequel/issues</b>.
14
14
 
@@ -26,12 +26,12 @@ In Merb, add it as a dependency to your config/dependencies.rb:
26
26
  ===Ruby 1.8.7:
27
27
  Sequel 2.11.0:: All pass
28
28
  Sequel 2.12.0:: All pass
29
- Sequel 3.:: All pass
29
+ Sequel 3.0.0:: All pass
30
30
 
31
31
  ===Ruby 1.9.1:
32
32
  Sequel 2.11.0:: All pass except session spec failing due to Marshall issues.
33
33
  Sequel 2.12.0:: All pass except session spec failing due to Marshall issues.
34
- Sequel 3.:: All pass except session spec failing due to Marshall issues.
34
+ Sequel 3.0.0:: All pass except session spec failing due to Marshall issues.
35
35
 
36
36
 
37
37
  == Connection options
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ GEM_EMAIL = "wayneeseguin@gmail.com, lancecarlson@gmail.com, email@loriholden.c
17
17
 
18
18
  GEM_NAME = "merb_sequel"
19
19
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
20
- GEM_VERSION = (Merb::MORE_VERSION rescue "1.0.1") + PKG_BUILD
20
+ GEM_VERSION = (Merb::MORE_VERSION rescue "1.0.2") + PKG_BUILD
21
21
 
22
22
  RELEASE_NAME = "REL #{GEM_VERSION}"
23
23
 
@@ -10,6 +10,14 @@ module Merb
10
10
  def config_file() Merb.dir_for(:config) / "database.yml" end
11
11
  def sample_dest() Merb.dir_for(:config) / "database.yml.sample" end
12
12
  def sample_source() File.dirname(__FILE__) / "database.yml.sample" end
13
+
14
+ # Determine if we use Sequel 3 or not
15
+ #
16
+ # ==== Returns
17
+ # Boolean:: True if using Sequel >= 2.12.0 or False
18
+ def new_sequel?
19
+ /^(2.12|3)/ =~ ::Sequel.version
20
+ end
13
21
 
14
22
  def copy_sample_config
15
23
  FileUtils.cp sample_source, sample_dest unless File.exists?(sample_dest)
@@ -1,6 +1,5 @@
1
1
  require 'sequel'
2
- # Load extensions if we use new versions of Sequel
3
- require 'sequel/extensions/migration' if /^(2.12|3)/ =~ Sequel.version
2
+ require 'sequel/extensions/migration' if Merb::Orms::Sequel.new_sequel?
4
3
  require 'merb-core/dispatch/session'
5
4
  require 'base64'
6
5
 
@@ -79,8 +78,10 @@ module Merb
79
78
  512 # TODO - figure out how much space we actually have
80
79
  end
81
80
 
82
- alias :create_table! :create_table
83
- alias :drop_table! :drop_table
81
+ unless Merb::Orms::Sequel.new_sequel?
82
+ alias :create_table! :create_table
83
+ alias :drop_table! :drop_table
84
+ end
84
85
  end
85
86
 
86
87
  # Lazy-unserialize session state.
@@ -98,6 +99,15 @@ module Merb
98
99
  !!@data
99
100
  end
100
101
 
102
+ if Merb::Orms::Sequel.new_sequel?
103
+ def before_save
104
+ super
105
+ prepare_data_to_save
106
+ end
107
+ else
108
+ before_save :prepare_data_to_save
109
+ end
110
+
101
111
  private
102
112
 
103
113
  def prepare_data_to_save
@@ -107,15 +117,6 @@ module Merb
107
117
  end
108
118
  end
109
119
 
110
- if /^(2.12|3)/ =~ Sequel.version
111
- def before_save
112
- super
113
- prepare_data_to_save
114
- end
115
- else
116
- before_save :prepare_data_to_save
117
- end
118
-
119
120
  end
120
121
 
121
122
  class SequelSession < SessionStoreContainer
@@ -11,7 +11,7 @@ namespace :sequel do
11
11
 
12
12
  desc "Perform migration using migrations in schema/migrations"
13
13
  task :migrate => :sequel_env do
14
- require 'sequel/extensions/migration' if /^(2.12|3)/ =~ Sequel.version
14
+ require 'sequel/extensions/migration' if Merb::Orms::Sequel.new_sequel?
15
15
  Sequel::Migrator.apply(Sequel::Model.db, "schema/migrations", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
16
16
  end
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pk-merb_sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayne E. Seguin, Lance Carlson, Lori Holden