dev/provisioning/modules/drush/manifests/setup.pp
changeset 357 e3b168fa7513
parent 353 bf1bc6b08c46
equal deleted inserted replaced
356:139bf74b9374 357:e3b168fa7513
       
     1 class drush::setup {
       
     2 
       
     3   #private()
       
     4   if $caller_module_name != $module_name {
       
     5     warning("${name} is not part of the public API of the ${module_name} \
       
     6 module and should not be directly included in the manifest.")
       
     7   }
       
     8 
       
     9   # Install extra packages.
       
    10   validate_bool($drush::ensure_extra_packages)
       
    11   if $drush::ensure_extra_packages {
       
    12     validate_array($drush::extra_packages)
       
    13     package { $drush::extra_packages:
       
    14       ensure => installed,
       
    15     }
       
    16   }
       
    17 
       
    18   concat{ 'drush-sh-profile':
       
    19     ensure => present,
       
    20     path   => '/etc/profile.d/drush.sh',
       
    21   }
       
    22   concat::fragment { 'drush-sh-profile-header':
       
    23     ensure  => present,
       
    24     target  => 'drush-sh-profile',
       
    25     content => "# MANAGED BY PUPPET\n\n",
       
    26     order   => 0,
       
    27   }
       
    28   if $drush::php_path {
       
    29     validate_absolute_path($drush::php_path)
       
    30     concat::fragment { 'drush-sh-profile-php-path':
       
    31       ensure  => present,
       
    32       target  => 'drush-sh-profile',
       
    33       content => "export DRUSH_PHP=${drush::php_path}\n",
       
    34       order   => 1,
       
    35     }
       
    36   }
       
    37   if $drush::php_ini_path {
       
    38     validate_absolute_path($drush::php_ini_path)
       
    39     concat::fragment { 'drush-sh-profile-php-ini-path':
       
    40       ensure  => present,
       
    41       target  => 'drush-sh-profile',
       
    42       content => "export PHP_INI=${drush::php_ini_path}\n",
       
    43       order   => 1,
       
    44     }
       
    45   }
       
    46   if $drush::drush_ini_path {
       
    47     validate_absolute_path($drush::drush_ini_path)
       
    48     concat::fragment { 'drush-sh-profile-drush-ini-path':
       
    49       ensure  => present,
       
    50       target  => 'drush-sh-profile',
       
    51       content => "export DRUSH_INI=${drush::drush_ini_path}\n",
       
    52       order   => 1,
       
    53     }
       
    54   }
       
    55 
       
    56   # Base install path of any drush installations.
       
    57   file { $drush::install_base_path:
       
    58     ensure => directory,
       
    59   }
       
    60 
       
    61   # Drush directories.
       
    62   file { ['/etc/drush', '/usr/share/drush', '/usr/share/drush/commands']:
       
    63     ensure => directory,
       
    64   }
       
    65 
       
    66   # Symlink to drush default version executable.
       
    67   file { $drush::drush_exe_default:
       
    68     ensure => link,
       
    69     target => "/usr/local/bin/drush${drush::default_version_major}",
       
    70   }
       
    71 
       
    72   # Install drush versions. It could be improved with future parser's each(),
       
    73   # or building a hash like
       
    74   # {'6' => {'version' => '6'}, 'master' => {'version' => 'master'}}
       
    75   validate_array($drush::versions)
       
    76   $versions = parseyaml(template('drush/install-versions-hash.erb'))
       
    77   $defaults = {
       
    78     install_type => $drush::install_type,
       
    79     autoupdate   => $drush::autoupdate,
       
    80     method       => 'composer'
       
    81   }
       
    82   create_resources('drush::install', $versions, $defaults)
       
    83 
       
    84   # Make /opt/drush/default a symlink to the codebase
       
    85   # of the default drush installation.
       
    86   # TODO: this is coupled to composer install method.
       
    87   $default_path = "${drush::install_base_path}/${drush::default_version_major}"
       
    88   file { "${drush::install_base_path}/default":
       
    89     ensure => link,
       
    90     target => "${default_path}/vendor/drush/drush",
       
    91   }
       
    92 
       
    93 }
       
    94