utopia 0.9.56 → 0.9.57
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/utopia.rb +5 -0
- data/lib/utopia/extensions/date.rb +56 -9
- data/lib/utopia/link.rb +0 -1
- data/lib/utopia/middleware/all.rb +3 -1
- data/lib/utopia/middleware/requester.rb +5 -0
- data/lib/utopia/middleware/static.rb +1 -0
- data/lib/utopia/tags.rb +1 -1
- data/lib/utopia/tags/all.rb +3 -1
- data/lib/utopia/tags/google_analytics.rb +6 -11
- data/lib/utopia/time_store.rb +1 -1
- data/lib/utopia/version.rb +6 -6
- metadata +5 -7
data/lib/utopia.rb
CHANGED
@@ -2,19 +2,66 @@
|
|
2
2
|
# Copyright 2010 Samuel Williams. All rights reserved.
|
3
3
|
# See <utopia.rb> for licensing details.
|
4
4
|
|
5
|
+
# These amendments allow for Date <=> DateTime <=> Time, and so on.
|
6
|
+
# Use only if required. This implementation works for Ruby 1.9.2.
|
7
|
+
|
5
8
|
require 'date'
|
6
9
|
|
7
10
|
class Date
|
8
|
-
alias_method :
|
11
|
+
alias_method :old_compare, :<=>
|
12
|
+
|
13
|
+
def <=>(other)
|
14
|
+
if other.class == Date
|
15
|
+
old_compare(other)
|
16
|
+
else
|
17
|
+
if Time === other
|
18
|
+
other = other.to_datetime
|
19
|
+
end
|
20
|
+
|
21
|
+
if DateTime === other
|
22
|
+
result = old_compare(other.to_date)
|
23
|
+
if result == 0 && other.day_fraction > 0
|
24
|
+
-1
|
25
|
+
else
|
26
|
+
result
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class Time
|
34
|
+
alias_method :old_compare, :<=>
|
9
35
|
|
10
|
-
def <=>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
return (other <=> self) * -1
|
36
|
+
def <=>(other)
|
37
|
+
if other.class == Date
|
38
|
+
(other <=> self) * -1
|
39
|
+
elsif Time === other
|
40
|
+
old_compare(other)
|
16
41
|
else
|
17
|
-
|
42
|
+
if DateTime === other
|
43
|
+
other = other.to_time
|
44
|
+
end
|
45
|
+
|
46
|
+
old_compare(other)
|
18
47
|
end
|
19
|
-
end
|
48
|
+
end
|
20
49
|
end
|
50
|
+
|
51
|
+
class DateTime
|
52
|
+
alias_method :old_compare, :<=>
|
53
|
+
|
54
|
+
def <=>(other)
|
55
|
+
if other.class == Date
|
56
|
+
(other <=> self) * -1
|
57
|
+
elsif DateTime === other
|
58
|
+
old_compare(other)
|
59
|
+
else
|
60
|
+
if Time === other
|
61
|
+
other = other.to_datetime
|
62
|
+
end
|
63
|
+
|
64
|
+
old_compare(other)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/utopia/link.rb
CHANGED
data/lib/utopia/tags.rb
CHANGED
data/lib/utopia/tags/all.rb
CHANGED
@@ -6,19 +6,14 @@ require 'utopia/tags'
|
|
6
6
|
|
7
7
|
Utopia::Tags.create("google_analytics") do |transaction, state|
|
8
8
|
html = <<EOF
|
9
|
-
<!-- Google Analytics -->
|
10
|
-
|
11
9
|
<script type="text/javascript">
|
12
|
-
var
|
13
|
-
|
10
|
+
var _gaq = _gaq || []; _gaq.push(['_setAccount', #{state[:id].to_quoted_string}]); _gaq.push(['_trackPageview']);
|
11
|
+
(function() {
|
12
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
13
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
14
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
15
|
+
})();
|
14
16
|
</script>
|
15
|
-
<script type="text/javascript">
|
16
|
-
try {
|
17
|
-
var pageTracker = _gat._getTracker(#{state[:id].dump});
|
18
|
-
pageTracker._trackPageview();
|
19
|
-
} catch(err) {}</script>
|
20
|
-
|
21
|
-
<!-- Google Analytics -->
|
22
17
|
EOF
|
23
18
|
|
24
19
|
|
data/lib/utopia/time_store.rb
CHANGED
data/lib/utopia/version.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
# See <utopia.rb> for licensing details.
|
4
4
|
|
5
5
|
module Utopia
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
module VERSION
|
7
|
+
MAJOR = 0
|
8
|
+
MINOR = 9
|
9
|
+
TINY = 57
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
12
|
+
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 73
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 57
|
10
|
+
version: 0.9.57
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Samuel Williams
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable: utopia
|
18
|
+
date: 2011-08-30 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: mime-types
|
@@ -156,7 +155,6 @@ files:
|
|
156
155
|
- lib/utopia/xnode.rb
|
157
156
|
- lib/utopia.rb
|
158
157
|
- bin/utopia
|
159
|
-
has_rdoc: true
|
160
158
|
homepage: http://www.oriontransfer.co.nz/software/utopia
|
161
159
|
licenses: []
|
162
160
|
|
@@ -186,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
184
|
requirements: []
|
187
185
|
|
188
186
|
rubyforge_project:
|
189
|
-
rubygems_version: 1.
|
187
|
+
rubygems_version: 1.8.7
|
190
188
|
signing_key:
|
191
189
|
specification_version: 3
|
192
190
|
summary: Utopia is a framework for building websites.
|