zena 1.0.0.beta1 → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.0.beta2 2010-07-24
2
+
3
+ * major changes
4
+ * fixed connection timezone with PostgreSQL
5
+
1
6
  == 1.0.0.beta1 2010-07-23
2
7
 
3
8
  * major changes
data/lib/zena.rb CHANGED
@@ -159,6 +159,7 @@ module Zena
159
159
  # do not change this !
160
160
  ActiveRecord::Base.default_timezone = :utc
161
161
  ENV['TZ'] = 'UTC'
162
+ Zena::Db.prepare_connection_for_timezone
162
163
  end
163
164
 
164
165
  def add_inflections
data/lib/zena/db.rb CHANGED
@@ -404,6 +404,36 @@ module Zena
404
404
 
405
405
  tables
406
406
  end
407
+
408
+ def prepare_connection_for_timezone
409
+ # Fixes #98
410
+ case ActiveRecord::Base.configurations[RAILS_ENV]['adapter']
411
+ when 'mysql'
412
+ # Fixes timezone to "+0:0"
413
+ raise "MySQL timezone UTC required too late, connection already active." if Class.new(ActiveRecord::Base).connected?
414
+
415
+ ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
416
+ def configure_connection_with_timezone
417
+ configure_connection_without_timezone
418
+ tz = ActiveRecord::Base.default_timezone == :utc ? "+0:0" : "SYSTEM"
419
+ execute("SET time_zone = '#{tz}'")
420
+ end
421
+ alias_method_chain :configure_connection, :timezone
422
+ end
423
+ when 'postgresql'
424
+ # Fixes timezone to "+0:0"
425
+ raise "PostgreSQL timezone UTC required too late, connection already active." if Class.new(ActiveRecord::Base).connected?
426
+
427
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
428
+ def configure_connection_with_timezone
429
+ configure_connection_without_timezone
430
+ tz = ActiveRecord::Base.default_timezone == :utc ? "UTC" : "SYSTEM"
431
+ execute("SET TIMEZONE = '#{tz}'")
432
+ end
433
+ alias_method_chain :configure_connection, :timezone
434
+ end
435
+ end
436
+ end
407
437
 
408
438
  # Return true if we can load models because the database has the basic tables.
409
439
  def migrated_once?
data/lib/zena/info.rb CHANGED
@@ -9,6 +9,6 @@ ZENA_CALENDAR_LANGS = ["en", "fr", "de"] # FIXME: build this dynamically from ex
9
9
  ENABLE_XSENDFILE = false
10
10
 
11
11
  module Zena
12
- VERSION = '1.0.0.beta1'
12
+ VERSION = '1.0.0.beta2'
13
13
  ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
14
14
  end
@@ -27,7 +27,7 @@ class DbTest < Zena::Unit::TestCase
27
27
  def test_insensitive_find
28
28
  assert_equal nodes_zip(:status), secure(Node) { Zena::Db.insensitive_find(Node, :first, :node_name => 'sTatuS')}.zip
29
29
  end
30
-
30
+
31
31
  def test_next_zip_rollback
32
32
  assert_raise(Zena::BadConfiguration) { Zena::Db.next_zip(88) }
33
33
  assert_equal zips_zip(:zena ) + 1, Zena::Db.next_zip(sites_id(:zena))
@@ -47,7 +47,7 @@ class DbTest < Zena::Unit::TestCase
47
47
  {"node_name"=>"skins", "zip"=>"51"},
48
48
  {"node_name"=>"style", "zip"=>"53"}], Zena::Db.fetch_attributes(['zip','node_name'], 'nodes', "node_name like 's%' and site_id = #{sites_id(:zena)} ORDER BY zip")
49
49
  end
50
-
50
+
51
51
  def test_migrated_once
52
52
  assert Zena::Db.migrated_once?
53
53
  end
