Skip to content

Commit ba54688

Browse files
authored
Merge pull request #68 from warrensbox/master
Release Changes
2 parents 6789a3f + d747848 commit ba54688

File tree

12 files changed

+191
-239
lines changed

12 files changed

+191
-239
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ test: $(EXE)
3131
.PHONEY: dep
3232
dep:
3333
dep ensure
34+
35+
.PHONY: docs
36+
docs:
37+
cd docs; bundle install --path vendor/bundler; bundle exec jekyll build -c _config.yml; cd ..
38+

README.md

Lines changed: 20 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ The most recently selected versions are presented at the top of the dropdown.
6565
3. Hit **Enter** to select the desired version.
6666

6767

68-
### Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer)
68+
### Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers)
6969
This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation
7070

71+
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 170px;"/>
7172
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 170px;"/>
7273

7374
1. Create a custom binary path. Ex: `mkdir /Users/warrenveerasingam/bin` (replace warrenveerasingam with your username)
@@ -81,64 +82,20 @@ version = "0.11.3"
8182
```
8283
4. Run `tfswitch` and it should automatically install the required terraform version in the specified binary path
8384

84-
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 170px;"/>
85-
86-
**Automatically switch with bash**
87-
88-
Add the following to the end of your `~/.bashrc` file:
89-
```
90-
cdtfswitch(){
91-
builtin cd "$@";
92-
cdir=$PWD;
93-
if [ -f "$cdir/.tfswitch.toml" ]; then
94-
tfswitch
95-
fi
96-
}
97-
alias cd='cdtfswitch'
98-
```
99-
100-
**Automatically switch with zsh**
101-
102-
Add the following to the end of your `~/.zshrc` file:
103-
104-
```
105-
load-tfswitch() {
106-
local tfswitchrc_path=".tfswitch.toml"
107-
108-
if [ -f "$tfswitchrc_path" ]; then
109-
tfswitch
110-
fi
111-
}
112-
add-zsh-hook chpwd load-tfswitch
113-
load-tfswitch
114-
```
115-
> 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`:
116-
> ```
117-
> autoload -U add-zsh-hook
118-
> ```
119-
120-
*older version of zsh*
121-
```
122-
cd(){
123-
builtin cd "$@";
124-
cdir=$PWD;
125-
if [ -f "$cdir/.tfswitchrc" ]; then
126-
tfswitch
127-
fi
128-
}
129-
```
130-
13185
### Use .tfswitchrc file
13286
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v6.gif" alt="drawing" style="width: 170px;"/>
13387

13488
1. Create a `.tfswitchrc` file containing the desired version
13589
2. For example, `echo "0.10.5" >> .tfswitchrc` for version 0.10.5 of terraform
13690
3. Run the command `tfswitch` in the same directory as your `.tfswitchrc`
13791

92+
*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*
13893

13994
**Automatically switch with bash**
14095

