Commit 7de962c5 authored by charlie-ablett's avatar charlie-ablett

Logging available per step execution. Pass on execution parameters to step.

parent 41f37a78
PATH
remote: .
specs:
ink_step (0.1.15)
ink_step (0.2.0)
awesome_print
httparty
rubyzip
......
......@@ -16,13 +16,14 @@ module InkStep
INPUT_FILE_DIRECTORY_NAME = "input_files"
OUTPUT_FILE_DIRECTORY_NAME = "output_files"
def initialize(chain_file_location:, position:, next_step: nil)
def initialize(chain_file_location:, position:, next_step: nil, execution_parameters: {})
@position = position
@next_step = next_step
@chain_file_location = chain_file_location
@position = position
@errors = []
@execution_parameters = execution_parameters
@required_parameters = []
@successful = nil
@errors = []
@notes = []
end
......@@ -99,7 +100,7 @@ module InkStep
def log_as_step(message)
message_with_metadata = "#{Time.now.utc.strftime("%y-%m-%d %H:%M:%S")} [#{self.class.name}] - #{message}"
ap message_with_metadata
process_log << message_with_metadata.gsub(working_directory, "$working_directory")
process_log << message_with_metadata
end
def success!
......
......@@ -77,16 +77,6 @@ module InkStep
end
end
end
def extract_contents(input_file)
if input_file.respond_to? :read
input_file.read
elsif input_file.is_a? String && File.exist?(input_file)
File.read(input_file)
else
raise input_file
end
end
end
end
end
\ No newline at end of file
module InkStep
VERSION = '0.1.15'
VERSION = '0.2.0'
end
\ No newline at end of file
......@@ -83,16 +83,9 @@ describe InkStep::Base do
end
end
context 'for a message without a path' do
context 'for a message with a path' do
let(:message) { "#{working_directory}/input_files/input_file.html is a great file!" }
it 'strips the absolute path info from the process log' do
subject.send(:log_as_step, message)
expect(subject.process_log).to_not include(/#{working_directory}/)
expect(subject.process_log).to include(/\$working_directory\/input_files\/input_file\.html is a great file!/)
end
it 'includes the absolute path in the server logs' do
expect(subject).to receive(:ap).with(/#{message}/)
......@@ -182,7 +175,7 @@ describe InkStep::Base do
end
describe '#version' do
context "if InkStep::Base is being used (for some reason? it doesn't do anything really :P)" do
context "if InkStep::Base is being used for some reason" do
specify do
expect(subject.version).to eq InkStep::VERSION
end
......@@ -202,7 +195,7 @@ describe InkStep::Base do
end
describe '#description' do
context "if InkStep::Base is being used (for some reason? it doesn't do anything really :P)" do
context "if InkStep::Base is being used for some reason" do
specify do
expect(InkStep::Base.description).to eq "A basic step that returns the files you provide unchanged"
expect(InkStep::ConversionStep.description).to eq "A generic step to facilitate conversion"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment