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:
- Run => Edit Configurations => + (Add New Configuration)
...
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 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. |
- vagrant ssh
- sudo su forum
- rspec command will run all tests
- To run just a specific test, add ":focus => true" where the test is declared. Example:
describe "app" do
describe "notifications", :focus => true do
- Add a "debugger" command in the code where you want to stop in the debugger
- Now specify -d to the rspec command (rspec -d)
- If that fails with a message that starts with "cannot load such file -- ruby-debug", do this:
- edit Gemfile and uncomment the line with "debugger"
- bundle install
- Run rspec -d again
...