跑步后卫init重复了观察者行

丹尼尔·霍兰斯(Daniel Hollands)

我不确定我怎么会在这里结束,但是guard init每次运行时,它似乎有点过头了,而不是一次添加coffeescript / sass / liverload,而是对它们进行了多次。

这是我运行后在命令行中得到的内容guard init

WARN: Unresolved specs during Gem::Specification.reset:
      thor (>= 0.14.6)
      lumberjack (>= 1.0.2)
      ffi (>= 0.5.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
11:39:55 - INFO - Writing new Guardfile to /var/www/the-newbies-guide-to-test-driven-development/Guardfile
11:39:55 - INFO - coffeescript guard added to Guardfile, feel free to edit it
11:39:55 - INFO - coffeescript guard added to Guardfile, feel free to edit it
11:39:55 - INFO - coffeescript guard added to Guardfile, feel free to edit it
11:39:57 - INFO - compass guard added to Guardfile, feel free to edit it
11:39:57 - INFO - concat guard added to Guardfile, feel free to edit it
11:39:58 - INFO - livereload guard added to Guardfile, feel free to edit it
11:39:58 - INFO - livereload guard added to Guardfile, feel free to edit it
11:39:58 - INFO - There are 2 definitions in your Guardfile for 'livereload', you may want to clean up your Guardfile as this could cause issues.
11:39:58 - INFO - livereload guard added to Guardfile, feel free to edit it
11:39:58 - INFO - There are 3 definitions in your Guardfile for 'livereload', you may want to clean up your Guardfile as this could cause issues.
11:39:58 - INFO - phpunit guard added to Guardfile, feel free to edit it
11:39:58 - INFO - sass guard added to Guardfile, feel free to edit it
11:39:58 - INFO - sass guard added to Guardfile, feel free to edit it
11:39:58 - INFO - sass guard added to Guardfile, feel free to edit it
11:39:58 - INFO - sass guard added to Guardfile, feel free to edit it
11:39:58 - INFO - sass guard added to Guardfile, feel free to edit it
11:39:58 - INFO - uglify guard added to Guardfile, feel free to edit it

这就是我的内容Guardfile

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'coffeescript', :input => 'app/assets/javascripts'

guard 'coffeescript', :input => 'app/assets/javascripts'

guard 'coffeescript', :input => 'app/assets/javascripts'

guard 'compass' do
  watch('^src/(.*)\.s[ac]ss')
end

# This will concatenate the javascript files specified in :files to public/js/all.js
guard :concat, type: "js", files: %w(), input_dir: "public/js", output: "public/js/all"

guard :concat, type: "css", files: %w(), input_dir: "public/css", output: "public/css/all"

guard 'livereload' do
  watch(%r{app/views/.+\.(erb|haml|slim)$})
  watch(%r{app/helpers/.+\.rb})
  watch(%r{public/.+\.(css|js|html)})
  watch(%r{config/locales/.+\.yml})
  # Rails Assets Pipeline
  watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
end

guard 'livereload' do
  watch(%r{app/views/.+\.(erb|haml|slim)$})
  watch(%r{app/helpers/.+\.rb})
  watch(%r{public/.+\.(css|js|html)})
  watch(%r{config/locales/.+\.yml})
  # Rails Assets Pipeline
  watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
end

guard 'livereload' do
  watch(%r{app/views/.+\.(erb|haml|slim)$})
  watch(%r{app/helpers/.+\.rb})
  watch(%r{public/.+\.(css|js|html)})
  watch(%r{config/locales/.+\.yml})
  # Rails Assets Pipeline
  watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
end

guard 'phpunit', :cli => '--colors' do
  watch(%r{^.+Test\.php$})
end

guard 'sass', :input => 'sass', :output => 'css'

guard 'sass', :input => 'sass', :output => 'css'

guard 'sass', :input => 'sass', :output => 'css'

guard 'sass', :input => 'sass', :output => 'css'

guard 'sass', :input => 'sass', :output => 'css'

guard 'uglify', :destination_file => "public/javascripts/application.js" do
  watch (%r{app/assets/javascripts/application.js})
end

显然,我可以删除重复的行,但是我想知道为什么它首先发生。

大原

看起来Guard在运行init时会使用插件的所有可用版本-不确定在实际运行时是否也会这样做(这会令人担忧)。我遇到了同样的麻烦,并检查了我的宝石清单:

gem list | grep guard

这显示了我安装了多少个与Guard相关的插件版本:

guard (1.8.2, 1.8.0, 1.7.0, 1.6.2, 1.6.1, 1.5.4, 1.0.3, 1.0.1)
guard-concat (0.0.3)
guard-rspec (3.0.0, 2.5.3, 2.4.1, 2.3.3, 2.1.2, 1.2.1, 0.7.2, 0.7.0)
guard-sass (1.3.2)
guard-spork (0.8.0)
guard-uglify (0.1.0)
terminal-notifier-guard (1.5.3)

在卫士插件上运行gem cleanup,然后重复进行整理:

gem cleanup guard-rspec

gem list | grep guard

然后显示:

guard (1.8.2, 1.8.0, 1.7.0, 1.6.2, 1.6.1, 1.5.4, 1.0.3, 1.0.1)
guard-concat (0.0.3)
guard-rspec (3.0.0)
guard-sass (1.3.2)
guard-spork (0.8.0)
guard-uglify (0.1.0)
terminal-notifier-guard (1.5.3)

现在运行时guard init,我的Guardfile中没有重复的代码。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章