Sha256: 75c8a42e5b39e38c11e16785a2bcb94db726ef55f28300165fac2fd24ba29ae4
Contents?: true
Size: 1.48 KB
Versions: 4
Compression:
Stored size: 1.48 KB
Contents
class UseCase attr_accessor :use_case_dir_path, :files_to_write, :commands_to_execute USE_CASE_FILE_NAME = 'use_case.md' TEMPLATE_FILE_NAME = 'use_case_template.md' def initialize(use_case_dir_path) self.use_case_dir_path = use_case_dir_path self.files_to_write = {} self.commands_to_execute = [] end def build Dir.chdir(use_case_dir_path) do files_to_write.each_pair do |file_name, text| File.open(file_name, 'w') do |file| file.write(text) end end commands_to_execute.each do |command| system(command) end end end def construct_command(command, template_file_path, markdown_file_path, pristine = false) pristine_option = pristine ? '--pristine ' : '' "markdown_helper #{command} #{pristine_option}#{template_file_path} #{markdown_file_path}" end def construct_include_command(template_file_path, markdown_file_path, pristine = false) construct_command(:include, template_file_path, markdown_file_path, pristine) end def construct_resolve_command(template_file_path, markdown_file_path, pristine = false) construct_command(:resolve, template_file_path, markdown_file_path, pristine) end def UseCase.construct_include_command(template_file_path, markdown_file_path, pristine = false) pristine_option = pristine ? '--pristine ' : '' "markdown_helper include #{pristine_option}#{template_file_path} #{markdown_file_path}" end end
Version data entries
4 entries across 4 versions & 1 rubygems