0

对于混合应用程序,我正在尝试运行 Grunt 构建来编译(等)Web 代码,作为 XCode 构建的一部分。

我有一个构建阶段运行脚本定义为:

source "$HOME/.rvm/scripts/rvm"
cd "${PROJECT_DIR}/www"
PATH=${PATH}:${HOME}/.rvm/gems/ruby-1.9.3-p327/bin:${HOME}/.rvm/gems/ruby-1.9.3-p327@global/bin:${HOME}/.rvm/rubies/ruby-1.9.3-p327/bin:${HOME}/.rvm/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:${HOME}/.rvm/bin
grunt build

grunt build从命令行工作正常,但通过 XCode 我得到以下错误:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem compass (>= 0) (Gem::LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
    from /Users/peteshau/.rvm/gems/ruby-1.9.3-p327/bin/compass:18
    from /Users/peteshau/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14

(指南针用于编译 SASS)。

4

1 回答 1

0

我通过删除一些无关的 PATH 条目以及添加 Ruby/RVM 环境变量来使其工作:

source "$HOME/.rvm/scripts/rvm"
cd "${PROJECT_DIR}/www"
PATH=${PATH}:${HOME}/.rvm/gems/ruby-1.9.3-p327/bin:${HOME}/.rvm/gems/ruby-1.9.3-p327@global/bin:${HOME}/.rvm/rubies/ruby-1.9.3-p327/bin:${HOME}/.rvm/bin:${HOME}/.rvm/bin:/usr/local/bin
export rvm_reset_clr=
export rvm_path=${HOME}/.rvm
export rvm_prefix=${HOME}
export rvm_env_string=ruby-1.9.3-p327
export rvm_version="1.18.5 (stable)"
export rvm_debug_clr=
export GEM_PATH=${HOME}/.rvm/gems/ruby-1.9.3-p327:${HOME}/.rvm/gems/ruby-1.9.3-p327@global
export MY_RUBY_HOME=${HOME}/.rvm/rubies/ruby-1.9.3-p327
grunt build
于 2013-10-31T15:18:31.070 回答