require_relative '../use_case' class IncludeUseCase < UseCase attr_accessor :use_case_dir_name INCLUDE_DIR_PATH = File.dirname(__FILE__) INCLUDEE_FILE_NAME = 'includee.md' INCLUDER_FILE_NAME = 'includer.md' INCLUDED_FILE_NAME = 'included.md' RUBY_FILE_NAME = 'include.rb' RUBY_COMMAND = "ruby #{RUBY_FILE_NAME}" INCLUDE_COMMAND = IncludeUseCase.construct_include_command(INCLUDER_FILE_NAME, INCLUDED_FILE_NAME, pristine = true) BUILD_COMMAND = UseCase.construct_include_command(TEMPLATE_FILE_NAME, USE_CASE_FILE_NAME, pristine = true) def initialize(use_case_dir_name) super commands_to_execute.push(RUBY_COMMAND) if File.exist?(RUBY_FILE_NAME) commands_to_execute.push(BUILD_COMMAND) if File.exist?(TEMPLATE_FILE_NAME) self.use_case_dir_name = use_case_dir_name end def use_case_dir_path File.join(File.absolute_path(File.dirname(__FILE__)), use_case_dir_name) end def write_includee_file File.write( INCLUDEE_FILE_NAME, < true)' : '' File.write( RUBY_FILE_NAME, <