14196
Add the following to the end of your `~/.bashrc` file:
97+
(Use either `.tfswitchrc` or `.tfswitch.toml` or `.terraform-version`)
98+
14299
```
143100
cdtfswitch(){
144101
builtin cd "$@";
@@ -181,9 +138,23 @@ cd(){
181138
}
182139
```
183140
141+
### Jenkins setup
142+
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/jenkins_tfswitch.png" alt="drawing" style="width: 170px;"/>
143+
144+
```
145+
#!/bin/bash
146+
147+
echo "Installing tfswitch locally"
148+
wget https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh
149+
chmod 755 install.sh
150+
./install.sh -b bin-directory
151+
152+
./bin-directory/tfswitch
153+
```
154+
184155
## Additional Info
185156
186-
See how to *upgrade*, *uninstall*, *troubleshoot* here:[More info](https://warrensbox.github.io/terraform-switcher/additional)
157+
See how to *upgrade*, *uninstall*, *troubleshoot* here: [More info](https://warrensbox.github.io/terraform-switcher/additional)
187158
188159
189160
## Issues

docs/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ GEM
205205
jekyll-seo-tag (~> 2.1)
206206
minitest (5.11.3)
207207
multipart-post (2.0.0)
208-
nokogiri (1.10.1)
208+
nokogiri (1.10.8)
209209
mini_portile2 (~> 2.4.0)
210210
octokit (4.13.0)
211211
sawyer (~> 0.8.0, >= 0.5.3)
@@ -219,7 +219,7 @@ GEM
219219
ruby-enum (0.7.2)
220220
i18n
221221
ruby_dep (1.5.0)
222-
rubyzip (1.2.2)
222+
rubyzip (1.3.0)
223223
safe_yaml (1.0.4)
224224
sass (3.7.3)
225225
sass-listen (~> 4.0.0)

docs/_layouts/default.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
gtag('config', 'UA-120055973-1');
2828
</script>
29+
30+
<!-- Place this tag in your head or just before your close body tag. -->
31+
<script async defer src="https://buttons.github.io/buttons.js"></script>
2932
</head>
3033
<body>
3134
<div class="wrapper">
@@ -51,17 +54,20 @@
5154
<li><a href="https://github.com/warrensbox/terraform-switcher/releases">Releases On <strong>GitHub</strong></a></li>
5255
</ul>
5356
{% endif %}
57+
58+
<!-- Place this tag where you want the button to render. -->
59+
<a class="github-button" href="https://github.com/warrensbox/terraform-switcher" data-size="large" data-show-count="true" aria-label="Star warrensbox/terraform-switcher on GitHub">Star</a>
5460
</header>
5561
<section>
5662

5763
{{ content }}
5864
{% if site.github.is_project_page %}
59-
<p><small>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></small></p>
65+
<p><small>This project is maintained by <a href="{{ site.github.repository_url }}">{{ site.github.owner_name }}</a></small></p>
6066
{% endif %}
6167
</section>
6268
<footer>
6369
<!-- <p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p> -->
64-
<p><small>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></small></p>
70+
<p><small>This project is maintained by <a href="{{ site.github.repository_url }}">{{ site.github.owner_name }}</a></small></p>
6571
</footer>
6672
</div>
6773
<script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script>

docs/_site/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ GEM
205205
jekyll-seo-tag (~> 2.1)
206206
minitest (5.11.3)
207207
multipart-post (2.0.0)
208-
nokogiri (1.10.1)
208+
nokogiri (1.10.8)
209209
mini_portile2 (~> 2.4.0)
210210
octokit (4.13.0)
211211
sawyer (~> 0.8.0, >= 0.5.3)
@@ -219,7 +219,7 @@ GEM
219219
ruby-enum (0.7.2)
220220
i18n
221221
ruby_dep (1.5.0)
222-
rubyzip (1.2.2)
222+
rubyzip (1.3.0)
223223
safe_yaml (1.0.4)
224224
sass (3.7.3)
225225
sass-listen (~> 4.0.0)

docs/_site/additional.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{"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"}</script>
2424
<!-- End Jekyll SEO tag -->
2525

26-
<link rel="stylesheet" href="/assets/css/style.css?v=6d07d7f358b39ef797c837ef812a979456d32f5f">
26+
<link rel="stylesheet" href="/assets/css/style.css?v=0b7be9932efc2fc12b75f7de015e535bb13fda26">
2727
<!--[if lt IE 9]>
2828
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
2929
<![endif]-->
@@ -37,6 +37,9 @@
3737

3838
gtag('config', 'UA-120055973-1');
3939
</script>
40+
41+
<!-- Place this tag in your head or just before your close body tag. -->
42+
<script async defer src="https://buttons.github.io/buttons.js"></script>
4043
</head>
4144
<body>
4245
<div class="wrapper">
@@ -57,11 +60,14 @@
5760

5861

5962
<ul>
60-
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.7.0/terraform-switcher_0.7.0_darwin_amd64.tar.gz">Download <strong>MacOS</strong></a></li>
61-
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.7.0/terraform-switcher_0.7.0_linux_amd64.tar.gz">Download <strong>Linux</strong></a></li>
63+
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.7.737/terraform-switcher_0.7.737_darwin_amd64.tar.gz">Download <strong>MacOS</strong></a></li>
64+
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.7.737/terraform-switcher_0.7.737_linux_amd64.tar.gz">Download <strong>Linux</strong></a></li>
6265
<li><a href="https://github.com/warrensbox/terraform-switcher/releases">Releases On <strong>GitHub</strong></a></li>
6366
</ul>
6467

68+
69+
<!-- Place this tag where you want the button to render. -->
70+
<a class="github-button" href="https://github.com/warrensbox/terraform-switcher" data-size="large" data-show-count="true" aria-label="Star warrensbox/terraform-switcher on GitHub">Star</a>
6571
</header>
6672
<section>
6773

@@ -111,12 +117,12 @@ <h2 id="troubleshoot">Troubleshoot:</h2>
111117
<a href="index">Back to main</a></p>
112118

113119

114-
<p><small>This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>
120+
<p><small>This project is maintained by <a href="http://github.com/warrensbox/terraform-switcher">warrensbox</a></small></p>
115121

116122
</section>
117123
<footer>
118124
<!-- <p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p> -->
119-
<p><small>This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>
125+
<p><small>This project is maintained by <a href="http://github.com/warrensbox/terraform-switcher">warrensbox</a></small></p>
120126
</footer>
121127
</div>
122128
<script src="/assets/js/scale.fix.js"></script>

docs/_site/index.html

Lines changed: 32 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{"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"}</script>
2424
<!-- End Jekyll SEO tag -->
2525

26-
<link rel="stylesheet" href="/assets/css/style.css?v=6d07d7f358b39ef797c837ef812a979456d32f5f">
26+
<link rel="stylesheet" href="/assets/css/style.css?v=0b7be9932efc2fc12b75f7de015e535bb13fda26">
2727
<!--[if lt IE 9]>
2828
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
2929
<![endif]-->
@@ -37,6 +37,9 @@
3737

3838
gtag('config', 'UA-120055973-1');
3939
</script>
40+
41+
<!-- Place this tag in your head or just before your close body tag. -->
42+
<script async defer src="https://buttons.github.io/buttons.js"></script>
4043
</head>
4144
<body>
4245
<div class="wrapper">
@@ -57,11 +60,14 @@
5760

5861

5962
<ul>
60-
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.7.0/terraform-switcher_0.7.0_darwin_amd64.tar.gz">Download <strong>MacOS</strong></a></li>
61-
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.7.0/terraform-switcher_0.7.0_linux_amd64.tar.gz">Download <strong>Linux</strong></a></li>
63+
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.7.737/terraform-switcher_0.7.737_darwin_amd64.tar.gz">Download <strong>MacOS</strong></a></li>
64+
<li><a href="https://github.com/warrensbox/terraform-switcher/releases/download/0.7.737/terraform-switcher_0.7.737_linux_amd64.tar.gz">Download <strong>Linux</strong></a></li>
6265
<li><a href="https://github.com/warrensbox/terraform-switcher/releases">Releases On <strong>GitHub</strong></a></li>
6366
</ul>
6467

68+
69+
<!-- Place this tag where you want the button to render. -->
70+
<a class="github-button" href="https://github.com/warrensbox/terraform-switcher" data-size="large" data-show-count="true" aria-label="Star warrensbox/terraform-switcher on GitHub">Star</a>
6571
</header>
6672
<section>
6773

@@ -128,10 +134,11 @@ <h3 id="see-all-versions-including-beta-alpha-and-release-candidatesrc">See all
128134
<li>Hit <strong>Enter</strong> to select the desired version.</li>
129135
</ol>
130136

131-
<h3 id="use-tfswitchtoml-file--for-uprivilege-users-non-admin---users-with-limited-privilege-on-their-computer">Use .tfswitch.toml file (For uprivilege users/ non-admin - users with limited privilege on their computer)</h3>
137+
<h3 id="use-tfswitchtoml-file--for-non-admin---users-with-limited-privilege-on-their-computers">Use .tfswitch.toml file (For non-admin - users with limited privilege on their computers)</h3>
132138
<p>This is similiar to using a .tfswitchrc file, but you can specify a custom binary path for your terraform installation</p>
133139

134-
<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 170px;" /></p>
140+
<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 490px;" />
141+
<img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v8.gif" alt="drawing" style="width: 490px;" /></p>
135142

136143
<ol>
137144
<li>Create a custom binary path. Ex: <code class="highlighter-rouge">mkdir /Users/warrenveerasingam/bin</code> (replace warrenveerasingam with your username)</li>
@@ -146,51 +153,6 @@ <h3 id="use-tfswitchtoml-file--for-uprivilege-users-non-admin---users-with-limit
146153
<li>Run <code class="highlighter-rouge">tfswitch</code> and it should automatically install the required terraform version in the specified binary path</li>
147154
</ol>
148155

149-
<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v7.gif" alt="drawing" style="width: 170px;" /></p>
150-
151-
<p><strong>Automatically switch with bash</strong></p>
152-
153-
<p>Add the following to the end of your <code class="highlighter-rouge">~/.bashrc</code> file:</p>
154-
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cdtfswitch(){
155-
builtin cd "$@";
156-
cdir=$PWD;
157-
if [ -f "$cdir/.tfswitch.toml" ]; then
158-
tfswitch
159-
fi
160-
}
161-
alias cd='cdtfswitch'
162-
</code></pre></div></div>
163-
164-
<p><strong>Automatically switch with zsh</strong></p>
165-
166-
<p>Add the following to the end of your <code class="highlighter-rouge">~/.zshrc</code> file:</p>
167-
168-
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>load-tfswitch() {
169-
local tfswitchrc_path=".tfswitch.toml"
170-
171-
if [ -f "$tfswitchrc_path" ]; then
172-
tfswitch
173-
fi
174-
}
175-
add-zsh-hook chpwd load-tfswitch
176-
load-tfswitch
177-
</code></pre></div></div>
178-
<blockquote>
179-
<p>NOTE: if you see an error like this: <code class="highlighter-rouge">command not found: add-zsh-hook</code>, then you might be on an older version of zsh (see below), or you simply need to load <code class="highlighter-rouge">add-zsh-hook</code> by adding this to your <code class="highlighter-rouge">.zshrc</code>:</p>
180-
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> autoload -U add-zsh-hook
181-
</code></pre></div> </div>
182-
</blockquote>
183-
184-
<p><em>older version of zsh</em></p>
185-
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd(){
186-
builtin cd "$@";
187-
cdir=$PWD;
188-
if [ -f "$cdir/.tfswitchrc" ]; then
189-
tfswitch
190-
fi
191-
}
192-
</code></pre></div></div>
193-
194156
<h3 id="use-tfswitchrc-file">Use .tfswitchrc file</h3>
195157
<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/tfswitch-v6.gif" alt="drawing" style="width: 490px;" /></p>
196158

@@ -200,9 +162,13 @@ <h3 id="use-tfswitchrc-file">Use .tfswitchrc file</h3>
200162
<li>Run the command <code class="highlighter-rouge">tfswitch</code> in the same directory as your <code class="highlighter-rouge">.tfswitchrc</code>.</li>
201163
</ol>
202164

165+
<p><em>Instead of a <code class="highlighter-rouge">.tfswitchrc</code> file, a <code class="highlighter-rouge">.terraform-version</code> file may be used for compatibility with <a href="https://github.com/tfutils/tfenv#terraform-version-file"><code class="highlighter-rouge">tfenv</code></a> and other tools which use it</em></p>
166+
203167
<p><strong>Automatically switch with bash</strong></p>
204168

205-
<p>Add the following to the end of your <code class="highlighter-rouge">~/.bashrc</code> file:</p>
169+
<p>Add the following to the end of your <code class="highlighter-rouge">~/.bashrc</code> file:
170+
(Use either <code class="highlighter-rouge">.tfswitchrc</code> or <code class="highlighter-rouge">.tfswitch.toml</code> or <code class="highlighter-rouge">.terraform-version</code>)</p>
171+
206172
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cdtfswitch(){
207173
builtin cd "$@";
208174
cdir=$PWD;
@@ -243,6 +209,19 @@ <h3 id="use-tfswitchrc-file">Use .tfswitchrc file</h3>
243209
}
244210
</code></pre></div></div>
245211

212+
<h3 id="jenkins-setup">Jenkins setup</h3>
213+
<p><img src="https://s3.us-east-2.amazonaws.com/kepler-images/warrensbox/tfswitch/jenkins_tfswitch.png" alt="drawing" style="width: 170px;" /></p>
214+
215+
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash </span>
216+
217+
<span class="nb">echo</span> <span class="s2">"Installing tfswitch locally"</span>
218+
wget https://raw.githubusercontent.com/warrensbox/terraform-switcher/release/install.sh
219+
chmod 755 install.sh
220+
./install.sh <span class="nt">-b</span> bin-directory
221+
222+
./bin-directory/tfswitch
223+
</code></pre></div></div>
224+
246225
<hr />
247226

248227
<h2 id="issues">Issues</h2>
@@ -255,12 +234,12 @@ <h2 id="issues">Issues</h2>
255234
<a href="additional">Additional Info</a></p>
256235

257236

258-
<p><small>This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>
237+
<p><small>This project is maintained by <a href="http://github.com/warrensbox/terraform-switcher">warrensbox</a></small></p>
259238

260239
</section>
261240
<footer>
262241
<!-- <p><small>View other products &mdash; by <a href="http://warren.veerasingam.com/#about_me" target="_blank">Warren Veerasingam</a></small></p> -->
263-
<p><small>This project is maintained by <a href="http://github.com/warrensbox">warrensbox</a></small></p>
242+
<p><small>This project is maintained by <a href="http://github.com/warrensbox/terraform-switcher">warrensbox</a></small></p>
264243
</footer>
265244
</div>
266245
<script src="/assets/js/scale.fix.js"></script>

0 commit comments

Comments
 (0)