From b5d2e9c5061f970064e2d889ea88fc4d54079084 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam@gmail.com" Date: Sun, 9 Jun 2019 17:37:20 -0500 Subject: [PATCH 01/20] Removed redundant documentation --- README.md | 46 ++--------------------------------- docs/_site/additional.html | 2 +- docs/_site/index.html | 49 ++++---------------------------------- docs/_site/index.md | 49 +++----------------------------------- docs/index.md | 49 +++----------------------------------- 5 files changed, 13 insertions(+), 182 deletions(-) diff --git a/README.md b/README.md index 4e93518d..a3421549 100644 --- a/README.md +++ b/README.md @@ -83,50 +83,6 @@ version = "0.11.3" drawing -**Automatically switch with bash** - -Add the following to the end of your `~/.bashrc` file: -``` -cdtfswitch(){ - builtin cd "$@"; - cdir=$PWD; - if [ -f "$cdir/.tfswitch.toml" ]; then - tfswitch - fi -} -alias cd='cdtfswitch' -``` - -**Automatically switch with zsh** - -Add the following to the end of your `~/.zshrc` file: - -``` -load-tfswitch() { - local tfswitchrc_path=".tfswitch.toml" - - if [ -f "$tfswitchrc_path" ]; then - tfswitch - fi -} -add-zsh-hook chpwd load-tfswitch -load-tfswitch -``` -> NOTE: if you see an error like this: `command not found: add-zsh-hook`, then you might be on an older version of zsh (see below), or you simply need to load `add-zsh-hook` by adding this to your `.zshrc`: -> ``` -> autoload -U add-zsh-hook -> ``` - -*older version of zsh* -``` -cd(){ - builtin cd "$@"; - cdir=$PWD; - if [ -f "$cdir/.tfswitchrc" ]; then - tfswitch - fi -} -``` ### Use .tfswitchrc file drawing @@ -139,6 +95,8 @@ cd(){ **Automatically switch with bash** Add the following to the end of your `~/.bashrc` file: +(Use either `.tfswitchrc` or `.tfswitch.toml`) + ``` cdtfswitch(){ builtin cd "$@"; diff --git a/docs/_site/additional.html b/docs/_site/additional.html index 7fa5da10..aaa1533f 100644 --- a/docs/_site/additional.html +++ b/docs/_site/additional.html @@ -23,7 +23,7 @@ {"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"} - + diff --git a/docs/_site/index.html b/docs/_site/index.html index 0aa0f160..62df3971 100644 --- a/docs/_site/index.html +++ b/docs/_site/index.html @@ -23,7 +23,7 @@ {"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"} - + @@ -148,49 +148,6 @@

-

Automatically switch with bash

- -

Add the following to the end of your ~/.bashrc file:

-
cdtfswitch(){
-  builtin cd "$@";
-  cdir=$PWD;
-  if [ -f "$cdir/.tfswitch.toml" ]; then
-    tfswitch
-  fi
-}
-alias cd='cdtfswitch'
-
- -

Automatically switch with zsh

- -

Add the following to the end of your ~/.zshrc file:

- -
load-tfswitch() {
-  local tfswitchrc_path=".tfswitch.toml"
-
-  if [ -f "$tfswitchrc_path" ]; then
-    tfswitch
-  fi
-}
-add-zsh-hook chpwd load-tfswitch
-load-tfswitch
-
-
-

NOTE: if you see an error like this: command not found: add-zsh-hook, then you might be on an older version of zsh (see below), or you simply need to load add-zsh-hook by adding this to your .zshrc:

-
   autoload -U add-zsh-hook
-
-
- -

older version of zsh

-
cd(){
-  builtin cd "$@";
-  cdir=$PWD;
-  if [ -f "$cdir/.tfswitchrc" ]; then
-    tfswitch
-  fi
-}
-
-

Use .tfswitchrc file

drawing

@@ -202,7 +159,9 @@

Use .tfswitchrc file

Automatically switch with bash

-

Add the following to the end of your ~/.bashrc file:

+

Add the following to the end of your ~/.bashrc file: +(Use either .tfswitchrc or .tfswitch.toml)

+
cdtfswitch(){
   builtin cd "$@";
   cdir=$PWD;
diff --git a/docs/_site/index.md b/docs/_site/index.md
index 9a7a5b3f..642236dd 100644
--- a/docs/_site/index.md
+++ b/docs/_site/index.md
@@ -76,51 +76,6 @@ version = "0.11.3"
 
 drawing
 
-**Automatically switch with bash**
-
-Add the following to the end of your `~/.bashrc` file:
-```
-cdtfswitch(){
-  builtin cd "$@";
-  cdir=$PWD;
-  if [ -f "$cdir/.tfswitch.toml" ]; then
-    tfswitch
-  fi
-}
-alias cd='cdtfswitch'
-```
-
-**Automatically switch with zsh**
-
-Add the following to the end of your `~/.zshrc` file:
-
-```
-load-tfswitch() {
-  local tfswitchrc_path=".tfswitch.toml"
-
-  if [ -f "$tfswitchrc_path" ]; then
-    tfswitch
-  fi
-}
-add-zsh-hook chpwd load-tfswitch
-load-tfswitch
-```
-> NOTE: if you see an error like this: `command not found: add-zsh-hook`, then you might be on an older version of zsh (see below), or you simply need to load `add-zsh-hook` by adding this to your `.zshrc`:
->    ```
->    autoload -U add-zsh-hook
->    ```
-
-*older version of zsh*
-```
-cd(){
-  builtin cd "$@";
-  cdir=$PWD;
-  if [ -f "$cdir/.tfswitchrc" ]; then
-    tfswitch
-  fi
-}
-```
-
 ### Use .tfswitchrc file
 drawing
 
@@ -131,7 +86,9 @@ cd(){
 
 **Automatically switch with bash**
 
-Add the following to the end of your `~/.bashrc` file:
+Add the following to the end of your `~/.bashrc` file: 
+(Use either `.tfswitchrc` or `.tfswitch.toml`)
+
 ```
 cdtfswitch(){
   builtin cd "$@";
diff --git a/docs/index.md b/docs/index.md
index 9a7a5b3f..642236dd 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -76,51 +76,6 @@ version = "0.11.3"
 
 drawing
 
-**Automatically switch with bash**
-
-Add the following to the end of your `~/.bashrc` file:
-```
-cdtfswitch(){
-  builtin cd "$@";
-  cdir=$PWD;
-  if [ -f "$cdir/.tfswitch.toml" ]; then
-    tfswitch
-  fi
-}
-alias cd='cdtfswitch'
-```
-
-**Automatically switch with zsh**
-
-Add the following to the end of your `~/.zshrc` file:
-
-```
-load-tfswitch() {
-  local tfswitchrc_path=".tfswitch.toml"
-
-  if [ -f "$tfswitchrc_path" ]; then
-    tfswitch
-  fi
-}
-add-zsh-hook chpwd load-tfswitch
-load-tfswitch
-```
-> NOTE: if you see an error like this: `command not found: add-zsh-hook`, then you might be on an older version of zsh (see below), or you simply need to load `add-zsh-hook` by adding this to your `.zshrc`:
->    ```
->    autoload -U add-zsh-hook
->    ```
-
-*older version of zsh*
-```
-cd(){
-  builtin cd "$@";
-  cdir=$PWD;
-  if [ -f "$cdir/.tfswitchrc" ]; then
-    tfswitch
-  fi
-}
-```
-
 ### Use .tfswitchrc file
 drawing
 
@@ -131,7 +86,9 @@ cd(){
 
 **Automatically switch with bash**
 
-Add the following to the end of your `~/.bashrc` file:
+Add the following to the end of your `~/.bashrc` file: 
+(Use either `.tfswitchrc` or `.tfswitch.toml`)
+
 ```
 cdtfswitch(){
   builtin cd "$@";

From a82b7030f116bea486a0fad07a8a9ea2dd0d5cd0 Mon Sep 17 00:00:00 2001
From: "warren.veerasingam@gmail.com" 
Date: Sun, 9 Jun 2019 23:10:11 -0500
Subject: [PATCH 02/20] FIxed screen size for documentation

---
 README.md                  | 2 +-
 docs/_site/additional.html | 2 +-
 docs/_site/index.html      | 8 ++++----
 docs/_site/index.md        | 6 +++---
 docs/index.md              | 6 +++---
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index a3421549..432b8672 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@ The most recently selected versions are presented at the top of the dropdown.
 3. Hit **Enter** to select the desired version.
 
 
-### Use .tfswitch.toml file  (For uprivilege users/ non-admin - users with limited privilege on their computer)
+### Use .tfswitch.toml file  (For non-admin - users with limited privilege on their computers)
 This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation
 
 drawing
diff --git a/docs/_site/additional.html b/docs/_site/additional.html
index aaa1533f..9e0f4671 100644
--- a/docs/_site/additional.html
+++ b/docs/_site/additional.html
@@ -23,7 +23,7 @@
 {"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"}
 
 
-    
+    
     
diff --git a/docs/_site/index.html b/docs/_site/index.html
index 62df3971..9fc4d600 100644
--- a/docs/_site/index.html
+++ b/docs/_site/index.html
@@ -23,7 +23,7 @@
 {"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"}
 
 
-    
+    
     
@@ -128,10 +128,10 @@ 

See all
  • Hit Enter to select the desired version.
  • -

    Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer)

    +

    Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers)

    This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation

    -

    drawing

    +

    drawing

    1. Create a custom binary path. Ex: mkdir /Users/warrenveerasingam/bin (replace warrenveerasingam with your username)
    2. @@ -146,7 +146,7 @@

      tfswitch and it should automatically install the required terraform version in the specified binary path

    -

    drawing

    +

    drawing

    Use .tfswitchrc file

    drawing

    diff --git a/docs/_site/index.md b/docs/_site/index.md index 642236dd..106e3af1 100644 --- a/docs/_site/index.md +++ b/docs/_site/index.md @@ -58,10 +58,10 @@ The most recently selected versions are presented at the top of the dropdown. 2. For example, `tfswitch -l` or `tfswitch --list-all` to see all versions. 3. Hit **Enter** to select the desired version. -### Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer) +### Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers) This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation -drawing +drawing 1. Create a custom binary path. Ex: `mkdir /Users/warrenveerasingam/bin` (replace warrenveerasingam with your username) 2. Add the path to your PATH. Ex: `export PATH=$PATH:/Users/warrenveerasingam/bin` (add this to your bash profile or zsh profile) @@ -74,7 +74,7 @@ version = "0.11.3" ``` 4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path -drawing +drawing ### Use .tfswitchrc file drawing diff --git a/docs/index.md b/docs/index.md index 642236dd..106e3af1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -58,10 +58,10 @@ The most recently selected versions are presented at the top of the dropdown. 2. For example, `tfswitch -l` or `tfswitch --list-all` to see all versions. 3. Hit **Enter** to select the desired version. -### Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer) +### Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers) This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation -drawing +drawing 1. Create a custom binary path. Ex: `mkdir /Users/warrenveerasingam/bin` (replace warrenveerasingam with your username) 2. Add the path to your PATH. Ex: `export PATH=$PATH:/Users/warrenveerasingam/bin` (add this to your bash profile or zsh profile) @@ -74,7 +74,7 @@ version = "0.11.3" ``` 4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path -drawing +drawing ### Use .tfswitchrc file drawing From bc81752d81190c607469fb32bfc1b6836b729696 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam@gmail.com" Date: Mon, 10 Jun 2019 09:28:07 -0500 Subject: [PATCH 03/20] Updated documentation for new feature --- README.md | 4 +--- docs/_site/additional.html | 6 +++--- docs/_site/index.html | 11 +++++------ docs/_site/index.md | 3 +-- docs/index.md | 3 +-- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 432b8672..5ae854d2 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ The most recently selected versions are presented at the top of the dropdown. ### Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers) This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation +drawing drawing 1. Create a custom binary path. Ex: `mkdir /Users/warrenveerasingam/bin` (replace warrenveerasingam with your username) @@ -81,9 +82,6 @@ version = "0.11.3" ``` 4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path -drawing - - ### Use .tfswitchrc file drawing diff --git a/docs/_site/additional.html b/docs/_site/additional.html index 9e0f4671..84898414 100644 --- a/docs/_site/additional.html +++ b/docs/_site/additional.html @@ -23,7 +23,7 @@ {"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"} - + @@ -57,8 +57,8 @@ diff --git a/docs/_site/index.html b/docs/_site/index.html index 9fc4d600..5c2c6255 100644 --- a/docs/_site/index.html +++ b/docs/_site/index.html @@ -23,7 +23,7 @@ {"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"} - + @@ -57,8 +57,8 @@ @@ -131,7 +131,8 @@

    See all

    Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers)

    This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation

    -

    drawing

    +

    drawing +drawing

    1. Create a custom binary path. Ex: mkdir /Users/warrenveerasingam/bin (replace warrenveerasingam with your username)
    2. @@ -146,8 +147,6 @@

      tfswitch and it should automatically install the required terraform version in the specified binary path

    -

    drawing

    -

    Use .tfswitchrc file

    drawing

    diff --git a/docs/_site/index.md b/docs/_site/index.md index 106e3af1..d97d1e8f 100644 --- a/docs/_site/index.md +++ b/docs/_site/index.md @@ -61,6 +61,7 @@ The most recently selected versions are presented at the top of the dropdown. ### Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers) This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation +drawing drawing 1. Create a custom binary path. Ex: `mkdir /Users/warrenveerasingam/bin` (replace warrenveerasingam with your username) @@ -74,8 +75,6 @@ version = "0.11.3" ``` 4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path -drawing - ### Use .tfswitchrc file drawing diff --git a/docs/index.md b/docs/index.md index 106e3af1..d97d1e8f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -61,6 +61,7 @@ The most recently selected versions are presented at the top of the dropdown. ### Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers) This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation +drawing drawing 1. Create a custom binary path. Ex: `mkdir /Users/warrenveerasingam/bin` (replace warrenveerasingam with your username) @@ -74,8 +75,6 @@ version = "0.11.3" ``` 4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path -drawing - ### Use .tfswitchrc file drawing From 45af5d166a97ba6db56ba31181768391887b4abd Mon Sep 17 00:00:00 2001 From: "warren.veerasingam@gmail.com" Date: Tue, 11 Jun 2019 22:21:09 -0500 Subject: [PATCH 04/20] added github star button --- docs/_site/additional.html | 2 +- docs/_site/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_site/additional.html b/docs/_site/additional.html index 84898414..058e0807 100644 --- a/docs/_site/additional.html +++ b/docs/_site/additional.html @@ -23,7 +23,7 @@ {"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"} - + diff --git a/docs/_site/index.html b/docs/_site/index.html index 5c2c6255..c070bf33 100644 --- a/docs/_site/index.html +++ b/docs/_site/index.html @@ -23,7 +23,7 @@ {"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"} - + From 4808de526ad398d7e781727bad6cc94e75c8a123 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam@gmail.com" Date: Tue, 11 Jun 2019 22:35:08 -0500 Subject: [PATCH 05/20] Added github button --- docs/_layouts/default.html | 10 ++++++++-- docs/_site/additional.html | 12 +++++++++--- docs/_site/index.html | 12 +++++++++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index a54204bf..9ba0968e 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -26,6 +26,9 @@ gtag('config', 'UA-120055973-1'); + + +
    @@ -51,17 +54,20 @@
  • Releases On GitHub
  • {% endif %} + + +Star
    {{ content }} {% if site.github.is_project_page %} -

    This project is maintained by {{ site.github.owner_name }}

    +

    This project is maintained by {{ site.github.owner_name }}

    {% endif %}
    diff --git a/docs/_site/additional.html b/docs/_site/additional.html index 058e0807..7ad31181 100644 --- a/docs/_site/additional.html +++ b/docs/_site/additional.html @@ -23,7 +23,7 @@ {"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"} - + @@ -37,6 +37,9 @@ gtag('config', 'UA-120055973-1'); + + +
    @@ -62,6 +65,9 @@
  • Releases On GitHub
  • + + +Star
    @@ -111,12 +117,12 @@

    Troubleshoot:

    Back to main

    -

    This project is maintained by warrensbox

    +

    This project is maintained by warrensbox

    diff --git a/docs/_site/index.html b/docs/_site/index.html index c070bf33..2213cf3f 100644 --- a/docs/_site/index.html +++ b/docs/_site/index.html @@ -23,7 +23,7 @@ {"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"} - + @@ -37,6 +37,9 @@ gtag('config', 'UA-120055973-1'); + + +
    @@ -62,6 +65,9 @@
  • Releases On GitHub
  • + + +Star
    @@ -213,12 +219,12 @@

    Issues

    Additional Info

    -

    This project is maintained by warrensbox

    +

    This project is maintained by warrensbox

    From a29b02c1fbccb0318f04818ab7a42ada8cb97e65 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 20 Oct 2019 01:58:17 +0000 Subject: [PATCH 06/20] Bump nokogiri from 1.10.1 to 1.10.4 in /docs Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.1 to 1.10.4. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.1...v1.10.4) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 132be98c..ca733df0 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -205,7 +205,7 @@ GEM jekyll-seo-tag (~> 2.1) minitest (5.11.3) multipart-post (2.0.0) - nokogiri (1.10.1) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) octokit (4.13.0) sawyer (~> 0.8.0, >= 0.5.3) From e99e64973ab64e4b9041a327f7d941ced768b844 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2019 01:14:53 +0000 Subject: [PATCH 07/20] Bump rubyzip from 1.2.2 to 1.3.0 in /docs Bumps [rubyzip](https://github.com/rubyzip/rubyzip) from 1.2.2 to 1.3.0. - [Release notes](https://github.com/rubyzip/rubyzip/releases) - [Changelog](https://github.com/rubyzip/rubyzip/blob/master/Changelog.md) - [Commits](https://github.com/rubyzip/rubyzip/compare/v1.2.2...v1.3.0) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index ca733df0..2e635f88 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -219,7 +219,7 @@ GEM ruby-enum (0.7.2) i18n ruby_dep (1.5.0) - rubyzip (1.2.2) + rubyzip (1.3.0) safe_yaml (1.0.4) sass (3.7.3) sass-listen (~> 4.0.0) From 655279c44b93b63d8fda18774257475c6badc8f0 Mon Sep 17 00:00:00 2001 From: Robert Blumen Date: Wed, 30 Oct 2019 12:59:21 -0700 Subject: [PATCH 08/20] corrected error message --- lib/symlink.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/symlink.go b/lib/symlink.go index b64790ce..f0df72c4 100644 --- a/lib/symlink.go +++ b/lib/symlink.go @@ -27,7 +27,7 @@ func RemoveSymlink(symlinkPath string) { _, err := os.Lstat(symlinkPath) if err != nil { log.Fatalf(` - Unable to remove symlink. + Unable to stat symlink. Maybe symlink already exist. Try removing existing symlink manually. Try running "unlink %s" to remove existing symlink. If error persist, you may not have the permission to create a symlink at %s. From 6166eb68034fa2986597f72757c5c80fec5f3eeb Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Thu, 28 Nov 2019 18:03:35 +0000 Subject: [PATCH 09/20] Allow expansion of path variables (such as $HOME) from the bin path value provided in the tfswitch.toml configuration file. --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index f5280793..ee36843a 100644 --- a/main.go +++ b/main.go @@ -88,7 +88,7 @@ func main() { bin := viper.Get("bin") // read custom binary location if binPath == defaultBin && bin != nil { // if the bin path is the same as the default binary path and if the custom binary is provided in the toml file (use it) - binPath = bin.(string) + binPath = os.ExpandEnv(bin.(string)) } version := viper.Get("version") //attempt to get the version if it's provided in the toml From 690e039e85ce1ec351e4d1eaf0e1022bbc63e129 Mon Sep 17 00:00:00 2001 From: Shaun Mouton Date: Thu, 5 Dec 2019 10:40:45 -0600 Subject: [PATCH 10/20] Adds support for `.terraform-version` file * fixes #60 * treats `.terraform-version` file exactly like the `.tfswitchrc` file for simplicity's sake and duplicates the if statement so this behavior can easily be modified later --- README.md | 3 ++- main.go | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ae854d2..3d3c26dd 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ version = "0.11.3" 2. For example, `echo "0.10.5" >> .tfswitchrc` for version 0.10.5 of terraform 3. Run the command `tfswitch` in the same directory as your `.tfswitchrc` +*instead of a `.tfswitchrc` file, a `.terraform-version` file may be used for compatibility with [`tfenv`](https://github.com/tfutils/tfenv#terraform-version-file) and other tools which use it* **Automatically switch with bash** @@ -139,7 +140,7 @@ cd(){ ## Additional Info -See how to *upgrade*, *uninstall*, *troubleshoot* here:[More info](https://warrensbox.github.io/terraform-switcher/additional) +See how to *upgrade*, *uninstall*, *troubleshoot* here: [More info](https://warrensbox.github.io/terraform-switcher/additional) ## Issues diff --git a/main.go b/main.go index f5280793..2938b51e 100644 --- a/main.go +++ b/main.go @@ -33,6 +33,7 @@ import ( const ( hashiURL = "https://releases.hashicorp.com/terraform/" defaultBin = "/usr/local/bin/terraform" //default bin installation dir + tfvFilename = ".terraform-version" rcFilename = ".tfswitchrc" tomlFilename = ".tfswitch.toml" ) @@ -56,6 +57,7 @@ func main() { os.Exit(1) } + tfvfile := dir + fmt.Sprintf("/%s", tfvFilename) //settings for .terraform-version file in current directory (tfenv compatible) rcfile := dir + fmt.Sprintf("/%s", rcFilename) //settings for .tfswitchrc file in current directory (backward compatible purpose) configfile := dir + fmt.Sprintf("/%s", tomlFilename) //settings for .tfswitch.toml file in current directory (option to specify bin directory) @@ -138,6 +140,23 @@ func main() { } tfversion := strings.TrimSuffix(string(fileContents), "\n") + if lib.ValidVersionFormat(tfversion) { //check if version is correct + lib.Install(string(tfversion), *custBinPath) + } else { + fmt.Println("Invalid terraform version format. Format should be #.#.# or #.#.#-@# where # is numbers and @ is word characters. For example, 0.11.7 and 0.11.9-beta1 are valid versions") + os.Exit(1) + } + } else if _, err := os.Stat(tfvfile); err == nil && len(args) == 0 { //if there is a .terraform-version file, and no command line arguments + fmt.Printf("Reading required terraform version %s ", tfvFilename) + + fileContents, err := ioutil.ReadFile(tfvfile) + if err != nil { + fmt.Printf("Failed to read %s file. Follow the README.md instructions for setup. https://github.com/warrensbox/terraform-switcher/blob/master/README.md\n", tfvFilename) + fmt.Printf("Error: %s\n", err) + os.Exit(1) + } + tfversion := strings.TrimSuffix(string(fileContents), "\n") + if lib.ValidVersionFormat(tfversion) { //check if version is correct lib.Install(string(tfversion), *custBinPath) } else { From 781d3a5e4cb0a4b44af37b8f2577a0552bd39f3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2020 18:52:14 +0000 Subject: [PATCH 11/20] Bump rubyzip from 1.2.2 to 1.3.0 in /docs/_site Bumps [rubyzip](https://github.com/rubyzip/rubyzip) from 1.2.2 to 1.3.0. - [Release notes](https://github.com/rubyzip/rubyzip/releases) - [Changelog](https://github.com/rubyzip/rubyzip/blob/master/Changelog.md) - [Commits](https://github.com/rubyzip/rubyzip/compare/v1.2.2...v1.3.0) Signed-off-by: dependabot[bot] --- docs/_site/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_site/Gemfile.lock b/docs/_site/Gemfile.lock index 132be98c..204fbc4b 100644 --- a/docs/_site/Gemfile.lock +++ b/docs/_site/Gemfile.lock @@ -219,7 +219,7 @@ GEM ruby-enum (0.7.2) i18n ruby_dep (1.5.0) - rubyzip (1.2.2) + rubyzip (1.3.0) safe_yaml (1.0.4) sass (3.7.3) sass-listen (~> 4.0.0) From cfbb30a2b95a12fe12c5beb820fea8b5506698ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2020 11:14:46 +0000 Subject: [PATCH 12/20] Bump nokogiri from 1.10.4 to 1.10.8 in /docs Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.4 to 1.10.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.4...v1.10.8) Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 2e635f88..c604714a 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -205,7 +205,7 @@ GEM jekyll-seo-tag (~> 2.1) minitest (5.11.3) multipart-post (2.0.0) - nokogiri (1.10.4) + nokogiri (1.10.8) mini_portile2 (~> 2.4.0) octokit (4.13.0) sawyer (~> 0.8.0, >= 0.5.3) From 60ae6f5c8e7a7ab17681e6d8f94e0c162e0933d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2020 14:04:57 +0000 Subject: [PATCH 13/20] Bump nokogiri from 1.10.1 to 1.10.8 in /docs/_site Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.1 to 1.10.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.1...v1.10.8) Signed-off-by: dependabot[bot] --- docs/_site/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_site/Gemfile.lock b/docs/_site/Gemfile.lock index 132be98c..ec5334fa 100644 --- a/docs/_site/Gemfile.lock +++ b/docs/_site/Gemfile.lock @@ -205,7 +205,7 @@ GEM jekyll-seo-tag (~> 2.1) minitest (5.11.3) multipart-post (2.0.0) - nokogiri (1.10.1) + nokogiri (1.10.8) mini_portile2 (~> 2.4.0) octokit (4.13.0) sawyer (~> 0.8.0, >= 0.5.3) From ae669055ba48fcea92d08d31240ca23643426144 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam" Date: Mon, 2 Mar 2020 22:03:49 -0600 Subject: [PATCH 14/20] Refactored code - not to run init() --- lib/install.go | 14 +++++++++++++- lib/symlink.go | 4 +++- main.go | 9 +-------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/install.go b/lib/install.go index 6d416a43..75a86bbe 100644 --- a/lib/install.go +++ b/lib/install.go @@ -22,7 +22,7 @@ var ( //installedBinPath = "/tmp" ) -func init() { +func initialize() { /* get current user */ usr, errCurr := user.Current() if errCurr != nil { @@ -65,6 +65,17 @@ func Install(tfversion string, binPath string) { os.Exit(1) } + pathDir := Path(binPath) //get path directory from binary path + binDirExist := CheckDirExist(pathDir) //check bin path exist + + if !binDirExist { + fmt.Printf("Error - Binary path does not exist: %s\n", pathDir) + fmt.Printf("Create binary path: %s for terraform installation\n", pathDir) + os.Exit(1) + } + + initialize() //initialize path + goarch := runtime.GOARCH goos := runtime.GOOS @@ -113,6 +124,7 @@ func Install(tfversion string, binPath string) { /* remove zipped file to clear clutter */ RemoveFiles(installLocation + installVersion + tfversion + "_" + goos + "_" + goarch + ".zip") + fmt.Println("rm2 symlink") /* remove current symlink if exist*/ symlinkExist := CheckSymlink(binPath) diff --git a/lib/symlink.go b/lib/symlink.go index f0df72c4..e1dcc5a2 100644 --- a/lib/symlink.go +++ b/lib/symlink.go @@ -1,6 +1,7 @@ package lib import ( + "fmt" "log" "os" ) @@ -23,7 +24,7 @@ func CreateSymlink(cwd string, dir string) { //RemoveSymlink : remove symlink func RemoveSymlink(symlinkPath string) { - + fmt.Println(symlinkPath) _, err := os.Lstat(symlinkPath) if err != nil { log.Fatalf(` @@ -36,6 +37,7 @@ func RemoveSymlink(symlinkPath string) { os.Exit(1) } else { errRemove := os.Remove(symlinkPath) + fmt.Println("ATTEMPING TO RM") if errRemove != nil { log.Fatalf(` Unable to remove symlink. diff --git a/main.go b/main.go index f5280793..7d4a6060 100644 --- a/main.go +++ b/main.go @@ -105,14 +105,7 @@ func main() { tfversion = version.(string) } - pathDir := lib.Path(binPath) //get path directory from binary path - binDirExist := lib.CheckDirExist(pathDir) //check bin path exist - - if !binDirExist { - fmt.Printf("Binary path does not exist: %s\n", pathDir) - fmt.Printf("Create binary path: %s for terraform installation\n", pathDir) - os.Exit(1) - } else if *listAllFlag { //show all terraform version including betas and RCs + if *listAllFlag { //show all terraform version including betas and RCs listAll := true //set list all true - all versions including beta and rc will be displayed installOption(listAll, &binPath) } else if tfversion == "" { // if no version is provided, show a dropdown of available release versions From 83ef2aafe32ef0c337fa4e18f1347649c4e56761 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam" Date: Mon, 2 Mar 2020 23:16:17 -0600 Subject: [PATCH 15/20] rm comments --- lib/symlink.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/symlink.go b/lib/symlink.go index e1dcc5a2..ba7f8291 100644 --- a/lib/symlink.go +++ b/lib/symlink.go @@ -1,7 +1,6 @@ package lib import ( - "fmt" "log" "os" ) @@ -24,7 +23,7 @@ func CreateSymlink(cwd string, dir string) { //RemoveSymlink : remove symlink func RemoveSymlink(symlinkPath string) { - fmt.Println(symlinkPath) + _, err := os.Lstat(symlinkPath) if err != nil { log.Fatalf(` @@ -37,7 +36,7 @@ func RemoveSymlink(symlinkPath string) { os.Exit(1) } else { errRemove := os.Remove(symlinkPath) - fmt.Println("ATTEMPING TO RM") + if errRemove != nil { log.Fatalf(` Unable to remove symlink. From 2fbc707c1a945b1759c1a66768b0ccc11c789c41 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam" Date: Mon, 2 Mar 2020 23:17:37 -0600 Subject: [PATCH 16/20] added new line --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 7d64f4d7..445b0f56 100644 --- a/main.go +++ b/main.go @@ -123,7 +123,7 @@ func main() { } } else if _, err := os.Stat(rcfile); err == nil && len(args) == 0 { //if there is a .tfswitchrc file, and no commmand line arguments - fmt.Printf("Reading required terraform version %s ", rcFilename) + fmt.Printf("Reading required terraform version %s \n", rcFilename) fileContents, err := ioutil.ReadFile(rcfile) if err != nil { @@ -140,7 +140,7 @@ func main() { os.Exit(1) } } else if _, err := os.Stat(tfvfile); err == nil && len(args) == 0 { //if there is a .terraform-version file, and no command line arguments - fmt.Printf("Reading required terraform version %s ", tfvFilename) + fmt.Printf("Reading required terraform version %s \n", tfvFilename) fileContents, err := ioutil.ReadFile(tfvfile) if err != nil { From f466e1f1c1220520b876a4984c343b52a5f06826 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam" Date: Tue, 3 Mar 2020 15:21:19 -0600 Subject: [PATCH 17/20] added install location --- lib/install.go | 51 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/lib/install.go b/lib/install.go index 75a86bbe..856f6185 100644 --- a/lib/install.go +++ b/lib/install.go @@ -12,27 +12,21 @@ const ( hashiURL = "https://releases.hashicorp.com/terraform/" installFile = "terraform" installVersion = "terraform_" - //binLocation = "/usr/local/bin/terraform" - installPath = "/.terraform.versions/" - recentFile = "RECENT" + installPath = "/.terraform.versions/" + recentFile = "RECENT" ) var ( installLocation = "/tmp" - //installedBinPath = "/tmp" ) +// initialize : removes existing symlink to terraform binary func initialize() { - /* get current user */ - usr, errCurr := user.Current() - if errCurr != nil { - log.Fatal(errCurr) - } - /* set installation location */ - installLocation = usr.HomeDir + installPath - - /* set default binary path for terraform */ + /* Step 1 */ + /* initilize default binary path for terraform */ + /* assumes that terraform is installed here */ + /* we will find the terraform path instalation later and replace this variable with the correct installed bin path */ installedBinPath := "/usr/local/bin/terraform" /* find terraform binary location if terraform is already installed*/ @@ -45,16 +39,33 @@ func initialize() { installedBinPath = path } - /* remove current symlink if exist*/ + /* check if current symlink to terraform binary exist */ symlinkExist := CheckSymlink(installedBinPath) + /* remove current symlink if exist*/ if symlinkExist { RemoveSymlink(installedBinPath) } +} + +// getInstallLocation : get location where the terraform binary will be installed, +// will create a directory in the home location if it does not exist +func getInstallLocation() string { + /* get current user */ + usr, errCurr := user.Current() + if errCurr != nil { + log.Fatal(errCurr) + } + + /* set installation location */ + installLocation = usr.HomeDir + installPath + /* Create local installation directory if it does not exist */ CreateDirIfNotExist(installLocation) + return installLocation + } //Install : Install the provided version in the argument @@ -74,7 +85,8 @@ func Install(tfversion string, binPath string) { os.Exit(1) } - initialize() //initialize path + initialize() //initialize path + installLocation = getInstallLocation() //get installation location - this is where we will put our terraform binary file goarch := runtime.GOARCH goos := runtime.GOOS @@ -124,7 +136,6 @@ func Install(tfversion string, binPath string) { /* remove zipped file to clear clutter */ RemoveFiles(installLocation + installVersion + tfversion + "_" + goos + "_" + goarch + ".zip") - fmt.Println("rm2 symlink") /* remove current symlink if exist*/ symlinkExist := CheckSymlink(binPath) @@ -142,6 +153,8 @@ func Install(tfversion string, binPath string) { // AddRecent : add to recent file func AddRecent(requestedVersion string) { + installLocation = getInstallLocation() //get installation location - this is where we will put our terraform binary file + fileExist := CheckFileExist(installLocation + recentFile) if fileExist { lines, errRead := ReadLines(installLocation + recentFile) @@ -175,6 +188,7 @@ func AddRecent(requestedVersion string) { } } else { + fmt.Println("adding to recent5") CreateRecentFile(requestedVersion) } } @@ -182,6 +196,8 @@ func AddRecent(requestedVersion string) { // GetRecentVersions : get recent version from file func GetRecentVersions() ([]string, error) { + installLocation = getInstallLocation() //get installation location - this is where we will put our terraform binary file + fileExist := CheckFileExist(installLocation + recentFile) if fileExist { @@ -217,5 +233,8 @@ func GetRecentVersions() ([]string, error) { //CreateRecentFile : create a recent file func CreateRecentFile(requestedVersion string) { + + installLocation = getInstallLocation() //get installation location - this is where we will put our terraform binary file + WriteLines([]string{requestedVersion}, installLocation+recentFile) } From 0b7be9932efc2fc12b75f7de015e535bb13fda26 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam" Date: Tue, 3 Mar 2020 16:02:06 -0600 Subject: [PATCH 18/20] added docs --- Makefile | 5 +++++ README.md | 16 ++++++++++++++-- docs/_site/additional.html | 2 +- docs/_site/index.html | 17 +++++++++++++++-- docs/_site/index.md | 15 ++++++++++++++- docs/index.md | 15 ++++++++++++++- 6 files changed, 63 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1f165c71..7f803816 100644 --- a/Makefile +++ b/Makefile @@ -31,3 +31,8 @@ test: $(EXE) .PHONEY: dep dep: dep ensure + +.PHONY: docs +docs: + cd docs; bundle install --path vendor/bundler; bundle exec jekyll build -c _config.yml; cd .. + diff --git a/README.md b/README.md index 3d3c26dd..b72e03db 100644 --- a/README.md +++ b/README.md @@ -89,12 +89,12 @@ version = "0.11.3" 2. For example, `echo "0.10.5" >> .tfswitchrc` for version 0.10.5 of terraform 3. Run the command `tfswitch` in the same directory as your `.tfswitchrc` -*instead of a `.tfswitchrc` file, a `.terraform-version` file may be used for compatibility with [`tfenv`](https://github.com/tfutils/tfenv#terraform-version-file) and other tools which use it* +*Instead of a `.tfswitchrc` file, a `.terraform-version` file may be used for compatibility with [`tfenv`](https://github.com/tfutils/tfenv#terraform-version-file) and other tools which use it* **Automatically switch with bash** Add the following to the end of your `~/.bashrc` file: -(Use either `.tfswitchrc` or `.tfswitch.toml`) +(Use either `.tfswitchrc` or `.tfswitch.toml` or `.terraform-version`) ``` cdtfswitch(){ @@ -138,6 +138,18 @@ cd(){ } ``` +### Jenkins setup +``` +#!/bin/bash + +echo "Installing tfswitch locally" +wget https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh +chmod 755 install.sh +./install.sh -b bin-directory + +./bin-directory/tfswitch +``` + ## Additional Info See how to *upgrade*, *uninstall*, *troubleshoot* here: [More info](https://warrensbox.github.io/terraform-switcher/additional) diff --git a/docs/_site/additional.html b/docs/_site/additional.html index 7ad31181..76414d8b 100644 --- a/docs/_site/additional.html +++ b/docs/_site/additional.html @@ -23,7 +23,7 @@ {"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"} - + diff --git a/docs/_site/index.html b/docs/_site/index.html index 2213cf3f..909ed6a2 100644 --- a/docs/_site/index.html +++ b/docs/_site/index.html @@ -23,7 +23,7 @@ {"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"} - + @@ -162,10 +162,12 @@

    Use .tfswitchrc file

  • Run the command tfswitch in the same directory as your .tfswitchrc.
  • +

    Instead of a .tfswitchrc file, a .terraform-version file may be used for compatibility with tfenv and other tools which use it

    +

    Automatically switch with bash

    Add the following to the end of your ~/.bashrc file: -(Use either .tfswitchrc or .tfswitch.toml)

    +(Use either .tfswitchrc or .tfswitch.toml or .terraform-version)

    cdtfswitch(){
       builtin cd "$@";
    @@ -207,6 +209,17 @@ 

    Use .tfswitchrc file

    }
    +

    Jenkins setup

    +
    #!/bin/bash 
    +
    +echo "Installing tfswitch locally"
    +wget https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh 
    +chmod 755 install.sh
    +./install.sh -b bin-directory
    +
    +./bin-directory/tfswitch
    +
    +

    Issues

    diff --git a/docs/_site/index.md b/docs/_site/index.md index d97d1e8f..95984027 100644 --- a/docs/_site/index.md +++ b/docs/_site/index.md @@ -82,11 +82,12 @@ version = "0.11.3" 2. For example, `echo "0.10.5" >> .tfswitchrc` for version 0.10.5 of terraform. 3. Run the command `tfswitch` in the same directory as your `.tfswitchrc`. +*Instead of a `.tfswitchrc` file, a `.terraform-version` file may be used for compatibility with [`tfenv`](https://github.com/tfutils/tfenv#terraform-version-file) and other tools which use it* **Automatically switch with bash** Add the following to the end of your `~/.bashrc` file: -(Use either `.tfswitchrc` or `.tfswitch.toml`) +(Use either `.tfswitchrc` or `.tfswitch.toml` or `.terraform-version`) ``` cdtfswitch(){ @@ -130,6 +131,18 @@ cd(){ } ``` +### Jenkins setup +``` +#!/bin/bash + +echo "Installing tfswitch locally" +wget https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh +chmod 755 install.sh +./install.sh -b bin-directory + +./bin-directory/tfswitch +``` +
    ## Issues diff --git a/docs/index.md b/docs/index.md index d97d1e8f..95984027 100644 --- a/docs/index.md +++ b/docs/index.md @@ -82,11 +82,12 @@ version = "0.11.3" 2. For example, `echo "0.10.5" >> .tfswitchrc` for version 0.10.5 of terraform. 3. Run the command `tfswitch` in the same directory as your `.tfswitchrc`. +*Instead of a `.tfswitchrc` file, a `.terraform-version` file may be used for compatibility with [`tfenv`](https://github.com/tfutils/tfenv#terraform-version-file) and other tools which use it* **Automatically switch with bash** Add the following to the end of your `~/.bashrc` file: -(Use either `.tfswitchrc` or `.tfswitch.toml`) +(Use either `.tfswitchrc` or `.tfswitch.toml` or `.terraform-version`) ``` cdtfswitch(){ @@ -130,6 +131,18 @@ cd(){ } ``` +### Jenkins setup +``` +#!/bin/bash + +echo "Installing tfswitch locally" +wget https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh +chmod 755 install.sh +./install.sh -b bin-directory + +./bin-directory/tfswitch +``` +
    ## Issues From b6dc01a224f5696ff39ef916e0bd2ba5ba1dba05 Mon Sep 17 00:00:00 2001 From: "warren.veerasingam" Date: Thu, 5 Mar 2020 11:04:13 -0600 Subject: [PATCH 19/20] added jenkins docs --- README.md | 2 ++ docs/_site/additional.html | 2 +- docs/_site/index.html | 4 +++- docs/_site/index.md | 2 ++ docs/index.md | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b72e03db..2f5d02a5 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,8 @@ cd(){ ``` ### Jenkins setup +drawing + ``` #!/bin/bash diff --git a/docs/_site/additional.html b/docs/_site/additional.html index 76414d8b..8f502959 100644 --- a/docs/_site/additional.html +++ b/docs/_site/additional.html @@ -23,7 +23,7 @@ {"description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebPage","url":"/additional.html","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"tfswitch","@context":"http://schema.org"} - + diff --git a/docs/_site/index.html b/docs/_site/index.html index 909ed6a2..93cd3025 100644 --- a/docs/_site/index.html +++ b/docs/_site/index.html @@ -23,7 +23,7 @@ {"name":"tfswitch","description":"Manage terraform versions - the tfswitch command line tool lets you switch between different versions of terraform","@type":"WebSite","url":"/","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/assets/img/logo.png"}},"headline":"Terraform Switcher","@context":"http://schema.org"} - + @@ -210,6 +210,8 @@

    Use .tfswitchrc file

    Jenkins setup

    +

    drawing

    +
    #!/bin/bash 
     
     echo "Installing tfswitch locally"
    diff --git a/docs/_site/index.md b/docs/_site/index.md
    index 95984027..2450c92f 100644
    --- a/docs/_site/index.md
    +++ b/docs/_site/index.md
    @@ -132,6 +132,8 @@ cd(){
     ```
     
     ### Jenkins setup
    +drawing
    +
     ```
     #!/bin/bash 
     
    diff --git a/docs/index.md b/docs/index.md
    index 95984027..2450c92f 100644
    --- a/docs/index.md
    +++ b/docs/index.md
    @@ -132,6 +132,8 @@ cd(){
     ```
     
     ### Jenkins setup
    +drawing
    +
     ```
     #!/bin/bash 
     
    
    From a48dd4d28d2f8976d5981dd44fb11dfdf6b8bc8b Mon Sep 17 00:00:00 2001
    From: "warren.veerasingam" 
    Date: Thu, 5 Mar 2020 11:06:19 -0600
    Subject: [PATCH 20/20] removed println
    
    ---
     lib/install.go | 1 -
     1 file changed, 1 deletion(-)
    
    diff --git a/lib/install.go b/lib/install.go
    index 856f6185..c3794d29 100644
    --- a/lib/install.go
    +++ b/lib/install.go
    @@ -188,7 +188,6 @@ func AddRecent(requestedVersion string) {
     		}
     
     	} else {
    -		fmt.Println("adding to recent5")
     		CreateRecentFile(requestedVersion)
     	}
     }