1. 安装drush的方法:
最权威的方法还是应该去他们的官网:
http://docs.drush.org/en/master/install/
我使用了第一种方法:
composer global require drush/drush:7.*
但前提是先安装 composer,所以过程有些曲折
2. 安装Drupal:
先按照LAMP 或者 XAMPP 环境
再到 www.drupal.org 去下载最新的drupal,解压后文件夹放到 /var/www/html 就可以
3. 使用drush安装Omega subtheme:
可以参考这个文章:http://mydrupal.org/comment/19783
我在运行这步 drush omega-wizard 遇到问题,是因为drush还没有加载跟omega相关的extensions。
找了半天,终于在这里找到答案:
https://www.digitalocean.com/community/tutorials/how-to-create-an-omega-4-drupal-subtheme-on-an-ubuntu-vps
通过 命令:drush en omega 就可加载omega的相关的extensions。
运行drush en omega和接下来的命令的时候请确保terminal位于/var/www/html/drupal文件夹内,否则可能无法运行。
我的文件夹是hnnsboy@ubuntu:/opt/lampp/htdocs/drupal/sites/all/themes/hdw_theme$ sudo bundle install
还有一种可能是你遇到了下列错误,
The drush command 'up' could not be executed.
Drush was not able to start (bootstrap) the Drupal database.
如果遇到这种错误,只需要把sites/default下的settings.php里面的localhost参数修改成127.0.0.1。
可以参考这个文章
http://blog.sina.com.cn/s/blog_45df8cd201016p2i.html
4. 设置环境为SASS做准备:
这一步骤需要涉及到ruby, rvm, gem的安装,相关安装方法可以去问度娘。
这一过程可能涉及到镜像的问题,请参考这个连接
http://www.jb51.net/article/49079.htm
接着需要运行 drush omega-guard
我遇到的情况是
drush omega-guard
Which theme do you want to run Guard for?
[0] : Cancel
[1] : hdw_theme (Subtheme of Omega) - Please provide a description for your
theme.
[2] : Ohm (Subtheme of Omega) - Omega based demonstration theme. Serves as a
best-practice reference for the Omega documentation. Ohm will be
constantly updated as best practice evolves so shouldn't be used in
production.
[3] : Omega - A powerful base theme framework.
1
You have to install Bundler version 1.2 or newer. [error]
chen@ubuntu:/opt/lampp/htdocs/drupal/sites/all/themes/hdw_theme$ gem
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
所以我必须要先执行 gem install bundle
但素,又遇到下面这个问题
Bundler::GemfileNotFound
由于某种不知道的原因,在drush 安装subtheme时候,没有把OMEGA的GEM文件复制到新的subtheme里面去。
这里我们可以手动复制GEM到subtheme的文件夹中。而且要记得修改GEM文件里面的第一句关于镜像的语句:
source 'https://ruby.taobao.org/'
bundle install 完成之后,我们就可以运行
drush omega-guard
但素,再次悲剧了,出现
Error: could not load guard/liveload
对于这个问题,需要更新liveload
bundle update guard-livereload