batch_manager 0.2.1 → 0.2.2

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzBhZTJiZjNjY2YxZWJmN2UxZDQ3OGU3YWI0NGNlN2VkODQ0ZmNmOQ==
4
+ NmNhYjY3YmRiN2ZlN2FlMDg5NmU1YmJiZmJkNTNjZTk4ZmM3ZDY2ZA==
5
5
  data.tar.gz: !binary |-
6
- YzQxOTg4NzhmNTY5MjQ0NDU1MmE1ZWI1ODE2MGExNzIyMWMzMmZhOA==
6
+ OWZhY2Q5MWMyMzljZjkxNzYxYzc1YzM2NmNhNWY3ZDhjMDg5OTU4ZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmE4YTBiN2QxZmQ5MTllMDI2OGFmMmQ2ODI1ZjQyMjIzYTJiNDE3YzhlODQw
10
- ZTJmOGNlOGQ5MDdkOGUzMDNiYzc2Mjk4NGQ1ZTYxOTdkYWYxNmE2MWZiNTVj
11
- YTU1MjEyYmU2NGE3NTMzMmMwNTE3NzlkOTQ3OWExYmNjOTdjOTc=
9
+ ZTFkZGVmYzg5MjViY2RiYTdjZGMwZmNhOTBhOTNiMjYwN2EzNzBlNDUwMGJm
10
+ MzEyMmYzM2U5MDU0MmM1NGNjMzIwYjNkMTYzMWQzMWY1ZGJlZDlhMGQwNDEy
11
+ ZmM5Yzg5Zjc0ODY1Yzg5YjkwZDA0ZDAwZmYxOGQ0ZjY5ZjRmNWI=
12
12
  data.tar.gz: !binary |-
