【问题标题】:guard-annotate gem is not working保护注释宝石不起作用
【发布时间】:2014-01-30 17:13:11
【问题描述】:

宝石文件

gem 'annotate'
gem 'guard'
gem 'guard-annotate'

保护文件

guard 'annotate', :run_at_start => false do
  watch( 'db/schema.rb' )

  # Uncomment the following line if you also want to run annotate anytime
  # a model file changes
  watch( 'app/models/*.rb' )

  # Uncomment the following line if you are running routes annotation
  # with the ":routes => true" option
  watch( 'config/routes.rb' )
end

当我运行“注释”(没有保护)时,它运行良好。当我运行警卫时,我发现警卫注释不起作用。

这是踪迹

$ 捆绑执行保护

09:33:56 - INFO - Guard is using NotifySend to send notifications.
09:33:56 - INFO - Guard is using TerminalTitle to send notifications.
09:33:56 - INFO - Guard is now watching at '/home/user/work/projects/a/alumni-not'
[1] guard(main)> 
09:34:56 - INFO - Run all
[2] guard(main)> 
09:34:56 - INFO - Run all
[3] guard(main)> 

调试跟踪

$ bundle exec guard --plugin annotate -d

16:48:13 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
16:48:13 - INFO - Guard is using Libnotify to send notifications.
16:48:13 - INFO - Guard is using TerminalTitle to send notifications.
16:48:13 - DEBUG - Command execution: hash stty
16:48:13 - DEBUG - Guard starts all plugins
16:48:13 - DEBUG - Hook :start_begin executed for Guard::Annotate
16:48:13 - DEBUG - Hook :start_end executed for Guard::Annotate
16:48:13 - INFO - Guard is now watching at '/home/user/work/projects/a/alumni-not'
16:48:13 - DEBUG - Start interactor
[1] Annotate guard(main)> 
16:48:23 - INFO - Run all
16:48:23 - DEBUG - Hook :run_all_begin executed for Guard::Annotate
16:48:23 - DEBUG - Hook :run_all_end executed for Guard::Annotate

我在这里找不到任何结果,但我可以找到一些正在运行的进程。我该如何解决这个问题?我应该在哪里看到带注释的结果?

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-3 guard


    【解决方案1】:

    宝石文件

    宝石“导轨”,“3.1.0” 宝石“耙子”,“0.8.7”

    组:开发做 宝石“注释”,“2.5.0” 结束

    命令行:

    $ gem install annotate 成功安装annotate-2.5.0 已安装 1 个宝石

    【讨论】:

    【解决方案2】:

    Guard annotate does not implement the run_all plugin API,所以 run all 对 annotate Guard 没有影响。

    我不知道 annotate gem,但是从快速浏览来看,它似乎总是对每个模型进行注释并且没有选择性重新生成,因此您只需触发单个文件更改,例如

    [1] guard(main)> c db/schema.rb
    

    这应该运行注释。

    另一种选择是发送拉取请求以实现run_all 方法,例如:

    def run_all
      run_annotate
    end
    

    这允许您将annotate 写入Guard 命令提示符以运行注释。

    【讨论】:

      【解决方案3】:

      使用特定版本的gem "jquery-rails", "~> 2.3.0",因为以后版本的gem已经删除了ui部分。

      您可以将 gem "jquery-ui-rails" 用于 jquery-ui 。更多信息请访问 git 仓库

      要要求所有 jQuery UI 模块,请将以下内容添加到您的 application.js:

      //= require jquery.ui.all
      

      还将 jQuery UI CSS 添加到您的 application.css:

      /*
       *= require jquery.ui.all
       */
      

      希望对你有帮助

      【讨论】:

        【解决方案4】:

        你是从命令提示符运行它吗?如果是这样,请尝试 bundle exec annotate User 使用您的捆绑 gem 而不是系统 gem。

        宝石被称为“注释”还是“注释模型”?

        【讨论】:

        • 嘿,guard-annotate 应该代表您执行此操作,前提是 db/schema.rb 文件发生更改。但是,您关于手动运行 bundle exec annotate 的评论确实对我有用。虽然它没有回答为什么 guard-annotate 没有正确运行。
        【解决方案5】:

        不应该是annotate gem吗?它的 github repo 被称为 annotate_models。

        annotate-models gem 不同,有一段时间没有更新了。

        【讨论】:

        • 我相信 guard-annotate 引入了 annotate 作为依赖。
        猜你喜欢
        • 2018-09-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-25
        • 1970-01-01
        • 2017-09-02
        • 1970-01-01
        相关资源
        最近更新 更多