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 +5 -0
- data/lib/zena.rb +1 -0
- data/lib/zena/db.rb +30 -0
- data/lib/zena/info.rb +1 -1
- data/test/unit/zena/db_test.rb +2 -2
- data/zena.gemspec +2 -6
- metadata +3 -7
- data/vendor/plugins/mysql_timezone_utc/init.rb +0 -1
- data/vendor/plugins/mysql_timezone_utc/lib/mysql_timezone_utc.rb +0 -14
- data/vendor/plugins/postgresql_timezone_utc/init.rb +0 -1
- data/vendor/plugins/postgresql_timezone_utc/lib/postgresql_timezone_utc.rb +0 -14
data/History.txt
CHANGED
data/lib/zena.rb
CHANGED
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
data/test/unit/zena/db_test.rb
CHANGED
@@ -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.
|
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-
|
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
|
-
-
|
10
|
-
version: 1.0.0.
|
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-
|
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
|