コード例 #1
0
ファイル: install.go プロジェクト: jmartiuk5/VenGO
// install from binary source
func (i *Install) fromBinary() (string, error) {
	if err := cache.CacheDownloadBinary(i.Version, i.Force); err != nil {
		return "error while installing from binary", err
	}

	result := fmt.Sprintf(
		"%s", utils.Ok(fmt.Sprintf("Go %s installed", i.Version)))
	return result, nil
}
コード例 #2
0
ファイル: cache_test.go プロジェクト: jmartiuk5/VenGO
					It("Should donwload and extract a valid tar.gz file", func() {
						Expect(cache.CacheDownload("1.1.1")).To(Succeed())

						_, err := os.Stat(filepath.Join(cache.CacheDirectory(), "1.1.1"))
						Expect(err).NotTo(HaveOccurred())
						os.RemoveAll(filepath.Join(cache.CacheDirectory(), "1.1.1"))
						debug.FreeOSMemory()
					})
				})
			})

			Describe("CacheDownloadBinary works as expected", func() {

				Context("Passing a valid Go version", func() {
					It("Should download and extract a valid tar.gz file", func() {
						Expect(cache.CacheDownloadBinary("1.2.2")).To(Succeed())

						binary := cache.GetBinaryVersion("1.2.2")
						_, err := os.Stat(
							filepath.Join(cache.CacheDirectory(), binary))
						Expect(err).NotTo(HaveOccurred())
						os.RemoveAll(
							filepath.Join(cache.CacheDirectory(), binary))
						debug.FreeOSMemory()
					})
				})

				Context("Passing an old Go version", func() {
					It("Should donwload and extract a valid tar.gz file", func() {
						Expect(cache.CacheDownloadBinary("1.2.1")).To(Succeed())