Sha256: 3cf86f78adf4ed2e2f6d935061ff5809298cfbfd75f7bf74ec7d35281061f151
Contents?: true
Size: 806 Bytes
Versions: 27
Compression:
Stored size: 806 Bytes
Contents
Rails::Generator::Commands::Base.class_eval do def file_contains?(relative_destination, line) File.read(destination_path(relative_destination)).include?(line) end end Rails::Generator::Commands::Create.class_eval do def insert_into(file, line) logger.insert "#{line} into #{file}" unless options[:pretend] || file_contains?(file, line) gsub_file file, /^(class|module) .+$/ do |match| "#{match}\n #{line}" end end end end Rails::Generator::Commands::Destroy.class_eval do def insert_into(file, line) logger.remove "#{line} from #{file}" unless options[:pretend] gsub_file file, "\n #{line}", '' end end end Rails::Generator::Commands::List.class_eval do def insert_into(file, line) logger.insert "#{line} into #{file}" end end
Version data entries
27 entries across 27 versions & 2 rubygems