Sha256: e577b61994747011fcc24febe3abb1c4eb9ede5b85f46940950848e65484cc93

Contents?: true

Size: 779 Bytes

Versions: 6

Compression:

Stored size: 779 Bytes

Contents

namespace :canard do
  desc 'Upgrades deprecated ability definition syntax and moves the files from abilities to app/abilities'
  task :upgrade => :environment do
    require 'rake/clean'
    source_path = 'abilities'
    destination_path = Canard::Abilities.definition_paths.first

    Dir.mkdir(destination_path) unless Dir.exists?(destination_path)

    if Dir.exists?(source_path)
      Dir[File.join(source_path, '*.rb')].each do |input_file|
        input = File.read(input_file)
        output = input.gsub(/abilities_for/, 'Canard::Abilities.for')
        output_file = File.expand_path(File.basename(input_file), destination_path)
        File.write(output_file, output)
        File.delete(input_file)
      end
      Dir.delete(source_path)
    else
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
canard-0.5.0.pre lib/tasks/canard.rake
canard-0.4.3 lib/tasks/canard.rake
canard-0.4.2.pre lib/tasks/canard.rake
canard-0.4.1 lib/tasks/canard.rake
canard-0.4.0 lib/tasks/canard.rake
canard-0.4.0.pre lib/tasks/canard.rake