wd_sinatra 1.0.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +1 -4
  3. data/CHANGELOG.md +20 -0
  4. data/Gemfile +0 -2
  5. data/LICENSE +4 -2
  6. data/README.md +28 -19
  7. data/bin/wd_sinatra +7 -25
  8. data/lib/wd_sinatra/app_loader.rb +12 -20
  9. data/lib/wd_sinatra/sinatra_ext.rb +8 -7
  10. data/lib/wd_sinatra/test_helpers.rb +1 -1
  11. data/lib/wd_sinatra/version.rb +2 -4
  12. data/templates/Gemfile +16 -11
  13. data/templates/{Rakefile → Rakefile.tt} +4 -4
  14. data/templates/Thorfile +14 -8
  15. data/templates/api/hello_world.rb +17 -10
  16. data/templates/bin/console +1 -1
  17. data/templates/config.ru.tt +6 -0
  18. data/templates/config/sinatra_config.rb.tt +50 -0
  19. data/templates/lib/{app.rb → app.rb.tt} +4 -1
  20. data/templates/lib/hooks.rb +25 -15
  21. data/templates/test/{test_helpers.rb → test_helpers.rb.tt} +8 -6
  22. data/test/test_helper.rb +0 -4
  23. data/test/ws_list_ext_test.rb +6 -6
  24. data/wd-sinatra.gemspec +11 -7
  25. metadata +72 -104
  26. data/templates/config.ru +0 -5
  27. data/templates/config/middleware.rb +0 -16
  28. data/templates/config/sinatra_config.rb +0 -18
  29. data/templates/lib/body_parser.rb +0 -24
  30. data/templates/lib/tasks/doc.rake +0 -39
  31. data/templates/lib/tasks/doc_generator/bootstrap/.gitignore +0 -4
  32. data/templates/lib/tasks/doc_generator/bootstrap/LICENSE +0 -176
  33. data/templates/lib/tasks/doc_generator/bootstrap/Makefile +0 -47
  34. data/templates/lib/tasks/doc_generator/bootstrap/README.md +0 -105
  35. data/templates/lib/tasks/doc_generator/bootstrap/bootstrap.css +0 -2467
  36. data/templates/lib/tasks/doc_generator/bootstrap/bootstrap.min.css +0 -356
  37. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/css/docs.css +0 -317
  38. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-114x114.png +0 -0
  39. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-57x57.png +0 -0
  40. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/bootstrap-apple-72x72.png +0 -0
  41. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/ico/favicon.ico +0 -0
  42. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/bird.png +0 -0
  43. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/browsers.png +0 -0
  44. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-01.png +0 -0
  45. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-02.png +0 -0
  46. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/example-diagram-03.png +0 -0
  47. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/grid-18px.png +0 -0
  48. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/img/twitter-logo-no-bird.png +0 -0
  49. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/application.js +0 -52
  50. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/google-code-prettify/prettify.css +0 -94
  51. data/templates/lib/tasks/doc_generator/bootstrap/docs/assets/js/google-code-prettify/prettify.js +0 -28
  52. data/templates/lib/tasks/doc_generator/bootstrap/docs/index.html +0 -2037
  53. data/templates/lib/tasks/doc_generator/bootstrap/docs/javascript.html +0 -798
  54. data/templates/lib/tasks/doc_generator/bootstrap/examples/container-app.html +0 -119
  55. data/templates/lib/tasks/doc_generator/bootstrap/examples/fluid.html +0 -122
  56. data/templates/lib/tasks/doc_generator/bootstrap/examples/hero.html +0 -79
  57. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-alerts.js +0 -124
  58. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-buttons.js +0 -64
  59. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-dropdown.js +0 -55
  60. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-modal.js +0 -260
  61. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-popover.js +0 -90
  62. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-scrollspy.js +0 -107
  63. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-tabs.js +0 -80
  64. data/templates/lib/tasks/doc_generator/bootstrap/js/bootstrap-twipsy.js +0 -321
  65. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/index.html +0 -40
  66. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-alerts.js +0 -41
  67. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-buttons.js +0 -42
  68. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-dropdown.js +0 -52
  69. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-modal.js +0 -151
  70. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-popover.js +0 -76
  71. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-scrollspy.js +0 -31
  72. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-tabs.js +0 -77
  73. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/unit/bootstrap-twipsy.js +0 -81
  74. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/vendor/qunit.css +0 -232
  75. data/templates/lib/tasks/doc_generator/bootstrap/js/tests/vendor/qunit.js +0 -1510
  76. data/templates/lib/tasks/doc_generator/bootstrap/lib/bootstrap.less +0 -26
  77. data/templates/lib/tasks/doc_generator/bootstrap/lib/forms.less +0 -479
  78. data/templates/lib/tasks/doc_generator/bootstrap/lib/mixins.less +0 -222
  79. data/templates/lib/tasks/doc_generator/bootstrap/lib/patterns.less +0 -1060
  80. data/templates/lib/tasks/doc_generator/bootstrap/lib/reset.less +0 -141
  81. data/templates/lib/tasks/doc_generator/bootstrap/lib/scaffolding.less +0 -139
  82. data/templates/lib/tasks/doc_generator/bootstrap/lib/tables.less +0 -224
  83. data/templates/lib/tasks/doc_generator/bootstrap/lib/type.less +0 -187
  84. data/templates/lib/tasks/doc_generator/bootstrap/lib/variables.less +0 -60
  85. data/templates/lib/tasks/doc_generator/template.erb +0 -156
