Author: Kevin Schoon [kevinschoon@gmail.com]
Hash: cb6867d32976c3766c52cd66226568e8004feec1
Timestamp: Sun, 10 Feb 2019 20:39:45 +0000 (5 years ago)

+81 -52 +/-6 browse
add installer script
1diff --git a/.gitignore b/.gitignore
2index 1597996..5720659 100644
3--- a/.gitignore
4+++ b/.gitignore
5 @@ -30,5 +30,6 @@ bin/*
6
7 www/public/
8 www/data/
9+ www/static/install.sh
10
11 docs/demo.gif
12 diff --git a/Makefile b/Makefile
13index f416e7d..329b10a 100644
14--- a/Makefile
15+++ b/Makefile
16 @@ -48,12 +48,11 @@ release-darwin: bin/pomo-$(VERSION)-darwin-amd64 bin/pomo-$(VERSION)-darwin-amd6
17
18 release: release-linux release-darwin
19
20- docs: readme
21- cd www && hugo -d ../docs
22-
23- readme: www/data/readme.json
24+ docs: www/data/readme.json
25+ cd www && cp ../install.sh static/ && hugo -d ../docs
26
27 www/data/readme.json: www/data README.md
28 cat README.md | python -c 'import json,sys; print(json.dumps({"content": sys.stdin.read()}))' > $@
29+
30 www/data bin:
31 mkdir -p $@
32 diff --git a/README.md b/README.md
33index b047194..f593d90 100644
34--- a/README.md
35+++ b/README.md
36 @@ -20,32 +20,18 @@ The Pomodoro Technique is simple and effective:
37
38 Binaries are available for Linux and OSX platforms in the [releases section](https://github.com/kevinschoon/pomo/releases) on github.
39
40- #### Linux
41+ ### Installer Script
42
43- ```
44- curl -L -o pomo https://github.com/kevinschoon/pomo/releases/download/0.6.0/pomo-0.6.0-linux-amd64
45- # Optionally verify file integrity
46- echo 97be4ccf66c4ae4e3e154f87b9bb0bf2 pomo | md5sum -c -
47- chmod +x pomo
48- ./pomo -v
49- # Copy pomo to somewhere on your $PATH
50- ```
51-
52- #### OSX
53-
54- ```
55- curl -L -o pomo https://github.com/kevinschoon/pomo/releases/download/0.6.0/pomo-0.6.0-darwin-amd64
56- # Optionally verify file integrity
57- [[ $(md5 -r pomo) != "55d77a30dfd6f66c95e19dd83c7ec95c pomo" ]] && echo "invalid hash!"
58- chmod +x pomo
59- ./pomo -v
60- # Copy pomo to somewhere on your $PATH
61+ A bash script to download and verify the latest release for Linux and OSX platforms can be run
62+ with the following command:
63
64+ ```bash
65+ curl -L -s https://kevinschoon.github.io/pomo/install.sh | bash /dev/stdin
66 ```
67
68 ### Source
69
70- ```
71+ ```bash
72 go get github.com/kevinschoon/pomo
73 pomo -v
74 ```
75 @@ -54,12 +40,12 @@ chmod +x pomo
76
77 Once `pomo` is installed you need to initialize it's database.
78
79- ```
80+ ``` bash
81 pomo init
82 ```
83
84 Start a 4 pomodoro session at 25 minute intervals:
85- ```
86+ ```bash
87 pomo start -t my-project "write some codes"
88 ```
89
90 @@ -72,7 +58,7 @@ Pomo has a few configuration options which can be read from a JSON file in Pomo'
91 You can map colors to specific tags in the `colors` field.
92
93 Example:
94- ```
95+ ```json
96 {
97 "colors": {
98 "my-project": "hiyellow",
99 @@ -93,7 +79,7 @@ making it easy to script and embed it's output in various Linux status bars.
100 You can create a module with the `custom/script` type and
101 embed Pomo's status output in your Polybar:
102
103- ```
104+ ```ini
105 [module/pomo]
106 type = custom/script
107 interval = 1
108 @@ -104,7 +90,6 @@ exec = pomo status
109 ## Roadmap
110
111 * Generate charts/burn down
112- * System tray notification/icon
113 * ??
114
115 ## Credits
116 diff --git a/docs/index.html b/docs/index.html
117index 1f3c0a4..61eadc4 100644
118--- a/docs/index.html
119+++ b/docs/index.html
120 @@ -146,30 +146,17 @@
121
122 <p>Binaries are available for Linux and OSX platforms in the <a href="https://github.com/kevinschoon/pomo/releases">releases section</a> on github.</p>
123
124- <h4 id="linux">Linux</h4>
125-
126- <pre><code>curl -L -o pomo https://github.com/kevinschoon/pomo/releases/download/0.6.0/pomo-0.6.0-linux-amd64
127- # Optionally verify file integrity
128- echo 97be4ccf66c4ae4e3e154f87b9bb0bf2 pomo | md5sum -c -
129- chmod +x pomo
130- ./pomo -v
131- # Copy pomo to somewhere on your $PATH
132- </code></pre>
133-
134- <h4 id="osx">OSX</h4>
135+ <h3 id="installer-script">Installer Script</h3>
136
137- <pre><code>curl -L -o pomo https://github.com/kevinschoon/pomo/releases/download/0.6.0/pomo-0.6.0-darwin-amd64
138- # Optionally verify file integrity
139- [[ $(md5 -r pomo) != &quot;55d77a30dfd6f66c95e19dd83c7ec95c pomo&quot; ]] &amp;&amp; echo &quot;invalid hash!&quot;
140- chmod +x pomo
141- ./pomo -v
142- # Copy pomo to somewhere on your $PATH
143+ <p>A bash script to download and verify the latest release for Linux and OSX platforms can be run
144+ with the following command:</p>
145
146+ <pre><code class="language-bash">curl -L -s https://kevinschoon.github.io/pomo/install.sh | bash /dev/stdin
147 </code></pre>
148
149 <h3 id="source">Source</h3>
150
151- <pre><code> go get github.com/kevinschoon/pomo
152+ <pre><code class="language-bash"> go get github.com/kevinschoon/pomo
153 pomo -v
154 </code></pre>
155
156 @@ -177,12 +164,12 @@ chmod +x pomo
157
158 <p>Once <code>pomo</code> is installed you need to initialize it&rsquo;s database.</p>
159
160- <pre><code>pomo init
161+ <pre><code class="language-bash">pomo init
162 </code></pre>
163
164 <p>Start a 4 pomodoro session at 25 minute intervals:</p>
165
166- <pre><code>pomo start -t my-project &quot;write some codes&quot;
167+ <pre><code class="language-bash">pomo start -t my-project &quot;write some codes&quot;
168 </code></pre>
169
170 <h2 id="configuration">Configuration</h2>
171 @@ -195,7 +182,7 @@ chmod +x pomo
172
173 <p>Example:</p>
174
175- <pre><code>{
176+ <pre><code class="language-json">{
177 &quot;colors&quot;: {
178 &quot;my-project&quot;: &quot;hiyellow&quot;,
179 &quot;another-project&quot;: &quot;green&quot;
180 @@ -215,7 +202,7 @@ making it easy to script and embed it&rsquo;s output in various Linux status bar
181 <p>You can create a module with the <code>custom/script</code> type and
182 embed Pomo&rsquo;s status output in your Polybar:</p>
183
184- <pre><code>[module/pomo]
185+ <pre><code class="language-ini">[module/pomo]
186 type = custom/script
187 interval = 1
188 exec = pomo status
189 @@ -225,7 +212,6 @@ exec = pomo status
190
191 <ul>
192 <li>Generate charts/burn down</li>
193- <li>System tray notification/icon</li>
194 <li>??</li>
195 </ul>
196
197 diff --git a/docs/install.sh b/docs/install.sh
198new file mode 100755
199index 0000000..9dba7d6
200--- /dev/null
201+++ b/docs/install.sh
202 @@ -0,0 +1,29 @@
203+ #!/bin/bash
204+
205+ POMO_VERSION="0.7.0"
206+ OSX_MD5="4aa452e021d07bbb2c7c3a15839fe5df"
207+ LINUX_MD5="84551ab258902e62d9d8e14368bfdf4b"
208+ OSX_TARBALL="https://github.com/kevinschoon/pomo/releases/download/$POMO_VERSION/pomo-$POMO_VERSION-darwin-amd64"
209+ LINUX_TARBALL="https://github.com/kevinschoon/pomo/releases/download/$POMO_VERSION/pomo-$POMO_VERSION-linux-amd64"
210+
211+ install_pomo() {
212+ echo "Installing Pomo..."
213+ if [[ "$OSTYPE" == darwin* ]] ; then {
214+ curl -L -o pomo "$OSX_TARBALL" && \
215+ [[ $(md5 -r pomo) == "$OSX_MD5" ]] && \
216+ chmod +x pomo && \
217+ ./pomo -v
218+ } elif [[ "$OSTYPE" == linux* ]] ; then {
219+ curl -L -o pomo "$LINUX_TARBALL" && \
220+ echo "$LINUX_MD5 pomo" | md5sum -c - && \
221+ chmod +x pomo && \
222+ ./pomo -v
223+ } else {
224+ echo "cannot detect OS type"
225+ return 1
226+ }
227+ fi
228+ echo "Pomo $POMO_VERSION installed, copy ./pomo to somewhere on your path."
229+ }
230+
231+ install_pomo
232 diff --git a/install.sh b/install.sh
233new file mode 100755
234index 0000000..9dba7d6
235--- /dev/null
236+++ b/install.sh
237 @@ -0,0 +1,29 @@
238+ #!/bin/bash
239+
240+ POMO_VERSION="0.7.0"
241+ OSX_MD5="4aa452e021d07bbb2c7c3a15839fe5df"
242+ LINUX_MD5="84551ab258902e62d9d8e14368bfdf4b"
243+ OSX_TARBALL="https://github.com/kevinschoon/pomo/releases/download/$POMO_VERSION/pomo-$POMO_VERSION-darwin-amd64"
244+ LINUX_TARBALL="https://github.com/kevinschoon/pomo/releases/download/$POMO_VERSION/pomo-$POMO_VERSION-linux-amd64"
245+
246+ install_pomo() {
247+ echo "Installing Pomo..."
248+ if [[ "$OSTYPE" == darwin* ]] ; then {
249+ curl -L -o pomo "$OSX_TARBALL" && \
250+ [[ $(md5 -r pomo) == "$OSX_MD5" ]] && \
251+ chmod +x pomo && \
252+ ./pomo -v
253+ } elif [[ "$OSTYPE" == linux* ]] ; then {
254+ curl -L -o pomo "$LINUX_TARBALL" && \
255+ echo "$LINUX_MD5 pomo" | md5sum -c - && \
256+ chmod +x pomo && \
257+ ./pomo -v
258+ } else {
259+ echo "cannot detect OS type"
260+ return 1
261+ }
262+ fi
263+ echo "Pomo $POMO_VERSION installed, copy ./pomo to somewhere on your path."
264+ }
265+
266+ install_pomo