summaryrefslogtreecommitdiff
path: root/provisioning/modules/pixelated/manifests/source.pp
blob: e1dc7844f07985762988c0f05a1672d15158a6e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class pixelated::source {
  include phantomjs

  package { [
    'git',
    'nodejs-legacy',
    'npm',
    'python-dev',
    'python-virtualenv',
    'libffi-dev',
    'g++',
    'ruby-dev',
    'libsqlite3-dev',
    'libfontconfig1']:
    ensure => latest
  }

  package { 'compass':
    ensure   => installed,
    provider => 'gem'
  }

  stage { 'install_pixelated': }

  class { 'install_pixelated' :
    stage => install_pixelated
  }

  class install_pixelated {
    $virtualenv_path = '/home/vagrant/user-agent-venv'

    exec { 'install-pixelated':
      environment => 'USERNAME=vagrant',
      command     => "/vagrant/install-pixelated.sh -v \"${virtualenv_path}\" -n /home/vagrant/boxed_node_modules",
      cwd         => '/vagrant',
      user        => 'vagrant',
      timeout     => 0
    }

    file { '/home/vagrant/.activate_custom_node_modules.sh':
      owner  => 'vagrant',
      mode   => '0600',
      source => 'puppet:///modules/pixelated/activate_custom_node_modules.sh',
    }
    exec { 'add_custom_node_modules_to_bashrc':
      command => "/bin/bash -c 'echo \"source /home/vagrant/.activate_custom_node_modules.sh\" >> /home/vagrant/.bashrc'",
      unless  => "/bin/grep \"source /home/vagrant/.activate_custom_node_modules.sh\" /home/vagrant/.bashrc",
      user    => 'vagrant',
      require => [Exec['install-pixelated'], File['/home/vagrant/.activate_custom_node_modules.sh']]
    }
  }

  Stage['main'] -> Stage['install_pixelated']
}