Module: KatanaStamp

Defined in:
lib/katana_stamp.rb,
lib/katana_stamp/version.rb,
lib/katana_stamp/stamp_file.rb

Defined Under Namespace

Classes: StampFile

Constant Summary collapse

DIR_PATTERS =
[ "app/**/*.rb", "lib/**/*.rb" ]
VERSION =
"1.1.0"

Class Method Summary collapse

Class Method Details

.run!(options = {}) ⇒ Object

Stamps all files matching DIR_PATTERNS and the --include-paths option unless they have already been stamped



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/katana_stamp.rb', line 9

def run!(options={})
  options[:exclude_paths] ||= []
  options[:include_paths].each do |path|
    DIR_PATTERS << path
  end if options[:include_paths]
  
  DIR_PATTERS.each do |main_dir|
    Dir.glob(main_dir).each do |path|
      # skip to the next file if this file matches exclude_paths
      next if options[:exclude_paths].detect { |pattern| File.fnmatch(pattern, path) }
      StampFile.new(path, options).stamp!
    end      
  end
  true # return true (success)
end