RubyMine 2017.1 EAP: Puppet Project Structure
We’re glad to bring out RubyMine 2017.1 EAP (171.2014.20) containing both new features and significant bug fixes. In this post we’d like to highlight a new feature for Puppet: Puppet Project Structure.
Puppet Project Structure
In the recently released RubyMine 2016.3, we announced more intelligent Puppet support, which provides better code completion and navigation along with other fundamental capabilities. But in this update, we think we have finally made a decent tool for developing Puppet modules, which are the most popular approach to Puppet development:
If you use Puppet for your development operations, you are likely to deal with lots of interdependent modules and/or environments. Each module uses its own resources and classes, or, simply put, files that should be installed for every module in your project. This probably implies downloading these modules to your project and configuring them manually. Bearing this in mind, we have implemented a new project structure that allows you to work with Puppet projects in an intelligent fashion, right inside IDE:
Here’s how it works:
First of all, open or create a Puppet project.
If you don’t have the
librarian-puppet gem installed, the IDE will notify you and run the installation in the background:
Starting with this EAP, RubyMine can find all modules/environments in the project automatically, based on dependencies files, and update the project structure if any has changed. Even if the IDE fails to update your project structure after installing additional modules into the project using the terminal, you can manually rescan the directory for modules or environments by using Scan for modules and environments from the context menu.
You’ve placed your modules and specified dependencies in
metadata.json and, optionally, Puppetfile for modules, and/or Puppetfile for environments. Now simply right-click on any file or directory inside the module or environment to open context menu, and then click Install dependencies:
Now you can see the installed modules in the .dependencies subdir for modules or modules subdir for environments.
What is important here is that the navigation and completion for each module will work in strict accordance with dependencies. For example, if you are editing one module depending on
puppetlabs-nginx, and another module depending on
puppetlabs-apache, then you’ll see either nginx or apache in completion:
The same logic applies to navigation actions like Go to declaration, Find usages, and so on:
Important! This EAP cannot handle dependencies versions. If two modules in your project depend on the same module with different versions and you’ve installed dependencies for both of them, navigation and completion may work wrong (resolve/complete from an incorrect version of dependency).
Another important note is that if some of your modules depend on module A, and you’ve got two copies of this module A (e.g. one in project root, and another in .dependencies directory), completion and resolve will work with the one in the project root. This has been done so that you can simultaneously work on a module and its dependency in the same project.
UPD please see also this post for new improvements for Puppet.
Your RubyMine Team