ガードを使用してファイルシステムの変更を監視し、スクリプトを実行しています。Ruby環境に慣れていません。これまでのところ、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'
編集2:
これは許可の問題でした。https://github.com/hawx/guard-sass/issues/29を参照してください。