dataloaderb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,10 +4,13 @@ module Dataloaderb
|
|
4
4
|
class ProcessRunner
|
5
5
|
# Create the process runner and specify the path to
|
6
6
|
# the Apex Data Loader executable (batch) files.
|
7
|
-
def initialize(bin_path, opts = {})
|
7
|
+
def initialize(bin_path, opts = {}, &block)
|
8
8
|
@bin_path = bin_path
|
9
9
|
@conf_path = nil
|
10
10
|
@opts = opts
|
11
|
+
if block_given?
|
12
|
+
instance_eval(&block)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
|
13
16
|
# Run one or more processes. Specify the processes to run by passing
|
data/lib/dataloaderb/version.rb
CHANGED
@@ -63,8 +63,18 @@ describe Dataloaderb::ProcessRunner do
|
|
63
63
|
describe "#execute_process" do
|
64
64
|
it "should return the result of the executable" do
|
65
65
|
@runner.stub!(:get_process_execute_command).and_return("./spec/fixtures/bin/test.sh")
|
66
|
-
result = @runner.execute_process 'fixutres/processes/sample_proc.yml'
|
66
|
+
result = @runner.execute_process 'spec/fixutres/processes/sample_proc.yml'
|
67
67
|
result.strip.should == "result of process"
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
describe "with a passed block" do
|
72
|
+
it "should execute the block in the scope of the instance" do
|
73
|
+
Dataloaderb::ProcessRunner.new('spec/fixtures/bin') do
|
74
|
+
self.stub!(:get_process_execute_command).and_return("./spec/fixtures/bin/test.sh")
|
75
|
+
result = execute_process 'spec/fixutres/processes/sample_proc.yml'
|
76
|
+
result.strip.should == "result of process"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
70
80
|
end
|