require 'insert_from_file/version' require 'line_containing' require 'string_in_file' # module InsertFromFile def self.add_before(file_source, file_dest, str_dest) str_to_add = StringInFile.read(file_source) LineContaining.add_before(str_dest, str_to_add, file_dest) end def self.add_after(file_source, file_dest, str_dest) str_to_add = StringInFile.read(file_source) LineContaining.add_after(str_dest, str_to_add, file_dest) end def self.replace(file_source, file_dest, str_dest) str_to_add = StringInFile.read(file_source) LineContaining.replace(str_dest, str_to_add, file_dest) end def self.replace_between(file_source, file_dest, str1, str2) LineContaining.delete_between(str1, str2, file_dest) InsertFromFile.add_after(file_source, file_dest, str1) end end # Your new gem is a module by default. You may wish to use a class instead.