Class: Codeguard::Install

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/codeguard/install.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lint) ⇒ Install

Returns a new instance of Install.



11
12
13
# File 'lib/codeguard/install.rb', line 11

def initialize(lint)
  @lint = lint
end

Instance Attribute Details

#lintObject

Returns the value of attribute lint.



5
6
7
# File 'lib/codeguard/install.rb', line 5

def lint
  @lint
end

Class Method Details

.perform(lint) ⇒ Object



7
8
9
# File 'lib/codeguard/install.rb', line 7

def self.perform(lint)
  new(lint).tap(&:perform)
end

Instance Method Details

#performObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/codeguard/install.rb', line 15

def perform
  output = config_gem_path.read
  prepare_dir
  output = if write_to_file(config_project_path, output)
             "File: #{config_project_path} was updated!"
           else
             "File: #{config_project_path} was created!"
           end
  puts Rainbow(output).green
end