Sha256: 8ac96f2647f0d536a75dc4dea23688d86f055e2554bc913fa6cdc19c13b4c151

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

module Pbmenv
  class DownloadSrcService
    class DownloadError < StandardError; end

    attr_accessor :version

    def initialize(version)
      self.version = version
    end

    def execute!
      if ENV["DEBUG_INSTALL"]
        shell = <<~SHELL
        git clone https://github.com/splaplapla/procon_bypass_man.git procon_bypass_man-#{version}
        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 > /dev/null
        SHELL
      end

      if Helper.system_and_puts(shell)
        unless File.exists?("procon_bypass_man-#{version}/project_template")
          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.10 lib/pbmenv/download_src_service.rb