mconnell-generators 1.0.6

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.
Files changed (42) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG +43 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.rdoc +46 -0
  5. data/Rakefile +17 -0
  6. data/TODO +11 -0
  7. data/bin/rubaidh_rails +11 -0
  8. data/generators.gemspec +59 -0
  9. data/generators/rubaidh_controller/USAGE +31 -0
  10. data/generators/rubaidh_controller/rubaidh_controller_generator.rb +40 -0
  11. data/generators/rubaidh_controller/templates/controller.rb +17 -0
  12. data/generators/rubaidh_controller/templates/controller_spec.rb +29 -0
  13. data/generators/rubaidh_controller/templates/view.html.erb +17 -0
  14. data/generators/rubaidh_helper/USAGE +23 -0
  15. data/generators/rubaidh_helper/rubaidh_helper_generator.rb +27 -0
  16. data/generators/rubaidh_helper/templates/helper.rb +12 -0
  17. data/generators/rubaidh_helper/templates/helper_spec.rb +14 -0
  18. data/generators/rubaidh_layout/rubaidh_layout_generator.rb +27 -0
  19. data/generators/rubaidh_layout/templates/base.css +334 -0
  20. data/generators/rubaidh_layout/templates/layout.html.erb +36 -0
  21. data/generators/rubaidh_layout/templates/style.css +321 -0
  22. data/generators/rubaidh_model/USAGE +25 -0
  23. data/generators/rubaidh_model/rubaidh_model_generator.rb +29 -0
  24. data/generators/rubaidh_model/templates/migration.rb +25 -0
  25. data/generators/rubaidh_model/templates/model.rb +15 -0
  26. data/generators/rubaidh_model/templates/model_exemplar.rb +13 -0
  27. data/generators/rubaidh_model/templates/model_spec.rb +31 -0
  28. data/generators/rubaidh_named_base.rb +31 -0
  29. data/generators/rubaidh_scaffold/USAGE +29 -0
  30. data/generators/rubaidh_scaffold/rubaidh_scaffold_generator.rb +90 -0
  31. data/generators/rubaidh_scaffold/templates/controller.rb +76 -0
  32. data/generators/rubaidh_scaffold/templates/controller_spec.rb +251 -0
  33. data/generators/rubaidh_scaffold/templates/partial_form.html.erb +13 -0
  34. data/generators/rubaidh_scaffold/templates/partial_layout.html.erb +13 -0
  35. data/generators/rubaidh_scaffold/templates/partial_model.html.erb +8 -0
  36. data/generators/rubaidh_scaffold/templates/routing_spec.rb +73 -0
  37. data/generators/rubaidh_scaffold/templates/view_edit.html.erb +10 -0
  38. data/generators/rubaidh_scaffold/templates/view_index.html.erb +10 -0
  39. data/generators/rubaidh_scaffold/templates/view_new.html.erb +9 -0
  40. data/generators/rubaidh_scaffold/templates/view_show.html.erb +17 -0
  41. data/templates/rubaidh.rb +115 -0
  42. metadata +113 -0
