Rubymine的正确打开方式

1 minute read

鉴于有人问关于如何使用rubymine,那我就在这里给个傻瓜教程:

下载

Rubymine对学生和老师开放了一年的免费使用,需要用学校的邮箱来验证,点击下面地址:

https://www.jetbrains.com/ruby/buy/#edition=discounts

使用条件

一般用Rubymine的都是在本地环境,先确认本地ruby和rails是否已经安装好:

PENG-MacBook-Pro:~ PENG-mac$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin14]
PENG-MacBook-Pro:~ PENG-mac$ rails -v
Rails 4.2.5.2
PENG-MacBook-Pro:~ PENG-mac$ gem -v
2.4.8
PENG-MacBook-Pro:~ PENG-mac$ bundle -v
Bundler version 1.11.2
PENG-MacBook-Pro:~ PENG-mac$

Usage

  1. 在合适的路径下,使用终端输入:rails new app
PENG-MacBook-Pro:rubyTest PENG-mac$ rails new app
      create
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/views/layouts/application.html.erb
      create  app/assets/images/.keep
      create  app/mailers/.keep
      create  app/models/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
         run  bundle install

哎,怎么执行到bundle install就不动了?

这个属于正常情况,请小伙伴们不要慌。于是我们直接Control+C终止这个运行,点击Rubymine打开,得到以下界面:

2.点击open,找到你刚才创建的app项目

3.点击ok,进入项目

在底下的terminal中,手动运行:bundle install就行啦。

TroubleShooting:

如果还是不行,打开Gemfile文件,看到第一行:

source 'https://rubygems.org'

改成:

source 'https://ruby.taobao.org'

之前那个rubygems.org可能被中国墙了,所以无法从那个网站上获取外部包,但是淘宝在国内有个镜像,大概十五分钟更新一次,几乎与rubygems.org保持同步。这叫做换源。

淘宝源:https://ruby.taobao.org/

除了淘宝源还有rubyChina源:https://ruby-china.org/