Class: GemLeaves

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_leaves.rb

Overview

Amateurish prototype of a tool to check the installed gems looking for leaves that can be removed.

I call leaves those gems with no reverse dependency that can be removed without breaking anything. Of course, users may desire to keep something around even if nothing depends on it, so this tool looks for and loads a simple YAML configuration file:

ignore:
  RedCloth: >= 0
  capistrano: >= 2
  mongrel_cluster: >= 0
  piston: >= 0
  rake: >= 0.7
  rubygems-update: >= 0
  ruport-util: = 0.10.0
  sources: >= 0

gem_leaves can generate its own configuration file merging the leaves list with the content of an already loaded configuration file (if any). The tool looks for the default configuration file, .gem_leaves.yml, in the current working directory and the user’s home directory.

Constant Summary collapse

VERSION =
'1.0.9'

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ GemLeaves

Returns a new instance of GemLeaves.



31
32
33
34
35
36
# File 'lib/gem_leaves.rb', line 31

def initialize(args)
  @options = {:color => "d0ed0e"}
  @configuration = {}
  @leaves = []
  parse_options(args)
end

Instance Method Details

#runObject



38
39
40
41
42
43
# File 'lib/gem_leaves.rb', line 38

def run
  load_config_file
  find_leaves
  show_leaves
  generate_config_file
end