@@ -1,187 +0,0 @@
1
- /* Typography.less
2
- * Headings, body text, lists, code, and more for a versatile and durable typography system
3
- * ---------------------------------------------------------------------------------------- */
4
-
5
-
6
- // BODY TEXT
7
- // ---------
8
-
9
- p {
10
- #font > .shorthand(normal,@basefont,@baseline);
11
- margin-bottom: @baseline / 2;
12
- small {
13
- font-size: @basefont - 2;
14
- color: @grayLight;
15
- }
16
- }
17
-
18
-
19
- // HEADINGS
20
- // --------
21
-
22
- h1, h2, h3, h4, h5, h6 {
23
- font-weight: bold;
24
- color: @grayDark;
25
- small {
26
- color: @grayLight;
27
- }
28
- }
29
- h1 {
30
- margin-bottom: @baseline;
31
- font-size: 30px;
32
- line-height: @baseline * 2;
33
- small {
34
- font-size: 18px;
35
- }
36
- }
37
- h2 {
38
- font-size: 24px;
39
- line-height: @baseline * 2;
40
- small {
41
- font-size: 14px;
42
- }
43
- }
44
- h3, h4, h5, h6 {
45
- line-height: @baseline * 2;
46
- }
47
- h3 {
48
- font-size: 18px;
49
- small {
50
- font-size: 14px;
51
- }
52
- }
53
- h4 {
54
- font-size: 16px;
55
- small {
56
- font-size: 12px;
57
- }
58
- }
59
- h5 {
60
- font-size: 14px;
61
- }
62
- h6 {
63
- font-size: 13px;
64
- color: @grayLight;
65
- text-transform: uppercase;
66
- }
67
-
68
-
69
- // COLORS
70
- // ------
71
-
72
- // Unordered and Ordered lists
73
- ul, ol {
74
- margin: 0 0 @baseline 25px;
75
- }
76
- ul ul,
77
- ul ol,
78
- ol ol,
79
- ol ul {
80
- margin-bottom: 0;
81
- }
82
- ul {
83
- list-style: disc;
84
- }
85
- ol {
86
- list-style: decimal;
87
- }
88
- li {
89
- line-height: @baseline;
90
- color: @gray;
91
- }
92
- ul.unstyled {
93
- list-style: none;
94
- margin-left: 0;
95
- }
96
-
97
- // Description Lists
98
- dl {
99
- margin-bottom: @baseline;
100
- dt, dd {
101
- line-height: @baseline;
102
- }
103
- dt {
104
- font-weight: bold;
105
- }
106
- dd {
107
- margin-left: @baseline / 2;
108
- }
109
- }
110
-
111
- // MISC
112
- // ----
113
-
114
- // Horizontal rules
115
- hr {
116
- margin: 20px 0 19px;
117
- border: 0;
118
- border-bottom: 1px solid #eee;
119
- }
120
-
121
- // Emphasis
122
- strong {
123
- font-style: inherit;
124
- font-weight: bold;
125
- }
126
- em {
127
- font-style: italic;
128
- font-weight: inherit;
129
- line-height: inherit;
130
- }
131
- .muted {
132
- color: @grayLight;
133
- }
134
-
135
- // Blockquotes
136
- blockquote {
137
- margin-bottom: @baseline;
138
- border-left: 5px solid #eee;
139
- padding-left: 15px;
140
- p {
141
- #font > .shorthand(300,14px,@baseline);
142
- margin-bottom: 0;
143
- }
144
- small {
145
- display: block;
146
- #font > .shorthand(300,12px,@baseline);
147
- color: @grayLight;
148
- &:before {
149
- content: '\2014 \00A0';
150
- }
151
- }
152
- }
153
-
154
- // Addresses
155
- address {
156
- display: block;
157
- line-height: @baseline;
158
- margin-bottom: @baseline;
159
- }
160
-
161
- // Inline and block code styles
162
- code, pre {
163
- padding: 0 3px 2px;
164
- font-family: Monaco, Andale Mono, Courier New, monospace;
165
- font-size: 12px;
166
- .border-radius(3px);
167
- }
168
- code {
169
- background-color: lighten(@orange, 40%);
170
- color: rgba(0,0,0,.75);
171
- padding: 1px 3px;
172
- }
173
- pre {
174
- background-color: #f5f5f5;
175
- display: block;
176
- padding: (@baseline - 1) / 2;
177
- margin: 0 0 @baseline;
178
- line-height: @baseline;
179
- font-size: 12px;
180
- border: 1px solid #ccc;
181
- border: 1px solid rgba(0,0,0,.15);
182
- .border-radius(3px);
183
- white-space: pre;
184
- white-space: pre-wrap;
185
- word-wrap: break-word;
186
-
187
- }
@@ -1,60 +0,0 @@
1
- /* Variables.less
2
- * Variables to customize the look and feel of Bootstrap
3
- * ----------------------------------------------------- */
4
-
5
-
6
- // Links
7
- @linkColor: #0069d6;
8
- @linkColorHover: darken(@linkColor, 15);
9
-
10
- // Grays
11
- @black: #000;
12
- @grayDark: lighten(@black, 25%);
13
- @gray: lighten(@black, 50%);
14
- @grayLight: lighten(@black, 75%);
15
- @grayLighter: lighten(@black, 90%);
16
- @white: #fff;
17
-
18
- // Accent Colors
19
- @blue: #049CDB;
20
- @blueDark: #0064CD;
21
- @green: #46a546;
22
- @red: #9d261d;
23
- @yellow: #ffc40d;
24
- @orange: #f89406;
25
- @pink: #c3325f;
26
- @purple: #7a43b6;
27
-
28
- // Baseline grid
29
- @basefont: 13px;
30
- @baseline: 18px;
31
-
32
- // Griditude
33
- // Modify the grid styles in mixins.less
34
- @gridColumns: 16;
35
- @gridColumnWidth: 40px;
36
- @gridGutterWidth: 20px;
37
- @extraSpace: (@gridGutterWidth * 2); // For our grid calculations
38
- @siteWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
39
-
40
- // Color Scheme
41
- // Use this to roll your own color schemes if you like (unused by Bootstrap by default)
42
- @baseColor: @blue; // Set a base color
43
- @complement: spin(@baseColor, 180); // Determine a complementary color
44
- @split1: spin(@baseColor, 158); // Split complements
45
- @split2: spin(@baseColor, -158);
46
- @triad1: spin(@baseColor, 135); // Triads colors
47
- @triad2: spin(@baseColor, -135);
48
- @tetra1: spin(@baseColor, 90); // Tetra colors
49
- @tetra2: spin(@baseColor, -90);
50
- @analog1: spin(@baseColor, 22); // Analogs colors
51
- @analog2: spin(@baseColor, -22);
52
-
53
-
54
-
55
- // More variables coming soon:
56
- // - @basefont to @baseFontSize
57
- // - @baseline to @baseLineHeight
58
- // - @baseFontFamily
59
- // - @primaryButtonColor
60
- // - anything else? File an issue on GitHub
@@ -1,156 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>Weasel Diesel - API documentation</title>
6
- <meta name="description" content="">
7
- <meta name="author" content="">
8
-
9
- <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
10
- <!--[if lt IE 9]>
11
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
12
- <![endif]-->
13
-
14
- <!-- Le styles -->
15
- <link href="css/bootstrap.css" rel="stylesheet">
16
- <style type="text/css">
17
- body {
18
- padding-top: 60px;
19
- }
20
- div.api {
21
- padding-top: 60px;
22
- margin-top: -60px;
23
- }
24
- </style>
25
-
26
- <!-- Le fav and touch icons -->
27
- <link rel="shortcut icon" href="images/favicon.ico">
28
- <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
29
- <link rel="apple-touch-icon" sizes="72x72" href=images/apple-touch-icon-72x72.png">
30
- <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
31
- </head>
32
-
33
- <body>
34
-
35
- <div class="topbar">
36
- <div class="topbar-inner">
37
- <div class="container-fluid">
38
- <a class="brand" href="#">Web APIs Documentation</a>
39
- <ul class="nav">
40
- <li class="active"><a href="index.html">Home</a></li>
41
- </ul>
42
- </div>
43
- </div>
44
- </div>
45
-
46
- <div class="container-fluid">
47
- <div class="sidebar">
48
- <div class="well">
49
- <h5>Available APIs</h5>
50
- <ul>
51
- <% WSList.all.sort{|a,b| a.url <=> b.url}.each do |api| %>
52
- <li><a href="#<%= "raw-#{api.verb}-#{api.url}" %>"><%= api.url %> [<%= api.verb.upcase %>]</a></li>
53
- <% end %>
54
- </ul>
55
- </div>
56
- </div>
57
- <div class="content">
58
- <div class="hero-unit">
59
- <h1>Web APIs</h1>
60
- <p>You will find on left, the list of all the web APIs offered by this app.</p>
61
- </div>
62
-
63
- <% WSList.all.each do |api| %>
64
- <div class="api" id="<%= "raw-#{api.verb}-#{api.url}" %>">
65
- <div>
66
- <h2><%= api.verb.upcase %> <%= '[SSL]' if api.ssl %> <%= api.url %></h2>
67
- <% if api.auth_required %>
68
- <span class='label important'>Authentication required</span>
69
- <% end %>
70
- <%= "<p>#{api.doc.desc}</p>" if api.doc.desc %>
71
- <% unless api.doc.examples.empty? %>
72
- <ul>
73
- <% api.doc.examples.each do |example| %>
74
- <li><code><%= example %></code></li>
75
- <% end %>
76
- </ul>
77
- <% end %>
78
-
79
- <h3>Input parameters description</h3>
80
- <%# TODO support for nested namespaced params %>
81
- <% api.params.namespaced_params.each do |params| %>
82
- <div class='well'>
83
- <h4>Namespace: <span style='font-style: italic'><%= params.space_name %></span></h4>
84
- <div style='padding-left: 40px'>
85
- <% [["Required", :list_required], ["Optional", :list_optional]].each do |label,rule_meth| %>
86
- <% unless params.send(rule_meth).empty? %>
87
- <h4><%= label %> Params</h4>
88
- <ul>
89
- <% params.send(rule_meth).each do |rule| %>
90
- <li>
91
- <span class='label notice'><%= rule.name %></span> of type <span class='label success'><%= rule.options[:type] || 'String' %></span>
92
- <% if desc = (api.doc.params_doc[rule.name.to_sym] || rule.options[:doc]) %>
93
- <%= desc %>&nbsp;
94
- <% end %>
95
- </li>
96
- <% end %>
97
- </ul>
98
- <% end %>
99
- <% end %>
100
- </div>
101
- </div>
102
- <% end %>
103
-
104
- <% [["Required", :required_rules], ["Optional", :optional_rules]].each do |label,rule_meth| %>
105
- <% unless api.send(rule_meth).empty? %>
106
- <h3><%= label %> Params</h3>
107
- <ul>
108
- <% api.send(rule_meth).each do |rule| %>
109
- <li>
110
- <span class='label notice'><%= rule.name %></span> of type <span class='label success'><%= rule.options[:type] || 'String' %></span>
111
- <% if desc = (api.doc.params_doc[rule.name.to_sym] || rule.options[:doc]) %>
112
- <%= desc %>&nbsp;
113
- <% end %>
114
- <% if options = rule.options[:options] %>
115
- Value Options: <span class='label'><%= options.join(', ') %></span>&nbsp;
116
- <% end %>
117
- <% if default = rule.options[:default] %>
118
- Default Value: <span class='label'><%= default %></span>&nbsp;
119
- <% end %>
120
- </li>
121
- <% end %>
122
- </ul>
123
- <% end %>
124
- <% end %>
125
-
126
- </div>
127
-
128
- <div>
129
- <% if api.response.nodes.any? %>
130
- <h3>Response description</h3>
131
- <div class='well'>
132
- <% api.response.elements.each do |el| %>
133
- <%= el.to_html %>
134
- <% end %>
135
- <% api.response.arrays.each do |arr| %>
136
- <%= arr.to_html %>
137
- <% end %>
138
- </div>
139
- </ul>
140
- <h4>Response example</h4>
141
- <div class='well'><code><%= api.response.to_json %></code></div>
142
- <% end %>
143
- </div>
144
-
145
- </div>
146
- <hr>
147
- <% end %>
148
-
149
- <footer>
150
- <p>&copy; You <%= Time.now.year %></p>
151
- </footer>
152
- </div>
153
- </div>
154
-
155
- </body>
156
- </html>