对于混合应用程序,我正在尝试运行Grunt构建来编译(等)Web代码,作为XCode构建的一部分。
我将Build Phase运行脚本定义为:
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)。
答案 0 :(得分: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