我正在使用guard来监视文件系统更改并运行一些脚本。我不熟悉ruby环境。到目前为止,要使用watcher,我只需要安装Shell(没有gem文件)。现在,我正在尝试按照here指令添加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 | ✔ |
+------------+--------------+
Guardfile:
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看起来像:
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'
答案 0 :(得分:1)
如果您重新阅读Github上的指南,您会注意到它将gem 'guard-sass', :require => false
添加到您的Gemfile中,而不是在您的终端中运行它。
现在,如果文档是正确的,您只需运行guard init sass