burden_web 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/.gitignore +8 -0
  2. data/Gemfile +6 -0
  3. data/LICENSE +22 -0
  4. data/README.md +3 -0
  5. data/Rakefile +29 -0
  6. data/app/assets/javascripts/burden_web/application.js +15 -0
  7. data/app/assets/stylesheets/burden_web/application.css +7 -0
  8. data/app/assets/stylesheets/burden_web/foundation.min.css +1 -0
  9. data/app/assets/stylesheets/burden_web/normalize.css +402 -0
  10. data/app/controllers/burden_web/application_controller.rb +10 -0
  11. data/app/controllers/burden_web/runs_controller.rb +7 -0
  12. data/app/controllers/burden_web/tasks_controller.rb +28 -0
  13. data/app/helpers/burden_web/application_helper.rb +14 -0
  14. data/app/views/burden_web/runs/index.html.erb +21 -0
  15. data/app/views/burden_web/tasks/index.html.erb +29 -0
  16. data/app/views/layouts/burden_web/application.html.erb +16 -0
  17. data/burden_web.gemspec +23 -0
  18. data/config/routes.rb +6 -0
  19. data/lib/burden_web/engine.rb +5 -0
  20. data/lib/burden_web/version.rb +3 -0
  21. data/lib/burden_web.rb +5 -0
  22. data/script/rails +8 -0
  23. data/spec/dummy/Rakefile +7 -0
  24. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  25. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  26. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  27. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  28. data/spec/dummy/app/mailers/.gitkeep +0 -0
  29. data/spec/dummy/app/models/.gitkeep +0 -0
  30. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  31. data/spec/dummy/config/application.rb +65 -0
  32. data/spec/dummy/config/boot.rb +10 -0
  33. data/spec/dummy/config/database.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +37 -0
  36. data/spec/dummy/config/environments/production.rb +67 -0
  37. data/spec/dummy/config/environments/test.rb +37 -0
  38. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/dummy/config/initializers/burden.rb +6 -0
  40. data/spec/dummy/config/initializers/inflections.rb +15 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  43. data/spec/dummy/config/initializers/session_store.rb +8 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +5 -0
  46. data/spec/dummy/config/routes.rb +3 -0
  47. data/spec/dummy/config.ru +4 -0
  48. data/spec/dummy/db/migrate/20130607082646_create_burden_runs.rb +14 -0
  49. data/spec/dummy/db/schema.rb +23 -0
  50. data/spec/dummy/lib/assets/.gitkeep +0 -0
  51. data/spec/dummy/lib/tasks/bad_failure.rake +6 -0
  52. data/spec/dummy/lib/tasks/good_bar.rake +6 -0
  53. data/spec/dummy/lib/tasks/good_foo.rake +6 -0
  54. data/spec/dummy/lib/tasks/unpredictable.rake +4 -0
  55. data/spec/dummy/log/.gitkeep +0 -0
  56. data/spec/dummy/public/404.html +26 -0
  57. data/spec/dummy/public/422.html +26 -0
  58. data/spec/dummy/public/500.html +25 -0
  59. data/spec/dummy/public/favicon.ico +0 -0
  60. data/spec/dummy/script/rails +6 -0
  61. metadata +209 -0
