gembox 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,121 @@
1
+ /*
2
+ * Metadata - jQuery plugin for parsing metadata from elements
3
+ *
4
+ * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ *
10
+ * Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
11
+ *
12
+ */
13
+
14
+ /**
15
+ * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
16
+ * in the JSON will become a property of the element itself.
17
+ *
18
+ * There are three supported types of metadata storage:
19
+ *
20
+ * attr: Inside an attribute. The name parameter indicates *which* attribute.
21
+ *
22
+ * class: Inside the class attribute, wrapped in curly braces: { }
23
+ *
24
+ * elem: Inside a child element (e.g. a script tag). The
25
+ * name parameter indicates *which* element.
26
+ *
27
+ * The metadata for an element is loaded the first time the element is accessed via jQuery.
28
+ *
29
+ * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
30
+ * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
31
+ *
32
+ * @name $.metadata.setType
33
+ *
34
+ * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
35
+ * @before $.metadata.setType("class")
36
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
37
+ * @desc Reads metadata from the class attribute
38
+ *
39
+ * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
40
+ * @before $.metadata.setType("attr", "data")
41
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
42
+ * @desc Reads metadata from a "data" attribute
43
+ *
44
+ * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
45
+ * @before $.metadata.setType("elem", "script")
46
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
47
+ * @desc Reads metadata from a nested script element
48
+ *
49
+ * @param String type The encoding type
50
+ * @param String name The name of the attribute to be used to get metadata (optional)
51
+ * @cat Plugins/Metadata
52
+ * @descr Sets the type of encoding to be used when loading metadata for the first time
53
+ * @type undefined
54
+ * @see metadata()
55
+ */
56
+
57
+ (function($) {
58
+
59
+ $.extend({
60
+ metadata : {
61
+ defaults : {
62
+ type: 'class',
63
+ name: 'metadata',
64
+ cre: /({.*})/,
65
+ single: 'metadata'
66
+ },
67
+ setType: function( type, name ){
68
+ this.defaults.type = type;
69
+ this.defaults.name = name;
70
+ },
71
+ get: function( elem, opts ){
72
+ var settings = $.extend({},this.defaults,opts);
73
+ // check for empty string in single property
74
+ if ( !settings.single.length ) settings.single = 'metadata';
75
+
76
+ var data = $.data(elem, settings.single);
77
+ // returned cached data if it already exists
78
+ if ( data ) return data;
79
+
80
+ data = "{}";
81
+
82
+ if ( settings.type == "class" ) {
83
+ var m = settings.cre.exec( elem.className );
84
+ if ( m )
85
+ data = m[1];
86
+ } else if ( settings.type == "elem" ) {
87
+ if( !elem.getElementsByTagName ) return;
88
+ var e = elem.getElementsByTagName(settings.name);
89
+ if ( e.length )
90
+ data = $.trim(e[0].innerHTML);
91
+ } else if ( elem.getAttribute != undefined ) {
92
+ var attr = elem.getAttribute( settings.name );
93
+ if ( attr )
94
+ data = attr;
95
+ }
96
+
97
+ if ( data.indexOf( '{' ) <0 )
98
+ data = "{" + data + "}";
99
+
100
+ data = eval("(" + data + ")");
101
+
102
+ $.data( elem, settings.single, data );
103
+ return data;
104
+ }
105
+ }
106
+ });
107
+
108
+ /**
109
+ * Returns the metadata object for the first member of the jQuery object.
110
+ *
111
+ * @name metadata
112
+ * @descr Returns element's metadata object
113
+ * @param Object opts An object contianing settings to override the defaults
114
+ * @type jQuery
115
+ * @cat Plugins/Metadata
116
+ */
117
+ $.fn.metadata = function( opts ){
118
+ return $.metadata.get( this[0], opts );
119
+ };
120
+
121
+ })(jQuery);
@@ -0,0 +1,273 @@
1
+ /*
2
+ * jQuery UI 1.6rc6
3
+ *
4
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
5
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
6
+ * and GPL (GPL-LICENSE.txt) licenses.
7
+ *
8
+ * http://docs.jquery.com/UI
9
+ */
10
+ * jQuery UI Draggable 1.6rc6
11
+ *
12
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
13
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
14
+ * and GPL (GPL-LICENSE.txt) licenses.
15
+ *
16
+ * http://docs.jquery.com/UI/Draggables
17
+ *
18
+ * Depends:
19
+ * ui.core.js
20
+ */
21
+ * jQuery UI Droppable 1.6rc6
22
+ *
23
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
24
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
25
+ * and GPL (GPL-LICENSE.txt) licenses.
26
+ *
27
+ * http://docs.jquery.com/UI/Droppables
28
+ *
29
+ * Depends:
30
+ * ui.core.js
31
+ * ui.draggable.js
32
+ */
33
+ * jQuery UI Resizable 1.6rc6
34
+ *
35
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
36
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
37
+ * and GPL (GPL-LICENSE.txt) licenses.
38
+ *
39
+ * http://docs.jquery.com/UI/Resizables
40
+ *
41
+ * Depends:
42
+ * ui.core.js
43
+ */
44
+ * jQuery UI Selectable 1.6rc6
45
+ *
46
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
47
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
48
+ * and GPL (GPL-LICENSE.txt) licenses.
49
+ *
50
+ * http://docs.jquery.com/UI/Selectables
51
+ *
52
+ * Depends:
53
+ * ui.core.js
54
+ */
55
+ * jQuery UI Sortable 1.6rc6
56
+ *
57
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
58
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
59
+ * and GPL (GPL-LICENSE.txt) licenses.
60
+ *
61
+ * http://docs.jquery.com/UI/Sortables
62
+ *
63
+ * Depends:
64
+ * ui.core.js
65
+ */
66
+ * jQuery UI Accordion 1.6rc6
67
+ *
68
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
69
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
70
+ * and GPL (GPL-LICENSE.txt) licenses.
71
+ *
72
+ * http://docs.jquery.com/UI/Accordion
73
+ *
74
+ * Depends:
75
+ * ui.core.js
76
+ */
77
+ * jQuery UI Dialog 1.6rc6
78
+ *
79
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
80
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
81
+ * and GPL (GPL-LICENSE.txt) licenses.
82
+ *
83
+ * http://docs.jquery.com/UI/Dialog
84
+ *
85
+ * Depends:
86
+ * ui.core.js
87
+ * ui.draggable.js
88
+ * ui.resizable.js
89
+ */
90
+ * jQuery UI Slider 1.6rc6
91
+ *
92
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
93
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
94
+ * and GPL (GPL-LICENSE.txt) licenses.
95
+ *
96
+ * http://docs.jquery.com/UI/Slider
97
+ *
98
+ * Depends:
99
+ * ui.core.js
100
+ */
101
+ * jQuery UI Tabs 1.6rc6
102
+ *
103
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
104
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
105
+ * and GPL (GPL-LICENSE.txt) licenses.
106
+ *
107
+ * http://docs.jquery.com/UI/Tabs
108
+ *
109
+ * Depends:
110
+ * ui.core.js
111
+ */
112
+ * jQuery UI Datepicker 1.6rc6
113
+ *
114
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
115
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
116
+ * and GPL (GPL-LICENSE.txt) licenses.
117
+ *
118
+ * http://docs.jquery.com/UI/Datepicker
119
+ *
120
+ * Depends:
121
+ * ui.core.js
122
+ */
123
+ * jQuery UI Progressbar 1.6rc6
124
+ *
125
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
126
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
127
+ * and GPL (GPL-LICENSE.txt) licenses.
128
+ *
129
+ * http://docs.jquery.com/UI/Progressbar
130
+ *
131
+ * Depends:
132
+ * ui.core.js
133
+ */
134
+ * jQuery UI Effects 1.6rc6
135
+ *
136
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
137
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
138
+ * and GPL (GPL-LICENSE.txt) licenses.
139
+ *
140
+ * http://docs.jquery.com/UI/Effects/
141
+ */
142
+ * jQuery UI Effects Blind 1.6rc6
143
+ *
144
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
145
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
146
+ * and GPL (GPL-LICENSE.txt) licenses.
147
+ *
148
+ * http://docs.jquery.com/UI/Effects/Blind
149
+ *
150
+ * Depends:
151
+ * effects.core.js
152
+ */
153
+ * jQuery UI Effects Bounce 1.6rc6
154
+ *
155
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
156
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
157
+ * and GPL (GPL-LICENSE.txt) licenses.
158
+ *
159
+ * http://docs.jquery.com/UI/Effects/Bounce
160
+ *
161
+ * Depends:
162
+ * effects.core.js
163
+ */
164
+ * jQuery UI Effects Clip 1.6rc6
165
+ *
166
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
167
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
168
+ * and GPL (GPL-LICENSE.txt) licenses.
169
+ *
170
+ * http://docs.jquery.com/UI/Effects/Clip
171
+ *
172
+ * Depends:
173
+ * effects.core.js
174
+ */
175
+ * jQuery UI Effects Drop 1.6rc6
176
+ *
177
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
178
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
179
+ * and GPL (GPL-LICENSE.txt) licenses.
180
+ *
181
+ * http://docs.jquery.com/UI/Effects/Drop
182
+ *
183
+ * Depends:
184
+ * effects.core.js
185
+ */
186
+ * jQuery UI Effects Explode 1.6rc6
187
+ *
188
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
189
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
190
+ * and GPL (GPL-LICENSE.txt) licenses.
191
+ *
192
+ * http://docs.jquery.com/UI/Effects/Explode
193
+ *
194
+ * Depends:
195
+ * effects.core.js
196
+ */
197
+ * jQuery UI Effects Fold 1.6rc6
198
+ *
199
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
200
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
201
+ * and GPL (GPL-LICENSE.txt) licenses.
202
+ *
203
+ * http://docs.jquery.com/UI/Effects/Fold
204
+ *
205
+ * Depends:
206
+ * effects.core.js
207
+ */
208
+ * jQuery UI Effects Highlight 1.6rc6
209
+ *
210
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
211
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
212
+ * and GPL (GPL-LICENSE.txt) licenses.
213
+ *
214
+ * http://docs.jquery.com/UI/Effects/Highlight
215
+ *
216
+ * Depends:
217
+ * effects.core.js
218
+ */
219
+ * jQuery UI Effects Pulsate 1.6rc6
220
+ *
221
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
222
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
223
+ * and GPL (GPL-LICENSE.txt) licenses.
224
+ *
225
+ * http://docs.jquery.com/UI/Effects/Pulsate
226
+ *
227
+ * Depends:
228
+ * effects.core.js
229
+ */
230
+ * jQuery UI Effects Scale 1.6rc6
231
+ *
232
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
233
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
234
+ * and GPL (GPL-LICENSE.txt) licenses.
235
+ *
236
+ * http://docs.jquery.com/UI/Effects/Scale
237
+ *
238
+ * Depends:
239
+ * effects.core.js
240
+ */
241
+ * jQuery UI Effects Shake 1.6rc6
242
+ *
243
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
244
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
245
+ * and GPL (GPL-LICENSE.txt) licenses.
246
+ *
247
+ * http://docs.jquery.com/UI/Effects/Shake
248
+ *
249
+ * Depends:
250
+ * effects.core.js
251
+ */
252
+ * jQuery UI Effects Slide 1.6rc6
253
+ *
254
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
255
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
256
+ * and GPL (GPL-LICENSE.txt) licenses.
257
+ *
258
+ * http://docs.jquery.com/UI/Effects/Slide
259
+ *
260
+ * Depends:
261
+ * effects.core.js
262
+ */
263
+ * jQuery UI Effects Transfer 1.6rc6
264
+ *
265
+ * Copyright (c) 2009 AUTHORS.txt (http://ui.jquery.com/about)
266
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
267
+ * and GPL (GPL-LICENSE.txt) licenses.
268
+ *
269
+ * http://docs.jquery.com/UI/Effects/Transfer
270
+ *
271
+ * Depends:
272
+ * effects.core.js
273
+ */
Binary file
File without changes
@@ -0,0 +1,133 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ describe "Gembox App" do
4
+
5
+ describe 'getting index' do
6
+ before do
7
+ get '/'
8
+ end
9
+
10
+ should "redirect to /gems" do
11
+ should.be.redirect
12
+ end
13
+
14
+ end
15
+
16
+ describe 'getting gems' do
17
+ before do
18
+ get '/gems'
19
+ end
20
+
21
+ should 'load the index' do
22
+ should.be.ok
23
+ end
24
+
25
+ should "display gem list" do
26
+ body.should have_element('div#gems')
27
+ end
28
+
29
+ should "display list of installed gems" do
30
+ body.should have_element('.gem')
31
+ end
32
+
33
+ should "display as 4 columns" do
34
+ body.should have_element('.column')
35
+ end
36
+ end
37
+
38
+ describe 'getting gems/ with layout = false' do
39
+ before do
40
+ get '/gems/?layout=false'
41
+ end
42
+
43
+ should "load" do
44
+ should.be.ok
45
+ end
46
+
47
+ should "not display layout" do
48
+ body.should.not have_element('html')
49
+ end
50
+
51
+ should "display gem list" do
52
+ html_body.should have_element('#gems')
53
+ end
54
+
55
+ should "display as 4 columns" do
56
+ html_body.should have_element('.column')
57
+ end
58
+ end
59
+
60
+ describe 'getting gems/ with a simple search' do
61
+ before do
62
+ get '/gems/?search=sin'
63
+ end
64
+
65
+ should "load" do
66
+ should.be.ok
67
+ end
68
+
69
+ should "display gem list" do
70
+ body.should have_element('#gems')
71
+ end
72
+
73
+ should "display gems that match the search" do
74
+ body.should have_element('.gem', /sinatra/)
75
+ end
76
+
77
+ should "not display gems that do not match the search" do
78
+ body.should.not have_element('.gem', /rack/)
79
+ end
80
+ end
81
+
82
+ describe 'getting gems/ with as = table' do
83
+ before do
84
+ get '/gems/?layout=false&as=table'
85
+ end
86
+
87
+ should "load" do
88
+ should.be.ok
89
+ end
90
+
91
+ should "not display layout" do
92
+ body.should.not have_element('html')
93
+ end
94
+
95
+ should "display as table" do
96
+ html_body.should have_element('table#gems')
97
+ html_body.should have_element('table#gems tr.gem')
98
+ end
99
+ end
100
+
101
+ describe 'getting gems/:name' do
102
+ before do
103
+ get '/gems/sinatra'
104
+ end
105
+
106
+ should "redirect to most recent version" do
107
+ should.be.redirect
108
+ end
109
+ end
110
+
111
+ describe 'getting gems/name/version' do
112
+ before do
113
+ get '/gems/sinatra/0.9.0.4'
114
+ end
115
+
116
+ should "display dependencies" do
117
+ body.should have_element('#dependencies .gem', /rack/)
118
+ end
119
+
120
+ should "display link to gems website" do
121
+ body.should have_element('a', 'http://sinatra.rubyforge.org')
122
+ end
123
+
124
+ should "load gem spec specified version" do
125
+ body.should have_element('.version', '0.9.0.4')
126
+ end
127
+
128
+ should "display links to all versions" do
129
+ body.should have_element('#versions a')
130
+ end
131
+ end
132
+
133
+ end