Information for: DEVELOPERS   PARTNERS

Using Drupal tooling in Cloud IDE

Cloud IDE ships with preconfigured tooling that is optimized for Drupal development so you can be productive right away. Review the tools installed and supported versions.

Acquia CLI

Acquia CLI is a command-line interface for interacting with the Cloud Platform applications and services.

You can view all Acquia CLI commands here.

Composer

Cloud IDE supports both Composer 1 and 2. Composer 2 is the default and can be invoked by running the composer command. To invoke Composer 1, run the composer1 command instead.

Note

We encourage you to update your code now so it’s fully compatible with Composer 2. Composer 2 is much faster and has more features than Composer 1.

You can view all Composer commands here.

Xdebug

Xdebug is preconfigured in Cloud IDE. It makes debugging Drupal simpler.

Enabling or disabling Xdebug

Cloud IDE allows you to enable and disable Xdebug with the acli ide:xdebug-toggle command.

ide:~/project $ acli ide:xdebug-toggle
xDebug enabled.
ide:~/project $ acli ide:xdebug-toggle
xDebug disabled.

Overriding Xdebug default settings (advanced)

To override the default settings, complete the following steps:

  1. In your Cloud IDE, locate the /home/ide/configs/php/xdebug.ini file.

  2. Modify any of the following configuration settings:

    [xdebug]
    ;zend_extension=xdebug.so
    xdebug.remote_enable=1
    xdebug.remote_autostart=1
    xdebug.remote_port=9001
    xdebug.auto_trace=Off
    xdebug.default_enable=Off
    xdebug.max_nesting_level=2000
    xdebug.profiler_enable=Off
    
  3. To apply the changes you’ve made, restart PHP-FPM by running the following command:

acli ide:service-restart php

PHP Code Sniffer

PHP Code Sniffer is an essential part of the Drupal developer toolbox to write quality code. Drupal best practices are automatically enforced in Cloud IDE with the Drupal and DrupalPractice code sniffs pre-installed.

ide:~/project (master) $ phpcs -i
The installed coding standards are Squiz, MySource, Zend, PSR1, PEAR, PSR12,
PSR2, Drupal, DrupalPractice, and VariableAnalysis.

To run PHP Code Sniffer against any supported Drupal file, invoke the phpcs command and pass the path to the filename or directory.

ide:~/project (master) $ phpcs docroot/core/core.api.php

FILE: /home/ide/project/docroot/core/core.api.php
------------------------------------------------------------------------------
FOUND 13 ERRORS AND 1 WARNING AFFECTING 14 LINES
------------------------------------------------------------------------------
    8 | ERROR   | [ ] Missing short description in doc comment
  459 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 1956 | ERROR   | [ ] Type hint "array" missing for $data_types
 1973 | ERROR   | [ ] Type hint "array" missing for $queues
 1992 | ERROR   | [ ] Missing parameter type
 2039 | ERROR   | [x] Doc comment short description must end with a full stop
 2045 | ERROR   | [ ] Missing parameter type
 2047 | ERROR   | [ ] Missing parameter type
 2068 | ERROR   | [ ] Missing parameter type
 2122 | ERROR   | [ ] Type hint "array" missing for $info
 2129 | ERROR   | [ ] Missing parameter type
 2158 | ERROR   | [ ] Type hint "array" missing for $definitions
 2232 | ERROR   | [ ] Type hint "array" missing for $sync_steps
 2254 | ERROR   | [ ] Missing parameter type
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------

Time: 2.74 secs; Memory: 14MB

Drush

Drush 8 is available for Drupal 7 applications. For Drupal 8 or later, the best practice is to add Drush to your composer.json file. You can do so with the following command:

composer require drush/drush

GitHub CLI

We have documentation for you to successfully clone your Drupal application hosted on GitHub. On top of this, we support the GitHub CLI so you can streamline working with GitHub from the Terminal.

You can view all GitHub CLI commands here.

Node Version Manager (NVM)

Node Version Manager (nvm) is a version manager for Node.js, designed to be installed per user, and invoked per shell.

To install a different version of Node.js, use nvm install and pass the target version.

ide:~/project (master #) $ nvm install 12.14.1
Downloading and installing node v12.14.1...
Downloading https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v12.14.1 (npm v6.13.4)

To use the newly installed version, use nvm use <version>.

ide:~/project (master #) $ nvm use 12.14.1
Now using node v12.14.1 (npm v6.13.4)

To confirm you’re running the target version, type node -v.

ide:~/project (master #) $ node -v
v12.14.1

Ruby Version Manager (RVM)

The Ruby Version Manager (RVM) is a command-line tool, which allows you to easily install, manage, and work with multiple Ruby environments, from interpreters to sets of gems. It helps with ensuring that all aspects of Ruby are completely contained within user space, strongly encouraging safer, non-root use.

To get a list of existing Ruby versions, use rvm list.

ide:~/project $ rvm list
=* ruby-2.4.9 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

To install a different version of Ruby, you can leverage the rvm install command and pass your target version.

ide:~/project $ rvm install 2.7.2
Searching for binary rubies, this might take some time.
No binary rubies available for: debian/bullseye_sid/x86_64/ruby-2.7.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for debian.
Installing requirements for debian.
.....
Installing required packages: libreadline6-dev...
Requirements installation successful.
Installing Ruby from source to: /home/ide/.rvm/rubies/ruby-2.7.2, this may take a while depending on your cpu(s)...
ruby-2.7.2 - #downloading ruby-2.7.2, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14.0M  100 14.0M    0     0  27.7M      0 --:--:-- --:--:-- --:--:-- 27.6M
ruby-2.7.2 - #extracting ruby-2.7.2 to /home/ide/.rvm/src/ruby-2.7.2.....
ruby-2.7.2 - #configuring........................................................................
ruby-2.7.2 - #post-configuration..
ruby-2.7.2 - #compiling............................................................................................................
ruby-2.7.2 - #installing..................
ruby-2.7.2 - #making binaries executable...
Installed rubygems 3.1.2 is newer than 3.0.9 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.2 - #gemset created /home/ide/.rvm/gems/[email protected]
ruby-2.7.2 - #importing gemset /home/ide/.rvm/gemsets/global.gems................................................................
ruby-2.7.2 - #generating global wrappers.......
ruby-2.7.2 - #gemset created /home/ide/.rvm/gems/ruby-2.7.2
ruby-2.7.2 - #importing gemsetfile /home/ide/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.2 - #generating default wrappers.......
ruby-2.7.2 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.2 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri

You can observe the new version is now available.

ide:~/project $ rvm list
=* ruby-2.4.9 [ x86_64 ]
   ruby-2.7.2 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

To switch to the new version, use the following commands.

ide:~/project $ /bin/bash --login
ide:~/project $ rvm use 2.7.2
Using /home/ide/.rvm/gems/ruby-2.7.2
ide:~/project $ rvm list
 * ruby-2.4.9 [ x86_64 ]
=> ruby-2.7.2 [ x86_64 ]

# => - current
# =* - current && default
#  * - default