草庐IT

ios - CGPointFromString,但对于 OS X

全部标签

ruby - osx bash 上的树命令

我正在关注screencast在名为pry的ruby上.在8:10,使用了.tree命令,我相信这是一个Unix命令。它似乎在我的系统上不起作用:[24]pry(main)>.tree\Error:therewasaproblemexecutingsystemcommand:tree我已将问题追溯到here,其中pry引用了一个shell命令:Pry::CommandSet.newdocommand(/\.(.*)/,"Alltextfollowinga'.'isforwardedtotheshell.",:listing=>".")do|cmd|ifcmd=~/^cd\s+(.+)/

通过 Mac Ports 在 Mac OSX 上使用 Ruby

我是Ruby和MacOSX的新手,但我对Unix命令有相当多的经验。我刚刚通过MacPorts命令(portinstallruby​​19)安装了Ruby1.9。然后,我需要从根目录中进行查找,以确定它去了哪里,结果是:/opt/local/var/macports/software/ruby19/1.9.1-p376_0/opt/local/bin/ruby1。9.当前版本的Ruby(1.8.6)通过/usr/bin/ruby运行,它是/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby的符号链

ruby-on-rails - Rails 上周日相对于任何日期时间

使用Rails3应用程序。给定一个日期时间,我需要生成前一个星期日的日期时间。如果DateTime是星期日,那么我希望那个星期日本身回来。下面是一些示例:November7,2011=>November6,2011November6,2011=>November6,2011November5,2011=>October30,2011有什么想法吗?我有点卡住了。 最佳答案 Rails有一个计算一周开始的便捷方法。irb(main):001:0>Date.today.beginning_of_week(:sunday)#=>Sun,16

ruby-on-rails - 'File.read' 和 'IO.read' 有什么区别?

我正在使用Ruby和RubyonRails3,我想知道......有什么区别File.read("filename.txt")和IO.read("filename.txt")? 最佳答案 由于File是IO的子类,没有read方法,调用File.read时实际上调用的是IO.read这里没有区别。 关于ruby-on-rails-'File.read'和'IO.read'有什么区别?,我们在StackOverflow上找到一个类似的问题: https://st

ruby - gem install pg 不适用于 OSX Lion

这个问题围绕SO有很多变化,但似乎没有一个能解决我的问题。我正在运行OSXLion(10.7.3)。安装了最新的XCode。我使用来自postgresapp.com的Postgres.app包安装了Postgres。但是当我尝试安装pggem时,我失败了:$geminstallpg----with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_configBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingpg:ERROR:Fail

ruby - 在 Mac 10.7 上运行 'requirements_osx_brew_libs_install...' 时出错

尝试在上一代MacbookPro上安装brew并不断收到以下错误:Errorrunning'requirements_osx_brew_libs_installautoconfautomakelibtoolpkg-configapple-gcc42libyamlreadlinelibxml2libxsltlibksbaopensslsqlite',pleaseread/Users/allegrascrugham/.rvm/log/ruby-1.9.3-p392/1368142352_package_install_autoconf_automake_libtool_pkg-config

Ruby:如何计算相对于另一条路径的路径?

假设我知道我开始的绝对路径和我试图到达的绝对路径:first='/first/path'second='/second/path'现在我想弄清楚如何构造一条相对于第一个路径的路径。例如:#answershouldbe/first/path/../../second/pathpath=second.get_path_relative_to(first)我如何在Ruby中做这种事情? 最佳答案 使用Pathname#relative_path_from:require'pathname'first=Pathname.new'/first

ruby - 如何在 OSX Mavericks 上安装命令行工具

我正在运行OSXMavericks(10.9),在尝试更新Rails中的bundle时,我收到以下错误消息:"Youhavetoinstalldevelopmenttoolsfirst."我已经安装了Xcode,似乎没有从Xcode4.6中安装工具的选项。如何通过终端下载和安装命令行工具? 最佳答案 Incase,在尝试更新bundle时,您会收到错误消息“您必须先安装开发工具。”在OSXMavericks(OSX10.9)上,但是你已经安装了Xcode,你仍然可以通过终端手动安装开发工具:xcode-select--install

ruby - 新 10.9 OSX for ruby​​ gems 的命令行工具?

安装OSXMavericks10.9演示后,我在运行bundle后得到这个Gem::Installer::ExtensionBuildError:ERROR:Failedtobuildgemnativeextension./Users/sandric/.rvm/rubies/ruby-1.9.3-p194/bin/rubyextconf.rbextconf.rb:17:UseRbConfiginsteadofobsoleteanddeprecatedConfig.checkingforsocket()in-lsocket...***extconf.rbfailed***Couldnot

ruby - 无法在 OSX Lion 上使用 RVM 安装 Ruby Enterprise Edition

这是我到目前为止所做的。全新安装OSXLion已从AppStore下载并安装最新版本的Xcode。已安装Git已安装自制软件已安装RVM我现在尝试使用rvminstallree为项目安装RubyEnterpriseEdition并收到以下错误:$rvminstallreeree-1.8.7-2011.03-#installingERROR:Errorrunning'./installer-a/Users/FaraazKhan/.rvm/rubies/ree-1.8.7-2011.03--no-tcmalloc--dont-install-useful-gems',pleaseread/