Class: Renegade::ProtectedFiles

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

Overview

Check protected files

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProtectedFiles

Returns a new instance of ProtectedFiles.



8
9
10
11
12
# File 'lib/renegade/protected_files.rb', line 8

def initialize
  # Instance variables
  @warnings = []
  @protected_files = ['app.config', 'web.config']
end

Instance Attribute Details

#protected_filesObject (readonly)

Returns the value of attribute protected_files.



6
7
8
# File 'lib/renegade/protected_files.rb', line 6

def protected_files
  @protected_files
end

#warningsObject (readonly)

Returns the value of attribute warnings.



6
7
8
# File 'lib/renegade/protected_files.rb', line 6

def warnings
  @warnings
end

Instance Method Details

#run(files) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/renegade/protected_files.rb', line 14

def run(files)
  files.each do |file|
    if @protected_files.include?(File.basename(file).downcase)
      @warnings.push 'Warning! You are making changes to: ' + file.highlight
    end
  end
end