├── .gitignore
├── .rspec
├── .travis.yml
├── Gemfile
├── Gemfile.lock
├── LICENSE.txt
├── README.md
├── Rakefile
├── bin
└── clean-idea
├── clean-idea.gemspec
├── extras
└── screenshot.png
├── lib
├── clean-idea
│ └── version.rb
└── idea.rb
└── spec
├── clean-idea
└── idea_spec.rb
└── spec_helper.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | /.bundle/
2 | /.yardoc
3 | /_yardoc/
4 | /coverage/
5 | /doc/
6 | /pkg/
7 | /spec/reports/
8 | /tmp/
9 |
--------------------------------------------------------------------------------
/.rspec:
--------------------------------------------------------------------------------
1 | --format documentation
2 | --color
3 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 2.2.1
4 | before_install: gem install bundler -v 1.10.6
5 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Specify your gem's dependencies in clean-idea.gemspec
4 | gemspec
5 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: .
3 | specs:
4 | clean-idea (0.2.0)
5 | colorize (~> 0.7)
6 |
7 | GEM
8 | remote: https://rubygems.org/
9 | specs:
10 | byebug (10.0.2)
11 | coderay (1.1.2)
12 | colorize (0.8.1)
13 | diff-lcs (1.3)
14 | method_source (0.9.0)
15 | pry (0.11.3)
16 | coderay (~> 1.1.0)
17 | method_source (~> 0.9.0)
18 | pry-byebug (3.6.0)
19 | byebug (~> 10.0)
20 | pry (~> 0.10)
21 | rake (10.5.0)
22 | rspec (3.7.0)
23 | rspec-core (~> 3.7.0)
24 | rspec-expectations (~> 3.7.0)
25 | rspec-mocks (~> 3.7.0)
26 | rspec-core (3.7.1)
27 | rspec-support (~> 3.7.0)
28 | rspec-expectations (3.7.0)
29 | diff-lcs (>= 1.2.0, < 2.0)
30 | rspec-support (~> 3.7.0)
31 | rspec-mocks (3.7.0)
32 | diff-lcs (>= 1.2.0, < 2.0)
33 | rspec-support (~> 3.7.0)
34 | rspec-support (3.7.1)
35 |
36 | PLATFORMS
37 | ruby
38 |
39 | DEPENDENCIES
40 | bundler (~> 1.10)
41 | clean-idea!
42 | pry-byebug (~> 3.2)
43 | rake (~> 10.0)
44 | rspec
45 |
46 | BUNDLED WITH
47 | 1.16.1
48 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 cesarferreira
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # clean-idea
2 |
3 | 
4 | [](http://badge.fury.io/rb/clean-idea)
5 | [](https://android-arsenal.com/details/1/2670)
6 |
7 |
8 | > All the `.idea/` and `*.iml`.. GONE!
9 |
10 |
11 |
12 |
13 |
14 | ## Installation
15 |
16 | $ gem install clean-idea
17 |
18 | ## License
19 |
20 | The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
21 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require "bundler/gem_tasks"
2 | require "rspec/core/rake_task"
3 |
4 | RSpec::Core::RakeTask.new(:spec)
5 |
6 | task :default => :spec
7 |
--------------------------------------------------------------------------------
/bin/clean-idea:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'bundler/setup'
3 | require "idea"
4 |
5 | Clean::Idea::Manager.new(ARGV)
6 |
--------------------------------------------------------------------------------
/clean-idea.gemspec:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | lib = File.expand_path('../lib', __FILE__)
3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4 | require 'clean-idea/version'
5 |
6 | Gem::Specification.new do |spec|
7 | spec.name = "clean-idea"
8 | spec.version = Clean::Idea::VERSION
9 | spec.authors = ["cesarferreira"]
10 | spec.email = ["cesar.manuel.ferreira@gmail.com"]
11 |
12 | spec.summary = %q{Clean up the intellij Android studio files }
13 | spec.description = %q{Clean up the intellij Android studio files }
14 | spec.homepage = "https://github.com/cesarferreira/clean-idea"
15 | spec.license = "MIT"
16 |
17 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18 | spec.bindir = "bin"
19 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20 | spec.require_paths = ["lib"]
21 |
22 | spec.required_ruby_version = '>= 2.0.0'
23 |
24 | spec.add_development_dependency "bundler", "~> 1.10"
25 | spec.add_development_dependency "rake", "~> 10.0"
26 | spec.add_development_dependency 'pry-byebug', '~> 3.2'
27 | spec.add_development_dependency "rspec"
28 |
29 | spec.add_dependency 'colorize', '~> 0.7'
30 | end
31 |
--------------------------------------------------------------------------------
/extras/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarferreira/clean-idea/be6417bafdac2efb47f34c22a261c465eab821e8/extras/screenshot.png
--------------------------------------------------------------------------------
/lib/clean-idea/version.rb:
--------------------------------------------------------------------------------
1 | module Clean
2 | module Idea
3 | VERSION = "0.3.0"
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/lib/idea.rb:
--------------------------------------------------------------------------------
1 | require 'colorize'
2 | require 'fileutils'
3 |
4 | module Clean
5 | module Idea
6 | class Manager
7 | def initialize(arguments)
8 | puts "Let the wipe begin....".yellow
9 |
10 | if !is_android_project?
11 | puts "but.. but... this isn't even an android project!".red
12 | exit
13 | end
14 |
15 | ideas = get_all_idea_folders
16 | imls = get_all_imls
17 |
18 | if ideas.empty? && imls.empty?
19 | puts "You have nothing to clean, cool!!".green
20 | exit
21 | end
22 |
23 | # wipe them all
24 | delete_them_all ideas
25 | delete_them_all imls
26 |
27 | end
28 |
29 |
30 | def delete_them_all array
31 | return nil if !array
32 |
33 | array.each do |item|
34 | delete item
35 | end
36 | end
37 |
38 | def delete(item)
39 | puts "Deleting: #{item.green}"
40 | FileUtils.rm_f(item) if File.exist?(item)
41 | FileUtils.remove_dir(item) if File.directory?(item)
42 | end
43 |
44 | def get_all_idea_folders
45 | Dir.glob("#{Dir.pwd}/**/.idea/")
46 | end
47 |
48 | def get_all_imls
49 | Dir.glob("#{Dir.pwd}/**/*.iml")
50 | end
51 |
52 | def is_android_project?
53 | File.exists?("#{Dir.pwd}/settings.gradle")
54 | end
55 | end
56 | end
57 | end
58 |
--------------------------------------------------------------------------------
/spec/clean-idea/idea_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Clean::Idea do
4 | # it 'has a version number' do
5 | # expect(Clean::Idea::VERSION).not_to be nil
6 | # end
7 |
8 | it 'does something useful' do
9 | expect(false).to eq(false)
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2 | require 'idea'
3 |
--------------------------------------------------------------------------------