wd_sinatra 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +148 -0
  5. data/Rakefile +2 -0
  6. data/bin/wd_sinatra +47 -0
  7. data/lib/wd_sinatra.rb +7 -0
  8. data/lib/wd_sinatra/app_loader.rb +120 -0
  9. data/lib/wd_sinatra/sinatra_ext.rb +117 -0
  10. data/lib/wd_sinatra/test_helpers.rb +204 -0
  11. data/lib/wd_sinatra/version.rb +5 -0
  12. data/templates/Gemfile +23 -0
  13. data/templates/Guardfile +13 -0
  14. data/templates/Rakefile +32 -0
  15. data/templates/api/hello_world.rb +29 -0
  16. data/templates/bin/console +7 -0
  17. data/templates/config.ru +5 -0
  18. data/templates/config/app.rb +5 -0
  19. data/templates/config/environments/default.rb +3 -0
  20. data/templates/config/environments/production.rb +2 -0
  21. data/templates/config/environments/test.rb +3 -0
  22. data/templates/config/hooks.rb +74 -0
  23. data/templates/config/middleware.rb +0 -0
  24. data/templates/config/sinatra_config.rb +12 -0
  25. data/templates/lib/body_parser.rb +24 -0
  26. data/templates/lib/tasks/doc.rake +39 -0
  27. data/templates/lib/tasks/doc_generator/bootstrap/.gitignore +4 -0
  28. data/templates/lib/tasks/doc_generator/bootstrap/LICENSE +176 -0
  29. data/templates/lib/tasks/doc_generator/bootstrap/Makefile +47 -0
  30. data/templates/lib/tasks/doc_generator/bootstrap/README.md +105 -0
  31. data/templates/lib/tasks/doc_generator/bootstrap/bootstrap.css +2467 -0
  32. data/templates/lib/tasks/doc_generator/bootstrap/bootstrap.min.css +356 -0
  33. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/css/docs.css +317 -0
  34. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-114x114.png +0 -0
  35. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-57x57.png +0 -0
  36. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-72x72.png +0 -0
  37. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/favicon.ico +0 -0
  38. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/bird.png +0 -0
  39. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/browsers.png +0 -0
  40. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-01.png +0 -0
  41. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-02.png +0 -0
  42. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-03.png +0 -0
  43. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/grid-18px.png +0 -0
  44. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/twitter-logo-no-bird.png +0 -0
  45. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/application.js +52 -0
  46. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/google-code-prettify/prettify.css +94 -0
  47. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/google-code-prettify/prettify.js +28 -0
  48. data/templates/lib/tasks/doc_generator/bootstrap/docs/index.html +2037 -0
  49. data/templates/lib/tasks/doc_generator/bootstrap/docs/javascript.html +798 -0
  50. data/templates/lib/tasks/doc_generator/bootstrap/examples/container-app.html +119 -0
  51. data/templates/lib/tasks/doc_generator/bootstrap/examples/fluid.html +122 -0
  52. data/templates/lib/tasks/doc_generator/bootstrap/examples/hero.html +79 -0
  53. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-alerts.js +124 -0
  54. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-buttons.js +64 -0
  55. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-dropdown.js +55 -0
  56. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-modal.js +260 -0
  57. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-popover.js +90 -0
  58. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-scrollspy.js +107 -0
  59. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-tabs.js +80 -0
  60. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-twipsy.js +321 -0
  61. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/index.html +40 -0
  62. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-alerts.js +41 -0
  63. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-buttons.js +42 -0
  64. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-dropdown.js +52 -0
  65. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-modal.js +151 -0
  66. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-popover.js +76 -0
  67. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-scrollspy.js +31 -0
  68. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-tabs.js +77 -0
  69. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-twipsy.js +81 -0
  70. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/vendor/qunit.css +232 -0
  71. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/vendor/qunit.js +1510 -0
  72. data/templates/lib/tasks/doc_generator/bootstrap/lib/bootstrap.less +26 -0
  73. data/templates/lib/tasks/doc_generator/bootstrap/lib/forms.less +479 -0
  74. data/templates/lib/tasks/doc_generator/bootstrap/lib/mixins.less +222 -0
  75. data/templates/lib/tasks/doc_generator/bootstrap/lib/patterns.less +1060 -0
  76. data/templates/lib/tasks/doc_generator/bootstrap/lib/reset.less +141 -0
  77. data/templates/lib/tasks/doc_generator/bootstrap/lib/scaffolding.less +139 -0
  78. data/templates/lib/tasks/doc_generator/bootstrap/lib/tables.less +224 -0
  79. data/templates/lib/tasks/doc_generator/bootstrap/lib/type.less +187 -0
  80. data/templates/lib/tasks/doc_generator/bootstrap/lib/variables.less +60 -0
  81. data/templates/lib/tasks/doc_generator/template.erb +117 -0
  82. data/templates/public/favicon.ico +0 -0
  83. data/wd-sinatra.gemspec +22 -0
  84. metadata +154 -0