data/zena.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{zena}
8
- s.version = "1.0.0.beta1"
8
+ s.version = "1.0.0.beta2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gaspard Bucher"]
12
- s.date = %q{2010-07-23}
12
+ s.date = %q{2010-07-24}
13
13
  s.default_executable = %q{zena}
14
14
  s.description = %q{zena is a Ruby on Rails CMS (content managment system) with a focus on usability, ease of customization and web 2.0 goodness (application like behaviour).}
15
15
  s.email = %q{gaspard@teti.ch}
@@ -2035,10 +2035,6 @@ Gem::Specification.new do |s|
2035
2035
  "vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/backend_spec.rb",
2036
2036
  "vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails_spec.rb",
2037
2037
  "vendor/plugins/gettext_i18n_rails/spec/spec_helper.rb",
2038
- "vendor/plugins/mysql_timezone_utc/init.rb",
2039
- "vendor/plugins/mysql_timezone_utc/lib/mysql_timezone_utc.rb",
2040
- "vendor/plugins/postgresql_timezone_utc/init.rb",
2041
- "vendor/plugins/postgresql_timezone_utc/lib/postgresql_timezone_utc.rb",
2042
2038
  "vendor/plugins/responds_to_parent/MIT-LICENSE",
2043
2039
  "vendor/plugins/responds_to_parent/README",
2044
2040
  "vendor/plugins/responds_to_parent/Rakefile",
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 1
7
7
  - 0
8
8
  - 0
9
- - beta1
10
- version: 1.0.0.beta1
9
+ - beta2
10
+ version: 1.0.0.beta2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gaspard Bucher
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-23 00:00:00 +02:00
18
+ date: 2010-07-24 00:00:00 +02:00
19
19
  default_executable: zena
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -2334,10 +2334,6 @@ files:
2334
2334
  - vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/backend_spec.rb
2335
2335
  - vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails_spec.rb
2336
2336
  - vendor/plugins/gettext_i18n_rails/spec/spec_helper.rb
2337
- - vendor/plugins/mysql_timezone_utc/init.rb
2338
- - vendor/plugins/mysql_timezone_utc/lib/mysql_timezone_utc.rb
2339
- - vendor/plugins/postgresql_timezone_utc/init.rb
2340
- - vendor/plugins/postgresql_timezone_utc/lib/postgresql_timezone_utc.rb
2341
2337
  - vendor/plugins/responds_to_parent/MIT-LICENSE
2342
2338
  - vendor/plugins/responds_to_parent/README
2343
2339
  - vendor/plugins/responds_to_parent/Rakefile
@@ -1 +0,0 @@
1
- require 'mysql_timezone_utc'
@@ -1,14 +0,0 @@
1
- # Fixes #98
2
- if ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] == 'mysql'
3
- # Fixes timezone to "+0:0"
4
- raise "MySQL timezone UTC required too late, connection already active." if Class.new(ActiveRecord::Base).connected?
5
-
6
- ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
7
- def configure_connection_with_timezone
8
- configure_connection_without_timezone
9
- tz = ActiveRecord::Base.default_timezone == :utc ? "+0:0" : "SYSTEM"
10
- execute("SET time_zone = '#{tz}'")
11
- end
12
- alias_method_chain :configure_connection, :timezone
13
- end
14
- end
@@ -1 +0,0 @@
1
- require 'postgresql_timezone_utc'
@@ -1,14 +0,0 @@
1
- # Fixes #98
2
- if ActiveRecord::Base.configurations[RAILS_ENV]['adapter'] == 'postgresql'
3
- # Fixes timezone to "+0:0"
4
- raise "PostgreSQL timezone UTC required too late, connection already active." if Class.new(ActiveRecord::Base).connected?
5
-
6
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
7
- def configure_connection_with_timezone
8
- configure_connection_without_timezone
9
- tz = ActiveRecord::Base.default_timezone == :utc ? "UTC" : "SYSTEM"
10
- execute("SET TIMEZONE = '#{tz}'")
11
- end
12
- alias_method_chain :configure_connection, :timezone
13
- end
14
- end