我正在使用:
TextMate:版本2.0-阿尔法9511
rvm:1.25.15(稳定)
ruby:版本2.1.0p0
哦,我的zshell:50.2
Mac OS X:10.9.1(小牛)
我已经设置了rvm和textmate以供使用
TM_RUBY=/Users/<myuser>/.rvm/bin/rvm-auto-ruby
问题是:
当我尝试在textmate中使用rake捆绑包运行rake任务时,我收到一些关于文件未加载的错误:“无法加载这样的文件--rubocop/rake_task”
线索:
我更改了我的rake文件,以便它只报告默认任务的“gemenv”。
当我运行该任务时,我看到的gem环境与我在终端命令行使用rake时看到的完全不同。
RakeMate v2.0.0
>>> /Users/Johno/Projects/puzzles/triangle/Rakefile
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [universal.x86_64-darwin13]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-13
- GEM PATHS:
- /Library/Ruby/Gems/2.0.0
- /Users/Johno/.gem/ruby/2.0.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
而我在跑步时看到了这一点
$gem环境
在我的终端,为我的项目
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0.rc.1
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-darwin12.0]
- INSTALLATION DIRECTORY: /Users/Johno/.rvm/gems/ruby-2.1.0@puzzles
- RUBY EXECUTABLE: /Users/Johno/.rvm/rubies/ruby-2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/Johno/.rvm/gems/ruby-2.1.0@puzzles/bin
- SPEC CACHE DIRECTORY: /Users/Johno/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /Users/Johno/.rvm/gems/ruby-2.1.0@puzzles
- /Users/Johno/.rvm/gems/ruby-2.1.0@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/Johno/.rvm/gems/ruby-2.1.0@puzzles/bin
- /Users/Johno/.rvm/gems/ruby-2.1.0@global/bin
- /Users/Johno/.rvm/rubies/ruby-2.1.0/bin
- /Users/Johno/.rvm/bin
- /usr/local/bin
- /Users/Johno/Projects/Scripts/Ruby
- /Users/Johno/Projects/Scripts/bash
- /Users/Johno/Projects/Scripts/perl
- /Users/Johno/Projects/Scripts/Geek Tool
- /usr/bin
- /bin
我怀疑textmate试图使用“错误”的耙,或者未能正确设置环境。
我认为问题可能出在text-mate的ruby bundle命令中:
#!/usr/bin/env bash
export RUBYLIB="$TM_BUNDLE_SUPPORT/RakeMate${RUBYLIB:+:$RUBYLIB}"
export TM_RAKE=$(which "${TM_RAKE:-rake}")
"/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby" -- "$TM_BUNDLE_SUPPORT/RakeMate/rake_mate.rb"
它似乎使用了特定的ruby(1.8),而不是rvm项目特定的ruby
有人对如何解决这个问题提出建议吗?
非常感谢。
约翰·尚克
按照建议设置TM_RAKE,但这没有帮助。
我尝试了建议的设置,并使用
which rake
/用户/Jhono/.rvm/gems/ruby-2.1.0@puzzles/料仓/耙
使用TM_RAKE时,会出现不同的错误
RakeMate v2.0.0
>>> /Users/Johno/Projects/puzzles/triangle/Rakefile
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'rake' (>= 0) among 5 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/Johno/.rvm/gems/ruby-2.1.0@puzzles/bin/rake:22:in `<main>'
这恰好是我尝试使用rubocop.tmbundle时遇到的相同错误
在我看来,gem环境仍然没有传递给子进程。