Sha256: cc991a440f177193a01b34e29bd67701e02fdcb14dabba04e406f3c892ff6389

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 Bytes

Contents

module Pbmenv
  class DownloadSrcService
    class DownloadError < StandardError; end

    attr_accessor :version

    def initialize(version)
      self.version = version
    end

    def execute!
      pathname = VersionPathname.new(version)
      pathname.src_pbm_path
      if ENV["DEBUG_INSTALL"]
        shell = <<~SHELL
          git clone https://github.com/splaplapla/procon_bypass_man.git #{pathname.src_pbm_path}
        SHELL
      else
        # TODO cache for testing
        shell = <<~SHELL
          curl -L https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v#{version}.tar.gz | tar xvz -C /tmp > /dev/null
        SHELL
      end

      if Helper.system_and_puts(shell)
        unless File.exists?(pathname.src_pbm_project_template_path)
          raise NotSupportVersionError, "This version is not support by pbmenv"
        end
      else
        raise DownloadError
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pbmenv-0.1.11 lib/pbmenv/services/download_src_service.rb