bin/diagram
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\nCommand #{args} failed")
end
chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.
puts 'Generating model diagram'
railroady_cmd = 'railroady -blamM --hide-through'
sed_cmd = 'sed -r \'s/\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g\''
neato_cmd = 'neato -Tsvg'
output = './doc/models_brief.svg'
cmd = "#{railroady_cmd} | #{sed_cmd} | #{neato_cmd} > #{output}"
system! cmd
end