@@ -0,0 +1,402 @@
1
+ /*! normalize.css v2.1.1 | MIT License | git.io/normalize */
2
+
3
+ /* ==========================================================================
4
+ HTML5 display definitions
5
+ ========================================================================== */
6
+
7
+ /**
8
+ * Correct `block` display not defined in IE 8/9.
9
+ */
10
+
11
+ article,
12
+ aside,
13
+ details,
14
+ figcaption,
15
+ figure,
16
+ footer,
17
+ header,
18
+ hgroup,
19
+ main,
20
+ nav,
21
+ section,
22
+ summary {
23
+ display: block;
24
+ }
25
+
26
+ /**
27
+ * Correct `inline-block` display not defined in IE 8/9.
28
+ */
29
+
30
+ audio,
31
+ canvas,
32
+ video {
33
+ display: inline-block;
34
+ }
35
+
36
+ /**
37
+ * Prevent modern browsers from displaying `audio` without controls.
38
+ * Remove excess height in iOS 5 devices.
39
+ */
40
+
41
+ audio:not([controls]) {
42
+ display: none;
43
+ height: 0;
44
+ }
45
+
46
+ /**
47
+ * Address styling not present in IE 8/9.
48
+ */
49
+
50
+ [hidden] {
51
+ display: none;
52
+ }
53
+
54
+ /* ==========================================================================
55
+ Base
56
+ ========================================================================== */
57
+
58
+ /**
59
+ * 1. Prevent system color scheme's background color being used in Firefox, IE,
60
+ * and Opera.
61
+ * 2. Prevent system color scheme's text color being used in Firefox, IE, and
62
+ * Opera.
63
+ * 3. Set default font family to sans-serif.
64
+ * 4. Prevent iOS text size adjust after orientation change, without disabling
65
+ * user zoom.
66
+ */
67
+
68
+ html {
69
+ background: #fff; /* 1 */
70
+ color: #000; /* 2 */
71
+ font-family: sans-serif; /* 3 */
72
+ -ms-text-size-adjust: 100%; /* 4 */
73
+ -webkit-text-size-adjust: 100%; /* 4 */
74
+ }
75
+
76
+ /**
77
+ * Remove default margin.
78
+ */
79
+
80
+ body {
81
+ margin: 0;
82
+ }
83
+
84
+ /* ==========================================================================
85
+ Links
86
+ ========================================================================== */
87
+
88
+ /**
89
+ * Address `outline` inconsistency between Chrome and other browsers.
90
+ */
91
+
92
+ a:focus {
93
+ outline: thin dotted;
94
+ }
95
+
96
+ /**
97
+ * Improve readability when focused and also mouse hovered in all browsers.
98
+ */
99
+
100
+ a:active,
101
+ a:hover {
102
+ outline: 0;
103
+ }
104
+
105
+ /* ==========================================================================
106
+ Typography
107
+ ========================================================================== */
108
+
109
+ /**
110
+ * Address variable `h1` font-size and margin within `section` and `article`
111
+ * contexts in Firefox 4+, Safari 5, and Chrome.
112
+ */
113
+
114
+ h1 {
115
+ font-size: 2em;
116
+ margin: 0.67em 0;
117
+ }
118
+
119
+ /**
120
+ * Address styling not present in IE 8/9, Safari 5, and Chrome.
121
+ */
122
+
123
+ abbr[title] {
124
+ border-bottom: 1px dotted;
125
+ }
126
+
127
+ /**
128
+ * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
129
+ */
130
+
131
+ b,
132
+ strong {
133
+ font-weight: bold;
134
+ }
135
+
136
+ /**
137
+ * Address styling not present in Safari 5 and Chrome.
138
+ */
139
+
140
+ dfn {
141
+ font-style: italic;
142
+ }
143
+
144
+ /**
145
+ * Address differences between Firefox and other browsers.
146
+ */
147
+
148
+ hr {
149
+ -moz-box-sizing: content-box;
150
+ box-sizing: content-box;
151
+ height: 0;
152
+ }
153
+
154
+ /**
155
+ * Address styling not present in IE 8/9.
156
+ */
157
+
158
+ mark {
159
+ background: #ff0;
160
+ color: #000;
161
+ }
162
+
163
+ /**
164
+ * Correct font family set oddly in Safari 5 and Chrome.
165
+ */
166
+
167
+ code,
168
+ kbd,
169
+ pre,
170
+ samp {
171
+ font-family: monospace, serif;
172
+ font-size: 1em;
173
+ }
174
+
175
+ /**
176
+ * Improve readability of pre-formatted text in all browsers.
177
+ */
178
+
179
+ pre {
180
+ white-space: pre-wrap;
181
+ }
182
+
183
+ /**
184
+ * Set consistent quote types.
185
+ */
186
+
187
+ q {
188
+ quotes: "\201C" "\201D" "\2018" "\2019";
189
+ }
190
+
191
+ /**
192
+ * Address inconsistent and variable font size in all browsers.
193
+ */
194
+
195
+ small {
196
+ font-size: 80%;
197
+ }
198
+
199
+ /**
200
+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.
201
+ */
202
+
203
+ sub,
204
+ sup {
205
+ font-size: 75%;
206
+ line-height: 0;
207
+ position: relative;
208
+ vertical-align: baseline;
209
+ }
210
+
211
+ sup {
212
+ top: -0.5em;
213
+ }
214
+
215
+ sub {
216
+ bottom: -0.25em;
217
+ }
218
+
219
+ /* ==========================================================================
220
+ Embedded content
221
+ ========================================================================== */
222
+
223
+ /**
224
+ * Remove border when inside `a` element in IE 8/9.
225
+ */
226
+
227
+ img {
228
+ border: 0;
229
+ }
230
+
231
+ /**
232
+ * Correct overflow displayed oddly in IE 9.
233
+ */
234
+
235
+ svg:not(:root) {
236
+ overflow: hidden;
237
+ }
238
+
239
+ /* ==========================================================================
240
+ Figures
241
+ ========================================================================== */
242
+
243
+ /**
244
+ * Address margin not present in IE 8/9 and Safari 5.
245
+ */
246
+
247
+ figure {
248
+ margin: 0;
249
+ }
250
+
251
+ /* ==========================================================================
252
+ Forms
253
+ ========================================================================== */
254
+
255
+ /**
256
+ * Define consistent border, margin, and padding.
257
+ */
258
+
259
+ fieldset {
260
+ border: 1px solid #c0c0c0;
261
+ margin: 0 2px;
262
+ padding: 0.35em 0.625em 0.75em;
263
+ }
264
+
265
+ /**
266
+ * 1. Correct `color` not being inherited in IE 8/9.
267
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
268
+ */
269
+
270
+ legend {
271
+ border: 0; /* 1 */
272
+ padding: 0; /* 2 */
273
+ }
274
+
275
+ /**
276
+ * 1. Correct font family not being inherited in all browsers.
277
+ * 2. Correct font size not being inherited in all browsers.
278
+ * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
279
+ */
280
+
281
+ button,
282
+ input,
283
+ select,
284
+ textarea {
285
+ font-family: inherit; /* 1 */
286
+ font-size: 100%; /* 2 */
287
+ margin: 0; /* 3 */
288
+ }
289
+
290
+ /**
291
+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in
292
+ * the UA stylesheet.
293
+ */
294
+
295
+ button,
296
+ input {
297
+ line-height: normal;
298
+ }
299
+
300
+ /**
301
+ * Address inconsistent `text-transform` inheritance for `button` and `select`.
302
+ * All other form control elements do not inherit `text-transform` values.
303
+ * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
304
+ * Correct `select` style inheritance in Firefox 4+ and Opera.
305
+ */
306
+
307
+ button,
308
+ select {
309
+ text-transform: none;
310
+ }
311
+
312
+ /**
313
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
314
+ * and `video` controls.
315
+ * 2. Correct inability to style clickable `input` types in iOS.
316
+ * 3. Improve usability and consistency of cursor style between image-type
317
+ * `input` and others.
318
+ */
319
+
320
+ button,
321
+ html input[type="button"], /* 1 */
322
+ input[type="reset"],
323
+ input[type="submit"] {
324
+ -webkit-appearance: button; /* 2 */
325
+ cursor: pointer; /* 3 */
326
+ }
327
+
328
+ /**
329
+ * Re-set default cursor for disabled elements.
330
+ */
331
+
332
+ button[disabled],
333
+ html input[disabled] {
334
+ cursor: default;
335
+ }
336
+
337
+ /**
338
+ * 1. Address box sizing set to `content-box` in IE 8/9.
339
+ * 2. Remove excess padding in IE 8/9.
340
+ */
341
+
342
+ input[type="checkbox"],
343
+ input[type="radio"] {
344
+ box-sizing: border-box; /* 1 */
345
+ padding: 0; /* 2 */
346
+ }
347
+
348
+ /**
349
+ * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
350
+ * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
351
+ * (include `-moz` to future-proof).
352
+ */
353
+
354
+ input[type="search"] {
355
+ -webkit-appearance: textfield; /* 1 */
356
+ -moz-box-sizing: content-box;
357
+ -webkit-box-sizing: content-box; /* 2 */
358
+ box-sizing: content-box;
359
+ }
360
+
361
+ /**
362
+ * Remove inner padding and search cancel button in Safari 5 and Chrome
363
+ * on OS X.
364
+ */
365
+
366
+ input[type="search"]::-webkit-search-cancel-button,
367
+ input[type="search"]::-webkit-search-decoration {
368
+ -webkit-appearance: none;
369
+ }
370
+
371
+ /**
372
+ * Remove inner padding and border in Firefox 4+.
373
+ */
374
+
375
+ button::-moz-focus-inner,
376
+ input::-moz-focus-inner {
377
+ border: 0;
378
+ padding: 0;
379
+ }
380
+
381
+ /**
382
+ * 1. Remove default vertical scrollbar in IE 8/9.
383
+ * 2. Improve readability and alignment in all browsers.
384
+ */
385
+
386
+ textarea {
387
+ overflow: auto; /* 1 */
388
+ vertical-align: top; /* 2 */
389
+ }
390
+
391
+ /* ==========================================================================
392
+ Tables
393
+ ========================================================================== */
394
+
395
+ /**
396
+ * Remove most spacing between table cells.
397
+ */
398
+
399
+ table {
400
+ border-collapse: collapse;
401
+ border-spacing: 0;
402
+ }
@@ -0,0 +1,10 @@
1
+ module BurdenWeb
2
+ class ApplicationController < ActionController::Base
3
+ def tasks
4
+ Rails.application.load_tasks
5
+ Rake.application.tasks.keep_if do |task|
6
+ task.name =~ /^[a-z0-9_:]+$/
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module BurdenWeb
2
+ class RunsController < ApplicationController
3
+ def index
4
+ @runs = Burden::Storage.run.history(params[:task_id])
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,28 @@
1
+ module BurdenWeb
2
+ class TasksController < ApplicationController
3
+ def index
4
+ @tasks = Burden::Storage.run.summary
5
+ (tasks.map(&:name) - @tasks.map(&:name)).each do |nr_task| # Never runned tasks
6
+ next if ignore? nr_task
7
+ @tasks << Burden::Storage.run.new(
8
+ name: nr_task
9
+ )
10
+ end
11
+ end
12
+
13
+ def ignore? name
14
+ Burden.config.ignored_tasks.collect{ |r| (name =~ r) ? 1 : 0 }.map(&:to_i).inject(:+) != 0
15
+ end
16
+
17
+ def run
18
+ Rails.application.load_tasks
19
+ task = Rake::Task[params[:id]]
20
+
21
+ task.prerequisite_tasks.each{ |t| t.execute(nil) }
22
+ task.execute(nil)
23
+ rescue => e # Gotta catch 'em all!
24
+ ensure
25
+ redirect_to params[:back]
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ module BurdenWeb
2
+ module ApplicationHelper
3
+ def task_label run
4
+ case run.success
5
+ when true
6
+ 'success'
7
+ when false
8
+ 'alert'
9
+ else
10
+ 'secondary'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ <%= link_to '&larr; Back'.html_safe, tasks_path, class: 'small radius secondary button' %>
2
+ <%= link_to 'Run', run_task_path(params[:task_id], back: task_runs_path(params[:task_id])), class: 'small radius button' %>
3
+ <br><br>
4
+ <table>
5
+ <thead>
6
+ <tr>
7
+ <th>Task</th>
8
+ <th>Timestamp</th>
9
+ <th>Took</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <% @runs.each do |run| %>
14
+ <tr>
15
+ <td><span class="<%= task_label(run) %> radius label"><%= run.name %></span></td>
16
+ <td><%= l run.timestamp, format: :short %> (<%= time_ago_in_words(run.timestamp) %> ago)</td>
17
+ <td><%= run.execution_time.round(6) %>s</td>
18
+ </tr>
19
+ <% end %>
20
+ </tbody>
21
+ </table>
@@ -0,0 +1,29 @@
1
+ <table>
2
+ <thead>
3
+ <tr>
4
+ <th>Task</th>
5
+ <th>Last Run</th>
6
+ <th>Took</th>
7
+ <th></th>
8
+ <th></th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% @tasks.each do |run| %>
13
+ <tr>
14
+ <td><span class="<%= task_label(run) %> radius label"><%= run.name %></span></td>
15
+ <% if run.timestamp %>
16
+ <td><%= time_ago_in_words(run.timestamp) %> ago</td>
17
+ <td><%= run.execution_time.round(6) %>s</td>
18
+ <td><%= link_to 'Run', run_task_path(run.name, back: tasks_path), class: 'small radius button' %></td>
19
+ <td><%= link_to 'History', task_runs_path(run.name), class: 'secondary small radius button' %></td>
20
+ <% else %>
21
+ <td>never</td>
22
+ <td>&mdash;</td>
23
+ <td><%= link_to 'Run', run_task_path(run.name, back: tasks_path), class: 'small radius button' %></td>
24
+ <td><a class="disabled secondary small radius button">History</a></td>
25
+ <% end %>
26
+ </tr>
27
+ <% end %>
28
+ </tbody>
29
+ </table>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Burden</title>
5
+ <%= stylesheet_link_tag 'burden_web/application', media: 'all' %>
6
+ <%= csrf_meta_tags %>
7
+ </head>
8
+ <body>
9
+ <div class="row">
10
+ <div class="large-12 columns">
11
+ <h2 class="subheader">Burden Dashboard</h2>
12
+ <%= yield %>
13
+ </div>
14
+ </div>
15
+ </body>
16
+ </html>
@@ -0,0 +1,23 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+ require 'burden_web/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'burden_web'
6
+ spec.version = BurdenWeb::VERSION
7
+ spec.authors = ['Gregory Eremin']
8
+ spec.email = ['magnolia_fan@me.com']
9
+ spec.summary = 'A web interface for Burden'
10
+ spec.description = 'Burden is a manager and statistics collector for Rake tasks. It comes with this web interface.'
11
+ spec.homepage = 'https://github.com/magnolia-fan/burden'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(/^bin\//){ |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(/^spec\//)
17
+
18
+ spec.add_dependency 'rails', '>= 3.2'
19
+ spec.add_development_dependency 'burden', "= #{BurdenWeb::VERSION}"
20
+
21
+ spec.add_development_dependency 'sqlite3', '>= 0'
22
+ spec.add_development_dependency 'awesome_print', '>= 0'
23
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ BurdenWeb::Engine.routes.draw do
2
+ resources :tasks, path: '/', only: [:index], constraints: { id: /[a-z0-9_:]+/ } do
3
+ member{ get :run }
4
+ resources :runs, only: [:index, :show]
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module BurdenWeb
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace BurdenWeb
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module BurdenWeb
2
+ VERSION = '0.1.0'
3
+ end
data/lib/burden_web.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'burden'
2
+ require 'burden_web/engine'
3
+
4
+ module BurdenWeb
5
+ end
data/script/rails ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/burden_web/engine', __FILE__)
6
+
7
+ require 'rails/all'
8
+ require 'rails/engine/commands'
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>