Class: Reflection::Command::Base

Inherits:
Object
Defined in:
lib/reflection/command/base.rb

Attribute Summary

Method Summary

Constructor Details

- (Base) initialize(new_config)

A new instance of Base

Returns:

  • (Base) — a new instance of Base


12
13
14
# File 'lib/reflection/command/base.rb', line 12

def initialize(new_config)
  self.config = new_config
end

Attribute Details

- (Object) config

Returns the value of attribute config



4
5
6
# File 'lib/reflection/command/base.rb', line 4

def config
  @config
end

Method Details

+ (Object) run!(config)



6
7
8
9
10
# File 'lib/reflection/command/base.rb', line 6

def self.run!(config)
  command = self.new(config)
  command.validate! if command.respond_to?(:validate!)
  command.run!
end

- (Object) validate



16
17
18
# File 'lib/reflection/command/base.rb', line 16

def validate
  Reflection::Validations
end

- (Object) verify_that_target_is_not_a_repository(target_directory)



20
21
22
23
24
# File 'lib/reflection/command/base.rb', line 20

def verify_that_target_is_not_a_repository(target_directory)
  if Repository.exists?(target_directory.path)
    Support.exit_with_error "The specified --directory is a repository. Reflection is afraid of breaking something, so it won't touch it. Pleace specify another one.."
  end
end