13
- YTZkMDM4YTNjN2NhODY5OTQwYjQ5ZmU1YmZlYzRhOTI1ZTU5NDNjNTVjNmM3
14
- NDkzZDU4MjYwMDY2YjgwMjY1ZjcwN2NhYTgwNTdhOTcyMTQ0MzJkYmNiODE0
15
- NDkzYmUwZDZlZmY5YzU5YzczYmQyZDY1MzdjNTM3M2Y5Yjg3Mzk=
13
+ YWVmNjg1YTNlZDcxZDU3Yjg4NGMwZWE4NDZiNjMyMDM1NmMwYTViOGY4YTYz
14
+ OTIzNDY4M2QyYWJjMmQzNDcwMjIzNGI2NmNhN2JlZmZlODc5NDI0YTZjNWY2
15
+ MDBmNmYzZjNhOTMxMThiZTMzY2U5NjQ1ZTFlNzk2NjUxMzhkOGY=
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require_self
3
+ *= require_tree .
4
+ */
@@ -0,0 +1,53 @@
1
+ body {
2
+ width: 1200px;
3
+ margin: 0 auto;
4
+ }
5
+
6
+ table {
7
+ width: 100%;
8
+ border-collapse:collapse;
9
+ border-spacing:0;
10
+ background-color:#ffffff;
11
+ empty-cells:show;
12
+ }
13
+
14
+ td, th {
15
+ border:1px solid #663300;
16
+ }
17
+
18
+ th {
19
+ color:#FFF;
20
+ background-color:#996633;
21
+ background-position:left top;
22
+ padding:0.1em 0.5em;
23
+ text-align:center;
24
+ }
25
+
26
+ th a {
27
+ color: #FFF;
28
+ text-decoration: underline;;
29
+ }
30
+
31
+ td {
32
+ padding:0.1em 0.5em;
33
+ }
34
+
35
+ tr.odd {
36
+ background-color:#ffffcc;
37
+ }
38
+
39
+ tr.attention {
40
+ background-color:#ffaaaa;
41
+ }
42
+
43
+ tr.disable {
44
+ background-color:#aaaaaa;
45
+ }
46
+
47
+ tr.even.disable {
48
+ background-color:#bbbbbb;
49
+ }
50
+
51
+ tr.odd.disable {
52
+ background-color:#bbbbaa;
53
+ }
@@ -0,0 +1,4 @@
1
+ module BatchManager
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,17 @@
1
+ module BatchManager
2
+ class BatchesController < ApplicationController
3
+ def index
4
+ @details = BatchManager::Monitor.details
5
+ end
6
+
7
+ def exec
8
+ BatchManager::Executor.exec(params[:batch_name], :wet => params[:wet])
9
+ redirect_to(batch_manager_batches_url)
10
+ end
11
+
12
+ def log
13
+ log_file = BatchManager::Logger.log_file_path(params[:batch_name], params[:wet])
14
+ render :text => File.read(log_file).gsub("\n", "<br/>")
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,42 @@
1
+ <h2>Batches</h2>
2
+ <table>
3
+ <tr>
4
+ <th>Managed?</th>
5
+ <th>Name</th>
6
+ <th>Ran/Limit</th>
7
+ <th>Last run at</th>
8
+ <th>Created at</th>
9
+ <th>Log</th>
10
+ <th></th>
11
+ </tr>
12
+ <% @details.each do |status| %>
13
+ <% schema_batch = status.schema_batch %>
14
+ <tr>
15
+ <td><%= status.managed?? "Yes" : "" %></td>
16
+ <td><%= status.name %></td>
17
+ <td style="text-align:right;"><%= schema_batch.try(:ran_times).to_i %>/<%= status.times_limit || 0 %></td>
18
+ <td style="text-align:center;">
19
+ <% if last_ran_at = schema_batch.try(:last_ran_at) %>
20
+ <%= last_ran_at.strftime('%Y-%m-%d %H:%M:%S') %>
21
+ <% end %>
22
+ </td>
23
+ <td style="text-align:center;"><%= status.created_at.strftime('%Y-%m-%d %H:%M:%S') if status.created_at %></td>
24
+ <td style="text-align:center;">
25
+ <% if File.exist?(BatchManager::Logger.log_file_path(status.name)) %>
26
+ <%= link_to "dry", log_batches_url(:batch_name => status.name) %>
27
+ <% end %>
28
+ <% if File.exist?(BatchManager::Logger.log_file_path(status.name, true)) %>
29
+ <%= link_to "wet", log_batches_url(:batch_name => status.name, :wet => true) %>
30
+ <% end %>
31
+ </td>
32
+ <td style="text-align:center;">
33
+ <% if status.managed? %>
34
+ <%= link_to "dry run", exec_batches_url(:batch_name => status.name) %>
35
+ <% if status.can_run? %>
36
+ <%= link_to "wet run", exec_batches_url(:batch_name => status.name, :wet => true), :class => "danger", :onclick => "return confirm('Are you sure?')" %>
37
+ <% end %>
38
+ <% end %>
39
+ </td>
40
+ </tr>
41
+ <% end %>
42
+ </table>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestEngine</title>
5
+ <%= stylesheet_link_tag "batch_manager/application", :media => "all" %>
6
+ <%= javascript_include_tag "batch_manager/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,12 @@
1
+ BatchManager::Engine.routes.draw do
2
+
3
+ root :to => "batches#index"
4
+
5
+ resources :batches do
6
+ collection do
7
+ get :exec
8
+ get :log
9
+ end
10
+ end
11
+
12
+ end
@@ -1,3 +1,3 @@
1
1
  module BatchManager
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batch_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weihu Chen
@@ -102,6 +102,13 @@ executables:
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
+ - app/assets/stylesheets/batch_manager/application.css
106
+ - app/assets/stylesheets/batch_manager/batches.css
107
+ - app/controllers/batch_manager/application_controller.rb
108
+ - app/controllers/batch_manager/batches_controller.rb
109
+ - app/views/batch_manager/batches/index.html.erb
110
+ - app/views/layouts/batch_manager/application.html.erb
111
+ - config/routes.rb
105
112
  - bin/bm_exec
106
113
  - lib/batch_manager/batch_status.rb
107
114
  - lib/batch_manager/engine.rb