Class: LocalPac::Actions::CreateRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/local_pac/actions/create_repository.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}, vcs_engine = GitRepository) ⇒ CreateRepository

Returns a new instance of CreateRepository.



11
12
13
14
15
# File 'lib/local_pac/actions/create_repository.rb', line 11

def initialize(path, options = {}, vcs_engine = GitRepository)
  @path        =::File.expand_path(path)
  @options     = options
  @vcs_engine  = vcs_engine
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/local_pac/actions/create_repository.rb', line 17

def run
  if need_to_run? || options[:force] == true
    LocalPac.ui_logger.warn "Creating repository \"#{path}\"."

    repo = vcs_engine.create(path)
    repo.add_content('README.md', 'Please place your proxy.pac-files here.')

  else
    LocalPac.ui_logger.warn "Repository \"#{path}\" already exists. Do not create it again!."
  end
end