rails_appengine 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -1
- data/Rakefile +4 -4
- data/lib/rails_appengine/active_support_conversions.rb +42 -0
- data/lib/rails_appengine/multiparameter_assignments.rb +27 -0
- data/lib/rails_appengine.rb +3 -0
- metadata +7 -4
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -3,13 +3,13 @@ require 'rake/gempackagetask'
|
|
3
3
|
|
4
4
|
spec = Gem::Specification.new do |s|
|
5
5
|
s.name = "rails_appengine"
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.2'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.has_rdoc = false
|
9
9
|
s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
|
10
|
-
s.description = "Config files for Rails on
|
11
|
-
s.summary = "We
|
12
|
-
"
|
10
|
+
s.description = "Config files for Rails on App Engine"
|
11
|
+
s.summary = "We intend to provide a common set of config files " +
|
12
|
+
"for Rails 2.3.5 (and eventually 3.0) on Google App Engine."
|
13
13
|
s.authors = ["Takeru Sasaki", "John Woodell"]
|
14
14
|
s.email = ["sasaki.takeru@gmail.com", "woodie@netpress.com"]
|
15
15
|
s.homepage = "http://github.com/takeru/rails_appengine"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# set a nil date or time when a date cannot be parced
|
2
|
+
# to avoid exception by ruby via to_date and to_time
|
3
|
+
module ActiveSupport #:nodoc:
|
4
|
+
module CoreExtensions #:nodoc:
|
5
|
+
module String #:nodoc:
|
6
|
+
# Converting strings to other objects
|
7
|
+
module Conversions
|
8
|
+
# 'a'.ord == 'a'[0] for Ruby 1.9 forward compatibility.
|
9
|
+
def ord
|
10
|
+
self[0]
|
11
|
+
end if RUBY_VERSION < '1.9'
|
12
|
+
# Form can be either :utc (default) or :local.
|
13
|
+
def to_time(form = :utc)
|
14
|
+
begin
|
15
|
+
::Time.send("#{form}_time", *::Date._parse(self, false).
|
16
|
+
values_at(:year, :mon, :mday, :hour, :min, :sec).
|
17
|
+
map { |arg| arg || 0 })
|
18
|
+
rescue
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
def to_date
|
23
|
+
begin
|
24
|
+
::Date.new(*::Date._parse(self, false).
|
25
|
+
values_at(:year, :mon, :mday))
|
26
|
+
rescue
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
def to_datetime
|
31
|
+
begin
|
32
|
+
::DateTime.civil(*::Date._parse(self, false).
|
33
|
+
values_at(:year, :mon, :mday, :hour, :min, :sec).
|
34
|
+
map { |arg| arg || 0 })
|
35
|
+
rescue
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Convert the values from the date and time picker
|
2
|
+
# to a date or time class that the datastore can accept
|
3
|
+
module MultiparameterAssignments
|
4
|
+
def self.fix_date(hash, property, type)
|
5
|
+
total_attributes = 0
|
6
|
+
if Date == type
|
7
|
+
total_attributes = 3
|
8
|
+
else
|
9
|
+
total_attributes = 5
|
10
|
+
end
|
11
|
+
time_string = ""
|
12
|
+
1.upto(total_attributes) do |n|
|
13
|
+
if n == 1
|
14
|
+
time_string << hash[:"#{property}(#{n}i)"]
|
15
|
+
elsif n > 1 && n <= 3
|
16
|
+
time_string << '-' + hash[:"#{property}(#{n}i)"]
|
17
|
+
elsif n == 4
|
18
|
+
time_string << ' ' + hash[:"#{property}(#{n}i)"]
|
19
|
+
elsif n > 4
|
20
|
+
time_string << ':' + hash[:"#{property}(#{n}i)"]
|
21
|
+
end
|
22
|
+
hash.delete :"#{property}(#{n}i)"
|
23
|
+
end
|
24
|
+
hash[property] = type.parse(time_string).send("to_#{type.to_s.downcase}")
|
25
|
+
hash
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Takeru Sasaki
|
@@ -19,7 +19,7 @@ date: 2010-03-01 00:00:00 -08:00
|
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
|
-
description: Config files for Rails on
|
22
|
+
description: Config files for Rails on App Engine
|
23
23
|
email:
|
24
24
|
- sasaki.takeru@gmail.com
|
25
25
|
- woodie@netpress.com
|
@@ -35,8 +35,11 @@ files:
|
|
35
35
|
- README.rdoc
|
36
36
|
- Rakefile
|
37
37
|
- lib/rails_appengine/action_mailer_vendored.rb
|
38
|
+
- lib/rails_appengine/active_support_conversions.rb
|
38
39
|
- lib/rails_appengine/active_support_vendored.rb
|
39
40
|
- lib/rails_appengine/bundler_boot.rb
|
41
|
+
- lib/rails_appengine/multiparameter_assignments.rb
|
42
|
+
- lib/rails_appengine.rb
|
40
43
|
has_rdoc: true
|
41
44
|
homepage: http://github.com/takeru/rails_appengine
|
42
45
|
licenses: []
|
@@ -66,6 +69,6 @@ rubyforge_project:
|
|
66
69
|
rubygems_version: 1.3.6
|
67
70
|
signing_key:
|
68
71
|
specification_version: 3
|
69
|
-
summary: We
|
72
|
+
summary: We intend to provide a common set of config files for Rails 2.3.5 (and eventually 3.0) on Google App Engine.
|
70
73
|
test_files: []
|
71
74
|
|