simplews 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simplews/jobs.rb +4 -0
- data/lib/simplews/rake.rb +19 -7
- metadata +2 -2
data/lib/simplews/jobs.rb
CHANGED
data/lib/simplews/rake.rb
CHANGED
@@ -5,19 +5,24 @@ require 'rake'
|
|
5
5
|
|
6
6
|
class SimpleWS::Jobs::Scheduler::Job
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
# Add step information to rule tasks, as the 'desc' method cannot be used to
|
9
|
+
# describe them for the time being.
|
10
|
+
def add_description(reg_exp, step, message)
|
11
|
+
@step_descriptions ||= {}
|
12
|
+
@step_descriptions[Regexp.new(reg_exp)] = "#{ step }: #{ message }"
|
11
13
|
end
|
12
14
|
|
15
|
+
# Instruct rake to load the rakefile, named Rakefile by default, and use it
|
16
|
+
# to produce the file specified first as product of the web service task. The
|
17
|
+
# 'execute' method of the Rake::Tasks class method execute is monkey-patched
|
18
|
+
# to log the steps. Since this is executed on a new process, there should be
|
19
|
+
# no side-effects from the patching.
|
13
20
|
def rake(rakefile = "Rakefile")
|
14
|
-
$_current_job = self
|
15
|
-
$_step_messages = @step_messages || {}
|
16
21
|
Rake::Task.class_eval <<-'EOC'
|
17
22
|
alias_method :old_execute, :execute
|
18
23
|
def execute(*args)
|
19
24
|
action = name
|
20
|
-
message = $
|
25
|
+
message = $_step_desriptions.collect{|rexp, msg|
|
21
26
|
if name.match(rexp)
|
22
27
|
msg
|
23
28
|
else
|
@@ -39,8 +44,15 @@ class SimpleWS::Jobs::Scheduler::Job
|
|
39
44
|
end
|
40
45
|
EOC
|
41
46
|
|
47
|
+
$step_descriptions = {}
|
42
48
|
load rakefile
|
43
|
-
|
49
|
+
$step_descriptions.each{|re, info|
|
50
|
+
add_description(re, info[:step], info[:message])
|
51
|
+
}
|
52
|
+
files = result_filenames
|
53
|
+
|
54
|
+
$_current_job = self
|
55
|
+
$_step_desriptions = @step_descriptions || {}
|
44
56
|
Rake::Task[files.first].invoke
|
45
57
|
end
|
46
58
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplews
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-08 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|