@@ -0,0 +1,80 @@
1
+ /* ========================================================
2
+ * bootstrap-tabs.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#tabs
4
+ * ========================================================
5
+ * Copyright 2011 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ======================================================== */
19
+
20
+
21
+ !function( $ ){
22
+
23
+ "use strict"
24
+
25
+ function activate ( element, container ) {
26
+ container
27
+ .find('> .active')
28
+ .removeClass('active')
29
+ .find('> .dropdown-menu > .active')
30
+ .removeClass('active')
31
+
32
+ element.addClass('active')
33
+
34
+ if ( element.parent('.dropdown-menu') ) {
35
+ element.closest('li.dropdown').addClass('active')
36
+ }
37
+ }
38
+
39
+ function tab( e ) {
40
+ var $this = $(this)
41
+ , $ul = $this.closest('ul:not(.dropdown-menu)')
42
+ , href = $this.attr('href')
43
+ , previous
44
+ , $href
45
+
46
+ if ( /^#\w+/.test(href) ) {
47
+ e.preventDefault()
48
+
49
+ if ( $this.parent('li').hasClass('active') ) {
50
+ return
51
+ }
52
+
53
+ previous = $ul.find('.active a').last()[0]
54
+ $href = $(href)
55
+
56
+ activate($this.parent('li'), $ul)
57
+ activate($href, $href.parent())
58
+
59
+ $this.trigger({
60
+ type: 'change'
61
+ , relatedTarget: previous
62
+ })
63
+ }
64
+ }
65
+
66
+
67
+ /* TABS/PILLS PLUGIN DEFINITION
68
+ * ============================ */
69
+
70
+ $.fn.tabs = $.fn.pills = function ( selector ) {
71
+ return this.each(function () {
72
+ $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
73
+ })
74
+ }
75
+
76
+ $(document).ready(function () {
77
+ $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
78
+ })
79
+
80
+ }( window.jQuery || window.ender );
@@ -0,0 +1,321 @@
1
+ /* ==========================================================
2
+ * bootstrap-twipsy.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#twipsy
4
+ * Adapted from the original jQuery.tipsy by Jason Frame
5
+ * ==========================================================
6
+ * Copyright 2011 Twitter, Inc.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ * ========================================================== */
20
+
21
+
22
+ !function( $ ) {
23
+
24
+ "use strict"
25
+
26
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
27
+ * ======================================================= */
28
+
29
+ var transitionEnd
30
+
31
+ $(document).ready(function () {
32
+
33
+ $.support.transition = (function () {
34
+ var thisBody = document.body || document.documentElement
35
+ , thisStyle = thisBody.style
36
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
37
+ return support
38
+ })()
39
+
40
+ // set CSS transition event type
41
+ if ( $.support.transition ) {
42
+ transitionEnd = "TransitionEnd"
43
+ if ( $.browser.webkit ) {
44
+ transitionEnd = "webkitTransitionEnd"
45
+ } else if ( $.browser.mozilla ) {
46
+ transitionEnd = "transitionend"
47
+ } else if ( $.browser.opera ) {
48
+ transitionEnd = "oTransitionEnd"
49
+ }
50
+ }
51
+
52
+ })
53
+
54
+
55
+ /* TWIPSY PUBLIC CLASS DEFINITION
56
+ * ============================== */
57
+
58
+ var Twipsy = function ( element, options ) {
59
+ this.$element = $(element)
60
+ this.options = options
61
+ this.enabled = true
62
+ this.fixTitle()
63
+ }
64
+
65
+ Twipsy.prototype = {
66
+
67
+ show: function() {
68
+ var pos
69
+ , actualWidth
70
+ , actualHeight
71
+ , placement
72
+ , $tip
73
+ , tp
74
+
75
+ if (this.hasContent() && this.enabled) {
76
+ $tip = this.tip()
77
+ this.setContent()
78
+
79
+ if (this.options.animate) {
80
+ $tip.addClass('fade')
81
+ }
82
+
83
+ $tip
84
+ .remove()
85
+ .css({ top: 0, left: 0, display: 'block' })
86
+ .prependTo(document.body)
87
+
88
+ pos = $.extend({}, this.$element.offset(), {
89
+ width: this.$element[0].offsetWidth
90
+ , height: this.$element[0].offsetHeight
91
+ })
92
+
93
+ actualWidth = $tip[0].offsetWidth
94
+ actualHeight = $tip[0].offsetHeight
95
+
96
+ placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])
97
+
98
+ switch (placement) {
99
+ case 'below':
100
+ tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
101
+ break
102
+ case 'above':
103
+ tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
104
+ break
105
+ case 'left':
106
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
107
+ break
108
+ case 'right':
109
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
110
+ break
111
+ }
112
+
113
+ $tip
114
+ .css(tp)
115
+ .addClass(placement)
116
+ .addClass('in')
117
+ }
118
+ }
119
+
120
+ , setContent: function () {
121
+ var $tip = this.tip()
122
+ $tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
123
+ $tip[0].className = 'twipsy'
124
+ }
125
+
126
+ , hide: function() {
127
+ var that = this
128
+ , $tip = this.tip()
129
+
130
+ $tip.removeClass('in')
131
+
132
+ function removeElement () {
133
+ $tip.remove()
134
+ }
135
+
136
+ $.support.transition && this.$tip.hasClass('fade') ?
137
+ $tip.bind(transitionEnd, removeElement) :
138
+ removeElement()
139
+ }
140
+
141
+ , fixTitle: function() {
142
+ var $e = this.$element
143
+ if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
144
+ $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
145
+ }
146
+ }
147
+
148
+ , hasContent: function () {
149
+ return this.getTitle()
150
+ }
151
+
152
+ , getTitle: function() {
153
+ var title
154
+ , $e = this.$element
155
+ , o = this.options
156
+
157
+ this.fixTitle()
158
+
159
+ if (typeof o.title == 'string') {
160
+ title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
161
+ } else if (typeof o.title == 'function') {
162
+ title = o.title.call($e[0])
163
+ }
164
+
165
+ title = ('' + title).replace(/(^\s*|\s*$)/, "")
166
+
167
+ return title || o.fallback
168
+ }
169
+
170
+ , tip: function() {
171
+ return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
172
+ }
173
+
174
+ , validate: function() {
175
+ if (!this.$element[0].parentNode) {
176
+ this.hide()
177
+ this.$element = null
178
+ this.options = null
179
+ }
180
+ }
181
+
182
+ , enable: function() {
183
+ this.enabled = true
184
+ }
185
+
186
+ , disable: function() {
187
+ this.enabled = false
188
+ }
189
+
190
+ , toggleEnabled: function() {
191
+ this.enabled = !this.enabled
192
+ }
193
+
194
+ , toggle: function () {
195
+ this[this.tip().hasClass('in') ? 'hide' : 'show']()
196
+ }
197
+
198
+ }
199
+
200
+
201
+ /* TWIPSY PRIVATE METHODS
202
+ * ====================== */
203
+
204
+ function maybeCall ( thing, ctx, args ) {
205
+ return typeof thing == 'function' ? thing.apply(ctx, args) : thing
206
+ }
207
+
208
+ /* TWIPSY PLUGIN DEFINITION
209
+ * ======================== */
210
+
211
+ $.fn.twipsy = function (options) {
212
+ $.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
213
+ return this
214
+ }
215
+
216
+ $.fn.twipsy.initWith = function (options, Constructor, name) {
217
+ var twipsy
218
+ , binder
219
+ , eventIn
220
+ , eventOut
221
+
222
+ if (options === true) {
223
+ return this.data(name)
224
+ } else if (typeof options == 'string') {
225
+ twipsy = this.data(name)
226
+ if (twipsy) {
227
+ twipsy[options]()
228
+ }
229
+ return this
230
+ }
231
+
232
+ options = $.extend({}, $.fn[name].defaults, options)
233
+
234
+ function get(ele) {
235
+ var twipsy = $.data(ele, name)
236
+
237
+ if (!twipsy) {
238
+ twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
239
+ $.data(ele, name, twipsy)
240
+ }
241
+
242
+ return twipsy
243
+ }
244
+
245
+ function enter() {
246
+ var twipsy = get(this)
247
+ twipsy.hoverState = 'in'
248
+
249
+ if (options.delayIn == 0) {
250
+ twipsy.show()
251
+ } else {
252
+ twipsy.fixTitle()
253
+ setTimeout(function() {
254
+ if (twipsy.hoverState == 'in') {
255
+ twipsy.show()
256
+ }
257
+ }, options.delayIn)
258
+ }
259
+ }
260
+
261
+ function leave() {
262
+ var twipsy = get(this)
263
+ twipsy.hoverState = 'out'
264
+ if (options.delayOut == 0) {
265
+ twipsy.hide()
266
+ } else {
267
+ setTimeout(function() {
268
+ if (twipsy.hoverState == 'out') {
269
+ twipsy.hide()
270
+ }
271
+ }, options.delayOut)
272
+ }
273
+ }
274
+
275
+ if (!options.live) {
276
+ this.each(function() {
277
+ get(this)
278
+ })
279
+ }
280
+
281
+ if (options.trigger != 'manual') {
282
+ binder = options.live ? 'live' : 'bind'
283
+ eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
284
+ eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
285
+ this[binder](eventIn, enter)[binder](eventOut, leave)
286
+ }
287
+
288
+ return this
289
+ }
290
+
291
+ $.fn.twipsy.Twipsy = Twipsy
292
+
293
+ $.fn.twipsy.defaults = {
294
+ animate: true
295
+ , delayIn: 0
296
+ , delayOut: 0
297
+ , fallback: ''
298
+ , placement: 'above'
299
+ , html: false
300
+ , live: false
301
+ , offset: 0
302
+ , title: 'title'
303
+ , trigger: 'hover'
304
+ , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
305
+ }
306
+
307
+ $.fn.twipsy.rejectAttrOptions = [ 'title' ]
308
+
309
+ $.fn.twipsy.elementOptions = function(ele, options) {
310
+ var data = $(ele).data()
311
+ , rejects = $.fn.twipsy.rejectAttrOptions
312
+ , i = rejects.length
313
+
314
+ while (i--) {
315
+ delete data[rejects[i]]
316
+ }
317
+
318
+ return $.extend({}, options, data)
319
+ }
320
+
321
+ }( window.jQuery || window.ender );
@@ -0,0 +1,40 @@
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <title>Bootstrap Plugin Test Suite</title>
5
+
6
+ <!-- jquery -->
7
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
8
+
9
+ <!-- qunit -->
10
+ <link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
11
+ <script src="vendor/qunit.js"></script>
12
+
13
+ <!-- plugin sources -->
14
+ <script src="../../js/bootstrap-alerts.js"></script>
15
+ <script src="../../js/bootstrap-dropdown.js"></script>
16
+ <script src="../../js/bootstrap-modal.js"></script>
17
+ <script src="../../js/bootstrap-tabs.js"></script>
18
+ <script src="../../js/bootstrap-twipsy.js"></script>
19
+ <script src="../../js/bootstrap-popover.js"></script>
20
+ <script src="../../js/bootstrap-buttons.js"></script>
21
+
22
+ <!-- unit tests -->
23
+ <script src="unit/bootstrap-alerts.js"></script>
24
+ <script src="unit/bootstrap-dropdown.js"></script>
25
+ <script src="unit/bootstrap-modal.js"></script>
26
+ <script src="unit/bootstrap-popover.js"></script>
27
+ <script src="unit/bootstrap-tabs.js"></script>
28
+ <script src="unit/bootstrap-twipsy.js"></script>
29
+ <script src="unit/bootstrap-buttons.js"></script>
30
+
31
+ <body>
32
+ <div>
33
+ <h1 id="qunit-header">Bootstrap Plugin Test Suite</h1>
34
+ <h2 id="qunit-banner"></h2>
35
+ <h2 id="qunit-userAgent"></h2>
36
+ <ol id="qunit-tests"></ol>
37
+ <div id="qunit-runoff"></div>
38
+ </div>
39
+ </body>
40
+ </html>
@@ -0,0 +1,41 @@
1
+ $(function () {
2
+
3
+ module("bootstrap-alerts")
4
+
5
+ test("should be defined on jquery object", function () {
6
+ ok($(document.body).alert, 'alert method is defined')
7
+ })
8
+
9
+ test("should return element", function () {
10
+ ok($(document.body).alert()[0] == document.body, 'document.body returned')
11
+ })
12
+
13
+ test("should fade element out on clicking .close", function () {
14
+ var alertHTML = '<div class="alert-message warning fade in">'
15
+ + '<a class="close" href="#">×</a>'
16
+ + '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
17
+ + '</div>'
18
+ , alert = $(alertHTML).alert()
19
+
20
+ alert.find('.close').click()
21
+
22
+ ok(!alert.hasClass('in'), 'remove .in class on .close click')
23
+ })
24
+
25
+ test("should remove element when clicking .close", function () {
26
+ $.support.transition = false
27
+
28
+ var alertHTML = '<div class="alert-message warning fade in">'
29
+ + '<a class="close" href="#">×</a>'
30
+ + '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
31
+ + '</div>'
32
+ , alert = $(alertHTML).appendTo('#qunit-runoff').alert()
33
+
34
+ ok($('#qunit-runoff').find('.alert-message').length, 'element added to dom')
35
+
36
+ alert.find('.close').click()
37
+
38
+ ok(!$('#qunit-runoff').find('.alert-message').length, 'element removed from dom')
39
+ })
40
+
41
+ })