Git Product home page Git Product logo

Comments (10)

moxley avatar moxley commented on July 20, 2024

Works for me. I'm not a chruby user, but I tried it out, removing rbenv first. Check out the steps I took and see if there is anything you might be doing differently:

  1. Remove rbenv files:

    rm -rf ~/.rbenv
    
  2. Remove these lines from ~/.bash_profile:

    export PATH="$HOME/.rbenv/bin:$PATH"
    eval "$(rbenv init -)"
    
  3. Close and reopen shell.

  4. Verify the system Ruby:

    ~ $ which ruby
    /usr/bin/ruby
    ~ $ ruby --version
    ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]
    
  5. Install chruby with Homebrew:

    brew update
    brew install chruby
    
  6. Add the following line to ~/.bash_profile:

    source /usr/local/opt/chruby/share/chruby/chruby.sh
    
  7. Install Ruby MRI 2.1.2:

    brew install gdbm libffi libyaml openssl readline wget
    wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
    tar -xjvf ruby-2.1.2.tar.bz2
    cd ruby-2.1.2
    ./configure --prefix="$HOME/.rubies/ruby-2.1.2" --with-opt-dir="$(brew --prefix openssl):$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm):$(brew --prefix libffi)"
    make
    sudo make install
    
  8. Add the following line to ~/.bash_profile:

    chruby ruby-2.1.2
    
  9. Restart shell.

  10. Verify Ruby:

    ~ $ ruby --version
    ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
    ~ $ which ruby
    /Users/moxley/.rubies/ruby-2.1.2/bin/ruby
    
  11. Install bundler:

    gem install bundler
    
  12. Install project gems:

    cd ~/projects/bands
    bundle
    
  13. Verify rspec:

    ~/projects/bands git:master(0) $ which rspec
    /Users/moxley/.gem/ruby/2.1.2/bin/rspec
    
  14. Quit and restart Atom

  15. Run test tests for a given test file: Cmd+Ctrl+T

from atom-ruby-test.

turboladen avatar turboladen commented on July 20, 2024

Hmm... I'll try when I get in front of a computer ASAP. Could it be due to me using zshell instead of bash?

On Jul 16, 2014, at 15:23, Moxley Stratton [email protected] wrote:

Works for me. I'm not a chruby user, but I tried it out, removing rbenv first. Check out the steps I took and see if there is anything you might be doing differently:

Remove rbenv files:

rm -rf ~/.rbenv
Remove these lines from ~/.bash_profile:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Close and reopen shell.

Verify the system Ruby:

~ $ which ruby
/usr/bin/ruby
~ $ ruby --version
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]
Install chruby with Homebrew:

brew update
brew install chruby
Add the following line to ~/.bash_profile:

source /usr/local/opt/chruby/share/chruby/chruby.sh
Install Ruby MRI 2.1.2:

brew install gdbm libffi libyaml openssl readline wget
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
tar -xjvf ruby-2.1.2.tar.bz2
cd ruby-2.1.2
./configure --prefix="$HOME/.rubies/ruby-2.1.2" --with-opt-dir="$(brew --prefix openssl):$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm):$(brew --prefix libffi)"
make
sudo make install
Add the following line to ~/.bash_profile:

chruby ruby-2.1.2
Restart shell.

Verify Ruby:

~ $ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
~ $ which ruby
/Users/moxley/.rubies/ruby-2.1.2/bin/ruby
Install bundler:

gem install bundler
Install project gems:

cd ~/projects/bands
bundle
Verify rspec:

~/projects/bands git:master(0) $ which rspec
/Users/moxley/.gem/ruby/2.1.2/bin/rspec
Quit and restart Atom

Run test tests for a given test file: Ctrl+T

Reply to this email directly or view it on GitHub.

from atom-ruby-test.

moxley avatar moxley commented on July 20, 2024

Yeah, zshell isn't supported yet.

from atom-ruby-test.

moxley avatar moxley commented on July 20, 2024

Everybody who is interested in this feature, can you please test #22 and provide feedback on the PR?

from atom-ruby-test.

moxley avatar moxley commented on July 20, 2024

