Class: DakeProtocol::Protocol
- Inherits:
-
Object
- Object
- DakeProtocol::Protocol
- Defined in:
- lib/dake/protocol.rb
Constant Summary collapse
- EXT_NAME =
''
Instance Attribute Summary collapse
-
#exec_path ⇒ Object
readonly
Returns the value of attribute exec_path.
-
#script_stderr ⇒ Object
readonly
Returns the value of attribute script_stderr.
-
#script_stdout ⇒ Object
readonly
Returns the value of attribute script_stdout.
Instance Method Summary collapse
- #create_script ⇒ Object
- #execute_step(log = false) ⇒ Object
-
#initialize(step, analyzer, dake_db, dry_run) ⇒ Protocol
constructor
A new instance of Protocol.
- #script_file ⇒ Object
Constructor Details
#initialize(step, analyzer, dake_db, dry_run) ⇒ Protocol
Returns a new instance of Protocol.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dake/protocol.rb', line 5 def initialize(step, analyzer, dake_db, dry_run) @step = step @analyzer = analyzer @dake_db = dake_db date = DAKE_EXEC_TIME.strftime('%Y%m%d') time = DAKE_EXEC_TIME.strftime('%H_%M_%S') @exec_path = "#{@dake_db.database_path}/#{date}/#{time}_#{DAKE_EXEC_PID}" @script_stdout = "#{@exec_path}/step.#{@step.object_id}.out" @script_stderr = "#{@exec_path}/step.#{@step.object_id}.err" FileUtils.mkdir_p(@exec_path) if not dry_run and not File.exist? @exec_path end |
Instance Attribute Details
#exec_path ⇒ Object (readonly)
Returns the value of attribute exec_path.
4 5 6 |
# File 'lib/dake/protocol.rb', line 4 def exec_path @exec_path end |
#script_stderr ⇒ Object (readonly)
Returns the value of attribute script_stderr.
4 5 6 |
# File 'lib/dake/protocol.rb', line 4 def script_stderr @script_stderr end |
#script_stdout ⇒ Object (readonly)
Returns the value of attribute script_stdout.
4 5 6 |
# File 'lib/dake/protocol.rb', line 4 def script_stdout @script_stdout end |
Instance Method Details
#create_script ⇒ Object
21 22 23 24 25 26 |
# File 'lib/dake/protocol.rb', line 21 def create_script file = File.open(script_file, 'w') file.write @step.cmd_text file.close file end |
#execute_step(log = false) ⇒ Object
28 29 |
# File 'lib/dake/protocol.rb', line 28 def execute_step(log=false) end |
#script_file ⇒ Object
17 18 19 |
# File 'lib/dake/protocol.rb', line 17 def script_file "#{@exec_path}/step.#{@step.object_id}.#{self.class::EXT_NAME}" end |