【问题标题】:Run Rails Server and Grunt Watch on Vagrant Boot在 Vagrant Boot 上运行 Rails Server 和 Grunt Watch
【发布时间】:2013-06-25 04:26:32
【问题描述】:

我想让我的 Rails 应用程序在“vagrant up”上运行,而无需 ssh 虚拟机并手动运行“rails server”。

为了做到这一点,我的 default.rb 配方中有:

execute "rails server" do
  command "cd /vagrant && rails server"
end

它让我的终端保持运行,实际上给了我一个运行的 Rails 服务器。

问题来了我还想在“vagrant up”上运行一个“grunt watch”。

execute "grunt watch" do
  command "cd /vagrant && grunt watch"
end

问题在于,由于 'rails server' 之前运行并且它不在后台运行,'grunt watch' 永远不会被执行。

因此,为了在后台运行它们,我在两个命令中都附加了“&”,但是在成功运行“vagrant up”后,rails 服务器或 grunt watch 都没有运行。

我也尝试过预先附加“nohup”命令,但我也没有工作。

这里有指南吗?

【问题讨论】:

    标签: ruby-on-rails gruntjs vagrant


    【解决方案1】:

    解决方法是:

    execute "rails server and grunt watch" do
        command "cd /vagrant && rails server & cd /vagrant && grunt watch"
    end
    

    【讨论】:

      猜你喜欢
      • 2015-06-04
      • 2014-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-25
      • 1970-01-01
      • 2019-05-06
      • 2019-07-01
      相关资源
      最近更新 更多