Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: modules/discourse/files/init-discourse

Issue 6221863587938304: Issue 212 - Update Discourse (Closed)
Left Patch Set: Fixed ordering issue, somewhat organized packages Created March 27, 2014, 10:15 p.m.
Right Patch Set: Disabled mini profiler Created March 28, 2014, 11:51 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « manifests/intraforumserver.pp ('k') | modules/discourse/files/redis.yml » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import sys, os, pwd, subprocess 3 import sys, os, pwd, subprocess
4 4
5 app_dir = '/opt/discourse' 5 app_dir = '/opt/discourse'
6 airbrake_key = os.environ.get('AIRBRAKE_KEY', None) 6 airbrake_key = os.environ.get('AIRBRAKE_KEY', None)
7 7
8 # HOME environment variable isn't reliable when called via sudo 8 # HOME environment variable isn't reliable when called via sudo
9 home_dir = os.path.expanduser('~' + pwd.getpwuid(os.getuid()).pw_name) 9 home_dir = os.path.expanduser('~' + pwd.getpwuid(os.getuid()).pw_name)
10 10
(...skipping 22 matching lines...) Expand all
33 callRailsCommand([os.path.join(app_dir, 'script', 'rails'), 'generate', 'airbr ake', '--api-key', airbrake_key]) 33 callRailsCommand([os.path.join(app_dir, 'script', 'rails'), 'generate', 'airbr ake', '--api-key', airbrake_key])
34 34
35 with open(path, 'rb+') as handle: 35 with open(path, 'rb+') as handle:
36 # Prepend file with require 'airbrake', won't happen by default 36 # Prepend file with require 'airbrake', won't happen by default
37 data = handle.read() 37 data = handle.read()
38 handle.seek(0) 38 handle.seek(0)
39 print >>handle, "require 'airbrake'" 39 print >>handle, "require 'airbrake'"
40 handle.write(data) 40 handle.write(data)
41 41
42 def runInitCommands(): 42 def runInitCommands():
43 service_path = '/etc/init.d/discourse-thin' 43 service_path = '/etc/init.d/discourse'
44 44
45 callRailsCommand(['bundle', 'install', '--deployment', '--without', 'test', '- -without', 'development']) 45 callRailsCommand(['bundle', 'install', '--deployment', '--without', 'test', '- -without', 'development'])
46 initAirBrake() 46 initAirBrake()
47 callRailsCommand(['bundle', 'exec', 'rake', 'assets:precompile']) 47 callRailsCommand(['bundle', 'exec', 'rake', 'assets:precompile'])
48 48
49 if os.path.exists(service_path): 49 if os.path.exists(service_path):
50 subprocess.check_call(['sudo', service_path, 'stop']) 50 subprocess.check_call(['sudo', service_path, 'stop'])
51 51
52 callRailsCommand(['bundle', 'exec', 'rake', 'db:migrate']) 52 callRailsCommand(['bundle', 'exec', 'rake', 'db:migrate'])
53 53
54 if os.path.exists(service_path): 54 if os.path.exists(service_path):
55 subprocess.check_call(['sudo', service_path, 'start']) 55 subprocess.check_call(['sudo', service_path, 'start'])
56 56
57 if __name__ == '__main__': 57 if __name__ == '__main__':
58 runInitCommands() 58 runInitCommands()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld