turbograft 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -11
- data/lib/assets/javascripts/turbograft/click.coffee +1 -4
- data/lib/assets/javascripts/turbograft/initializers.coffee +4 -2
- data/lib/assets/javascripts/turbograft/page.coffee +3 -1
- data/lib/assets/javascripts/turbograft/remote.coffee +18 -21
- data/lib/assets/javascripts/turbograft/turbolinks.coffee +36 -53
- data/lib/turbograft/version.rb +1 -1
- data/lib/turbograft/xhr_headers.rb +16 -5
- data/lib/turbograft.js +978 -0
- metadata +34 -34
- data/lib/assets/javascripts/turbograft/page_cache.coffee +0 -42
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbograft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kristian Plettenberg-Dussault
|
@@ -13,174 +13,174 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2014-
|
16
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: coffee-rails
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
|
-
- -
|
22
|
+
- - '>='
|
23
23
|
- !ruby/object:Gem::Version
|
24
24
|
version: '0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
|
-
- -
|
29
|
+
- - '>='
|
30
30
|
- !ruby/object:Gem::Version
|
31
31
|
version: '0'
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: bundler
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
|
-
- -
|
36
|
+
- - '>='
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: '0'
|
39
39
|
type: :development
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rake
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
|
-
- -
|
50
|
+
- - '>='
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0'
|
53
53
|
type: :development
|
54
54
|
prerelease: false
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - '>='
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: rails
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- -
|
64
|
+
- - '>='
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - '>='
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: jquery-rails
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - '>='
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
type: :development
|
82
82
|
prerelease: false
|
83
83
|
version_requirements: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - '>='
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
89
|
name: minitest-reporters
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- -
|
92
|
+
- - '>='
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
type: :development
|
96
96
|
prerelease: false
|
97
97
|
version_requirements: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - '>='
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: capybara
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- -
|
106
|
+
- - '>='
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
type: :development
|
110
110
|
prerelease: false
|
111
111
|
version_requirements: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- -
|
113
|
+
- - '>='
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
117
|
name: selenium-webdriver
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - '>='
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- -
|
127
|
+
- - '>='
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
- !ruby/object:Gem::Dependency
|
131
131
|
name: teaspoon
|
132
132
|
requirement: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
|
-
- -
|
134
|
+
- - '>='
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
type: :development
|
138
138
|
prerelease: false
|
139
139
|
version_requirements: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
|
-
- -
|
141
|
+
- - '>='
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0'
|
144
144
|
- !ruby/object:Gem::Dependency
|
145
145
|
name: sqlite3
|
146
146
|
requirement: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
|
-
- -
|
148
|
+
- - '>='
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
type: :development
|
152
152
|
prerelease: false
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
159
|
name: thin
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
|
-
- -
|
162
|
+
- - '>='
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0'
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
167
|
version_requirements: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- -
|
169
|
+
- - '>='
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
172
|
- !ruby/object:Gem::Dependency
|
173
173
|
name: byebug
|
174
174
|
requirement: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
|
-
- -
|
176
|
+
- - '>='
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: '0'
|
179
179
|
type: :development
|
180
180
|
prerelease: false
|
181
181
|
version_requirements: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
|
-
- -
|
183
|
+
- - '>='
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '0'
|
186
186
|
description: It's like turbolinks, but with partial page replacement and tests
|
@@ -190,25 +190,25 @@ executables: []
|
|
190
190
|
extensions: []
|
191
191
|
extra_rdoc_files: []
|
192
192
|
files:
|
193
|
-
- MIT-LICENSE
|
194
|
-
- README.md
|
195
|
-
- lib/assets/javascripts/turbograft.coffee
|
196
193
|
- lib/assets/javascripts/turbograft/click.coffee
|
197
194
|
- lib/assets/javascripts/turbograft/component_url.coffee
|
198
195
|
- lib/assets/javascripts/turbograft/csrf_token.coffee
|
199
196
|
- lib/assets/javascripts/turbograft/initializers.coffee
|
200
197
|
- lib/assets/javascripts/turbograft/link.coffee
|
201
198
|
- lib/assets/javascripts/turbograft/page.coffee
|
202
|
-
- lib/assets/javascripts/turbograft/page_cache.coffee
|
203
199
|
- lib/assets/javascripts/turbograft/remote.coffee
|
204
200
|
- lib/assets/javascripts/turbograft/turbolinks.coffee
|
205
|
-
- lib/turbograft.
|
201
|
+
- lib/assets/javascripts/turbograft.coffee
|
206
202
|
- lib/turbograft/cookies.rb
|
207
203
|
- lib/turbograft/redirection.rb
|
208
204
|
- lib/turbograft/version.rb
|
209
205
|
- lib/turbograft/x_domain_blocker.rb
|
210
206
|
- lib/turbograft/xhr_headers.rb
|
211
207
|
- lib/turbograft/xhr_url_for.rb
|
208
|
+
- lib/turbograft.js
|
209
|
+
- lib/turbograft.rb
|
210
|
+
- README.md
|
211
|
+
- MIT-LICENSE
|
212
212
|
homepage: https://github.com/Shopify/turbograft
|
213
213
|
licenses:
|
214
214
|
- MIT
|
@@ -219,17 +219,17 @@ require_paths:
|
|
219
219
|
- lib
|
220
220
|
required_ruby_version: !ruby/object:Gem::Requirement
|
221
221
|
requirements:
|
222
|
-
- -
|
222
|
+
- - '>='
|
223
223
|
- !ruby/object:Gem::Version
|
224
224
|
version: '0'
|
225
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- -
|
227
|
+
- - '>='
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.0.14
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: turbolinks with partial page replacement
|
@@ -1,42 +0,0 @@
|
|
1
|
-
class window.PageCache
|
2
|
-
storage = {}
|
3
|
-
simultaneousAdditionOffset = 0
|
4
|
-
constructor: (@cacheSize = 10) ->
|
5
|
-
storage = {}
|
6
|
-
return this
|
7
|
-
|
8
|
-
get: (key) ->
|
9
|
-
storage[key]
|
10
|
-
|
11
|
-
set: (key, value) ->
|
12
|
-
if typeof value != "object"
|
13
|
-
throw "Developer error: You must store objects in this cache"
|
14
|
-
|
15
|
-
value['cachedAt'] = new Date().getTime() + (simultaneousAdditionOffset+=1)
|
16
|
-
|
17
|
-
storage[key] = value
|
18
|
-
@constrain()
|
19
|
-
|
20
|
-
clear: ->
|
21
|
-
storage = {}
|
22
|
-
|
23
|
-
setCacheSize: (newSize) ->
|
24
|
-
if /^[\d]+$/.test(newSize)
|
25
|
-
@cacheSize = parseInt(newSize, 10)
|
26
|
-
@constrain()
|
27
|
-
else
|
28
|
-
throw "Developer error: Invalid parameter '#{newSize}' for PageCache; must be integer"
|
29
|
-
|
30
|
-
constrain: ->
|
31
|
-
pageCacheKeys = Object.keys storage
|
32
|
-
|
33
|
-
cacheTimesRecentFirst = pageCacheKeys.map (url) =>
|
34
|
-
storage[url].cachedAt
|
35
|
-
.sort (a, b) -> b - a
|
36
|
-
|
37
|
-
for key in pageCacheKeys when storage[key].cachedAt <= cacheTimesRecentFirst[@cacheSize]
|
38
|
-
triggerEvent 'page:expire', storage[key] # TODO: fix this global
|
39
|
-
delete storage[key]
|
40
|
-
|
41
|
-
length: ->
|
42
|
-
Object.keys(storage).length
|