Script/extension install in production mode

How can I set “ruby script/extension install [gallery]” to run in
production mode?

[concrete]$ ruby script/extension install gallery
Initialized empty Git repository in /tmp/gallery/.git/
remote: Counting objects: 759, done.
remote: Compressing objects: 100% (320/320), done.
remote: Total 759 (delta 378), reused 759 (delta 378)
Receiving objects: 100% (759/759), 230.00 KiB, done.
Resolving deltas: 100% (378/378), done.
rake aborted!
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

(See full trace by running task with --trace)
rake aborted!
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

(See full trace by running task with --trace)

This error usually happens when I forget to include ‘production’ in a
rake command. I’m not sure how to specify the environment in a “ruby
script” command.

Thanks in advance!
Ben

script/extension install gallery RAILS_ENV=production

Jim G. wrote:

script/extension install gallery RAILS_ENV=production

Hmm… still get the same:

[concrete]$ ruby script/extension install gallery RAILS_ENV=production
gallery is already installed.

[concrete]$ ruby script/extension uninstall gallery RAILS_ENV=production
rake aborted!
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

My development setting in database.yml is:

development:
adapter: mysql
database: radiant_dev
username: root
password:
socket: /tmp/mysql.sock

…which is why I think it is using that setting rather than production.

Looks like you should also be able to set

ENV[‘RAILS_ENV’] ||= ‘production’

in environment.rb

Ben,

If you look at the article on setting up radiant on Dreamhost, you’ll
see that I only install Ray using script/extension and after that I
would use:

rake production ray:ext name=gallery hub=pilu fullname=radiant-gallery

There is nothing special about DH in this respect, I would suggest it
to anyone.

john wrote:

Looks like you should also be able to set

ENV[‘RAILS_ENV’] ||= ‘production’

Thanks for the suggestion John, but I already uncommented that line.

Adam van den Hoven wrote:

Ben,

If you look at the article on setting up radiant on Dreamhost, you’ll
see that I only install Ray using script/extension and after that I
would use:

rake production ray:ext name=gallery hub=pilu fullname=radiant-gallery

With script/extension I couldn’t get Ray to install, so I tried it
manually. I FTP’d the Ray directory to vendor/extensions and ran “rake
production radiant:extensions:ray:migrate”. I got:

rake aborted!
Don’t know how to build task ‘radiant:extensions:ray:migrate’

However the Ray code is installed the proper directory:
-vendor
–extensions
—ray
----.git
----lib
----spec

Any ideas?

On Oct 13, 2008, at 9:12, Ben M. [email protected] wrote:

With script/extension I couldn’t get Ray to install, so I tried it
—ray
----.git
----lib
----spec

Any ideas?

There is no migrate task for Ray. All you need to do is place it in
vendor/extensions and start using it.

Jim G. wrote:

There is no migrate task for Ray. All you need to do is place it in
vendor/extensions and start using it.

You are correct! Thank you all for your help, everything is working
perfectly now.

Jim G. wrote:

script/extension install gallery RAILS_ENV=production

Hmm… still get the same:

john wrote:

Looks like you should also be able to set
ENV[‘RAILS_ENV’] ||= ‘production’

Thanks for the suggestion John, but I already uncommented that line.

Sorry, I didn’t test it I just had a quick glance at the code and
guessed it would work.

Ben M. wrote:

With script/extension I couldn’t get Ray to install

Do you happen to recall the error? Or was is just the error messages
from trying to run the migrate/update rake tasks that made you think
there had been a problem?

In any event, I just added migrate/update tasks to ray, so now instead
of rake errors you will get a friendly “No migrations/updates
necessary.” message. Sorry if the lack of these tasks caused any issue.

john wrote:

Do you happen to recall the error? Or was is just the error messages
from trying to run the migrate/update rake tasks that made you think
there had been a problem?

Yes, it was only the error messages about the migrate/update tasks.

In any event, I just added migrate/update tasks to ray, so now instead
of rake errors you will get a friendly “No migrations/updates
necessary.” message. Sorry if the lack of these tasks caused any issue.

^ This solution is great!