hak 0.3.8 → 0.3.9

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 +99 -59
  3. data/lib/hak/version.rb +1 -1
  4. metadata +17 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2863e5f7035d67c47b0e09e77a98d5dcd7688c0
4
- data.tar.gz: 2061c19b0a34d99e1d74f11e9853358438500547
3
+ metadata.gz: 1f0256602f85d9b367bd3d8c938bc696b5514eca
4
+ data.tar.gz: 9b598bfa48f929ff5c7908a84e899fff597303c5
5
5
  SHA512:
6
- metadata.gz: c3ee66d9c868a04d14e05bfb346a200d5c3edb92b7be83355be870744dfd4a41cd10aaf42453e6b9d61a6e1b7b8a5e8d5f44e00b14b8eba168df4894fcd292d8
7
- data.tar.gz: 6833dd0911021c742e8820dbb2e82d4f5310a53da549c69178dd3fc3a72636e953bf1729f7fd2480146dc0255481e4639789b80056b5b66b26771dd0199f3800
6
+ metadata.gz: eab84cd52e3aea6b7b532f48ac9532b740c479a4f66cef0c7d87fb7cdf836da6df7851e5f0eef0166b251256e2fa66c33b4653248aaea2c42eb72b08cf6cee0e
7
+ data.tar.gz: 9aff8b01c8160ab5fb0696719904a474a46dfe3ca1f2d60346a9cceb429fb0ff8ec651efd0dda6d839ba366b98bb3f57468791e37c8ebdbb6923cb4dd65b051d
data/bin/hak CHANGED
@@ -3,14 +3,111 @@
3
3
  require 'rubygems'
4
4
  require 'commander/import'
5
5
  require 'yaml'
6
- require 'pp'
6
+ require 'colorize'
7
7
 
8
8
  program :name, 'hak'
9
- program :version, '0.3.8'
9
+ program :version, '0.3.9'
10
10
  program :description, 'Hak - start hacking!'
11
11
 
12
12
  default_command :help
13
13
 
14
+ command :setup do |c|
15
+ c.syntax = 'hak setup'
16
+ c.summary = 'sets up the hak environment'
17
+ c.description = 'installs docker and sets up the entire docker based environment along with proxy'
18
+ c.example 'description', 'hak setup'
19
+ c.action do |args, options|
20
+
21
+ # if ~/.hak not exists, initialize it
22
+ puts "checking to see if ~/.hak exists".blue
23
+ if !Dir.exists?(File.expand_path('~/.hak'))
24
+ puts "- creating ~/.hak".light_blue
25
+ system "mkdir -p ~/.hak/packages"
26
+ else
27
+ puts "- it exists, skipping".blue
28
+ end
29
+
30
+ # if ~/.dinghy not exists, initialize it
31
+ puts "checking to see if ~/.dinghy exists".blue
32
+ if !Dir.exists?(File.expand_path('~/.dinghy'))
33
+ puts "- installing docker, docker-machine, docker-compose, xhyve, wget".light_blue
34
+ # remove existing docker
35
+ system "brew upgrade docker docker-machine docker-compose"
36
+ system "brew tap codekitchen/dinghy"
37
+ system "brew install dinghy"
38
+ system "brew install docker docker-machine docker-compose wget"
39
+ system "brew link --overwrite docker-machine"
40
+ system "brew install docker-machine-driver-xhyve"
41
+ system "sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve"
42
+ system "sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve"
43
+ system "dinghy create --provider xhyve"
44
+
45
+ else
46
+ puts "- it exists, skipping".blue
47
+ end
48
+
49
+ # check if Docker env variables are set and from which SHELL
50
+ puts "checking your shell:".blue
51
+ shell = `echo $SHELL`.strip
52
+ puts "- #{shell} detected".blue
53
+
54
+ puts "checking if docker environmental variables are set:".blue
55
+ if shell == '/bin/zsh'
56
+ docker_env_exist = `fgrep "export DOCKER_MACHINE_NAME=dinghy" ~/.zshrc |wc -l`.to_i
57
+ if docker_env_exist == 0
58
+ puts '- not set, type:'.yellow
59
+ puts ' echo "$(dinghy env)" >> ~/.zshrc'
60
+ end
61
+ end
62
+
63
+ if shell == '/bin/bash'
64
+ docker_env_exist = `fgrep "export DOCKER_MACHINE_NAME=dinghy" ~/.bashrc |wc -l`.to_i
65
+ if docker_env_exist == 0
66
+ puts '- not set, type:'.yellow
67
+ puts ' echo "$(dinghy env)" >> ~/.bash_profile'
68
+ end
69
+ end
70
+
71
+ puts "to power on hak, type:".yellow
72
+ puts " hak on"
73
+
74
+ end
75
+ end
76
+
77
+ command :on do |c|
78
+ c.syntax = 'hak on'
79
+ c.summary = 'powers on the hak server'
80
+ c.description = 'powers on the hak server'
81
+ c.example 'description', 'hak on'
82
+ c.action do |args, options|
83
+ # start up
84
+ system "dinghy up"
85
+ end
86
+ end
87
+
88
+ command :off do |c|
89
+ c.syntax = 'hak off'
90
+ c.summary = 'shuts off hak server'
91
+ c.description = 'shuts off the hak server'
92
+ c.example 'description', 'hak off'
93
+ c.action do |args, options|
94
+ system "dinghy halt"
95
+ end
96
+ end
97
+
98
+ command :uninstall do |c|
99
+ c.syntax = 'hak destroy'
100
+ c.summary = 'destroys hak server'
101
+ c.description = 'shuts off and destroys the hak server'
102
+ c.example 'description', 'hak destroy'
103
+ c.action do |args, options|
104
+ system "dinghy halt"
105
+ system "dinghy destroy"
106
+ system "rm -rf ~/.hak"
107
+ system "rm -rf ~/.dinghy"
108
+ end
109
+ end
110
+
14
111
  command :pull do |c|
