Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

  • Install rbenv on your host machine.  The following assumes Mac + Homebrew:

    Code Block
    brew install rbenv


  • Install Ruby 1.9

    Code Block
    rbenv install 1.9.3-p551
    rbenv global '1.9.3-p551'
    # verify the following gives 1.9.3-p551
    ruby --version


  • Add the following to your local ~/.bash_profile:

    Code Block
    eval "$(rbenv init -)"


  • Update your local Gems:

    Code Block
    # on your host machine
    cd ~/edx/cs_comments_service  # update path as required for your installation
    bundle install


    Warning

    After running "bundle install", you may need to delete the cs_comments_service/.bundle directory if you see the following error:

    There was an error while trying to write to `/edx/app/forum/.gem/ruby/1.9.1`.


  • Forward Mongo port from devstack to your local environment.

    Code Block
    # Add the following to your devstack Vagrantfile:
    
        config.vm.network :forwarded_port, guest: 27017, host: 27017  # Mongo


  • Add local Ruby SDK to RubyMine 
    • RubyMine => Preferences => Languages and Frameworks => Ruby SDK and Gems
    • Use '+' to add an SDK
      • Choose "New local...".
      • Choose the newly installed Ruby SDK: ~/.rbenv/versions/1.9.3-p551/bin/ruby
      • Choose OK.
  •  Add Run Configuration
    • Run => Edit Configurations => + (Add New Configuration)
      • Choose "Rack" for the type of configuration.
      • Name: Comment Service
      • Server: WEBrick
      • Port: 28080 (or some unused port)
      • Environment variables: API_KEY=password
      • Use other SDK: ruby-1.9.3-p551 (~/.rbenv/versions/1.9.3-p551...)
      • Switch from "Configuration" tab to "Bundler" tab and check box.
      • Screens should look as follows:

...

Code Block
API_KEY=password bundle exec rackup -o 0.0.0.0 -p 28080


Warning

This stopped working for me (Robert Raposa) as of April 3, 2017, with the following error:

NoMethodError: undefined method `each' for nil:NilClass
  /Users/robertraposa/.rbenv/versions/1.9.3-p550/lib/ruby/gems/1.9.1/gems/mongo-2.1.1/lib/mongo/cluster.rb:114:in `initialize'
  /Users/robertraposa/.rbenv/versions/1.9.3-p550/lib/ruby/gems/1.9.1/gems/mongo-2.1.1/lib/mongo/client.rb:300:in `new'
  /Users/robertraposa/.rbenv/versions/1.9.3-p550/lib/ruby/gems/1.9.1/gems/mongo-2.1.1/lib/mongo/client.rb:300:in `create_from_addresses'

I will try to update if I ever resolve this. For now, I need to abandon using the debugger.  


The Devstack LMS/Studio will not yet be able to see this local version of devstack.  In order to do that, you'll need to do remote port forwarding either by:

...

Warning

These are old instructions that haven't been tested with recent changes. Please edit/remove this comment or section as appropriate if you try this out.


  1. vagrant ssh
  2. sudo su forum
  3. rspec command will run all tests
  4. To run just a specific test, add ":focus => true" where the test is declared. Example:
    1. describe "app" do
          describe "notifications", :focus => true do

  5. Add a "debugger" command in the code where you want to stop in the debugger
  6. Now specify -d to the rspec command (rspec -d)
  7. If that fails with a message that starts with "cannot load such file -- ruby-debug", do this:
    1. edit Gemfile and uncomment the line with "debugger"
    2. bundle install
    3. Run rspec -d again

...