hak 0.2.5 → 0.2.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 +37 -33
  3. data/lib/hak/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d7c21a42db6d5be332c1736701fe29b53ad48f2
4
- data.tar.gz: 0164bdced80f29e31c5fe289a655a8b4c7ff2e64
3
+ metadata.gz: 024bb8aabbcd431750643b97d116f4417400fc05
4
+ data.tar.gz: 59f8fe05bc51a58cf36c2ead1fb1830c97d36d36
5
5
  SHA512:
6
- metadata.gz: b84efd649b16b8cabce09d717277dd172f2c655f75d64be252cd11f8e9aeb00f89b876e2ab6bbb8ccf1a76c81c7826e5793c8c2c7c74d17b6531938458795c53
7
- data.tar.gz: 85e00ee1cefb2bd95726154619e8f22138b42f75906e1ec77ee0e547f8529afacde7e6cff0ae75b45142bea2835f26154b88b6b4621b2f9b414256dcbb8278c4
6
+ metadata.gz: 730f1370a48be9e9b5191dba8be3438cdb6eb287584a5b8f574da07c724e9d9c7f71a27e5d43cade1179655477263830d959a742748b871b0dd8e3e29ae8f5dd
7
+ data.tar.gz: 73d704874bbe92b3af34e1594cd4b02030d12b08a95af68bad88a000f8dff200ff79b914802a0d375d17dd1ce4d964a91418b6d0a75a60c10c24cd2ee3d2a180
data/bin/hak CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'commander/import'
5
+ require 'yaml'
6
+ require 'pp'
5
7
 
6
8
  program :name, 'hakberry'
7
- program :version, '0.2.0'
9
+ program :version, '0.2.7'
8
10
  program :description, 'Hakberry - a Ruby hackathon starter'
9
11
 
10
12
  default_command :help
@@ -17,7 +19,7 @@ command :pull do |c|
17
19
  c.action do |args, options|
18
20
 
19
21
  if !Dir.exists?(File.expand_path("~/.hak"))
20
- exec "mkdir ~/.hak"
22
+ system "mkdir ~/.hak"
21
23
  end
22
24
 
23
25
  if args.empty?
@@ -31,15 +33,15 @@ command :pull do |c|
31
33
  package = repo.split("/")[1]
32
34
  end
33
35
 
34
- exec "cd ~/.hak && rm -rf #{repo} && mkdir -p #{repo} && cd #{repo} && wget https://github.com/#{repo}/archive/master.zip && unzip master.zip && rm -f master.zip && mv #{package}-master/* . && rm -r #{package}-master"
36
+ system "cd ~/.hak && rm -rf #{repo} && mkdir -p #{repo} && cd #{repo} && wget https://github.com/#{repo}/archive/master.zip && unzip master.zip && rm -f master.zip && mv #{package}-master/* . && rm -r #{package}-master"
35
37
  end
36
38
  end
37
39
 
38
40
  command :create do |c|
39
41
  c.syntax = 'hak create something.com'
40
- c.summary = 'downloads framework'
42
+ c.summary = 'creates site'
41
43
  c.description = ''
42
- c.example 'description', 'hak get jaequery/honeybadger'
44
+ c.example 'description', 'hak create something.com'
43
45
  c.action do |args, options|
44
46
 
45
47
  if args.empty?
@@ -57,23 +59,27 @@ command :create do |c|
57
59
  # download package if not exist
58
60
  if !Dir.exists?(File.expand_path("~/.hak/" + repo))
59
61
  puts "#{repo} not exists, pulling"
60
- exec "hak pull #{repo}"
62
+ system "hak pull #{repo}"
61
63
  end
62
64
 
65
+ # copies the package from local ~/.hak/[repo] to local folder
66
+ puts "copying ~/.hak/#{repo} to ./#{folder}"
67
+ system "cp -Rfp ~/.hak/#{repo} #{folder}"
68
+
63
69
  # rename virtual host to app name
64
- require 'yaml'
65
- file_path = 'docker-compose.yml'
70
+ file_path = "#{folder}/docker-compose.yml"
66
71
  file = File.open(file_path, "r+")
67
72
  content = file.read
68
73
  new_content = content.gsub(/VIRTUAL_HOST=(.*?)\n/, "VIRTUAL_HOST=#{folder}.docker\n")
69
74
  File.write(file_path, new_content)
75
+ puts "set VIRTUAL_HOST of http://#{file_path}.docker/"
70
76
 
71
- # copies the package from local ~/.hak/[repo] to local folder
72
- puts "copying ~/.hak/#{repo} to ./#{folder}"
73
77
  puts "now type:"
74
78
  puts "cd #{folder}"
75
79
  puts "hak up"
76
- exec "cp -Rfp ~/.hak/#{repo} #{folder}"
80
+ puts "copied"
81
+
82
+
77
83
 
78
84
  end
79
85
 
@@ -91,16 +97,16 @@ command :on do |c|
91
97
 
92
98
  # if ~/.hak not exists, initialize it
93
99
  if !Dir.exists?(File.expand_path('~/.dinghy'))
94
- exec "mkdir -p ~/.hak/packages"
100
+ system "mkdir -p ~/.hak/packages"
95
101
  end
96
102
 
97
103
  # if ~/.dinghy not exists, initialize it
98
104
  if !Dir.exists?(File.expand_path('~/.dinghy'))
99
- exec "mkdir ~/.hak"
100
- exec "brew tap codekitchen/dinghy && brew install dinghy"
101
- exec "brew install docker docker-machine"
105
+ system "mkdir ~/.hak"
106
+ system "brew tap codekitchen/dinghy && brew install dinghy"
107
+ system "brew install docker docker-machine wget"
102
108
  else
103
- exec "dinghy up"
109
+ system "dinghy up"
104
110
  end
105
111
  end
106
112
  end
@@ -111,7 +117,7 @@ command :off do |c|
111
117
  c.description = 'shuts off the hakberry server'
112
118
  c.example 'description', 'hak off'
113
119
  c.action do |args, options|
114
- exec "dinghy halt"
120
+ system "dinghy halt"
115
121
  end
116
122
  end
117
123
 
@@ -121,7 +127,7 @@ command :up do |c|
121
127
  c.description = 'this starts up the website'
122
128
  c.example 'description', 'hak up'
123
129
  c.action do |args, options|
124
- exec "docker-compose up -d && docker-compose logs"
130
+ system "docker-compose up -d && docker-compose logs"
125
131
  end
126
132
  end
127
133
 
@@ -131,7 +137,7 @@ command :down do |c|
131
137
  c.description = 'turns the site down'
132
138
  c.example 'description', 'hak down'
133
139
  c.action do |args, options|
134
- exec "docker-compose stop"
140
+ system "docker-compose stop"
135
141
  end
136
142
  end
137
143
 
@@ -141,35 +147,33 @@ command :logs do |c|
141
147
  c.description = ''
142
148
  c.example 'description', 'hak logs'
143
149
  c.action do |args, options|
144
- exec "docker-compose logs"
150
+ system "docker-compose logs"
145
151
  end
146
152
  end
147
153
 
148
154
  command :ssh do |c|
149
-
150
- require 'yaml'
151
- require 'pp'
152
- file_name = 'docker-compose.yml'
153
- config_options = YAML.load_file(file_name)
154
- app = ''
155
- apps = []
156
- config_options.each do |key, value|
157
- apps << key
158
- end
159
-
155
+
160
156
  c.syntax = 'hak ssh'
161
157
  c.summary = 'ssh to your app'
162
158
  c.description = ''
163
159
  c.example 'description', 'hak ssh [app]'
164
160
  c.action do |args, options|
165
161
 
162
+ file_name = 'docker-compose.yml'
163
+ config_options = YAML.load_file(file_name)
164
+ app = ''
165
+ apps = []
166
+ config_options.each do |key, value|
167
+ apps << key
168
+ end
169
+
166
170
  if args.empty?
167
171
  puts "choose one:"
168
- PP.pp apps
172
+ puts apps
169
173
  #app = apps[0]
170
174
  else
171
175
  app = args[0]
172
- exec "docker-compose run #{app} bash"
176
+ system "docker-compose run #{app} bash"
173
177
  end
174
178
 
175
179
  end
data/lib/hak/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hak
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - jaequery