Installing CKEditor using Drush

CKEditor is my favorite WYSIWYG for Drupal. Installing it used to be a pain. I downloaded the module, then the library, uploaded both to my site via FTP, enabled the module, and then cleared cache. The library's fairly large, so downloading it took the longest.

Here's the new and improved workflow with Drush, no other tools needed:

  1. drush dl ckeditor - This downloads the module.
  2. drush en -y ckeditor - This enables the module. If you skip this step, the next one won't work.
  3. drush ckeditor-download - This downloads the library.
  4. drush cc all - This clears cache on your site.

You should now see the editor when editing the Body field, and any others with an input format associated with a CKEditor profile (see admin/config/content/ckeditor if you're having problems).

Posted on June 17, 2012 at 2:55pm

Comments

As always, you save me from extraneous work. I was just looking up how to get ckeditor installed via drush when your site came up on the first page! I then said "screw it" to all the other results and went straight for yours.

Submitted by Rosemary Foley on

That is the best thing I've heard all week. :) I wrote this post because I was fruitlessly googling "drush ckeditor" and never found a post that worked for me - turns out it was just doing things in the right order that solved it.

Glad it helped!

Submitted by WebbyKat on

Agree with WebbyKat , you saved my time.

Submitted by Ashkar on

Web-designers and developers are such snobs! Yes, they provide content to us for 'free', but that really doesn't give them the right to flummox the 'noobs' with literally NO idea of codes or how these stuff works. These 'noobs' are often from other fields of work, who (very naturally) are aware of a lot of things the developer doesn't know either. A community is supposed to help people, and I came to this page from a forum thinking I might be helped *just a little bit* by this article. Instead, I get this stupid Drush gibberish that literally MAKES NO SENSE!!

But it's just gibberish to me. And you didn't explain your gibberish either, or explain WHERE I might get an explanation for such so it's NOT gibberish to me anymore! Wish they would make cameras with the shutter switches hidden or plates with food concealed in its lining: for the so-called 'community' web developers!

Submitted by Newbie who wasn... on

This is a post about using a particular Drupal tool to perform a particular task more quickly than you normally would. If you don't know what Drush is, then of course it's not going to help you. If you stumble across a page on my blog that does not tell you exactly what you want to know, that does not demonstrate that web designers and developers are snobs who don't care about helping people who are new to the field. It just indicates that this post isn't the one that's going to help you solve your problem.

If you want actual help, feel free to leave a (civil) comment explaining what you're trying to do.

Submitted by WebbyKat on

Some people want the world handed to them on a silver platter. But in life and the real world, just about everything has prerequisites. One can't reasonably expect to study algebra with knowing arithmetic, nor calculus without algebra. Nor get a date with bad breath. While i can understand how drush might seem like gobbledygook to some, i can't understand why they aren't able to Google it and learn more.

Reading and Googling are prerequisites for using the InterNet.

By the way… Thanks so much, WebbyKat, for the instructions. In the past, i've installed FCKeditor the hard way, and figured that it would be easier with drush, so did some Googling and found your page! So much easier!

The only thing you omitted, that a newbie might get stuck on, is the need to cd to the Drupal directory before issuing your drush commands.

Submitted by Hawkeye on

I take exception to you uncivil comments. It was not that long ago that I was a newbie (and I still am in some respects). How ever, webbykat's article made perfect sense if you know drush.

But here is the issue. The author wrote this for a specific audience with a specific level of knowledge. I don't believe your comment is appropriate given that you do not possess the required level of knowledge. But eventually, you will. It is all part of the Drupal learning curve.

Let's say you read an article that describes a weekend car trip. It provides a map, photos of picturesque outlooks and other appropriate information. Now, if you did not know how to drive a car, would you call that author a snob because they did not provide instructions for teaching you how to drive a vehicle in the article? I don't think so.

Part of being in a community is saying - I think this is what I'm looking for but I'm not sure, can you please explain "what ever". In this case, your response should have been "What is drush? Can you please explain or point me to some further documentation?"

I've done this many time on different subjects and I'm always amazed by the number of people who are there to help. Granted, it might take a few days - but I've have literally received help from all over the world - Russia, China, Australia, USA, Brazil, South Africa, UK, and many other countries.

Now, you also have to realize that many people who respond are NOT profession writers and some times it takes them a few tries to explain what they know. But you have to remember - they are trying to help YOU!

To answer you unasked question - drush is Drupal tool that makes life a bit easier for you. Drush stands for "Drupal shell". You can learn more about it by looking at http://drupal.org/project/drush or at http://www.drush.org/. You might also want to look do a google search for "what is drush".

When I did that search, I found a couple of you tube videos. One is by Drupalize.me (a leader in drupal on-line classes) http://www.youtube.com/watch?v=WIjSfExbOCM and another video at http://dotsub.com/view/64a86a9b-62e3-46c8-9b28-7f1599ea7344.

There are pages of articles that explain what drush is and how to use it. So next time, instead of getting nasty, simply ask the question.

I read the above article and understood most of it. And I am still learning drush and Drupal.

Now, having said all of that - I do share your frustration with the quality of the some of the Drupal documentation. But, look at the quality of the documentation supplied by IBM and Microsoft - which are written by professionals. Some one described Microsoft's documentation as "technically correct, but totally unusable in the real world".

Shame on you for being so rude to someone who is trying to help other.

Submitted by densolis on

I just tried your solution using drush on Windows, and got an error message when I tried to download the libraries (no problem downloading the module and enabling it). My guess is that this is because it uses svn checkout which I would need to install on Windows (or in Git bash perhaps, which I have installed to run drush?). It's not a big deal because downloading manually is ok for just one library, but if anyone knows the answer I would be interested.

As for Newbie, well there's an old English saying that God helps those who help themselves. If you're going to take on a new field of knowledge then you will have a learning curve, and you just have to get used to finding that there are places where you're expected to dig in and find the basic knowledge yourself (like what drush is...) rather than expecting to have it handed to you on a plate. Thanks for the guide Webbykat, I say.

Submitted by Martin on

Yep, svn checkout seems to be required, although I run Git instead of SVN and have never had a problem (you seem to be able to do an svn checkout with Git, though). What was the error though?

Submitted by WebbyKat on

I love the article and it will make my life much easier. But I do have one question.

How does drush know how to process "ckeditor-download"? Somehow drush need to translatre "ckeditor-download" to a web site where it can find the required library and then download it my site into the appropriate library.

I followed the above instructions, but I too received an error message. Here is is:

$ drush ckeditor-download
Drush was unable to download CKEditor to [error]
<code>c:/Sites/www/webspeech/sites/all/libraries/ckeditor</code>.<br/>Attempted
command: <code>svn checkout
http://svn.ckeditor.com/CKEditor/releases/stable/
c:/Sites/www/webspeech/sites/all/libraries/ckeditor</code>.

I'm using "git" instead of svn.

Appreciate any comment or further information.

Dennis

Submitted by densolis on

The ckeditor-download command is included in the module itself -- it's in [path to ckeditor module]/includes/ckeditor.drush.inc. Here's the important bit:

function ckeditor_drush_download() {
    $args = func_get_args();
    if ($args[0]) {
        $path = $args[0];
    }
    else {
        $path = drush_get_context('DRUSH_DRUPAL_ROOT') . '/sites/all/libraries/ckeditor';
    }
    $svn_cmd = 'svn checkout http://svn.ckeditor.com/CKEditor/releases/stable/ ' . $path;
    if (drush_shell_exec($svn_cmd)) {
        drush_log(dt('CKEditor was downloaded to !path.', array('!path' => '' . $path . '')), 'success');
    }
    else {
        drush_log(dt('Drush was unable to download CKEditor to !path.', array('!path' => '' . $path . '')) . '
' . dt('Attempted command: !svn_cmd.', array('!svn_cmd' => '' . $svn_cmd . '')), 'error'); } }

It does look like ckeditor-download is reliant on SVN checkout, which is a surprise for me since my test environment doesn't use SVN. I'm wondering if, given some of the integration possibilities between Git and SVN (see https://www.kernel.org/pub/software/scm/git/docs/git-svn.html), my Git environment is smart enough to execute an SVN checkout. However, that's not my specialty, and I could well be wrong. If anyone else knows the secret, I'd love to hear about it.

Submitted by WebbyKat on

Hey guys, who get an error related to SVN, just install it by doing this

sudo apt-get install subversion libapache2-svn apache2

Submitted by Pratik on

Add new comment