~cf-charmers/charms/trusty/cf-webadmin/trunk

« back to all changes in this revision

Viewing changes to hooks/install

  • Committer: Cory Johns
  • Date: 2014-10-23 22:27:49 UTC
  • Revision ID: johnsca@gmail.com-20141023222749-fbb06saygj5ec8no
Added missing hooks and fixed various bugs

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
from charmhelpers.core.hookenv import log
6
6
from charmhelpers import fetch
7
7
from path import path
8
 
from .utils import home
9
 
from .utils import shell
 
8
from utils import home
 
9
from utils import shell
10
10
 
11
11
import logging
12
12
 
22
22
logger = logging.getLogger(__name__)
23
23
 
24
24
 
25
 
 
26
 
 
27
 
 
28
 
def append_line_once(line, fp):
29
 
    if not fp.exists():
30
 
        fp.touch()
31
 
 
32
 
    if line not in fp.lines():
33
 
        fp.write_text(line + '\n', append=True)
34
 
 
35
 
 
36
25
def install_ruby_repo(repo, dest):
37
26
    cmd = 'git clone %s %s' % (repo, dest)
38
27
    if dest.exists():
58
47
        shell(rp, '')
59
48
 
60
49
    boilerplate = home / '.boilerplate'
61
 
    append_line_once('export PATH="%s/.rbenv/bin:$PATH"' % home, boilerplate)
62
 
    append_line_once('eval "$(rbenv init -)"', boilerplate)
 
50
    bp_txt = "\n".join(('export PATH="/opt/uaac/bin:%s/.rbenv/bin:$PATH"' % home,
 
51
                        'eval "$(rbenv init -)"'))
 
52
 
 
53
    boilerplate.write_text(bp_txt)
63
54
 
64
55
    shell('rbenv install -s 1.9.3-p484')
65
56
    shell('rbenv global 1.9.3-p484')
76
67
                      opt / 'uaac')
77
68
 
78
69
 
79
 
 
80
70
if __name__ == "__main__":
81
71
    install()