我正在使用警卫来观察文件系统的变化并运行一些脚本。我不熟悉红宝石环境。到目前为止,要使用 watcher,我只需要安装 Shell(没有 gem 文件)。现在,我也尝试按照此处的说明添加 Sass 。
我通过安装它
gem install guard-shell
但是,当尝试下一个命令时
gem 'guard-sass', :require => false
它给出了错误
$ gem 'guard-sass', :require => false
ERROR: While executing gem ... (RuntimeError)
Unknown command guard-sass,
怎么了?我需要一个 gem 文件吗(不知道应该是什么内容,或者我为什么需要这个)
guard list
+------------+--------------+
| Available Guard plugins |
+------------+--------------+
| Plugin | In Guardfile |
+------------+--------------+
| Sass | ✘ |
| Shell | ✔ |
+------------+--------------+
保护文件:
guard 'shell' do
watch(/(.*).md/) {`python render.py` }
end
编辑:
跳过捆绑器,给出了这个消息。不知道有什么含义,但guard init sass
没有添加任何东西到我的
guard init sass
10:03:05 - INFO - Guard here! It looks like your project has a Gemfile, yet you are running
> [#] `guard` outside of Bundler. If this is your intent, feel free to ignore this
> [#] message. Otherwise, consider using `bundle exec guard` to ensure your
> [#] dependencies are loaded correctly.
> [#] (You can run `guard` with --no-bundler-warning to get rid of this message.)
10:03:05 - ERROR - Could not load 'guard/sass' or '~/.guard/templates/sass' or find class Guard::Sass
添加了一个gemfile,然后像这样运行
bundle exec guard init sass
10:04:31 - ERROR - Could not load 'guard/sass' or '~/.guard/templates/sass' or find class Guard::Sass
如上所述,我安装了 sass
sudo gem install sass
和 gemfile 看起来像:
示例 Gemfile
source "https://rubygems.org"
# gem "rails"
group :development do
gem 'guard'
gem "sass"
gem 'guard-sass', :require => false
end
gem 'rb-fsevent', '~> 0.9.1'