• 可以使用 ssh 接口 ssh = Net::SSH.start(host, username, :password => password) result = ssh.exec!("pwd") puts result

  • 补充一个 ubuntu 的

    要安装 ruby,最好是用 rvm,这个是经验 安装 rvm:先安装 curl 和 git

    sudo apt-get install git-core sudo apt-get install curl

    可以用 dpkg -s curl 命令检查一下系统有没有安装

    安装 rvm 用 rvm 官方推荐的方式安装 curl -L get.rvm.io | bash -s stable 回显提示我们,RVM 被安装在$HOME/.rvm 中;并且需要在终端中加载脚本$HOME/.rvm/scripts/rvm

    应该请把这句话加在$HOME/.bash_profile 文件中,以便在开启一个终端会话时候加载 RVM [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

    如果对 shell 变成不熟悉,这里简单解释一下这是干什么用的。

    [[condition]],两层的方括号中间括着条件返回条件是不是真。-s 是判断给定的文件是否存在的命令。这样一来,不就是在 [[ -s "$HOME/.vrm/scripts/vrm"]] 判断刚才安装的 RVM 是否存在吗? 接下来的&&符号是“短路的与”,当前面的条件是真的时候,执行后面的语句,返回这两个语句是不是全是真。在这里,利用了“短路”特性。也就是说当 RVM 已经安装的话,执行后面的。"$HOME/.rvm/scripts/rvm"命令。这条命令和 source "$HOME/.rvm/scripts/rvm"是一个意思:加载 rvm 的启动脚本。 #符号后面是注释信息。 使用 RVM 刚才我们通过修改.bash_profile 增加的内容需要重新打开终端窗口时加载。我们有两个选择,一个是关闭当前的终端窗口重新打开,另一个是在当前窗口执行一遍。"$HOME/.rvm/scripts/rvm"。 察看 RVM 的版本

    rvm 1.16.20 (stable) by Wayne E. Seguin [email protected], Michal Papis [email protected] [https://rvm.io/]

    可以查看可以安装的版本 rvm list known

    安装 ruby rvm install 1.9.3-p125

    这一步按道理讲会发生问题

    Searching for binary rubies, this might take some time. No binary rubies available for: ubuntu/10.04/i386/ruby-1.9.3-p125. Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. Installing requirements for ubuntu, might require sudo password. Skipping apt-get update make sure your system is up to date. RVM autolibs is now configured with mode '2' => 'check and stop if missing', please run rvm autolibs enable to let RVM do its job or run and read rvm autolibs [help] or visit https://rvm.io/rvm/autolibs for more information.

    如下划线所示,运行 rvm autolibs enable rvm autolibs

    然后就可以安装 ruby 了,选择一个版本 rvm install 1.9.3-p125

    再运行 ruby 时,发现会有这样一个错误 RVM is not a function, selecting rubies with 'rvm use ...' will not work.

    You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use /bin/bash --login as the command. Please visit https://rvm.io/integration/gnome-terminal/ for a example. 访问下划线处网站,会有指点,按方式做,很简单

    关闭 terminal 之后,重新打开 ruby -v 成功

    再使用 gem 安装 rails gem install rails

  • #11 楼 @gihnius 估计程序员没能力从 11 点折腾到 1 两点。。。

  • 希望家乡的 IT 和 Rails 多发展一点吧,这样就能回家了~~~

  • 毕业设计选题,求指教 at 2013年12月20日

    做了一个在线订餐系统,html5+rails,一周左右的样子,大家还都觉得很牛逼的感觉~~~

  • 长春有做 rails 的公司吗?!

  • 是啊,现在都 20 号了,好想知道有没有被选中呢

  • #30 楼 @sundevilyang 额额,好的好的

  • 报名了成都站~~

  • 要是真做相关工作,应该自己写一个