Skip to content

Instantly share code, notes, and snippets.

@speculatrix
Created October 22, 2019 12:21
Show Gist options
  • Save speculatrix/ff7097f20e4f363a4e154409dac6c1a6 to your computer and use it in GitHub Desktop.
Save speculatrix/ff7097f20e4f363a4e154409dac6c1a6 to your computer and use it in GitHub Desktop.
pycharm puppet module for linux and OSX
this replaces the init.pp in https://forge.puppet.com/skoblenick/pycharm/
# == Class: pycharm::install
#
# Installs PyCharm.
#
# === Authors
#
# Ryan Skoblenick <[email protected]>
# Paul Mansfield <[email protected]> - remove X for real address
#
# === Copyright
#
# Copyright 2013 Ryan Skoblenick - original MacOS/OSX version
# Copyright 2019 Paul Mansfield - added linux support
#
class pycharm::install {
$edition = $pycharm::edition
$version = $pycharm::version
case $::kernel {
'Linux': {
#$source = "https://download.jetbrains.com/python/pycharm-${edition}-${version}.tar.gz"
$source = "puppet:///files/pycharm/pycharm-${edition}-${version}.tar.gz"
$dest = "/tmp/pycharm-${edition}-${version}.tar.gz"
file { $dest:
ensure => file,
source => $source,
owner => root,
mode => '0644',
}
->exec { 'unpack pycharm to /opt':
command => "/usr/bin/tar xf $dest",
cwd => '/opt',
creates => "/opt/pycharm-${edition}-${version}",
}
->file { '/usr/local/bin/pycharm':
content => "#!/bin/bash\n# controlled by puppet\n\n/opt/pycharm-${edition}-${version}/bin/pycharm.sh \$*\n\n",
owner => root,
mode => '0755',
}
}
'Darwin': {
#$source = "http://download-ln.jetbrains.com/python/pycharm-${edition}-${version}.dmg"
$source = "puppet:///files/pycharm/pycharm-${edition}-${version}.dmg"
package {"pycharm-${edition}-${version}":
ensure => installed,
source => $source,
provider => appdmg,
}
}
default: {
$source = undef
}
}
if $source == undef {
fail("pycharm not supported on platform OS ${::kernel}, family ${::os['family']}")
}
}
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment