class Clean::Idea::Manager

Public Class Methods

new(arguments) click to toggle source
# File lib/idea.rb, line 7
def initialize(arguments)
  puts "Let the wipe begin....".yellow

  if !is_android_project?
    puts "but.. but... this isn't even an android project!".red
    exit
  end

  ideas = get_all_idea_folders
  imls = get_all_imls

  if ideas.empty? && imls.empty?
    puts "You have nothing to clean, cool!!".green
    exit
  end

  # wipe them all
  delete_them_all ideas
  delete_them_all imls

end

Public Instance Methods

delete(item) click to toggle source
# File lib/idea.rb, line 38
def delete(item)
  puts "Deleting: #{item.green}"
  FileUtils.rm_f(item) if File.exist?(item)
  FileUtils.remove_dir(item) if File.directory?(item)
end
delete_them_all(array) click to toggle source
# File lib/idea.rb, line 30
def delete_them_all array
  return nil if !array

  array.each do |item|
    delete item
  end
end
get_all_idea_folders() click to toggle source
# File lib/idea.rb, line 44
def get_all_idea_folders
  Dir.glob("#{Dir.pwd}/**/.idea/")
end
get_all_imls() click to toggle source
# File lib/idea.rb, line 48
def get_all_imls
  Dir.glob("#{Dir.pwd}/**/*.iml")
end
is_android_project?() click to toggle source
# File lib/idea.rb, line 52
def is_android_project?
  File.exists?("#{Dir.pwd}/settings.gradle")
end