Sha256: fcc2155409d56cb76743dee18524d807dddea27e4151cf6c5e0545defb354ccf

Contents?: true

Size: 1.37 KB

Versions: 11

Compression:

Stored size: 1.37 KB

Contents

namespace :cmstyle do
  desc "Cleanup CmStyle from rails app"
  task :cleanup do

    puts "Cleaning up CmStyle from rails app..."
  
    puts "NOTE: We DELETE all copied stuff from cmstyle. If you did local adjustments, they get lost!"
    Rake::Task["cmstyle:ask_question"].invoke 
  end
  
  task :ask_question do
    puts "Do you want to proceed with the task(Y/N)?"
    get_input
  end

  task :continue do
    puts "Task starting..."
    
    view_files = Dir.glob(Rails.root + "app/views/layouts/*.slim")
    
    application_js = Rails.root + "app/assets/javascripts/application.js"
    application_css = Rails.root + "app/assets/stylesheets/application.css"
    images = Dir.glob(Rails.root + "app/assets/images/novartis*")
  
    puts "Removing layout view files from app/views/layouts"
    FileUtils.rm_r view_files
    
    puts "Removing application js and css files from app/assets"
    FileUtils.rm_r application_js
    FileUtils.rm_r application_css
    
    puts "Removing Novartis Image files from app/assets/images"
    FileUtils.rm_r images
    
    puts "Done."
  end
  
  def get_input
    STDOUT.flush
    input = STDIN.gets.chomp
    case input.upcase
    when "Y"
      puts "Ok, going through with the task.."
      Rake::Task["cmstyle:continue"].invoke
    when "N"
      puts "aborting the task.."
    else
      puts "Please enter Y or N"
      get_input
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
cmstyle-0.1.3 lib/tasks/cleanup.rake
cmstyle-0.1.2 lib/tasks/cleanup.rake
cmstyle-0.1.1 lib/tasks/cleanup.rake
cmstyle-0.1.0 lib/tasks/cleanup.rake
cmstyle-0.0.18 lib/tasks/cleanup.rake
cmstyle-0.0.17 lib/tasks/cleanup.rake
cmstyle-0.0.16 lib/tasks/cleanup.rake
cmstyle-0.0.15 lib/tasks/cleanup.rake
cmstyle-0.0.14 lib/tasks/cleanup.rake
cmstyle-0.0.13 lib/tasks/cleanup.rake
cmstyle-0.0.12 lib/tasks/cleanup.rake