Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am a beginner just starting to learn ruby. The tutorials I have been reading say that I can create a file with the extension .rb(eg. hello.rb) and run the file in the command prompt by typing ruby hello.rb. But when I create and save the file on the desktop and run it in the cmd it always gives me this error message:
C:\Windows\system32>ruby hello.rb
Traceback (most recent call last):
ruby: No such file or directory -- hello.rb (LoadError)
I searched the internet and read a lot of other tutorials but none of them seem to have any discussion on this issue.
Can someone give me any hints on this please?
Any advice or help will be greatly appreciated!
You should provide the correct path to your file, since it's not located in system32 directory, this relative path won't work. If it's on the desktop, it would be something like this, probably:
ruby %HOMEPATH%\Desktop\hello.rb
or you can change your current directory to desktop before you start playing with ruby:
cd %HOMEPATH%\Desktop
from now on, you can easily use relative path, since hello.rb is located in the same directory you're in currently in your command line:
ruby hello.rb
I'm not quite sure of exact syntax etc, I don't use Windows cmd very often - you would have to experiment on your own.
There may be context menu option like "open command line here" in Windows, but I'm not sure of it as well.
Also, you may need to learn basics of command line even before you start to learn Ruby.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 months ago.
Improve this question
So I was learning ruby and practicing reverse engineering a ruby app and i found this line :
include ::Pro::License
I need to know what does it include because I am finding any file or folder name Pro or License
If it was a class I want to view the class
Although there exist some conventions for files to be named after the classes/modules they define (and constants autoloading magic, in Rails in particular, relies on these conventions), Ruby itself, as a language, doesn't enforce this in any way. So one can define class Bar in path/to/foo file, require the latter explicitly and then include Bar - everything will just work, for good or bad.
The module you include might be defined in some gem - and some of (most of?) the IDEs don't search the gems source code by default.
So, what to do. If you are on a relatively fresh Ruby (2.7+) there is a method Module#const_source_location that can help you to locate where the particular constant comes from (try self.class.const_source_location("::Pro::License") in the console). That's probably the shortest path.
If your Ruby is older, try pry (or pry-rails if it's Rails) code browsing capabilities. Drop a breakpoint (binding.pry) somewhere in the app, then cd ::Pro::License, then show-source (dash, not underscore!). It should print the source code of the module along with the full path to the file where it is defined.
If none of the methods above works for you for whatever the reason, then your IDE advanced search (or grep) is your only friend (just ensure you're searching not only through the project folder but through gems too).
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
Production, and development work just fine, but the test environment doesn't want to migrate.
Does anyone have any idea as to why the gem is not working for the migration?
Did you run bundle exec rspec:install ?
In case you have multiple versions of rspec, you can try bundle exec rspec so it calls the one defined in your Gemfile.
Instead of require, try require_relative, that way, the path is resolved regardless of the location from which you're calling the script.
I ended up removing the repo, and deleting my database then re-installing everything which seemed to do the trick.
I have used PHP for quite sometime now. But I want to be a ROR developer. I would love to know of the process to create a website in Ruby. Well !!! I am getting an error "DL is deprecated please use Fiddle" and the terminal window is not accepting any command. Can anyone please tell how to proceed?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am following Hartl's Tutorial and am confused as to why I am getting this error. I am trying to eliminate duplication in my code by embedding ruby in my layouts. To do this, I follow the tutorial's instructions and I enter the command:
$ mv foobar app/views/layouts/application.html.erb
and in return, I see:
mv: foobar: No such file or directory
My questions are:
1) What does "foobar" mean?
2) How do I fix/get past this error?
Please let me know if this requires more context and/or code. Thanks.
foobar is a generic name. It is most likely used as a placeholder.
mv is a command that moves a file from a source to a destination
mv <source> <destination>
This means that tutorial tells you to move the file foobar to app/views/layouts/application.html.erb.
Obviously you don't have a file named foobar. Either you have to create it or it stands for another file that you already have.
I am often pointed to the source of typo blog engine i.e., http://typosphere.org/stable.tar.gz But, if I download and perform the following: bundle install etc. it runs as a separate engine.
I tried installing typo as a gem, I tried the following:
gem install typo
typo install /some/path this fails, saying 'Typo command not found'
How to integrate typo blog engine with existing app, any pointers would be welcome.
Typo is a Rails project. I am happy to say that I contributed to it at one point of time.
You asked in comments, that you wish to use database of Typo in your main application. For that, I'll suggest you to check out connection_ninja.
However, there are many gotchas with these type of configurations.
Good luck.
PS: Just noticed that this question was asked long ago. Ouch!