Class: Reflection::Command::Base

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

Direct Known Subclasses

Apply, Stash

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(new_config) ⇒ Base

Returns 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

Instance Attribute Details

#configObject

Returns the value of attribute config.



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

def config
  @config
end

Class Method Details

.run!(config) ⇒ Object



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

Instance Method Details

#validateObject



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

def validate
  Reflection::Validations
end

#verify_that_target_is_not_a_repository(target_directory) ⇒ Object



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