Packaging for Rails applications

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 ?

Regards,
Amiruddin N.,
Bangalore, 560008, KA
India

Y! IM : [email protected]
GTalk : [email protected]

On Sep 21, 9:31 am, Amiruddin N. [email protected] wrote:

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.

Why would you want to do that? How will you run tests on your
production application if you exclude those directories?

For deployment what things you are going to used? Are you deploying it
automatically?

Is the problem with the spec’s cleaning your database? can you give
clarification on that?

On Tue, Sep 21, 2010 at 7:01 PM, Amiruddin N.
[email protected]wrote:

test/spec are ignored while deploying ?
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Thanks & Regards,
MuraliDharaRao.T
+91-9642234646

On Tue, Sep 21, 2010 at 9:31 PM, murali dhararao [email protected]
wrote:

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.

Why would you want to do that?

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 N.,
Bangalore, 560008, KA
India

Y! IM : [email protected]
GTalk : [email protected]

there is a manual way to do it .

git rm -r . --cached

then edit .gitignore and add the specs folder

git add .

git commit -am " with no specs folder"

git push

to go back to normal

git rm -r . --cached

then edit .gitignore and remove the specs folder

git add .

git commit -am " with no specs folder"

git push

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.

On Wed, Sep 22, 2010 at 10:53 PM, Marnen Laibow-Koser
[email protected]wrote:

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.

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.

Regards,
Lewisou

Amiruddin N. wrote:

On Tue, Sep 21, 2010 at 9:31 PM, murali dhararao [email protected]
wrote:

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.

Just write a statement in your Cap recipe that deletes files you don’t
want.

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.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Amiruddin N. wrote:

On Wed, Sep 22, 2010 at 10:53 PM, Marnen Laibow-Koser
[email protected]wrote:

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.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs