I am working on a Rails app, for deployment I usually checkout the code from git repository to the production servers which are running apache with mod-rails.
But checking out the complete code, I am also checking out the spec and tests folder, I would like to avoid having test/specs code on my production servers.
Is there a set way of packaging rails application for deployment ? I am using capistrano, so is there a way in capistrano to package so that test/spec are ignored while deploying ?
I want to follow a good practice of deploying only the code required to run the functionality on production servers. If you are coming from java world, that is what you do, have your application jar/war only containing your source code and resources, the tests are packaged in a separate jar.
How will you run tests on your production application if you exclude those directories?
Why would I want to run tests on my production servers ??? I have staging, uat and other environments to emulate production environment.
Regards,
Amiruddin Nagri,
Bangalore, 560008, KA
India
For deployment what things you are going to used? Are you deploying it automatically?
I am deploying it using capistrano, it has built in tasks, you just have to configure your server address, username, password etc in a config file.
Is the problem with the spec’s cleaning your database? can you give clarification on that?
No, I am not even running the specs against my production servers. I am trying to follow a good practice where you package only the things required to run your application, and exclude the development necessary stuffs like specs/test. This is what I used to follow when I was doing java projects, have separate jar/war for production code and separate packaging of tests.
i think is possible to add this to you cap recipe , but the thing is you could add the specs folder to the .gitignore file and push, but before
adding it you have to flush the cached index.
I will be very skeptical about running tests against production servers, what if by mistake I corrupt the data or drop the database itself.
Deleting the spec folder sounds ok, but there are also many test configuration files floating around that are not need for eg environments/test.rb etc. What about them ?
Rails is clearly missing the isolation for the necessary final executable code and rest of the files required for eg testing etc. It is much more clearly defined in Java world.
I think it is easy enough to do that.
First of all, it is not rails fault since rails never know what
plugins you're using for test(e.g. rspec).
You just make a branch and a tag for your particular release that
doesn't include all the files and folders you don't need in production
environment.
Then let your capistrano to checkout that tag from your git
repository.
But it would be best to keep the tests. If you run into a problem on
your production server, you should be able to run the tests to see where
things are going wrong.
I will be very skeptical about running tests against production servers,
what if by mistake I corrupt the data or drop the database itself.
Don't run them against the production *database*!
Deleting the spec folder sounds ok,
But it isn't.
but there are also many test
configuration files floating around that are not need for eg
environments/test.rb etc. What about them ?
Rails is clearly missing the isolation for the necessary final
executable
code and rest of the files required for eg testing etc. It is much more
clearly defined in Java world.
No...you're trying to define an isolation point where there really isn't
one.