Skip to content

Commit

Permalink
Merge pull request #25 from warrensbox/master
Browse files Browse the repository at this point in the history
Release - upgrade cached version
  • Loading branch information
warrensbox authored Jun 23, 2018
2 parents a0c17ea + 1457fc7 commit 722c3e3
Show file tree
Hide file tree
Showing 54 changed files with 5,359 additions and 185 deletions.
32 changes: 20 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,24 @@ jobs:
root: build
paths: tfswitch

test:
test-ubuntu:
docker:
- image: "circleci/ruby:2.5-stretch"
- image: "circleci/ubuntu-server"

steps:

- run: ls

- attach_workspace:
at: build

test-alpine:
docker:
- image: "mhart/alpine-node"

steps:
- run: ls

develop-master:
docker:
- image: circleci/golang:1.10
Expand All @@ -39,17 +47,12 @@ jobs:
- checkout
- run:
command: |
git status
source version
export RELEASE_VERSION
git tag $RELEASE_VERSION.${CIRCLE_BUILD_NUM}
git config --global user.email "warren.veerasingam@gmail.com"
git config --global user.name "warrensbox"
git push origin $RELEASE_VERSION.${CIRCLE_BUILD_NUM}
echo "Placeholder"
release:
docker:
- image: circleci/golang:1.10
- image: warrensbox/go-rb-py-aws

steps:
- checkout
Expand All @@ -61,6 +64,7 @@ jobs:
RELEASE_VERSION=$RELEASE_VERSION.${CIRCLE_BUILD_NUM}
export RELEASE_VERSION;
echo $RELEASE_VERSION
cd docs; bundle install --path vendor/bundler; bundle exec jekyll build -c _config.yml; cd ..
go get -v -t -d ./...
git config user.email "warren.veerasingam@gmail.com"
git config user.name "warrensbox"
Expand All @@ -74,12 +78,16 @@ workflows:
build_and_test:
jobs:
- build
- test:
- test-ubuntu:
requires:
- build
- test-alpine:
requires:
- build
- develop-master:
requires:
- test
- test-ubuntu
- test-alpine
filters:
branches:
only:
Expand Down
11 changes: 10 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@
# go-tests = true
# unused-packages = true

required = ["github.com/pborman/getopt/v2"]

[[constraint]]
name = "github.com/pborman/getopt"
branch = "master"

[[constraint]]
name = "github.com/manifoldco/promptui"
branch = "master"


[prune]
go-tests = true
unused-packages = true

5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ clean:
test: $(EXE)
mv $(EXE) build
go test -v ./...


.PHONEY: dep
dep:
dep ensure
16 changes: 14 additions & 2 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-120055973-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-120055973-1');
</script>
</head>
<body>
<div class="wrapper">
Expand Down Expand Up @@ -45,12 +55,14 @@
{% endif %}
</section>
<footer>
<p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p>

<!-- <p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p> -->
<p><small>VERSION: {{ site.github.releases[0].tag_name }}. This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></small></p>
</footer>
</div>
<script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script>
{% if site.google_analytics %}


<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
Expand Down
32 changes: 21 additions & 11 deletions docs/_site/additional.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,33 @@
<meta name="description" content="The tfswitch command line tool lets you switch between different versions of terraform.">

