batch_manager 0.3.1 → 0.3.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 +8 -8
- data/app/assets/stylesheets/batch_manager/application.css +51 -1
- data/app/assets/stylesheets/batch_manager/notice.css +4 -11
- data/app/controllers/batch_manager/batches_controller.rb +21 -1
- data/app/views/batch_manager/batches/_form_content.html.erb +8 -0
- data/app/views/batch_manager/batches/edit.html.erb +1 -8
- data/app/views/batch_manager/batches/index.html.erb +1 -9
- data/app/views/batch_manager/batches/new.html.erb +9 -0
- data/app/views/layouts/batch_manager/application.html.erb +10 -1
- data/lib/batch_manager/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yzg5MzM1MGQzMTFhNDJlM2YzZDljODRmNjQ0NzQyODJkZDI1YTU4Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzViMWU3NTE1OGNjNDU2MzcxMDA0M2U0ZWI1ZmE3ZDY3ZDkzZjcwZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzQ0NDcyOTQyYTNmNmMyZTUyMTc5NjE0YTA0YjQ1ZTg5N2VkMWVjOTYyZjIy
|
10
|
+
NjhhN2U3ODZhMzZlNGQ0MzkwNmUyMjc0NmU1MzhjNjU1YTYwZDRmNWUxODhm
|
11
|
+
ZGFhMmE4NThjMzQxYTdkZjE3MDAwMDQ2NjIxNDc0YjdmOTY1Nzk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Mjc4ZTVmYTUzMGE3ZDhiMTQ3NDJhMmM1MjExMWRiZjI0ZDc0YmMxMGE3Yjdj
|
14
|
+
ODA4ODRkNGE3YjI4ZmJhYTg5M2EyMWFjNGM4NDk4MzJmMThiY2ZlYTZkMDA5
|
15
|
+
NjlkNjQ1NTQ1OWI0ZGNiYThiM2MyN2U1NTAyZjBlOTIyNzExNWE=
|
@@ -43,16 +43,61 @@ header h1 {
|
|
43
43
|
font-size: 18px;
|
44
44
|
line-height: 36px;
|
45
45
|
font-weight: normal;
|
46
|
-
color: #777777;
|
47
46
|
text-shadow: 0 1px 0 #ffffff;
|
48
47
|
}
|
49
48
|
|
49
|
+
header h1 a {
|
50
|
+
color: #777777;
|
51
|
+
text-decoration: none;
|
52
|
+
}
|
53
|
+
|
54
|
+
header .new_link {
|
55
|
+
float: right;
|
56
|
+
font-size: 14px;
|
57
|
+
line-height: 36px;
|
58
|
+
font-weight: bold;
|
59
|
+
}
|
60
|
+
|
61
|
+
header .new_link a {
|
62
|
+
color: #ccc;
|
63
|
+
text-shadow: 0 1px 1px #ffffff;
|
64
|
+
text-decoration: none;
|
65
|
+
}
|
66
|
+
|
67
|
+
header .new_link a:hover {
|
68
|
+
color: #aaa;
|
69
|
+
text-decoration: underline;
|
70
|
+
}
|
71
|
+
|
50
72
|
.title {
|
51
73
|
padding-bottom: 20px;
|
52
74
|
margin-bottom: 25px;
|
53
75
|
border-bottom: 1px solid #e2e2e2;
|
54
76
|
}
|
55
77
|
|
78
|
+
.title .new_batch {
|
79
|
+
color: #aaa;
|
80
|
+
line-height: 22px;
|
81
|
+
}
|
82
|
+
|
83
|
+
.title input {
|
84
|
+
margin: 0;
|
85
|
+
margin-top: -2px;
|
86
|
+
padding: 2px 5px;
|
87
|
+
font-size: 14px;
|
88
|
+
line-height: 18px;
|
89
|
+
width: 250px;
|
90
|
+
background-color: #ffffff;
|
91
|
+
border: 1px solid #cccccc;
|
92
|
+
color: #555;
|
93
|
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
94
|
+
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
95
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
96
|
+
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
97
|
+
-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
|
98
|
+
transition: border linear 0.2s, box-shadow linear 0.2s;
|
99
|
+
}
|
100
|
+
|
56
101
|
h2 {
|
57
102
|
color: #777;
|
58
103
|
font-size: 18px;
|
@@ -86,6 +131,11 @@ a.cancel:hover {
|
|
86
131
|
text-decoration: underline;
|
87
132
|
}
|
88
133
|
|
134
|
+
.divider {
|
135
|
+
padding: 0 5px;
|
136
|
+
color: #aaa;
|
137
|
+
}
|
138
|
+
|
89
139
|
footer {
|
90
140
|
text-align: center;
|
91
141
|
padding: 30px 0;
|
@@ -1,24 +1,17 @@
|
|
1
1
|
.alert {
|
2
|
-
|
2
|
+
border-bottom: 1px solid #e2e2e2;
|
3
3
|
margin: 20px auto;
|
4
|
+
padding-bottom: 20px;
|
4
5
|
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
5
|
-
background-color: #fcf8e3;
|
6
|
-
border: 1px solid #fbeed5;
|
7
|
-
-webkit-border-radius: 4px;
|
8
|
-
-moz-border-radius: 4px;
|
9
|
-
border-radius: 4px;
|
10
|
-
width: 600px;
|
11
6
|
text-align: center;
|
7
|
+
font-weight: bold;
|
8
|
+
font-size: 15px;
|
12
9
|
}
|
13
10
|
|
14
11
|
.alert.notice {
|
15
12
|
color: #468847;
|
16
|
-
background-color: #dff0d8;
|
17
|
-
border-color: #d6e9c6;
|
18
13
|
}
|
19
14
|
|
20
15
|
.alert.error {
|
21
16
|
color: #b94a48;
|
22
|
-
background-color: #f2dede;
|
23
|
-
border-color: #eed3d7;
|
24
17
|
}
|
@@ -1,7 +1,9 @@
|
|
1
|
+
require 'generators/batch/batch_generator'
|
2
|
+
|
1
3
|
module BatchManager
|
2
4
|
class BatchesController < ApplicationController
|
3
5
|
include BatchManager::Utils
|
4
|
-
before_filter :retain_batch_params, :except => [:index]
|
6
|
+
before_filter :retain_batch_params, :except => [:index, :new, :create]
|
5
7
|
helper_method :escape_batch_name
|
6
8
|
|
7
9
|
def index
|
@@ -9,6 +11,24 @@ module BatchManager
|
|
9
11
|
@details = BatchManager::Monitor.details
|
10
12
|
end
|
11
13
|
|
14
|
+
def new
|
15
|
+
template = File.read(File.join(Rails::Generators::BatchGenerator.source_root, "batch.rb"))
|
16
|
+
@content = ERB.new(template).result(binding)
|
17
|
+
end
|
18
|
+
|
19
|
+
def create
|
20
|
+
batch_name = params[:batch_name]
|
21
|
+
if batch_name.blank?
|
22
|
+
flash[:error] = "Please input the batch name."
|
23
|
+
redirect_to(new_batch_url) and return
|
24
|
+
end
|
25
|
+
file_path = File.join(BatchManager.batch_dir, batch_name)
|
26
|
+
file_path << ".rb" unless file_path.end_with?(".rb")
|
27
|
+
FileUtils.mkdir_p(File.dirname(file_path)) if batch_name.include?("/")
|
28
|
+
File.open(file_path, "w") { |f| f << params[:content] }
|
29
|
+
redirect_to(batches_url, :notice => "#{batch_name} created.")
|
30
|
+
end
|
31
|
+
|
12
32
|
def edit
|
13
33
|
@content = File.read(batch_full_path(@batch_name))
|
14
34
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= hidden_field_tag :content, @content, :id => "content" %>
|
2
|
+
<div id="editor"><%= @content %></div>
|
3
|
+
<div class="group" style="margin-top:15px;">
|
4
|
+
<div style="float:left;"><%= submit_tag "Save", :class => "btn info large" %></div>
|
5
|
+
<div style="margin-left:15px;float:left;padding-top:6px;">
|
6
|
+
<%= link_to "Cancel", batches_url, :class => "cancel" %>
|
7
|
+
</div>
|
8
|
+
</div>
|
@@ -6,12 +6,5 @@
|
|
6
6
|
</div>
|
7
7
|
|
8
8
|
<%= form_tag batch_url(escape_batch_name(@batch_name)), :method => :put do %>
|
9
|
-
<%=
|
10
|
-
<div id="editor"><%= @content %></div>
|
11
|
-
<div class="group" style="margin-top:15px;">
|
12
|
-
<div style="float:left;"><%= submit_tag "Save", :class => "btn info large" %></div>
|
13
|
-
<div style="margin-left:15px;float:left;padding-top:6px;">
|
14
|
-
<%= link_to "Cancel", batches_url, :class => "cancel" %>
|
15
|
-
</div>
|
16
|
-
</div>
|
9
|
+
<%= render "form_content" %>
|
17
10
|
<% end %>
|
@@ -8,14 +8,6 @@
|
|
8
8
|
<% end %>
|
9
9
|
</div>
|
10
10
|
</div>
|
11
|
-
<div class="group">
|
12
|
-
<% if flash[:notice] %>
|
13
|
-
<div class="alert notice"><%= flash[:notice] %></div>
|
14
|
-
<% end %>
|
15
|
-
<% if flash[:error] %>
|
16
|
-
<div class="alert error"><%= flash[:error] %></div>
|
17
|
-
<% end %>
|
18
|
-
</div>
|
19
11
|
<table>
|
20
12
|
<tr>
|
21
13
|
<th>Managed?</th>
|
@@ -31,7 +23,7 @@
|
|
31
23
|
<tr>
|
32
24
|
<td><%= status.managed?? "Yes" : "" %></td>
|
33
25
|
<td><%= status.name %></td>
|
34
|
-
<td style="text-align:right;"><%= schema_batch.try(:ran_times).to_i
|
26
|
+
<td style="text-align:right;"><%= schema_batch.try(:ran_times).to_i %><span class="divider">/</span><%= status.times_limit || 0 %></td>
|
35
27
|
<td style="text-align:center;">
|
36
28
|
<% if last_ran_at = schema_batch.try(:last_ran_at) %>
|
37
29
|
<%= last_ran_at.strftime('%Y-%m-%d %H:%M:%S') %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= javascript_include_tag "batch_manager/editor" %>
|
2
|
+
|
3
|
+
<%= form_tag batches_url do %>
|
4
|
+
<div class="group title">
|
5
|
+
<h2 style="float:left;">New Batch</h2>
|
6
|
+
<div class="new_batch" style="float:left;margin-left:25px;"><%= text_field_tag :batch_name, nil, :placeholder => "Batch name here..." %></div>
|
7
|
+
</div>
|
8
|
+
<%= render "form_content" %>
|
9
|
+
<% end %>
|
@@ -10,11 +10,20 @@
|
|
10
10
|
|
11
11
|
<header>
|
12
12
|
<div class="inner">
|
13
|
-
<h1
|
13
|
+
<h1><%= link_to "BatchManager", batches_url %></h1>
|
14
|
+
<div class="new_link"><%= link_to "NEW BATCH", new_batch_url %></div>
|
14
15
|
</div>
|
15
16
|
</header>
|
16
17
|
|
17
18
|
<div id="wrapper">
|
19
|
+
<div class="group">
|
20
|
+
<% if flash[:notice] %>
|
21
|
+
<div class="alert notice"><%= flash[:notice] %></div>
|
22
|
+
<% end %>
|
23
|
+
<% if flash[:error] %>
|
24
|
+
<div class="alert error"><%= flash[:error] %></div>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
18
27
|
<%= yield %>
|
19
28
|
</div>
|
20
29
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: batch_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weihu Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -130,9 +130,11 @@ files:
|
|
130
130
|
- app/assets/stylesheets/batch_manager/table.css
|
131
131
|
- app/controllers/batch_manager/application_controller.rb
|
132
132
|
- app/controllers/batch_manager/batches_controller.rb
|
133
|
+
- app/views/batch_manager/batches/_form_content.html.erb
|
133
134
|
- app/views/batch_manager/batches/edit.html.erb
|
134
135
|
- app/views/batch_manager/batches/index.html.erb
|
135
136
|
- app/views/batch_manager/batches/log.html.erb
|
137
|
+
- app/views/batch_manager/batches/new.html.erb
|
136
138
|
- app/views/layouts/batch_manager/application.html.erb
|
137
139
|
- app/workers/batch_manager/exec_batch_worker.rb
|
138
140
|
- config/routes.rb
|