Module: Ignorance

Defined in:
lib/ignorance.rb,
lib/ignorance/version.rb,
lib/ignorance/ignore_file.rb,
lib/ignorance/hg_ignore_file.rb,
lib/ignorance/git_ignore_file.rb,
lib/ignorance/svn_ignore_file.rb,
lib/ignorance/project_oriented_vcs.rb

Defined Under Namespace

Modules: ProjectOrientedVCS Classes: GitIgnoreFile, HgIgnoreFile, IgnoreFile, IgnorefileError, SvnIgnoreFile

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.advise(token) ⇒ Object



11
12
13
14
15
# File 'lib/ignorance.rb', line 11

def advise(token)
  active_ignore_files.each do |ignore_file|
    warning token, ignore_file unless ignore_file.ignored?(token)
  end
end

.guarantee!(token, comment = nil) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/ignorance.rb', line 39

def guarantee!(token, comment=nil)
  active_ignore_files.each do |ignore_file|
    unless ignore_file.ignored?(token)
      ignore_file.ignore! token, comment
    end
  end
end

.guard(token) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/ignorance.rb', line 17

def guard(token)
  active_ignore_files.each do |ignore_file|
    unless ignore_file.ignored?(token)
      raise IgnorefileError.new "Please add \"#{token}\" to this project's #{ignore_file.name} file!"
    end
  end
end

.negotiate(token, comment = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ignorance.rb', line 25

def negotiate(token, comment=nil)
  active_ignore_files.each do |ignore_file|
    unless ignore_file.ignored?(token)
      msg = "would you like me to add #{token} to this project's #{ignore_file.name} file automatically?"
      if agree? msg
        guarantee! token, comment
        puts "Added \"#{token}\" to this project's #{ignore_file.name} file."
      else
        warning token, ignore_file
      end
    end
  end
end

Instance Method Details

#advise_ignorance(token) ⇒ Object



67
68
69
# File 'lib/ignorance.rb', line 67

def advise_ignorance(token)
  Ignorance.advise token, comment
end

#guarantee_ignorance!(token, comment = nil) ⇒ Object



79
80
81
# File 'lib/ignorance.rb', line 79

def guarantee_ignorance!(token, comment=nil)
  Ignorance.guarantee! token, comment
end

#guard_ignorance(token) ⇒ Object



71
72
73
# File 'lib/ignorance.rb', line 71

def guard_ignorance(token)
  Ignorance.guard token, comment
end

#negotiate_ignorance(token, comment = nil) ⇒ Object



75
76
77
# File 'lib/ignorance.rb', line 75

def negotiate_ignorance(token, comment=nil)
  Ignorance.negotiate token, comment
end