module SimpleDataMigrations::Utils

Public Class Methods

humanize_filename(filename) click to toggle source
# File lib/simple_data_migrations/utils.rb, line 21
def self.humanize_filename(filename)
  return "********** NO FILE **********" unless filename

  filename.delete_prefix(version(filename)).delete_suffix(".rb").humanize
end
ran_versions() click to toggle source
# File lib/simple_data_migrations/utils.rb, line 9
def self.ran_versions
  Entry.pluck(:version)
end
root() click to toggle source
# File lib/simple_data_migrations/utils.rb, line 13
def self.root
  Rails.root.join("db/data")
end
script_files() click to toggle source
# File lib/simple_data_migrations/utils.rb, line 5
def self.script_files
  Dir.children(root).sort
end
version(filename) click to toggle source
# File lib/simple_data_migrations/utils.rb, line 17
def self.version(filename)
  filename.split("_", 2).first
end