Sha256: 2b466691c9aa4f5913fe6bdecf56991fe31e279297db82f5d6ed5dbfb7b15e32
Contents?: true
Size: 912 Bytes
Versions: 2
Compression:
Stored size: 912 Bytes
Contents
module Localtower class Status def run files = Dir["#{Rails.root}/db/migrate/*.rb"].sort.reverse db_migrations = begin ActiveRecord::Base.connection.execute("select * from schema_migrations;") rescue => e [] end db_migrations = db_migrations.map { |e| e["version"].to_s } files.map do |file_full_path| name = file_full_path.split("/")[-1] # add_email_to_user.rb time = name.split("_")[0] # 201203890987 status = db_migrations.include?(time) ? :done : :todo content = File.open(file_full_path).read relative_path = file_full_path.gsub(Rails.root.to_s, '') { "file_full_path" => file_full_path, "name" => name, "time" => time.to_i, "status" => status, "content" => content, "relative_path" => relative_path } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
localtower-2.0.1 | lib/localtower/status.rb |
localtower-2.0.0 | lib/localtower/status.rb |