-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require vs. require_relative - hello exercise #8
Comments
Did you try just running "rake"? That should take care of the path stuff; if it doesn't then I'd like to know! On May 13, 2013, at 8:33 AM, ianalexh [email protected] wrote:
|
Well, I couldn't get "rake" to work, but I probably don't know how to use it correctly. The instruction in the file is: ## Run the testrake## Watch it failI took that to mean that I should type "rake" into the Terminal (I'm a noob, so forgive me). I also tried "rake hello_spec.rb" and "rake hello.rb" from within the file's directory, but I still can't get the file to load until I use require_relative. Tried reading about the "rake" command and can't quite make sense of it just yet, so that also makes it harder to know just how to use it. Any pointers appreciated! Thanks, |
Can you provide the output of the error that arises from running 'rake'? |
Yes, that's correct. It's supposed to set up the path and a few other |
Here is one I ran on pig-latin, from inside the directory I had set up (rake pig_latin_spec.rb): rake aborted! By the way, these challenges are very cool and extremely challenging. Each time I pass one, I dance around and feel like a king. Then I go to the next and begin feeling like a fool all over again. Each one takes me 3-5 hours, I think.... (and I REFUSE to google an answer, though I do google methods along the way that I think might help). |
Um no, just run "rake". That's r, a, k, e, return. (That's the ruby-world I'm glad you're enjoying Hard Mode! :-) |
Ah, I get it now.... rake works now, but it didn't seem to work before - I think because I hadn't built the *.rb file yet, and didn't understand the "rake" purpose at the time. Hard Mode?!!? I think I missed "Easy Mode!" (or at least I missed "Intermediate mode"). I'm trying to get accepted into App Academy, with only a smudge of experience writing javascript (maybe 10 hours total). I feel that I'm trying to go from 0-60 in 3 seconds. They say these Test-First exercises should take 10-15 hours in total, but for me, each one is a monumental task. I'm pretty sure I'm on the right track with "Pig Latin," but I just don't have quite the skills to easily express what I want to say. I was even trying to write my own "shift" method on an array before I realized that there already is a shift method! Thanks again, |
https://github.com/alexch/learn_ruby/tree/master/00_hello
This is for everyone's benefit:
I think this is partially because I'm running Ruby 2.0.0, not 1.8.7
When I try "rspec hello_spec.rb" from the Terminal, I get that it can't load the "hello" file, with a listing of directories that it tried to load it from.
I did not define those directories, nor do I know if I can change them.
However, a little research shows me that I can use the "require_relative" method instead of simply "require." Then, if I put "hello.rb" in the same folder as "hello_spec.rb", I can run the test and everything works out.
That took me an hour, so I hope this post saves somebody some time!
The text was updated successfully, but these errors were encountered: