bonethug 0.0.82 → 0.0.83

Sign up to get free protection for your applications and to get access to all the features.
data/bin/bonethug CHANGED
@@ -5,4 +5,38 @@ root_path = File.expand_path(File.dirname(__FILE__)) + '/..'
5
5
  require 'rubygems' unless Object.const_defined?(:Gem)
6
6
  require root_path +'/lib/bonethug'
7
7
 
8
+ #-----------------------------------
9
+ # require 'io/console'
10
+
11
+ # list = Bonethug::CLI.tasks.sort
12
+
13
+ # word = ""
14
+
15
+ # while (char = $stdin.getch) != "\r"
16
+ # word += char
17
+ # word = "" if char == " "
18
+ # if char == "\t"
19
+ # list.each do |task|
20
+ # print task if task[0..word.length-1] == word
21
+ # end
22
+ # else
23
+ # print char
24
+ # end
25
+ # end
26
+ # puts
27
+
28
+ #-----------------------------------
29
+ # require 'readline'
30
+
31
+ # list = Bonethug::CLI.tasks.sort
32
+
33
+ # comp = proc { |s| list.grep(/^#{Regexp.escape(s)}/) }
34
+
35
+ # Readline.completion_append_character = " "
36
+ # Readline.completion_proc = comp
37
+
38
+ # while line = Readline.readline('> ', true)
39
+ # p line
40
+ # end
41
+
8
42
  Bonethug::CLI.handle 'bonethug'
data/bin/thug CHANGED
@@ -5,4 +5,38 @@ root_path = File.expand_path(File.dirname(__FILE__)) + '/..'
5
5
  require 'rubygems' unless Object.const_defined?(:Gem)
6
6
  require root_path +'/lib/bonethug'
7
7
 
8
+ #-----------------------------------
9
+ # require 'io/console'
10
+
11
+ # list = Bonethug::CLI.tasks.sort
12
+
13
+ # word = ""
14
+
15
+ # while (char = $stdin.getch) != "\r"
16
+ # word += char
17
+ # word = "" if char == " "
18
+ # if char == "\t"
19
+ # list.each do |task|
20
+ # print task if task[0..word.length-1] == word
21
+ # end
22
+ # else
23
+ # print char
24
+ # end
25
+ # end
26
+ # puts
27
+
28
+ #-----------------------------------
29
+ # require 'readline'
30
+
31
+ # list = Bonethug::CLI.tasks.sort
32
+
33
+ # comp = proc { |s| list.grep(/^#{Regexp.escape(s)}/) }
34
+
35
+ # Readline.completion_append_character = " "
36
+ # Readline.completion_proc = comp
37
+
38
+ # while line = Readline.readline('> ', true)
39
+ # p line
40
+ # end
41
+
8
42
  Bonethug::CLI.handle 'thug'
data/config/deploy.rb CHANGED
@@ -414,8 +414,10 @@ task :deploy => :environment do
414
414
  cmds = conf.get 'post_cmds'
415
415
  if cmds
416
416
  cmds = cmds.get env
417
- cmds.each do |index, cmd|
418
- queue cmd
417
+ if cmds
418
+ cmds.each do |index, cmd|
419
+ queue cmd
420
+ end
419
421
  end
420
422
  end
421
423
 
data/lib/bonethug/cli.rb CHANGED
@@ -5,6 +5,39 @@ require 'bonethug/configurator'
5
5
  module Bonethug
6
6
  class CLI
7
7
 
8
+ @@tasks = [
9
+ 'help',
10
+ 'auth',
11
+ 'install',
12
+ 'init-db',
13
+ 'init-local-db',
14
+ 'setup-db',
15
+ 'setup-env',
16
+ 'vhost-local',
17
+ 'init',
18
+ 'update',
19
+ 'run',
20
+ 'rake',
21
+ 'drush',
22
+ 'drush-local',
23
+ 'sake',
24
+ 'sync-state',
25
+ 'deploy',
26
+ 'setup',
27
+ 'remote-backup',
28
+ 'local-backup',
29
+ 'sync-backup-to',
30
+ 'sync-backup-from',
31
+ 'force-unlock',
32
+ 'cleanup',
33
+ 'clean',
34
+ 'watch'
35
+ ]
36
+
37
+ def self.tasks
38
+ @@tasks
39
+ end
40
+
8
41
  def self.handle(bin_name = 'thug')
9
42
 
10
43
  # what are we doing?
@@ -56,7 +89,7 @@ module Bonethug
56
89
  admin_user = ARGV.length == 3 ? ARGV[1] : 'root'
57
90
 
58
91
  # validate
59
- unless env
92
+ if !env || env == task
60
93
  puts 'Usage: ' + bin_name + ' ' + task + ' [admin_user] [environment]'
61
94
  return
62
95
  end
@@ -75,7 +108,7 @@ module Bonethug
75
108
  env = ARGV.last
76
109
 
77
110
  # validate
78
- unless env
111
+ if !env || env == task
79
112
  puts 'Usage: ' + bin_name + ' setup-env [environment]'
80
113
  return
81
114
  end
@@ -108,28 +141,30 @@ module Bonethug
108
141
 
109
142
  # get env
110
143
  env = ARGV.last
144
+ env = 'development' if env == 'vhost-local'
111
145
 
112
146
  # exec env
113
147
  exec_path = File.expand_path('.')
114
148
 
115
149
  # load config
116
- conf = Conf.new.add(exec_path + '/config/cnf.yml')
150
+ conf = Conf.new.add exec_path + '/config/cnf.yml'
117
151
  conf.add(exec_path + '/config/database.yml' => { root: 'dbs.default' }) if File.exist? exec_path + '/config/database.yml'
118
152
  deploy = conf.node_merge 'deploy.common', 'deploy.environments.' + env
119
153
 
120
154
  # vhost name
121
155
  vhost = deploy.get('project_slug') + '_' + env
122
156
 
123
- # build the vhosts
157
+ # build the vhost conf
124
158
  vh_cnf = conf.get 'vhost'
125
159
  vh_cnf = conf.get 'apache' unless vh_cnf
126
160
  vh_cnf = vh_cnf.get env
127
161
  conf_path = vh_cnf.get('conf_path') || '/etc/apache2/sites-available'
128
162
 
163
+ # load the appropriate config for the web server
129
164
  vh = Configurator.vhost vh_cnf, exec_path
130
165
 
166
+ # check if we have a custom config for the webserver type
131
167
  case vh_cnf.get('type')
132
-
133
168
  when "nginx"
134
169
 
135
170
  # to be implemented
@@ -152,14 +187,19 @@ module Bonethug
152
187
  "
153
188
 
154
189
  # write the to the hosts file
