Sha256: 4a3253e46cbe78866e37d93b4fe4d93ef36ad1a7e527f3fd1ecc05e81e1a1594

Contents?: true

Size: 839 Bytes

Versions: 15

Compression:

Stored size: 839 Bytes

Contents

# encoding: utf-8
module LocalPac
  module Actions
    class CreateRepository
      private

      attr_reader :vcs_engine, :path, :options

      public

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

      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

      private

      def need_to_run?
        !::File.exists?(path)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
local_pac-0.10.2 lib/local_pac/actions/create_repository.rb
local_pac-0.10.1 lib/local_pac/actions/create_repository.rb
local_pac-0.10.0 lib/local_pac/actions/create_repository.rb
local_pac-0.9.0 lib/local_pac/actions/create_repository.rb
local_pac-0.7.0 lib/local_pac/actions/create_repository.rb
local_pac-0.6.3 lib/local_pac/actions/create_repository.rb
local_pac-0.6.2 lib/local_pac/actions/create_repository.rb
local_pac-0.6.1 lib/local_pac/actions/create_repository.rb
local_pac-0.5.0 lib/local_pac/actions/create_repository.rb
local_pac-0.4.0 lib/local_pac/actions/create_repository.rb
local_pac-0.3.0 lib/local_pac/actions/create_repository.rb
local_pac-0.2.3 lib/local_pac/actions/create_repository.rb
local_pac-0.2.2 lib/local_pac/actions/create_repository.rb
local_pac-0.2.1 lib/local_pac/actions/create_repository.rb
local_pac-0.2.0 lib/local_pac/actions/create_repository.rb