hak 0.5.9 → 0.6.0
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.
- checksums.yaml +4 -4
- data/bin/hak +100 -37
- data/lib/hak/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ccab0e8c148fe31b82b4616417d674670ceda79c
|
|
4
|
+
data.tar.gz: 5b27503207226611ea12ea2114917b077c21fd6d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9311ce88bfff02ce1717a22619c4d99a995d010b9f95029dc85bab24eaeed63311674523599551a88c2391c6e1638b11d637e5633d99d51f1baa6c5fa3e4447
|
|
7
|
+
data.tar.gz: 353b36d61ab2f990264d4e9e4640c0c52983b695d0ecee68fced6bd623203d6643f764dca6d598f28a03f90b047d02137a945eb1dc98e8d2e53d1dd4da99346a
|
data/bin/hak
CHANGED
|
@@ -5,9 +5,10 @@ require 'commander/import'
|
|
|
5
5
|
require 'yaml'
|
|
6
6
|
require 'colorize'
|
|
7
7
|
require 'highline'
|
|
8
|
+
require 'rbconfig'
|
|
8
9
|
|
|
9
10
|
program :name, 'hak'
|
|
10
|
-
program :version, '0.
|
|
11
|
+
program :version, '0.6.0'
|
|
11
12
|
program :description, 'Hak - A Docker-driven development platform'
|
|
12
13
|
|
|
13
14
|
default_command :help
|
|
@@ -17,25 +18,27 @@ command :install do |c|
|
|
|
17
18
|
c.summary = 'installs hak'
|
|
18
19
|
c.description = 'installs hak'
|
|
19
20
|
c.example 'description', 'hak install'
|
|
20
|
-
c.action do |args, options|
|
|
21
|
+
c.action do |args, options|
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
installed = false
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
case os
|
|
26
|
+
when :macosx
|
|
27
|
+
installed = `echo "nameserver 127.0.0.1\nport 19322" | sudo tee -a /etc/resolver/docker`
|
|
28
|
+
when :linux
|
|
29
|
+
installed = `gem install dory`
|
|
29
30
|
else
|
|
31
|
+
puts "other os are not supported at this time".red
|
|
32
|
+
abort
|
|
33
|
+
end
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
nameserver 127.0.0.1
|
|
33
|
-
port 19322`
|
|
34
|
-
|
|
35
|
+
if installed
|
|
35
36
|
puts "hak installed".green
|
|
36
37
|
puts "now turn hak on by typing:"
|
|
37
38
|
puts "hak on".yellow
|
|
38
|
-
|
|
39
|
+
else
|
|
40
|
+
puts "dns resolver was not setup correctly".red
|
|
41
|
+
abort
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
end
|
|
@@ -47,11 +50,17 @@ command :on do |c|
|
|
|
47
50
|
c.description = 'powers on the hak server'
|
|
48
51
|
c.example 'description', 'hak on'
|
|
49
52
|
c.action do |args, options|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
|
|
54
|
+
case os
|
|
55
|
+
when :macosx
|
|
56
|
+
check_docker
|
|
57
|
+
check_dns
|
|
58
|
+
`docker stop hak-proxy > /dev/null 2>&1`
|
|
59
|
+
`docker rm hak-proxy > /dev/null 2>&1`
|
|
60
|
+
`docker run -d -v /var/run/docker.sock:/tmp/docker.sock:ro -p 80:80 -p 443:443 -p 19322:19322/udp -e CONTAINER_NAME=hak-proxy --name hak-proxy codekitchen/dinghy-http-proxy > /dev/null 2>&1`
|
|
61
|
+
when :linux
|
|
62
|
+
`dory up`
|
|
63
|
+
end
|
|
55
64
|
puts "hak-proxy started".green
|
|
56
65
|
end
|
|
57
66
|
end
|
|
@@ -62,8 +71,13 @@ command :off do |c|
|
|
|
62
71
|
c.description = 'shuts off the hak server'
|
|
63
72
|
c.example 'description', 'hak off'
|
|
64
73
|
c.action do |args, options|
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
case os
|
|
75
|
+
when :macosx
|
|
76
|
+
`docker stop hak-proxy > /dev/null 2>&1`
|
|
77
|
+
`docker rm hak-proxy > /dev/null 2>&1`
|
|
78
|
+
when :linux
|
|
79
|
+
`dory down`
|
|
80
|
+
end
|
|
67
81
|
puts "hak-proxy stopped".green
|
|
68
82
|
end
|
|
69
83
|
end
|
|
@@ -76,7 +90,7 @@ command :clone do |c|
|
|
|
76
90
|
c.action do |args, options|
|
|
77
91
|
|
|
78
92
|
if args.empty?
|
|
79
|
-
puts "for more
|
|
93
|
+
puts "for more packages, check out https://www.composeup.com/"
|
|
80
94
|
puts "type one of the following to get started: "
|
|
81
95
|
puts "hak clone jaequery/react-starter".yellow
|
|
82
96
|
puts "hak clone jaequery/honeybadger".yellow
|
|
@@ -122,10 +136,8 @@ command :start do |c|
|
|
|
122
136
|
c.action do |args, options|
|
|
123
137
|
check_all
|
|
124
138
|
check_compose
|
|
125
|
-
|
|
126
139
|
run "docker-compose up -d && docker-compose logs -f"
|
|
127
140
|
puts "app started".green
|
|
128
|
-
|
|
129
141
|
end
|
|
130
142
|
end
|
|
131
143
|
|
|
@@ -172,7 +184,7 @@ command :logs do |c|
|
|
|
172
184
|
c.description = ''
|
|
173
185
|
c.example 'description', 'hak logs'
|
|
174
186
|
c.action do |args, options|
|
|
175
|
-
|
|
187
|
+
check_all
|
|
176
188
|
run "docker-compose logs -f"
|
|
177
189
|
end
|
|
178
190
|
end
|
|
@@ -215,17 +227,23 @@ command :ps do |c|
|
|
|
215
227
|
c.action do |args, options|
|
|
216
228
|
check_all
|
|
217
229
|
|
|
230
|
+
case os
|
|
231
|
+
when :macosx
|
|
232
|
+
proxy_name = "hak-proxy"
|
|
233
|
+
when :linux
|
|
234
|
+
proxy_name = "dory_dinghy_http_proxy"
|
|
235
|
+
end
|
|
236
|
+
|
|
218
237
|
container_names = run('docker ps --format "{{.Names}}"', true)
|
|
219
238
|
lines = container_names.lines
|
|
220
239
|
dinghy_running = false
|
|
221
240
|
sites = lines.map do |line|
|
|
222
241
|
name = line.split('_')[0]
|
|
223
|
-
if name ==
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
end
|
|
242
|
+
# if name == proxy_name
|
|
243
|
+
# dinghy_running = true
|
|
244
|
+
# else
|
|
245
|
+
# name
|
|
246
|
+
# end
|
|
229
247
|
end
|
|
230
248
|
|
|
231
249
|
puts sites.uniq
|
|
@@ -331,9 +349,14 @@ def run(command, hide=false)
|
|
|
331
349
|
end
|
|
332
350
|
|
|
333
351
|
def check_all
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
352
|
+
case os
|
|
353
|
+
when :macosx
|
|
354
|
+
check_docker
|
|
355
|
+
check_dns
|
|
356
|
+
check_proxy
|
|
357
|
+
when :linux
|
|
358
|
+
check_dory
|
|
359
|
+
end
|
|
337
360
|
end
|
|
338
361
|
|
|
339
362
|
def check_docker
|
|
@@ -352,11 +375,25 @@ def check_docker
|
|
|
352
375
|
end
|
|
353
376
|
|
|
354
377
|
def check_dns
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
case os
|
|
381
|
+
when :macosx
|
|
382
|
+
|
|
383
|
+
if !File.exist?('/etc/resolver/docker')
|
|
384
|
+
puts "hak not installed properly, please type:"
|
|
385
|
+
puts "hak install".yellow
|
|
386
|
+
abort
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
when :linux
|
|
390
|
+
if !File.exist?('/etc/resolver/docker')
|
|
391
|
+
puts "hak not installed properly, please type:"
|
|
392
|
+
puts "hak install".yellow
|
|
393
|
+
abort
|
|
394
|
+
end
|
|
359
395
|
end
|
|
396
|
+
|
|
360
397
|
return true
|
|
361
398
|
end
|
|
362
399
|
|
|
@@ -377,3 +414,29 @@ def check_compose
|
|
|
377
414
|
end
|
|
378
415
|
end
|
|
379
416
|
|
|
417
|
+
def check_dory
|
|
418
|
+
res = system "dory status"
|
|
419
|
+
if res.include? "not running"
|
|
420
|
+
puts 'Dory was not running, starting it up'.green
|
|
421
|
+
system "dory on"
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
def os
|
|
426
|
+
@os ||= (
|
|
427
|
+
host_os = RbConfig::CONFIG['host_os']
|
|
428
|
+
case host_os
|
|
429
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
|
430
|
+
:windows
|
|
431
|
+
when /darwin|mac os/
|
|
432
|
+
:macosx
|
|
433
|
+
when /linux/
|
|
434
|
+
:linux
|
|
435
|
+
when /solaris|bsd/
|
|
436
|
+
:unix
|
|
437
|
+
else
|
|
438
|
+
raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
|
|
439
|
+
end
|
|
440
|
+
)
|
|
441
|
+
end
|
|
442
|
+
|
data/lib/hak/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- jaequery
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-06-
|
|
11
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: commander
|
|
@@ -38,6 +38,20 @@ dependencies:
|
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rbconfig
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
41
55
|
description: Hak is like NPM for websites. You can download, start, and deploy websites
|
|
42
56
|
directly from the CLI.
|
|
43
57
|
email:
|