Defined Type: redmine::plugin

Defined in:
manifests/plugin.pp

Overview

Define: redmine::plugin

Define allowing to install a redmine plugin

Parameters

Document parameters here.

Examples

'redmine::plugin' { 'namevar':
  parameter1 => [ 'just', 'an', 'example', ]
}

Authors

Baptiste Grenier <bgrenier@gnubila.fr>

Copyright 2015 gnúbila

Parameters:

  • user (Any) (defaults to: $redmine::owner)
  • group (Any) (defaults to: $user)
  • redmine_home (Any) (defaults to: "${redmine::install_dir}/redmine")
  • repo_url (Any) (defaults to: undef)
  • revision (Any) (defaults to: 'master')
  • provider (Any) (defaults to: 'git')


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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'manifests/plugin.pp', line 23

define redmine::plugin (
  $user = $redmine::owner,
  $group = $user,
  $redmine_home = "${redmine::install_dir}/redmine",
  $repo_url = undef,
  $revision = 'master',
  $provider = 'git',
) {
  include ::redmine

  if $repo_url == undef {
    fail('Please provide rep_url.')
  }
  vcsrepo { "${redmine_home}/plugins/${title}":
    ensure   => 'present',
    provider => $provider,
    source   => $repo_url,
    revision => $revision,
    user     => $user,
    notify   => Exec["Update gems environment using bundler for plugin ${title}"],
    require  => File['redmine_link'],
  }

  $path = [
    "${redmine::install_dir}/.rbenv/shims",
    "${redmine::install_dir}/.rbenv/bin",
    '/bin', '/usr/bin', '/usr/sbin'
  ]
  exec { "Update gems environment using bundler for plugin ${title}":
    command     => 'bundle update',
    user        => $user,
    cwd         => "${redmine_home}/plugins/${title}",
    path        => $path,
    refreshonly => true,
    notify      => Exec["Install gems using bundler for plugin ${title}"],
    require     => Exec['Install gems using bundler'],
  }
  exec { "Install gems using bundler for plugin ${title}":
    command     => 'bundle install --without development test',
    user        => $user,
    cwd         => "${redmine_home}/plugins/${title}",
    path        => $path,
    refreshonly => true,
    notify      => Exec["Run database migration for plugin ${title}"],
    require     => Exec['Install gems using bundler'],
  }

  exec { "Run database migration for plugin ${title}":
    command     => 'bundle exec rake redmine:plugins:migrate',
    user        => $user,
    cwd         => $redmine_home,
    path        => $path,
    environment => [ 'RAILS_ENV=production' ],
    refreshonly => true,
    require     => Exec['Run database migration'],
  }
}