<!-- Begin Jekyll SEO tag v2.4.0 -->
<title>tfswitch | The tfswitch command line tool lets you switch between different versions of terraform</title>
<title>tfswitch | Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform</title>
<meta name="generator" content="Jekyll v3.7.3" />
<meta property="og:title" content="tfswitch" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="The tfswitch command line tool lets you switch between different versions of terraform" />
<meta property="og:description" content="The tfswitch command line tool lets you switch between different versions of terraform" />
<meta name="description" content="Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform" />
<meta property="og:description" content="Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform" />
<link rel="canonical" href="http://localhost:4000/additional.html" />
<meta property="og:url" content="http://localhost:4000/additional.html" />
<meta property="og:site_name" content="tfswitch" />
<script type="application/ld+json">
{"description":"The tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"http://localhost:4000/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"http://localhost:4000/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"}</script>
{"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"http://localhost:4000/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"http://localhost:4000/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/assets/css/style.css?v=6896e1e3b55581482a0f3e7780e98a0bb16b8d71">
<link rel="stylesheet" href="/assets/css/style.css?v=1177239d879d4ea0a245317aa6bdac517bc873d5">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-120055973-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-120055973-1');
</script>
</head>
<body>
<div class="wrapper">
Expand All @@ -35,7 +45,7 @@
<img align="middle" src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/logo.png" alt="Logo" />
</p>

<p style="text-align: center">The tfswitch command line tool lets you switch between different versions of terraform</p>
<p style="text-align: center">Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform</p>
<!-- <p>Written in go</p> -->
<img src="https://travis-ci.org/warrensbox/terraform-switcher.svg?branch=master" alt="Travis" />
<img src="https://goreportcard.com/badge/github.com/warrensbox/terraform-switcher" alt="Go Report" />
Expand All @@ -44,8 +54,8 @@


<ul>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.3.256/terraform-switcher_0.3.256_darwin_amd64.tar.gz">Download <strong>MacOS</strong></a></li>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.3.256/terraform-switcher_0.3.256_linux_amd64.tar.gz">Download <strong>Linux</strong></a></li>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.3.379/terraform-switcher_0.3.379_darwin_amd64.tar.gz">Download <strong>MacOS</strong></a></li>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.3.379/terraform-switcher_0.3.379_linux_amd64.tar.gz">Download <strong>Linux</strong></a></li>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases">Releases On <strong>GitHub</strong></a></li>
</ul>

Expand Down Expand Up @@ -98,12 +108,12 @@ <h2 id="troubleshoot">Troubleshoot:</h2>
<a href="index">Back to main</a></p>


<p><small>VERSION: 0.3.256. This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>
<p><small>VERSION: 0.3.379. This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>

</section>
<footer>
<p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p>

<!-- <p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p> -->
<p><small>VERSION: 0.3.379. This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
Expand Down
30 changes: 20 additions & 10 deletions docs/_site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,29 @@
<meta name="generator" content="Jekyll v3.7.3" />
<meta property="og:title" content="Terraform Switcher" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="The tfswitch command line tool lets you switch between different versions of terraform" />
<meta property="og:description" content="The tfswitch command line tool lets you switch between different versions of terraform" />
<meta name="description" content="Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform" />
<meta property="og:description" content="Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform" />
<link rel="canonical" href="http://localhost:4000/" />
<meta property="og:url" content="http://localhost:4000/" />
<meta property="og:site_name" content="tfswitch" />
<script type="application/ld+json">
{"name":"tfswitch","description":"The tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"http://localhost:4000/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"http://localhost:4000/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"}</script>
{"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"http://localhost:4000/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"http://localhost:4000/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/assets/css/style.css?v=6896e1e3b55581482a0f3e7780e98a0bb16b8d71">
<link rel="stylesheet" href="/assets/css/style.css?v=1177239d879d4ea0a245317aa6bdac517bc873d5">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-120055973-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-120055973-1');
</script>
</head>
<body>
<div class="wrapper">
Expand All @@ -35,7 +45,7 @@
<img align="middle" src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/logo.png" alt="Logo" />
</p>

<p style="text-align: center">The tfswitch command line tool lets you switch between different versions of terraform</p>
<p style="text-align: center">Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform</p>
<!-- <p>Written in go</p> -->
<img src="https://travis-ci.org/warrensbox/terraform-switcher.svg?branch=master" alt="Travis" />
<img src="https://goreportcard.com/badge/github.com/warrensbox/terraform-switcher" alt="Go Report" />
Expand All @@ -44,8 +54,8 @@


<ul>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.3.256/terraform-switcher_0.3.256_darwin_amd64.tar.gz">Download <strong>MacOS</strong></a></li>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.3.256/terraform-switcher_0.3.256_linux_amd64.tar.gz">Download <strong>Linux</strong></a></li>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.3.379/terraform-switcher_0.3.379_darwin_amd64.tar.gz">Download <strong>MacOS</strong></a></li>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.3.379/terraform-switcher_0.3.379_linux_amd64.tar.gz">Download <strong>Linux</strong></a></li>
<li><a href="https://github.com/warrensbox/terraform-switcher/releases">Releases On <strong>GitHub</strong></a></li>
</ul>

Expand Down Expand Up @@ -107,12 +117,12 @@ <h2 id="issues">Issues</h2>
<a href="additional">Additional Info</a></p>


<p><small>VERSION: 0.3.256. This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>
<p><small>VERSION: 0.3.379. This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>

</section>
<footer>
<p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p>

<!-- <p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p> -->
<p><small>VERSION: 0.3.379. This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
Expand Down
55 changes: 55 additions & 0 deletions lib/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ package lib

import (
"archive/zip"
"bufio"
"bytes"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strings"
)

// RenameFile : rename file name
Expand Down Expand Up @@ -107,3 +110,55 @@ func CreateDirIfNotExist(dir string) {
}
}
}

//WriteLines : writes into file
func WriteLines(lines []string, path string) (err error) {
var (
file *os.File
)

if file, err = os.Create(path); err != nil {
return err
}
defer file.Close()

for _, item := range lines {
_, err := file.WriteString(strings.TrimSpace(item) + "\n")
if err != nil {
fmt.Println(err)
break
}
}

return nil
}

// ReadLines : Read a whole file into the memory and store it as array of lines
func ReadLines(path string) (lines []string, err error) {
var (
file *os.File
part []byte
prefix bool
)
if file, err = os.Open(path); err != nil {
return
}
defer file.Close()

reader := bufio.NewReader(file)
buffer := bytes.NewBuffer(make([]byte, 0))
for {
if part, prefix, err = reader.ReadLine(); err != nil {
break
}
buffer.Write(part)
if !prefix {
lines = append(lines, buffer.String())
buffer.Reset()
}
}
if err == io.EOF {
err = nil
}
return
}
Loading

0 comments on commit 722c3e3

Please sign in to comment.