This should work in version 0.9.0. Feel free to post comments on this issue if it doesn't.

from atom-ruby-test.

turboladen avatar turboladen commented on July 20, 2024

Sorry for no comments on this while you were trying to fix it--had project deadlines so I switched back to RubyMine so I could be productive again. :)

I'm still seeing issues here, running 0.9.1. I set the Shell option to /bin/zsh, reverted all settings back to default, restarted Atom, go to run a specific test and am seeing:

Running tests: rspec --tty /spec/controllers/things_controller_spec.rb:104
---
zsh:1 command not found: rspec

Amongst other things, I have this in my .zshrc:

# chruby
source /usr/local/opt/chruby/share/chruby/chruby.sh
chruby 2.1.2

I then realized that I'm using bundler to install gems to vendor/bundle, so I just gem installed rspec, restarted Atom, and am still getting the same error as posted above.

Next, I tried changing default settings to use bin/rspec instead of rspec, and that fails with the same error that I reported initially (sure would be nice to be able to copy text from the console, atom... grr). That makes it seem like it's still not loading my .zshrc.

So next, I prefaced the commands with source ~/.zshrc and that got me using the right ruby, but got cannot load such file -- [the wrong path to my spec file] (LoadError) . The path for the spec that it was looking for was /Users/sloveless/Development/spec/controllers/things_controller_spec.rb, when it really should have been /Users/sloveless/Development/projects/my_project/spec/controllers/things_controller_spec.rb. I then noticed that there's an Atom "Project Home" setting, which was set to /Users/sloveless/Development, so I changed that to /Users/sloveless/Development/projects/my_project, reran the test and got the same error (with the wrong path). I then restarted Atom, just in case, ran again, and it's still looking in the wrong directory.

Next, I tried not sourcing my .zshrc (just in case that was doing some PATH) stuff, and changed my commands to look like:

source /usr/local/opt/chruby/share/chruby/chruby.sh && chruby 2.1.2 && rspec --tty {relative_path}

New error from bundler: "You have already activated rspec-support 3.1.0, but your Gemfile requires rspec-support 3.0.4 [etc...]". So now I'm working out of the correct path for my project, but the commands aren't using bundler.

I got it working using commands like:

source /usr/local/opt/chruby/share/chruby/chruby.sh && chruby 2.1.2 && bin/rspec --tty {relative_path}

Using bin/rspec instead of just rspec seems like something reasonable for me to have to do (instead of being this plugin's default), but it'd be nice to not have to do the chruby stuff.

Suggestions:

  • Give an option for a "run before tests shell script" or something. That way, I could just write a small shell script to do things for me--or just source the chruby.sh like I'm doing--to get around problems I'm having. Not sure if this is opening the door for bad hackery though.
  • It doesn't seem like the plugin is picking up on the .ruby-version file in my project's root dir, which would be nice.

from atom-ruby-test.

OleMchls avatar OleMchls commented on July 20, 2024

Hey,

I also just stumbled upon this, and have the same issues. That's why I'd love to see this issue reopened. A little thing I found is that calling chruby_auto right before the test at least helps picking up the .ruby-version file so my commands look like chruby_auto && ruby -I test {relative_path}

Maybe something like a shell setup block or such would help :)

from atom-ruby-test.

yock avatar yock commented on July 20, 2024

@NesQuick When I prefix my command with chruby_auto the results window says the command is not found. How are you getting Atom and/or ruby-test to load chruby in the first place?

from atom-ruby-test.

yock avatar yock commented on July 20, 2024

source ~/.zshrc && chruby_auto && bin/rspec --tty spec

This works, but initializing my shell every time is quite time consuming. I'd imagine I could probably load chruby this way and exclude most of the irrelevant ZSH pieces, but this still incurs a big startup cost. I wonder if there's a way to initialize this into the Atom environment itself.

from atom-ruby-test.

OleMchls avatar OleMchls commented on July 20, 2024

@yock I created the .zprofile file as mentioned in a similar issue #60

λ  ~  cat ~/.zprofile
source ~/.zshrc

from atom-ruby-test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.