set "PATH_Classic=C:\IBM\InformationServer\Clients\Classic"
cd /D "%PATH_Classic%"
set /P "INV_ID=Type the invocation ID: "
echo %INV_ID%
setlocal EnableDelayedExpansion
for /F "usebackq tokens=* delims= " %%G in ("%~1") do (
set "FLOW=%%G"
set "JOBNAME=****_****_**_***_!FLOW!_***_***.%INV_ID%"
set "STAGENAME=ReadFile_!FLOW!"
dsjob -domain NONE -user ******* -password ******* -server ****** -linkinfo ****** !JOBNAME! !STAGENAME! read_file_IN
)
endlocal
pause
但是当我在IDE上运行我的代码时,我收到了以下错误:
➜ ~ ruby -v
ruby 1.8.7 (2014-01-28 patchlevel 376) [i686-darwin15.0.0]
➜ ~ rails -v
Rails 2.3.18
➜ ~ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.17
- RUBY VERSION: 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin15.0.0]
- INSTALLATION DIRECTORY: /Users/reboot/.rvm/gems/ruby-1.8.7-p374
- RUBY EXECUTABLE: /Users/reboot/.rvm/rubies/ruby-1.8.7-p374/bin/ruby
- EXECUTABLE DIRECTORY: /Users/reboot/.rvm/gems/ruby-1.8.7-p374/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-15
- GEM PATHS:
- /Users/reboot/.rvm/gems/ruby-1.8.7-p374
- /Users/reboot/.rvm/gems/ruby-1.8.7-p374@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
因此,从上面的错误消息,它看起来像正在使用ruby 2.0.0。由于某种原因,我也无法加载文件。
如何告诉Rails使用Ruby 1.8.7。
我已经完成了/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- cron_tools (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
这是我的路径
rvm --default use 1.8.7
答案 0 :(得分:0)
Rubymine
运行一个脚本时它正在使用Ruby解释,这就是为什么它没有加载rails环境。由于我的脚本使用Time.now - 1.month
,其中1.month
来自Active Support,而不是Ruby stdlib,这就是我收到错误的原因。我通过从终端运行脚本来解决问题
./script/runner <filename>
一切正常。
我还必须在开头添加此行或我的.zshrc
文件来修复Ruby版本的问题。
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"