hak 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/hak +33 -13
  3. data/lib/hak/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fa4f3e8c13734a9fd62d935ac3239a5c69b0930
4
- data.tar.gz: 45e61a65496a632201fe8ee9e2bd13a1364cdb97
3
+ metadata.gz: e2863e5f7035d67c47b0e09e77a98d5dcd7688c0
4
+ data.tar.gz: 2061c19b0a34d99e1d74f11e9853358438500547
5
5
  SHA512:
6
- metadata.gz: 4d5685322c8338b1351baf0af0be46f3ff38f2e2c7fb3547ae9140fa56d7da43f136bd19d77baf4bbfff4255dab5789aec79b464079646da53a807d2629d454a
7
- data.tar.gz: c56b8b8db7895e0e6905f39c44e52e5b279eb814d334129745d8a722018b325ed1e13520664e0679ba97c9391695bfa5ba5876a5a30c65229f4706133fd63cf6
6
+ metadata.gz: c3ee66d9c868a04d14e05bfb346a200d5c3edb92b7be83355be870744dfd4a41cd10aaf42453e6b9d61a6e1b7b8a5e8d5f44e00b14b8eba168df4894fcd292d8
7
+ data.tar.gz: 6833dd0911021c742e8820dbb2e82d4f5310a53da549c69178dd3fc3a72636e953bf1729f7fd2480146dc0255481e4639789b80056b5b66b26771dd0199f3800
data/bin/hak CHANGED
@@ -5,8 +5,8 @@ require 'commander/import'
5
5
  require 'yaml'
6
6
  require 'pp'
7
7
 
8
- program :name, 'hakberry'
9
- program :version, '0.3.7'
8
+ program :name, 'hak'
9
+ program :version, '0.3.8'
10
10
  program :description, 'Hak - start hacking!'
11
11
 
12
12
  default_command :help
@@ -149,7 +149,7 @@ command :up do |c|
149
149
  c.description = 'this starts up the website'
150
150
  c.example 'description', 'hak up'
151
151
  c.action do |args, options|
152
- h_com "docker-compose up -d && docker-compose logs"
152
+ run "docker-compose up -d && docker-compose logs"
153
153
  end
154
154
  end
155
155
 
@@ -159,7 +159,7 @@ command :down do |c|
159
159
  c.description = 'turns the site down'
160
160
  c.example 'description', 'hak down'
161
161
  c.action do |args, options|
162
- h_com "docker-compose stop"
162
+ run "docker-compose stop"
163
163
  end
164
164
  end
165
165
 
@@ -169,7 +169,7 @@ command :logs do |c|
169
169
  c.description = ''
170
170
  c.example 'description', 'hak logs'
171
171
  c.action do |args, options|
172
- h_com "docker-compose logs"
172
+ run "docker-compose logs"
173
173
  end
174
174
  end
175
175
 
@@ -195,7 +195,7 @@ command :ssh do |c|
195
195
  #app = apps[0]
196
196
  else
197
197
  app = args[0]
198
- h_com "docker-compose run #{app} bash"
198
+ run "docker-compose run #{app} bash"
199
199
  end
200
200
 
201
201
  end
@@ -208,21 +208,41 @@ command :ps do |c|
208
208
  c.description = ''
209
209
  c.example 'description', 'hak ps'
210
210
  c.action do |args, options|
211
- container_names = h_com('docker ps --format "{{.Names}}"', true)
211
+ container_names = run('docker ps --format "{{.Names}}"', true)
212
212
  lines = container_names.lines
213
- sites = lines.map do | line |
214
- line.split('_')[0]
213
+ dinghy_running = false
214
+ sites = lines.map do |line|
215
+ name = line.split('_')[0]
216
+ if name == 'dinghy'
217
+ dinghy_running = true
218
+ "proxy"
219
+ else
220
+ name
221
+ end
215
222
  end
216
223
 
217
- sites.shift
224
+ if dinghy_running == true
225
+ puts sites.uniq
226
+ else
227
+ puts "hak is off, turn it on first by typing:"
228
+ puts "hak on"
229
+ end
218
230
 
219
- puts "Running websites"
220
- puts sites.uniq
231
+ end
232
+ end
233
+
234
+ command :upgrade do |c|
235
+ c.syntax = 'hak upgrade'
236
+ c.summary = 'upgrades hak and dinghy'
237
+ c.description = ''
238
+ c.example 'description', 'hak upgrade'
239
+ c.action do |args, options|
240
+ run "dinghy upgrade"
221
241
  end
222
242
  end
223
243
 
224
244
 
225
- def h_com(command, hide=false)
245
+ def run(command, hide=false)
226
246
  exec = "eval $(dinghy env) && #{command}"
227
247
 
228
248
  if hide
data/lib/hak/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hak
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - jaequery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-04 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander