ruby on rails: .project file - ruby-on-rails

For some reason, when I create my project, the .project file is missing. Which command creates this file?/Why is it missing from my project directory?

This file is created by your IDE. Likely Aptana. It is not required to run rails and usually ends up on my .gitignore file if I am working with others who use Aptana.

Running rails new foo from the CLI doesn't create that file. As #Gazler said, it's created by your IDE. Most likely Aptana or Eclipse, as that IDE uses .project files.

Related

Ruby 2.0.0-p353, Rails 4.0.2, Netbeans 7.4 - Cannot start webrick

I am trying to use netbeans 7.4 with Ruby 2.0.0-p353 and Rails 4.0.2. Plugin seems to work ok. I am able to generate project and everything is there, but when I try to run project I receive following message and server is not started:
C:\Ruby200-x64\bin\ruby.exe: No such file or directory -- script/rails (LoadError)
There is a comment under official plugin page that says:
I found a simple workaround, I'm using Windows 7 and created a
symbolic link between directories like this: mklink /D script bin
Now I can start and debug my Rails 4 project in Netbeans. Posted by
mgard on Aug 19, 2013
I have tried to do this but it still doesn't solve a problem. Is there anybody that can help?
The proposed solution works well from what I have seen. What is the error you are getting? Are you able to create directory link? You would need Admin rights for that and should start the command prompt "Run as Administrator". Alternatively, try right-clicking on the "bin" directory and execute "Create shortcut" that must be renamed to "script" later.
I'm using Aptana on Win 8 and came to the problem.
Now rails 4 doesn't have script/rails in the folder. We will need to create it manually in your application folder. You can simply create the folder, then mklink or copy the file in the script folder. Please take caution that your IDE will have proper access to the file you create, otherwise, you will come to the error:
c:\Ruby200\bin\rubyw.EXE: No such file or directory -- C:/Users/Zhou/Documents/GitHub/HR-SNA/script/rails (LoadError)
Go to project's root directory and execute from a console following command:
ln -s ./bin ./script
In Rails 4, script has been replaced with bin

"Can't initialize a new Rails application within the directory of another, please Type 'rails' for help."

I'm just starting out with rails and I'm practicing the basic ruby commands, one of which is the rails new myproject command.
My projects are under the Aptana workspace directory where I've used the command line and Aptana both to create projects there. After a few creations and rails s commands and deletions, I've started getting this error message when I try to generate a new rails project:
"Can't initialize a new Rails application within the directory of
another, please Type 'rails' for help."
This doesn't just happen when I create a new project (rails new myproject) under the Aptana workspace directory, but also when I use the command rails new . directly inside the workspace directory. Can someone explain to me what I need to do to flush rails so it knows I don't have a project there anymore? What did I do to make this happen?
I don't remember what rails looking for. The quickest way to solve this issue is to completely empty the affected directory.
Most likely there are some hidden files or directories which prevents rails from creating a new project. Look at that with ls -a probably there is a .bundle folder inside that dir.
I got same problem since I failed to create rails project. I tried to remove Aptana plug-in and Eclipe that include ./eclipse, ./metadata but not sloved the problem until I removed Ruby and Devkit and reinstall them again.
So, I think the root cause may in Devkit or Ruby. The problem work out after I reinstall Ruby(rubyinstaller-2.2.3-x64.exe) and DevKit(DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe).
If you are under Windows, you must install Aptana Studio as administrator or it will not work properly. Uninstall and install it as administrator and the terminal folder will be set correctly

Ruby on Rails -- new install on windows 7 but cant run ruby commands, problem with path?

I just installed ruby on rails on my new computer ( I was using instantrails before) and I'm trying to get everything setup.
Im running Windows 7. So I followed the instructions from this tutorial.
http://blogupstairs.com/ruby-on-rails/installing-ruby-on-rails-on-windows-7/
The problem i'm guessing is step 3
"Add the newly installed bin directory to your path in your windows system : Open windows explorer-> right click the icon computer-> choose Properties -> in the contol panel Home, Click Advanced system settings and then click Envitonment Variables button->in the system variables click new and add new system variables like this : Variable name : RUBY_HOME , Variable Value : C:\Ruby, after that add it in to the path and add the bin after a semicolon to the “Path” variable like this : C:\Program Files\Common Files\Adobe\AGL;%JAVA_HOME%\bin;%ANDROID_HOME%\tools;%RUBY_HOME%\bin"
I set created the system variables but when I try to run script/generate in the main directory of my app I get the error
"Ruby: no such file or directory --script/generate"
I checked the apps directory and the script folder is in there. How can I run the "ruby script/generate" commands from the control panel?
I was guessing it was something with the path but I dont know any ways to check to find out whats going wrong.
Are you using Rails 3.0+? In this version of rails and up, the script/* folder has been deprecated in favor of rails generate, rails server, etc. See here.
In 99.99999% of all cases, if a computer tells you that it cannot find a file at a specific location, it is because that file is not at that specific location.
So, is there actually a file named generate in a directory named script in the current directory?
I have recently installed RoR on my "clean" Win7 as well.
What IDE are you using?
I suggest trying JRuby with NetBeans/RubyMine:
JRuby installer does all the work (even adds the proper variables to your path in system environment settings...,
IDEs take care of gems, setting up servers etc.
As for the commands, as Nuclearsandwitch mentioned, there is no script/generate or script/server in Rails 3. Just make sure you in the directory with your Rails app and then try running rails server. It should work :-)

Creating new Rails project with Aptana fails with "/<project name>/public does not exist"

I am using Windows 7 and Ruby 1.8.7. I get the following error message when I start a new Rails project:
Problem Occured
'Replace project index file' has encountered a problem. Resource '/Foobar/public' does not exist. (where 'Foobar' is the name of my new project).
Any ideas?
Just found a workaround: Create the project but UNCHECK the part about generating a rails skeleton. Then open a console, navigate to the project's parent directory, and run rails <project name>. The skeleton will generate in the folder, and then you can refresh the project directory within Aptana/Eclipse.
When new project is created using radrails, RadRails execute the command rails beta -d sqlite3 which is older syntax and the new syntax is rails new beta -d sqlite3 So unless the Aptana Teams invokes new rails functionality the workaround would be to use the methods mentioned above.
Follow the same procedure as mentioned above....
But for me Rails didn't work.
rails new "project name" worked for me.
Thanks
I had this problem because my project had spaces in the name. Removed the spaces and it worked.
I've the same problem but in web projects and using a network directory. I create the project in local and then move it to network unity.
Try running your IDE as an administrator. Right click your IDE icon -> "Run as administrator".
Now your IDE will have the appropriate privileges to write files and folders.
Changing the interpreter that the IDE uses worked for me. Go to windows->preferences->ruby->installed interpreters then select the one that comes with your installation of Aptana Studio, mine's name is org.jruby_1.2.0.9... It worked like a charm for me. I hope that helped.

Copying files from a Rails plugin into the application upon plugin install

When someone installs this plugin, I would like a file to be copied into the config/initializers directory of the app. I could do this in install.rb by copying a template file that resides somewhere in the plugin. Another option would be to require the user to run a generator after install. I know rspec-rails makes you run a generator after you install it, is that the recommended behavior?
And is there anything wrong with copying files into the application in install.rb?
Thanks!
Lou
Does the user need to manually tweak the file? If so, then I would use a generator with parameters. If not, I would prefer that you do it with install.rb. My $.02

Resources