@@ -0,0 +1,27 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'rubaidh_named_base')
2
+
3
+ class RubaidhLayoutGenerator < RubaidhNamedBase
4
+ def initialize(runtime_args, runtime_options = {})
5
+ runtime_args = ["application"] if runtime_args.blank?
6
+ super
7
+ end
8
+
9
+ def manifest
10
+ record do |m|
11
+ # Check the layout dir and stylesheets dir exist
12
+ m.directory File.join('app/views/layouts')
13
+ m.directory File.join('public/stylesheets')
14
+
15
+ # copy layout over to app
16
+ m.template 'layout.html.erb',
17
+ File.join('app/views/layouts', "#{file_name}.html.erb")
18
+
19
+ # copy CSS files
20
+ m.template 'base.css',
21
+ File.join('public/stylesheets', "base.css")
22
+ m.template 'style.css',
23
+ File.join('public/stylesheets', "style.css")
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,334 @@
1
+ * {margin:0;padding:0}
2
+ .clear { clear: both; height: 0; }
3
+
4
+ h1 { margin: 15px 0; font-size: 22px; font-weight: normal; }
5
+ h2 { font-size: 22px; margin: 15px 0; font-weight: normal;}
6
+ h3 { font-size: 18px; margin: 10px 0; font-weight: normal;}
7
+ h4 { font-size: 16px; margin: 10px 0; font-weight: normal;}
8
+ hr {height: 1px; border: 0; }
9
+ p { margin: 15px 0;}
10
+ a img { border: none; }
11
+
12
+ body {
13
+ font-size: 12px;
14
+ font-family: sans-serif;
15
+ }
16
+
17
+ #container {
18
+ min-width: 960px;
19
+ }
20
+
21
+ #header, #wrapper, #footer {
22
+ padding: 0 20px;
23
+ }
24
+
25
+ #header {
26
+ position: relative;
27
+ padding-top: 1px;
28
+ }
29
+
30
+ #header h1 {
31
+ margin: 0;
32
+ padding: 10px 0;
33
+ font-size: 30px;
34
+ }
35
+
36
+ #header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited {
37
+ text-decoration: none;
38
+ }
39
+
40
+ #main {
41
+ width: 70%;
42
+ float: left;
43
+ }
44
+
45
+ .actions-bar {
46
+ padding: 10px 1px;
47
+ }
48
+
49
+ .actions-bar .actions {
50
+ float: left;
51
+ }
52
+
53
+
54
+ .actions-bar .pagination {
55
+ float: right;
56
+ padding: 1px 0;
57
+ }
58
+
59
+ #sidebar {
60
+ width: 25%;
61
+ float: right;
62
+ }
63
+
64
+ #sidebar h3 {
65
+ padding: 10px 15px;
66
+ margin: 0;
67
+ font-size: 13px;
68
+ }
69
+
70
+ #sidebar .block {
71
+ margin-bottom: 20px;
72
+ padding-bottom: 10px;
73
+ }
74
+
75
+ #sidebar .block .content {
76
+ padding: 0 15px;
77
+ }
78
+
79
+ #sidebar ul.navigation li a:link, #sidebar ul.navigation li a:visited {
80
+ display: block;
81
+ padding: 10px 15px;
82
+ }
83
+
84
+ #sidebar .block .sidebar-block, #sidebar .notice {
85
+ padding:10px;
86
+ }
87
+
88
+ #wrapper {
89
+ padding-top: 20px;
90
+ }
91
+
92
+ #main .block {
93
+ margin-bottom: 20px;
94
+ padding-top: 1px;
95
+ }
96
+
97
+ #main .block .content .inner {
98
+ padding: 0 15px 15px;
99
+ }
100
+
101
+ #main .main p.first {
102
+ margin-top: 0;
103
+ }
104
+
105
+ #user-navigation {
106
+ position: absolute;
107
+ top: 0px;
108
+ right: 20px;
109
+ }
110
+
111
+ #main-navigation {
112
+ width: 100%;
113
+ }
114
+
115
+ #user-navigation ul, #main-navigation ul, .secondary-navigation ul, #sidebar ul.navigation {
116
+ margin: 0;
117
+ padding: 0;
118
+ list-style-type: none;
119
+ }
120
+
121
+ #user-navigation ul li, #main-navigation ul li, .secondary-navigation ul li {
122
+ float: left;
123
+ }
124
+
125
+ #main-navigation ul li {
126
+ margin-right: 5px;
127
+ }
128
+
129
+ #user-navigation ul li {
130
+ padding: 5px 10px;
131
+ }
132
+
133
+ #main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active,
134
+ .secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active,
135
+ #user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active {
136
+ text-decoration: none;
137
+ }
138
+
139
+ #main-navigation ul li a {
140
+ font-size: 15px;
141
+ display: block;
142
+ padding: 8px 15px;
143
+ }
144
+
145
+ .secondary-navigation {
146
+ font-size: 13px;
147
+ border-bottom-width: 10px;
148
+ border-bottom-style: solid;
149
+ }
150
+
151
+ .secondary-navigation ul li a {
152
+ display: block;
153
+ padding: 10px 15px;
154
+ }
155
+
156
+ #footer {
157
+ padding-bottom: 20px;
158
+ }
159
+
160
+ /* pagination */
161
+
162
+ .pagination a, .pagination span {
163
+ padding: 2px 5px;
164
+ margin-right: 5px;
165
+ display: block;
166
+ float: left;
167
+ border-style: solid;
168
+ border-width: 1px;
169
+ }
170
+
171
+ .pagination span.current {
172
+ font-weight: bold;
173
+ }
174
+
175
+ .pagination a {
176
+ text-decoration: none;
177
+ }
178
+
179
+ /* tables */
180
+ .table {
181
+ width: 100%;
182
+ border-collapse: collapse;
183
+ margin-bottom: 15px;
184
+ }
185
+
186
+ .table th {
187
+ padding: 10px;
188
+ font-weight: bold;
189
+ text-align: left;
190
+ }
191
+
192
+ .table th.first {
193
+ width: 30px;
194
+ }
195
+
196
+ .table th.last {
197
+ width: 200px;
198
+ }
199
+
200
+ .table .checkbox {
201
+ margin-left: 10px;
202
+ }
203
+
204
+ .table td {
205
+ padding: 10px;
206
+ }
207
+
208
+ .table td.last {
209
+ text-align: right;
210
+ }
211
+
212
+ /* forms */
213
+
214
+ input.checkbox {
215
+ margin: 0;
216
+ padding: 0;
217
+ }
218
+
219
+ .form .group {
220
+ margin-bottom: 15px;
221
+ }
222
+
223
+ .form div.left {
224
+ width: 20%;
225
+ float: left;
226
+ }
227
+
228
+ .form div.right {
229
+ width: 75%;
230
+ float: right;
231
+ }
232
+
233
+ .form .columns .column {
234
+ width: 48%;
235
+ }
236
+
237
+ .form .columns .left {
238
+ float: left;
239
+ }
240
+
241
+ .form .columns .right {
242
+ float: right;
243
+ }
244
+
245
+ .form label.label, .form input.text_field, .form textarea.text_area {
246
+ font-size: 1.2em;
247
+ padding: 1px 0;
248
+ margin: 0;
249
+ }
250
+
251
+ .form label.right {
252
+ text-align: right;
253
+ }
254
+
255
+ .form input.checkbox, .form input.radio {
256
+ margin-right: 5px;
257
+ }
258
+
259
+ .form label.checkbox, .form label.radio {
260
+ line-height: 1.5em;
261
+ }
262
+
263
+ .form label.label {
264
+ display: block;
265
+ padding-bottom: 2px;
266
+ font-weight: bold;
267
+ }
268
+
269
+ .form div.fieldWithErrors label.label {
270
+ display: inline;
271
+ }
272
+
273
+ .form .fieldWithErrors .error {
274
+ color: red;
275
+ }
276
+
277
+ .form input.text_field, .form textarea.text_area {
278
+ width: 100%;
279
+ border-width: 1px;
280
+ border-style: solid;
281
+ }
282
+
283
+ /* lists */
284
+
285
+ ul.list {
286
+ margin: 0;
287
+ padding: 0;
288
+ list-style-type: none;
289
+ }
290
+
291
+ ul.list li {
292
+ clear: left;
293
+ padding-bottom: 5px;
294
+ }
295
+
296
+ ul.list li .left {
297
+ float: left;
298
+ }
299
+
300
+ ul.list li .left .avatar {
301
+ width: 50px;
302
+ height: 50px;
303
+ }
304
+
305
+ ul.list li .item {
306
+ margin-left: 80px;
307
+ }
308
+
309
+ ul.list li .item .avatar {
310
+ float: left;
311
+ margin: 0 5px 5px 0;
312
+ width: 30px;
313
+ height: 30px;
314
+ }
315
+
316
+ /* box */
317
+
318
+ #box {
319
+ width: 500px;
320
+ margin: 50px auto;
321
+ }
322
+
323
+ #box .block {
324
+ margin-bottom: 20px;
325
+ }
326
+
327
+ #box .block h2 {
328
+ padding: 10px 15px;
329
+ margin: 0;
330
+ }
331
+
332
+ #box .block .content {
333
+ padding: 10px 20px;
334
+ }
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <title>title</title>
6
+ <%%= stylesheet_link_tag 'base', 'style' %>
7
+ </head>
8
+ <body>
9
+ <div id="container">
10
+ <div id="header">
11
+ <h1><a href="/"><%%= File.dirname(RAILS_ROOT) %></a></h1>
12
+ </div>
13
+ <div id="wrapper">
14
+ <div id="main">
15
+ <%% unless flash.empty? %>
16
+ <div class="flash">
17
+ <%% flash.each do |sev, message| %>
18
+ <%%= content_tag :div, message, :class => sev %>
19
+ <%% end %>
20
+ </div>
21
+ <%% end %>
22
+ <%%= yield %>
23
+ </div>
24
+ <div id="sidebar">
25
+ <%%= yield :sidebar %>
26
+ </div>
27
+ <div class="clear"></div>
28
+ </div>
29
+ <div id="footer">
30
+ <div class="block">
31
+ <p>Copyright &copy; <%= Time.now.strftime("%Y") %> Rubaidh Ltd</p>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </body>
36
+ </html>
@@ -0,0 +1,321 @@
1
+ .small { font-size:11px; }
2
+ .gray { color:#999; }
3
+ .hightlight { background-color:#ffc; }
4
+
5
+ a:link, a:visited, a:hover, a:active, h1, h2, h3 { color: #660606; }
6
+
7
+ body {
8
+ color: #222;
9
+ background: #ddd;
10
+ font-family: "Helvetica Neue",Helvetica,Arial,"Bitstream Vera Sans",sans-serif;
11
+ }
12
+
13
+ hr {
14
+ background: #EEF0F0;
15
+ color: #EEF0F0;
16
+ }
17
+
18
+ /* @end */
19
+
20
+ /* @group Header */
21
+
22
+ #header {
23
+ background: #660606;
24
+ }
25
+
26
+ #header h1 {
27
+ padding: 10px 0;
28
+ }
29
+
30
+ #header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited {
31
+ color: #F7F7F8;
32
+ }
33
+
34
+ /* @end */
35
+
36
+ #user-navigation {
37
+ top: auto;
38
+ bottom: 5px;
39
+ right: 25px;
40
+ }
41
+
42
+ #main .block h2{
43
+ background-color: blue;
44
+ padding: 5px 15px;
45
+ margin: 0;
46
+ background-color: #9e0a0a;
47
+ color: #fff;
48
+ -moz-border-radius-topleft: 4px;
49
+ -webkit-border-top-left-radius: 4px;
50
+ -moz-border-radius-topright: 4px;
51
+ -webkit-border-top-right-radius: 4px;
52
+ }
53
+
54
+ #main .block .content {
55
+ background: #F7F7F8;
56
+ -moz-border-radius-bottomleft: 4px;
57
+ -webkit-border-bottom-left-radius: 4px;
58
+ -moz-border-radius-bottomright: 4px;
59
+ -webkit-border-bottom-right-radius: 4px;
60
+ }
61
+
62
+ #main .block .content .inner{
63
+ line-height: 1.4em;
64
+ font-size: 1.1em;
65
+ }
66
+
67
+ table.results{
68
+ width: 100%;
69
+ text-align: center;
70
+ }
71
+ /* @group Main navigation */
72
+
73
+ #main-navigation ul li {
74
+ padding-left: 0;
75
+ }
76
+
77
+ #main-navigation ul li a {
78
+ padding: 8px 0;
79
+ }
80
+
81
+ #main-navigation ul li a {
82
+ padding: 8px 15px;
83
+ }
84
+
85
+ #main-navigation {
86
+ background-color: #005573;
87
+ }
88
+
89
+ #main-navigation ul li a:hover {
90
+ background-color: #001C26;
91
+ }
92
+
93
+ #main-navigation ul li.active a {
94
+ background-color: #C2C8D1;
95
+ background: -webkit-gradient(linear, left top, left bottom, from(#C2C8D1), to(#C2C8D1), color-stop(0.5, #F7F7F8), color-stop(0.5, #F7F7F8));
96
+
97
+ }
98
+
99
+ label{
100
+ display: block;
101
+ font-size: 1.3em;
102
+ }
103
+
104
+ #query_keywords{
105
+ width: 100%;
106
+ font-size: 1.3em;
107
+ border: 3px solid #bdd0dd;
108
+ }
109
+
110
+ /* @end */
111
+
112
+ /* @group Secondary navigation */
113
+
114
+ .secondary-navigation li a:hover {
115
+ background: #005573;
116
+ }
117
+
118
+ .secondary-navigation {
119
+ background: #007BA7;
120
+ border-bottom-width: 7px;
121
+ border-bottom-color: #005573;
122
+ }
123
+
124
+ .secondary-navigation ul li.active, .secondary-navigation ul li.active a:hover {
125
+ background-color: #005573;
126
+ }
127
+
128
+ /* @end */
129
+
130
+ /* @group Sidebar */
131
+
132
+ #sidebar .block {
133
+ background: #F7F7F8;
134
+ line-height: 1.4em;
135
+ font-size: 1.1em;
136
+ }
137
+
138
+ #sidebar h3 {
139
+ background: #007BA7;
140
+ color: #F7F7F8;
141
+ border-bottom: 7px solid #005573;
142
+ }
143
+
144
+ #sidebar ul{
145
+ padding-left: 2em;
146
+ list-style-type: square;
147
+ color: #bdd1dd;
148
+ }
149
+ #sidebar ul span{
150
+ color: #000;
151
+ }
152
+
153
+ #sidebar ul li a:link, #sidebar ul li a:visited {
154
+ background: #F7F7F8;
155
+ border-bottom: 1px solid #EEF0F0;
156
+ text-decoration: none;
157
+ }
158
+
159
+ #sidebar ul li a:hover, #sidebar ul li a:active {
160
+ background: #005573;
161
+ color: #F7F7F8;
162
+ }
163
+
164
+ /* @end */
165
+
166
+ #main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active,
167
+ .secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active,
168
+ #user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active {
169
+ text-decoration: none;
170
+ color: #F7F7F8;
171
+ }
172
+
173
+ #main-navigation ul li.active a:link, #main-navigation ul li.active a:visited, #main-navigation ul li.active a:hover, #main-navigation ul li.active a:active {
174
+ color: #001C26;
175
+ }
176
+
177
+ #footer .block {
178
+ color: #222;
179
+ background-color: #aaa;
180
+ }
181
+
182
+ #footer .block p {
183
+ margin: 0;
184
+ padding: 10px;
185
+ }
186
+
187
+ /* pagination */
188
+
189
+ .pagination span.current {
190
+ background: #005573;
191
+ color: #F7F7F8;
192
+ border-color: #005573;
193
+ }
194
+
195
+ .pagination a,
196
+ .pagination span {
197
+ color: #001C26;
198
+ border-color: #005573;
199
+ }
200
+
201
+ .pagination a:hover {
202
+ color: #F7F7F8;
203
+ background: #005573;
204
+ }
205
+
206
+ /* tables */
207
+
208
+ .table th {
209
+ background: #C2C8D1;
210
+ color: #001C26;
211
+ }
212
+
213
+ .table td {
214
+ border-bottom:1px solid #EEF0F0;
215
+ }
216
+
217
+ /* forms */
218
+
219
+ .form input.text_field, .form textarea.text_area {
220
+ width: 100%;
221
+ border: 1px solid #001C26;
222
+ }
223
+
224
+ .form input.button {
225
+ background: #EEE;
226
+ color: #001C26;
227
+ padding: 2px 5px;
228
+ border: 1px solid #001C26;
229
+ cursor: pointer;
230
+ }
231
+
232
+ .form .description {
233
+ color: #8C8C8C;
234
+ font-size: .9em;
235
+ }
236
+
237
+ /* @group Flash messages */
238
+
239
+ .flash .message {
240
+ -moz-border-radius: 3px;
241
+ -webkit-border-radius: 3px;
242
+ text-align:center;
243
+ margin: 0 auto 15px;
244
+ }
245
+
246
+ .flash .message p {
247
+ margin:8px;
248
+ }
249
+ .flash .error {
250
+ border: 1px solid #fbb;
251
+ background-color: #fdd;
252
+ }
253
+ .flash .warning {
254
+ border: 1px solid #e0d300;
255
+ background-color: #ffffcc;
256
+ }
257
+ .flash .notice {
258
+ border: 1px solid #8ec4df;
259
+ background-color: #dffaff;
260
+ }
261
+
262
+ /* @end */
263
+
264
+ /* lists */
265
+
266
+ ul.list li {
267
+ border-bottom-color: #EEF0F0;
268
+ border-bottom-width: 1px;
269
+ border-bottom-style: solid;
270
+ }
271
+
272
+ ul.list li .item .avatar {
273
+ border-color: #EEF0F0;
274
+ border-width: 1px;
275
+ border-style: solid;
276
+ padding: 2px;
277
+ }
278
+
279
+ /* box */
280
+
281
+ #box .block {
282
+ background: #F7F7F8;
283
+ }
284
+
285
+ #box .block h2 {
286
+ background: #005573;
287
+ color: #F7F7F8;
288
+ }
289
+
290
+
291
+ /* rounded borders */
292
+
293
+ #main, #main-navigation, #main-navigation li, #main-navigation li a, .secondary-navigation, #main .block, #sidebar .block, #sidebar h3, ul.list li,
294
+ #footer .block, .form input.button, #box .block, #box .block h2 {
295
+ -moz-border-radius-topleft: 4px;
296
+ -webkit-border-top-left-radius: 4px;
297
+ -moz-border-radius-topright: 4px;
298
+ -webkit-border-top-right-radius: 4px;
299
+ }
300
+
301
+ .secondary-navigation li.first a, .secondary-navigation ul li.first, .table th.first, .table th.first {
302
+ -moz-border-radius-topleft: 4px;
303
+ -webkit-border-top-left-radius: 4px;
304
+ }
305
+
306
+ .table th.last {
307
+ -moz-border-radius-topright: 4px;
308
+ -webkit-border-top-right-radius: 4px;
309
+ }
310
+
311
+ .secondary-navigation ul li.first {
312
+ -moz-border-radius-topleft: 4px;
313
+ -webkit-border-top-left-radius: 4px;
314
+ }
315
+
316
+ #sidebar, #sidebar .block, #main .block, #sidebar ul.navigation, ul.list li, #footer .block, .form input.button, #box .block {
317
+ -moz-border-radius-bottomleft: 4px;
318
+ -webkit-border-bottom-left-radius: 4px;
319
+ -moz-border-radius-bottomright: 4px;
320
+ -webkit-border-bottom-right-radius: 4px;
321
+ }