Class: Shoe::Tasks::Clean

Inherits:
Task
  • Object
show all
Defined in:
lib/shoe/tasks/clean.rb

Overview

Defines `rake clean` to remove .gitignored files and directories.

Uses something like `{git clean}[http://www.kernel.org/pub/software/scm/git/docs/git-clean.html] -fdX`, except preserves .bundle/.

To enable, version your project with git.

To configure, edit your {.gitignore}[http://www.kernel.org/pub/software/scm/git/docs/gitignore.html].

Instance Attribute Summary

Attributes inherited from Task

#spec

Instance Method Summary collapse

Methods inherited from Task

#initialize

Constructor Details

This class inherits a constructor from Shoe::Tasks::Task

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/shoe/tasks/clean.rb', line 16

def active?
  File.directory?('.git')
end

#defineObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/shoe/tasks/clean.rb', line 20

def define
  desc "    Remove ignored files.\n    Configure via your .gitignore file. Uses something like `git clean -fdX`,\n    except preserves .bundle/.\n  END\n\n  task :clean do\n    rm_r ignored_files - preserved_files\n  end\nend\n".gsub(/^ */, '')