155
- system "sed -i '/## BONETHUG-#{vhost} ##/,/## END_BONETHUG-#{vhost} ##/ s/.*//g' #{path}"
190
+ # this needs work
191
+ system "sed -i '/## BONETHUG-#{vhost} ##/,/## END_BONETHUG-#{vhost} ##/ s/.*//g' #{path}"
156
192
  escaped = (hosts).gsub(/"/, '\"')
157
193
  system "echo \"#{escaped}\" >> #{path}"
158
194
 
195
+ # reload apache - linux - but need a debian specific look up
196
+ system "a2ensite #{vhost} && service apache2 restart" if RbConfig::CONFIG['target_os'] =~ /linux/i
197
+
159
198
  when 'init', 'update'
160
199
 
161
200
  # handle args
162
201
  location = ARGV[1] || '.'
202
+ stage = ARGV[2] || 0
163
203
 
164
204
  # validate
165
205
  unless location
@@ -168,7 +208,7 @@ module Bonethug
168
208
  end
169
209
 
170
210
  # run the initaliser
171
- Installer.bonethugise(location, task.to_sym)
211
+ Installer.bonethugise location, task.to_sym, stage.to_i
172
212
 
173
213
  when 'run',
174
214
  'rake',
@@ -61,6 +61,8 @@ module Bonethug
61
61
 
62
62
  else # apache
63
63
 
64
+ access = vh_cnf.get('version').to_f >= 2.4 ? "Require all granted" : "Order allow,deny\nAllow from all"
65
+
64
66
  vh = "
65
67
  <VirtualHost *:80>
66
68
 
@@ -82,9 +84,7 @@ module Bonethug
82
84
 
83
85
  Options Indexes MultiViews FollowSymLinks
84
86
  AllowOverride All
85
- Order allow,deny
86
- Allow from all
87
- #{vh_cnf.get('version').to_f > 2.4 ? 'Require all granted' : ''}
87
+ #{access}
88
88
 
89
89
  </Directory>
90
90
 
@@ -155,8 +155,13 @@ module Bonethug
155
155
  conf.get('dbs').each do |name,envs|
156
156
 
157
157
  db = envs.get env
158
- puts "creating: " + db.get('name')
159
- system Bonethug::Installer.init_mysql_db_script(db, path, admin_user)
158
+ if !db
159
+ puts "No db for env " + env + " found - check your config file"
160
+ exit
161
+ else
162
+ puts "Mysql user " + admin_user + " is creating db: " + db.get('name') + " and granting access to " + db.get('user') + "@" + db.get('host')
163
+ system Bonethug::Installer.init_mysql_db_script(db, path, admin_user)
164
+ end
160
165
 
161
166
  end
162
167
 
@@ -245,129 +250,146 @@ module Bonethug
245
250
  # add bonethug to gemfile if required
246
251
  # run bundle install
247
252
 
248
- def self.bonethugise(dir='.', mode=:init)
253
+ def self.bonethugise(dir='.', mode=:init, stage=0)
249
254
 
250
255
  target = File.expand_path(dir)
251
256
 
252
- # run bundle update first
253
- system('bundle update bonethug') if mode == :update
257
+ case stage
258
+ when 0
254
259
 
255
- # check for the existence of required dirs and create if required
256
- [target + '/.bonethug', target + '/config', target + '/config/example'].each do |path|
257
- FileUtils.mkdir path unless File.directory? path
258
- end
260
+ # get bonethug
261
+ if mode == :update
262
+ system 'bundle update bonethug'
263
+ else
264
+ system 'bundle install bonethug'
265
+ end
259
266
 
260
- # insert version file
261
- File.open(target + '/.bonethug/version','w') { |file| file.puts VERSION }
267
+ # kill this process and run the next step as a new process
268
+ exec 'bundle exec thug ' + mode.to_s + ' ' + dir + ' ' + (stage + 1).to_s
262
269
 
263
- # Handle config files
264
- @@project_config_files.each do |type, dirs|
265
- dirs.each do |config|
270
+ when 1
266
271
 
267
- # vars
268
- src_file = @@bonthug_gem_dir + '/config/' + config
269
- example_file = target + '/config/example/' + config if type == :editable
270
- target_file = type == :editable ? target + '/config/' + config : target + '/.bonethug/' + config
272
+ # check for the existence of required dirs and create if required
273
+ [target + '/.bonethug', target + '/config', target + '/config/example'].each do |path|
274
+ FileUtils.mkdir path unless File.directory? path
275
+ end
271
276
 
272
- # output
273
- puts 'Handling ' + target_file
277
+ # insert version file
278
+ File.open(target + '/.bonethug/version','w') { |file| file.puts VERSION }
279
+
280
+ # Handle config files
281
+ @@project_config_files.each do |type, dirs|
282
+ dirs.each do |config|
283
+
284
+ # vars
285
+ src_file = @@bonthug_gem_dir + '/config/' + config
286
+ example_file = target + '/config/example/' + config if type == :editable
287
+ target_file = type == :editable ? target + '/config/' + config : target + '/.bonethug/' + config
288
+
289
+ # output
290
+ puts 'Handling ' + target_file
291
+
292
+ # what mode are we in?
293
+ if mode == :init
294
+ FileUtils.cp src_file, example_file if type == :editable and !File.exist?(example_file)
295
+ FileUtils.cp src_file, target_file unless File.exist?(target_file)
296
+ elsif mode == :update
297
+ FileUtils.cp src_file, example_file if type == :editable
298
+ FileUtils.cp src_file, target_file if type == :generated or !File.exist?(target_file)
299
+ else
300
+ puts "Invalid bonethugise mode"
301
+ exit
302
+ end
274
303
 
275
- # what mode are we in?
276
- if mode == :init
277
- FileUtils.cp src_file, example_file if type == :editable and !File.exist?(example_file)
278
- FileUtils.cp src_file, target_file unless File.exist?(target_file)
279
- elsif mode == :update
280
- FileUtils.cp src_file, example_file if type == :editable
281
- FileUtils.cp src_file, target_file if type == :generated or !File.exist?(target_file)
282
- else
283
- puts "Invalid bonethugise mode"
284
- exit
285
304
  end
286
-
287
305
  end
288
- end
289
-
290
- # Handle project type specific files
291
- if mode == :update
292
- target_cnf = target + '/config/cnf.yml'
293
- project_conf = Conf.new.add target_cnf
294
- project_type = project_conf.get('deploy.common.project_type')
295
- if project_type
296
- bonethug_files = @@conf.get 'project_types.' + project_type + '.bonethug_files'
297
- if bonethug_files
298
- bonethug_files.each do |index, file|
299
-
300
- # push some output
301
- puts 'Handling ' + index.to_s + ':' + file.to_s
302
306
 
303
- # do the copy
304
- src_file = @@bonthug_gem_dir + '/skel/project_types/' + project_type + '/' + file
305
- dst_file = target + '/' + file
306
- FileUtils.cp src_file, dst_file
307
+ # Handle project type specific files
308
+ if mode == :update
309
+ target_cnf = target + '/config/cnf.yml'
310
+ project_conf = Conf.new.add target_cnf
311
+ project_type = project_conf.get('deploy.common.project_type')
312
+ if project_type
313
+ bonethug_files = @@conf.get 'project_types.' + project_type + '.bonethug_files'
314
+ if bonethug_files
315
+ bonethug_files.each do |index, file|
316
+
317
+ # push some output
318
+ puts 'Handling ' + index.to_s + ':' + file.to_s
319
+
320
+ # do the copy
321
+ src_file = @@bonthug_gem_dir + '/skel/project_types/' + project_type + '/' + file
322
+ dst_file = target + '/' + file
323
+ dir = File.dirname dst_file
324
+ FileUtils.mkdir_p dir
325
+ FileUtils.cp_r src_file, dst_file
307
326
 
327
+ end
308
328
  end
329
+ else
330
+ puts "Couldn't find project type in " + target_cnf
309
331
  end
310
- else
311
- puts "Couldn't find project type in " + target_cnf
312
332
  end
313
- end
314
333
 
315
- # handle gemfile
316
- gemfile_path = target + '/Gemfile'
317
- if File.exist? gemfile_path
318
-
319
- # extract the contents
320
- gemfile_contents = File.read(gemfile_path)
321
-
322
- # identify what we are looking for
323
- required_gems = {
324
- 'mina' => 'nadarei/mina',
325
- 'astrails-safe' => 'astrails/safe',
326
- 'whenever' => 'javan/whenever',
327
- 'guard-erb' => 'azt3k/guard-erb',
328
- 'coffee-script' => 'josh/ruby-coffee-script',
329
- 'guard-uglify' => 'customink/guard-uglify',
330
- 'guard-concat' => 'mikz/guard-concat',
331
- 'bonethug' => nil
332
- }
333
-
334
- # look at each requirement and identify if we need things
335
- required_gems.each do |gem_name, github|
336
-
337
- add_gem = false;
338
- gem_reg = Regexp.new('gem[^"\']+["\']'+gem_name+'["\']')
339
- git_reg = Regexp.new('gem[^"\']+["\']'+gem_name+'["\'],[^,]+github: ["\']'+github+'["\']') if github
340
-
341
- if gem_reg =~ gemfile_contents
342
- puts 'Found '+gem_name+' in gem file.'
343
- if github
344
- puts 'Requires github version, checking...'
345
- unless git_reg =~ gemfile_contents
346
- puts 'Couldn\'t find '+gem_name+' (github) in gem file adding...'
347
- gemfile_contents.gsub(gem_reg,'')
348
- add_gem = true;
334
+ # handle gemfile
335
+ gemfile_path = target + '/Gemfile'
336
+ if File.exist? gemfile_path
337
+
338
+ # extract the contents
339
+ gemfile_contents = File.read(gemfile_path)
340
+
341
+ # identify what we are looking for
342
+ # this should have groups - i.e. dev
343
+ required_gems = {
344
+ 'mina' => 'nadarei/mina',
345
+ 'astrails-safe' => 'astrails/safe',
346
+ 'whenever' => 'javan/whenever',
347
+ 'guard-erb' => 'azt3k/guard-erb',
348
+ 'coffee-script' => 'josh/ruby-coffee-script',
349
+ 'guard-uglify' => 'customink/guard-uglify',
350
+ 'guard-concat' => 'mikz/guard-concat',
351
+ 'bonethug' => nil
352
+ }
353
+
354
+ # look at each requirement and identify if we need things
355
+ required_gems.each do |gem_name, github|
356
+
357
+ add_gem = false;
358
+ gem_reg = Regexp.new('gem[^"\']+["\']'+gem_name+'["\']')
359
+ git_reg = Regexp.new('gem[^"\']+["\']'+gem_name+'["\'],[^,]+github: ["\']'+github+'["\']') if github
360
+
361
+ if gem_reg =~ gemfile_contents
362
+ puts 'Found '+gem_name+' in gem file.'
363
+ if github
364
+ puts 'Requires github version, checking...'
365
+ unless git_reg =~ gemfile_contents
366
+ puts 'Couldn\'t find '+gem_name+' (github) in gem file adding...'
367
+ gemfile_contents.gsub(gem_reg,'')
368
+ add_gem = true;
369
+ end
349
370
  end
371
+ else
372
+ puts "Couldn't find "+gem_name+" in gem file adding..."
373
+ add_gem = true;
374
+ end
375
+
376
+ if add_gem
377
+ gemfile_contents += "\n" + 'gem "'+gem_name+'"'+(github ? ', github: "'+github+'"' : '')
378
+ File.open(gemfile_path,'w') { |file| file.puts gemfile_contents }
350
379
  end
351
- else
352
- puts "Couldn't find "+gem_name+" in gem file adding..."
353
- add_gem = true;
354
- end
355
380
 
356
- if add_gem
357
- gemfile_contents += "\n" + 'gem "'+gem_name+'"'+(github ? ', github: "'+github+'"' : '')
358
- File.open(gemfile_path,'w') { |file| file.puts gemfile_contents }
359
381
  end
360
382
 
383
+ else
384
+ puts 'No Gemfile found, creating one...'
385
+ FileUtils.cp @@skel_dir + '/base/Gemfile', gemfile_path
361
386
  end
362
387
 
363
- else
364
- puts 'No Gemfile found, creating one...'
365
- FileUtils.cp @@skel_dir + '/base/Gemfile', gemfile_path
388
+ # run bundler
389
+ exec 'bundle install --path vendor'
390
+
366
391
  end
367
392
 
368
- # run bundler
369
- exec 'bundle install --path vendor'
370
-
371
393
  # self
372
394
 
373
395
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Bonethug
3
- VERSION = "0.0.82"
4
- BUILD_DATE = "2014-06-02 12:27:14 +1200"
3
+ VERSION = "0.0.83"
4
+ BUILD_DATE = "2014-06-14 11:26:12 +1200"
5
5
  end
6
6
 
data/scripts/mail ADDED
@@ -0,0 +1,6 @@
1
+ # /bin/bash
2
+
3
+ cd /usr/share && sudo git clone https://github.com/joshdata/mailinabox
4
+ sudo bash mailinabox/setup/start.sh
5
+
6
+ # need to go in and change the default listening ports in /etc/nginx/conf.d/local.conf
@@ -0,0 +1,138 @@
1
+ # /bin/bash
2
+
3
+ # -----------------------------------------------------
4
+ # install native stuff
5
+ # -----------------------------------------------------
6
+
7
+ # install the repo adding scripts
8
+ sudo apt-get install software-properties-common python-software-properties
9
+
10
+ # add repos
11
+ # sudo add-apt-repository ppa:richarvey/nodejs
12
+ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
13
+ sudo add-apt-repository "deb-src http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
14
+ sudo add-apt-repository ppa:ondrej/apache2
15
+ sudo add-apt-repository ppa:ondrej/php5
16
+ sudo add-apt-repository ppa:ondrej/mysql-5.6
17
+
18
+ # update
19
+ sudo apt-get update && sudo apt-get upgrade
20
+
21
+ # install
22
+
23
+ # dev headers
24
+ sudo apt-get install libcurl4-openssl-dev libssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev libapr1-dev libaprutil1-dev
25
+ sudo apt-get install libmysqlclient-dev libmagickwand-dev libsqlite3-dev libxml2-dev libxslt1-dev
26
+
27
+ # regular packages
28
+ sudo apt-get install apache2-mpm-worker
29
+ sudo apt-get install curl libapache2-mod-fastcgi php5-fpm php5 php5-cli php5-curl php5-gd php5-imagick php-apc php5-mysql
30
+ sudo apt-get install mysql-server mysql-client sqlite3
31
+ sudo apt-get install imagemagick
32
+ sudo apt-get install phpmyadmin
33
+ sudo apt-get install sshpass
34
+ sudo apt-get install libxml2 g++
35
+ sudo apt-get install git ruby1.9.3 wkhtmltopdf nodejs npm
36
+
37
+
38
+ # -----------------------------------------------------
39
+ # Configure stuff
40
+ # -----------------------------------------------------
41
+
42
+ # unix socket
43
+ # echo "
44
+ # <IfModule mod_fastcgi.c>
45
+ # AddHandler php5-fcgi .php
46
+ # Action php5-fcgi /php5-fcgi
47
+ # Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
48
+ # FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
49
+ # </IfModule>
50
+ # " > /etc/apache2/conf.d/php-fpm.conf
51
+ # sed -i -e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php5-fpm.sock/g" /etc/php5/fpm/pool.d/www.conf
52
+
53
+ ## TCP
54
+ # echo "
55
+ # <IfModule mod_fastcgi.c>
56
+ # AddHandler php5-fcgi .php
57
+ # Action php5-fcgi /php5-fcgi
58
+ # Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
59
+ # FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization
60
+ # </IfModule>
61
+ # " > /etc/apache2/conf.d/php-fpm.conf
62
+ # sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
63
+
64
+ sudo sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
65
+ # sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization\n </IfModule>" > /etc/apache2/conf.d/php-fpm.conf
66
+
67
+ #apache2.4
68
+ sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization\n <Directory />\nRequire all granted\n </Directory>\n </IfModule>" > /etc/apache2/conf-available/php-fpm.conf
69
+ sudo a2enconf php-fpm.conf
70
+
71
+ # Apache
72
+ # ------
73
+
74
+ # modules
75
+ sudo a2enmod actions fastcgi alias rewrite headers
76
+
77
+ # phpmyadmin apache 2.4
78
+ sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
79
+ sudo a2enconf phpmyadmin.conf
80
+
81
+ # -----------------------------------------------------
82
+ # Install Gems
83
+ # -----------------------------------------------------
84
+
85
+ # install some gems - yes gem1.9.3 - wtf - use rbenv
86
+ # sudo gem1.9.3 install mina bundler whenever astrails-safe
87
+
88
+ # install passenger
89
+ # sudo gem1.9.3 install passenger
90
+ sudo gem install passenger
91
+ sudo passenger-install-apache2-module
92
+ sudo touch /etc/apache2/mods-available/passenger.load
93
+ sudo touch /etc/apache2/mods-available/passenger.confc
94
+
95
+ # -----------------------------------------------------
96
+ # Node.js related
97
+ # -----------------------------------------------------
98
+
99
+ sudo npm install bower -g
100
+
101
+ # -----------------------------------------------------
102
+ # Restart stuff
103
+ # -----------------------------------------------------
104
+
105
+ sudo service apache2 restart
106
+ sudo service php5-fpm restart
107
+
108
+ # -----------------------------------------------------
109
+ # Build tools
110
+ # -----------------------------------------------------
111
+
112
+ sudo apt-get install pngcrush jpegoptim pngquant libcroco3*
113
+
114
+ # -----------------------------------------------------
115
+ # things bashit likes
116
+ # -----------------------------------------------------
117
+
118
+ sudo apt-get install irssi irissi-scripts
119
+
120
+ # -----------------------------------------------------
121
+ # rbenv
122
+ # -----------------------------------------------------
123
+
124
+ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
125
+ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
126
+ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
127
+ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
128
+
129
+ # -----------------------------------------------------
130
+ # Bash it
131
+ # -----------------------------------------------------
132
+
133
+ sudo apt-get install python-pip python-dev-all
134
+ sudo pip install argcomplete
135
+ sudo activate-global-python-argcomplete
136
+ git clone https://github.com/revans/bash-it.git ~/.bash_it
137
+ ~/.bash_it/install.sh
138
+ echo -e "BASH_IT=$HOME/.bash_it\nexport BASH_IT_THEME='bobby'\nexport GIT_HOSTING='git@github.com'\nexport EDITOR=\"/usr/bin/subl -w\"\nexport GIT_EDITOR='/usr/bin/subl -w'\nexport TODO=\"t\"\nexport IRC_CLIENT='irssi'\nsource $BASH_IT/bash_it.sh" >> ~/.bashrc
@@ -60,12 +60,12 @@ sudo apt-get install git ruby1.9.3 nodejs npm
60
60
  # " > /etc/apache2/conf.d/php-fpm.conf
61
61
  # sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
62
62
 
63
- sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
63
+ sudo sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
64
64
  sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -appConnTimeout 900 -idle-timeout 900 -pass-header Authorization\n </IfModule>" > /etc/apache2/conf.d/php-fpm.conf
65
65
 
66
66
  #apache2.4
67
67
  sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -appConnTimeout 900 -idle-timeout 900 -pass-header Authorization\n <Directory />\nRequire all granted\n </Directory>\n </IfModule>" > /etc/apache2/conf-available/php-fpm.conf
68
- a2enconf php-fpm.conf
68
+ sudo a2enconf php-fpm.conf
69
69
 
70
70
  # Apache
71
71
  # ------
@@ -93,7 +93,7 @@ sudo touch /etc/apache2/mods-available/passenger.conf
93
93
  # Node.js related
94
94
  # -----------------------------------------------------
95
95
 
96
- npm install bower -g
96
+ sudo npm install bower -g
97
97
 
98
98
  # -----------------------------------------------------
99
99
  # Restart stuff
@@ -61,13 +61,16 @@ sudo apt-get install git ruby1.9.3 wkhtmltopdf nodejs npm
61
61
  # " > /etc/apache2/conf.d/php-fpm.conf
62
62
  # sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
63
63
 
64
- sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
64
+ sudo sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
65
65
  # sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization\n </IfModule>" > /etc/apache2/conf.d/php-fpm.conf
66
66
 
67
67
  #apache2.4
68
68
  sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization\n <Directory />\nRequire all granted\n </Directory>\n </IfModule>" > /etc/apache2/conf-available/php-fpm.conf
69
69
  sudo a2enconf php-fpm.conf
70
70
 
71
+ # symlink node to nodejs
72
+ sudo ln -s /usr/bin/nodejs /usr/bin/node
73
+
71
74
  # Apache
72
75
  # ------
73
76
 
@@ -75,8 +78,8 @@ sudo a2enconf php-fpm.conf
75
78
  sudo a2enmod actions fastcgi alias rewrite headers
76
79
 
77
80
  # phpmyadmin apache 2.4
78
- cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
79
- a2enconf phpmyadmin.conf
81
+ sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
82
+ sudo a2enconf phpmyadmin.conf
80
83
 
81
84
  # -----------------------------------------------------
82
85
  # Install Gems
@@ -96,7 +99,7 @@ sudo touch /etc/apache2/mods-available/passenger.conf
96
99
  # Node.js related
97
100
  # -----------------------------------------------------
98
101
 
99
- npm install bower -g
102
+ sudo npm install bower -g
100
103
 
101
104
  # -----------------------------------------------------
102
105
  # Restart stuff
@@ -80,7 +80,8 @@ class SS_LoadConf {
80
80
  $cnf = Yaml::parse($base_dir . '/config/cnf.yml');
81
81
 
82
82
  // expected urls
83
- $url = 'http://' . $cnf['apache'][APPLICATION_ENV]['server_name'];
83
+ $vhost = empty($cnf['vhost']) ? $cnf['apache'] : $cnf['vhost'];
84
+ $url = 'http://' . $vhost[APPLICATION_ENV]['server_name'];
84
85
 
85
86
  // load db settings
86
87
  $db = (object) $cnf['dbs']['default'][APPLICATION_ENV];
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bonethug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.82
4
+ version: 0.0.83
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-02 00:00:00.000000000 Z
12
+ date: 2014-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -397,6 +397,8 @@ files:
397
397
  - lib/bonethug/watcher.rb
398
398
  - lib/init.rb
399
399
  - lib/tasks/bonethug.rake
400
+ - scripts/mail
401
+ - scripts/ubuntu-14.04-dev.sh
400
402
  - scripts/ubuntu_setup.sh
401
403
  - scripts/ubuntu_setup_2.4.sh
402
404
  - skel/base/.gitignore