Sha256: a51ff81cabe4ffde70f32a7427f6e7ad6bcef4e063ea8a254740410b23ce8cf3
Contents?: true
Size: 1.36 KB
Versions: 9
Compression:
Stored size: 1.36 KB
Contents
class UseCase attr_accessor :files_to_write, :commands_to_execute USE_CASE_FILE_NAME = 'use_case.md' TEMPLATE_FILE_NAME = 'use_case_template.md' BUILDER_FILE_NAME = 'use_case_builder.rb' def initialize self.files_to_write = {} self.commands_to_execute = [] end def build files_to_write.each_pair do |file_name, text| File.open(file_name, 'w') do |file| file.write(text) end end if File.exist?('includer.md') command = self.construct_include_command('includer.md','included.md', pristine = true) system(command) end commands_to_execute.each do |command| system(command) 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 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
9 entries across 9 versions & 1 rubygems