15
112
  c.syntax = 'hak pull jaequery/honeybadger'
16
113
  c.summary = 'downloads framework'
@@ -84,64 +181,7 @@ command :create do |c|
84
181
  end
85
182
  end
86
183
 
87
- command :on do |c|
88
- c.syntax = 'hak on'
89
- c.summary = 'powers on the hak server'
90
- c.description = 'sets up the entire docker based environment along with proxy'
91
- c.example 'description', 'hak on'
92
- c.action do |args, options|
93
-
94
- # if ~/.hak not exists, initialize it
95
- if !Dir.exists?(File.expand_path('~/.hak'))
96
- system "mkdir -p ~/.hak/packages"
97
- end
98
-
99
- # if ~/.dinghy not exists, initialize it
100
- if !Dir.exists?(File.expand_path('~/.dinghy'))
101
-
102
- # remove existing docker
103
- system "brew upgrade docker docker-machine"
104
- system "brew tap codekitchen/dinghy"
105
- system "brew install dinghy"
106
- system "brew install docker docker-machine wget"
107
- system "brew link --overwrite docker-machine"
108
- system "brew install docker-machine-driver-xhyve"
109
- system "sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve"
110
- system "sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve"
111
- system "dinghy create --provider xhyve"
112
-
113
-
114
- end
115
-
116
- system "eval $(dinghy env)"
117
-
118
- # start up
119
- system "dinghy up"
120
- end
121
- end
122
-
123
- command :off do |c|
124
- c.syntax = 'hak off'
125
- c.summary = 'shuts off hak server'
126
- c.description = 'shuts off the hak server'
127
- c.example 'description', 'hak off'
128
- c.action do |args, options|
129
- system "dinghy halt"
130
- end
131
- end
132
184
 
133
- command :uninstall do |c|
134
- c.syntax = 'hak destroy'
135
- c.summary = 'destroys hak server'
136
- c.description = 'shuts off and destroys the hak server'
137
- c.example 'description', 'hak destroy'
138
- c.action do |args, options|
139
- system "dinghy halt"
140
- system "dinghy destroy"
141
- system "rm -rf ~/.hak"
142
- system "rm -rf ~/.dinghy"
143
- end
144
- end
145
185
 
146
186
  command :up do |c|
147
187
  c.syntax = 'hak up'
data/lib/hak/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hak
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
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.8
4
+ version: 0.3.9
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-10 00:00:00.000000000 Z
11
+ date: 2016-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Hak is like NPM for websites. You can download, start, and deploy websites
28
42
  directly from the CLI.
29
43
  email:
@@ -56,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
70
  version: '0'
57
71
  requirements: []
58
72
  rubyforge_project:
59
- rubygems_version: 2.4.6
73
+ rubygems_version: 2.5.1
60
74
  signing_key:
61
75
  specification_version: 4
62
76
  summary: Hak is like NPM for websites