Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b1edae008e
Fetching contributors…

Cannot retrieve contributors at this time

file 17 lines (16 sloc) 0.609 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
namespace :backtastic do
  namespace :validations do
    desc "Build put validation metadata in app/assets/javascripts"
    task :build => :environment do
      output = ENV["VALIDATIONS_FILE"] || Rails.root.join("app", "assets", "javascripts", "rails_validations.coffee")
      Dir[Rails.root.join "app", "models", '**', '*.rb'].each do |file|
        begin
          require file
        rescue
        end
      end

      erb = ERB.new File.read(File.join(File.dirname(__FILE__), "..", "templates", "rails_validations.coffee.erb"))
      File.open(output, "w") { |f| f.puts(erb.result) }
    end
  end
end
Something went wrong with that request. Please try again.