Module: Hoe::Ignore

Includes:
Rake::DSL
Defined in:
lib/hoe/ignore.rb

Constant Summary collapse

VERSION =
'1.0.0'

Instance Method Summary collapse

Instance Method Details

#check_manifestObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/hoe/ignore.rb', line 21

def check_manifest
  dirs, fmatch = File.read(".hoeignore").split("\n").partition { |x| x[-1,1] == "/" }

  f = "Manifest.tmp"
  require 'find'
  files = []
  with_config do |config, _|
    exclusions = config["exclude"]

    Find.find '.' do |path|
      if File.directory? path
        Find.prune if dirs.index("#{path[2..-1]}/")
        next
      end

      next unless File.file? path
      next if fmatch.find { |x| File.fnmatch?(x, path[2..-1]) }
      files << path[2..-1]
    end

    files = files.sort.join "\n"

    File.open f, 'w' do |fp| fp.puts files end

    verbose = { :verbose => Rake.application.options.verbose }

    begin
      sh "#{Hoe::Debug::DIFF} -du Manifest.txt #{f}", verbose
    ensure
      rm f, verbose
    end
  end
end

#define_ignore_tasksObject



13
14
15
16
17
18
19
# File 'lib/hoe/ignore.rb', line 13

def define_ignore_tasks
  return unless File.exists? ".hoeignore"

  task :check_manifest => :clean do
    check_manifest
  end
end

#initialize_ignoreObject



10
11
# File 'lib/hoe/ignore.rb', line 10

def initialize_ignore
end