Puppet for installing PHPStorm:
class dev-tools::phpstorm ($version = "3.0", $revision = "111.19", $eap = false) {
exec { "download-phpstorm":
unless => "/usr/bin/test -d /opt/PhpStorm-${revision}",
cwd => "/tmp",
command => $eap ? {
true => "/usr/bin/wget http://download.jetbrains.com/webide/PhpStorm-EAP-${revision}.tar.gz",
false => "/usr/bin/wget http://download.jetbrains.com/webide/PhpStorm-${revision}.tar.gz",
},
creates => "/tmp/PhpStorm-${version}.tar.gz"
}
exec { "untar-phpstorm":
cwd => "/opt",
command => $eap ? {
true => "/bin/tar xvfz /tmp/PhpStorm-EAP-${revision}.tar.gz",
false => "/bin/tar xvfz /tmp/PhpStorm-${revision}.tar.gz",
},
creates => "/opt/PhpStorm-${revision}",
require => [Exec["download-phpstorm"]]
}
file { "/opt/PhpStorm-${revision}/bin/phpstorm.vmoptions":
source => "puppet:///modules/dev-tools/phpstorm/phpstorm.vmoptions"
}
file { "/usr/share/applications/phpstorm.desktop":
content => template("dev-tools/phpstorm.desktop.erb")
}
}
The Puppet class installs PHPStorm in the directory **/opt
**The version number can be specified through parameters. The use of parameters is explained in the puppet manual at http://docs.puppetlabs.com/learning/modules2.html.
The Puppet manifest also sets PHPStorm's default Java VM settings and increases the available memory.
-Xms32m -Xmx1024m -XX:MaxPermSize=150m -ea -Didea.platform.prefix=PhpStorm
To automatically create menu entries for the new PHPStorm version, I created the template "phpstorm.desktop.erb". The current path is always updated there.
[Desktop Entry] Encoding=UTF-8 Exec=export AWT_TOOLKIT=MLtoolkit; /bin/sh /opt/PhpStorm-<%= revision %>/bin/phpstorm.sh Icon=/opt/PhpStorm-<%= revision %>/bin/webide.png Icon[de_DE]=/opt/PhpStorm-<%= revision %>/bin/webide.png Name=PhpStorm Name[de_DE]=PhpStorm Type=Application Categories=Development;Application
I put the file into my own dev-tools module. The structure looks as follows:
modules
└── dev-tools
├── files
│ └── phpstorm.vmoptions
├── templates
│ └── phpstorm.desktop.erb
└── manifests
├── init.pp
└── phpstorm.pp