草庐IT

distutils_path

全部标签

ruby - 为什么 puts File.expand_path(File.dirname(File.dirname(__FILE__))) 给我不同的结果?

在Win7上使用ruby​​2.0.0p481(2014-05-08)[x64-mingw32]在一个目录中(准确地说是d:\download\ruby)我有两个文件——calling.rb和called.rb调用.rbrequire_relative'called'print_path()called.rbdefprint_path()puts"File.expand_path(File.dirname(__FILE__))is#{File.expand_path(File.dirname(__FILE__))}"puts"File.expand_path(File.dirname(

ruby - 执行 bundle --path 使用了错误的 Ruby 版本

我正在使用Ruby2.2.2。当我执行bundle--pathvendor/bundle时,我得到一个名为vendor/bundle/ruby/2.2.0的文件夹。我的Gemfile指定Ruby2.2.2。我的.ruby-version指定2.2.2。当我执行rvmlist时,我得到=>ruby​​-2.2.2[x86_64]。当我执行ruby-v时,我得到ruby2.2.2p95(2015-04-13修订版50295)[x86_64-darwin14]。我什至卸载了Ruby2.2.0,当我执行bundle--pathvendor/bundle时,我仍然得到2.2.0文件夹。为什么它使

ruby - 新安装的 Ruby gem 没有出现在 $LOAD_PATH 中

我使用MacPorts来管理我的Ruby/Rails/Gems安装。最近在执行geminstallwirble后,当我启动irb实例时wirble无法加载。这是输出:$irb--simple-promptCouldn'tloadWirble:nosuchfiletoload--wirbleWirblegem没有出现在我的$LOAD_PATH中:>>puts$:/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionmailer-2.3.5/lib/opt/local/lib/ruby1.9/gems/1.9.1/gems/actionpack-2.3.

ruby-on-rails - 如何将局部变量传递到使用 to_partial_path 渲染的局部变量中

我一直在寻找here并且想知道是否可以将局部变量添加到用于呈现局部变量集合的速记符号中?两者都不是:也不是:似乎可以工作,有没有办法让它工作,或者这些部分不会接受像这样的其他本地人的参数? 最佳答案 正确的语法是, 关于ruby-on-rails-如何将局部变量传递到使用to_partial_path渲染的局部变量中,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/17623458

ruby - 如何在 Mac OS X 上将 PATH 指向新版本的 ruby​​ 以连接 Octopress

我是MacOS(10.8.4),所以安装了ruby的系统版本(1.8.7)。我知道我无法删除它,因为它是我的系统所必需的。但是,我有兴趣通过Octopress在GitHub上建立一个Jekyll博客:http://octopress.org.它需要ruby​​版本1.9.3,所以我通过添加了它rbenvinstall1.9.3-p385它似乎有效(几个小时后才意识到我必须通过macports卸载旧版本的wine)。但是,当我运行localhost:~Dan$ruby-v我明白了ruby1.9.3p392(2013-02-22revision39386)[x86_64-darwin12.

ruby - rvm system-wide install : Warning! PATH 未正确设置

我在Ubuntu12.10上的/usr/local/rvm/bin中安装了RVM的多用户版本。当我将Ruby从1.9.3升级到2.0.0时,这似乎导致每当我执行rvmversion或类似命令时弹出以下错误消息:$rvmversionWarning!PATHisnotproperlysetup,'/usr/local/rvm/gems/ruby-2.0.0-p247/bin'isnotatfirstplace,usuallythisiscausedbyshellinitializationfiles-checkthemfor'PATH=...'entries,itmightalsohel

ruby-on-rails - 如何在 Rails 中覆盖 `root_path`?

我有这样定义的语言环境:#routes.rbscope"(:locale)",locale:/#{I18n.available_locales.join("|")}/do...root"home#index"end我还在ApplicationController的default_url_params中设置了语言环境。这样我的所有路线和网址都包含这样的语言环境:http://example.com/en/somethinghttp://example.com/fr/something这对我来说是预期的行为。我也有这样的根网址:http://example.com/enhttp://exa

ruby-on-rails - 使用 heroku rails 时出错,找不到数据库客户端 psql。检查您的 $PATH 并重试

尝试执行需要我执行railsdb的数据库操作我正在执行herokurunrailsdb但我得到了Runningrailsdbattachedtoterminal...启动,运行.7334找不到数据库客户端:psql。检查您的$PATH并重试。我做了:gemupdateheroku但是没有用。仍然出现相同的错误。还有:$herokurunbundleexecrailsdb--accountwork--appdmplanningRunning`bundleexecrailsdb`attachedtoterminal...up,run.1572Couldn'tfinddatabaseclie

ruby-on-rails - Rails 3.2.13 recognize_path 返回约束的路由错误

我的路由中有两条路径,同一条路径指向不同的Controller和Actionmatch'/:id'=>'users#show',:as=>'user',:constraints=>UserConstraintmatch'/:id'=>'customers#show',:as=>'customer'我的约束类有以下匹配项吗?方法defself.matches?(request)returnUser.exists?(request.path_parameters[:id])end当我在我的浏览器中调用url时,这工作正常。但是,这不适用于recognize_path方法。Rails.app

ruby-on-rails - 教程 Michael Hartl 在 9.3 上访问 edit_user_path 失败

我有一个我无法解决的错误。我按照教程中的步骤操作,但无法通过绿色测试。我遇到了这个错误:$bundleexecrspecspec/requests/user_pages_spec.rb-e"Editpage"Runoptions:include{:full_description=>/Edit\page/}FFFFailures:1)UserpagesEditpageFailure/Error:before{visitedit_user_path(user)}ActionView::Template::Error:undefinedmethod`model_name'forNilCla