Skip to content

Instantly share code, notes, and snippets.

Last active April 18, 2017 08:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
#!/usr/bin/env ruby
require 'csv-diff'
require 'pp'
file1 = ARGV[0]
file2 = ARGV[1]
IGNORE = ['created_at', 'updated_at', 'deleted_at']
ignore_moves: true,
courses: {
key_fields: 'id',
ignore_fields: IGNORE,
people: {
key_fields: 'id',
ignore_fields: IGNORE + ['access_token'],
parallels: {
key_fields: 'id',
ignore_fields: IGNORE + ['student_ids'],
rooms: {
key_fields: 'id',
ignore_fields: IGNORE,
timetable_slots: {
key_fields: 'id',
ignore_fields: IGNORE,
file_params = DIFF_PARAMS.find {|k, v| file1.include? k.to_s}
unless file_params
puts "File #{file1} does not match any key"
file_id, file_v = file_params
params = COMMON_PARAMS.merge(file_v)
diff =, file2, params)
puts '#### DELETED'
pp diff.deletes
puts '#### ADDED'
pp diff.adds
puts '#### CHANGED'
pp diff.updates
puts 'Summary'
pp diff.summary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment