Extension problems: create model and rake db:migrate


#1

Hi everybody,
I’m trying to develop my first radiant extension, and I’ve found two
problems.
I’ll try to describe this problems.

First problem:
After that I’ve created my extension running “ruby script/generate
extension xbrlink”, I’ve tried to create a model running “ruby
script/generate model link” and I’ve got back this message in the
console:

D:\ProveRails\xbrail>ruby script/generate model link
Couldn't find 'model' generator

I've solved this problem adding in the folder 

D:\ProveRails\xbrail\script a file called “generate_model” that contains
this script:

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'

require ‘commands/generate’

Now typing the command "ruby script/generate extension...", ruby 

creates the extension correctly, and if I type “ruby
script/generate_model model / controler…” ruby creates models or
controllers correctly.
Is this a good solution or it might causes some other problems?

Second problem:
After that I’ve created the model called “link”, I’ve edited the
migration file 001_create_links.rb, to create the links table in my
database.
When I run the “rake db:migrate” command in the root folder nothing
happens, there isn’t the table in the database and I don’t have any
error message in the console. The same thing happens if I run the
command in the extensions folder.
This is the console output:
D:\prove_rails\xbrail>rake db:migrate

(in D:/prove_rails/xbrail)

   D:\prove_rails\xbrail>

Any suggestions?

Thaks everybody.

Taddei Fabrizio


L’email della prossima generazione? Puoi averla con la nuova Yahoo!
Mail:
http://it.docs.yahoo.com/nowyoucan.html


#2

First problem:

There are currently no generators for extension
models/controllers/migrations/etc. You will have to make them manually,
although even that doesn’t take too much work.

That said, it sounds like either 1) you have installed Radiant from the
gem without unpacking or 2) something else is messed up with the
paths/configuration/etc.

Second problem:
If your migration is properly in the db/migrate directory of your
extension, then run rake db:migrate:extensions. That should do it.

Sean


#3

On Apr 3, 2007, at 11:30 AM, Sean C. wrote:

That said, it sounds like either 1) you have installed Radiant from
the gem without unpacking or 2) something else is messed up with the
paths/configuration/etc.

I have had extreme problems getting this to work. I installed 0.6 as a
gem, and when I ran unpack, I got an endless supply of permissions
errors when trying to run the resulting unpacked radiant. I discovered
svn, and found it to be easier (hah!).

Could someone please advise me (slowly, in words that suit an extreme
ruby-nuby) how to best do the following:

Install Radiant 0.6 as a Gem.
Create a Radiant instance site.
Modify that site only with new/modified/different Extensions.

My goal here is to understand how you could use the Gem version and
extend it on a site-by-site basis without digging into the code in the
gems directory. Is that possible?

I have a fundamental lack of knowledge about Gems proper, and that’s
probably where my education needs to start. Could anyone point me to a
place where I can learn?

Thanks,

Walter


#4

Fabrizio T. wrote:

Sean C. wrote:

First problem:

There are currently no generators for extension
models/controllers/migrations/etc. You will have to make them manually,
although even that doesn’t take too much work.

That said, it sounds like either 1) you have installed Radiant from the
gem without unpacking or 2) something else is messed up with the
paths/configuration/etc.

Thanks Sean for the answer,
this is true, I’ve installed radiant without unpacking, following the
radiantcms weblog instruction. I’m sorry but I’ve some problems to
understand what you mean.

Should I unpack radiant in the vendor folder of my application?
Could you explain me better what I should do?

Thanks,

Fabrizio

Hi,
looking in mailing list I’ve found the post Radiant 0.6
RC1(http://www.ruby-forum.com/topic/96515#200885) inwich it’s explain
how to install radiant with unpacking.
I’ve followed the instructions and now I’ve radiant in
D:\ProveRails\xbrail\vendor\radiant
I’ve modified the my application file environment.rd adding the string

ENV[‘RADIANT_ROOT’] =‘D:\ProveRails\xbrail\vendor\radiant’ in the top of
file,

and uncommenting the line
ENV[‘RAILS_ENV’] ||= ‘production’.

Unfortunately when I try to run “ruby script/generate model” I’m still
having
Couldn’t find ‘model’ generator

Any suggestions?

Thanks

Fabrizio


#5

Sean C. wrote:

First problem:

There are currently no generators for extension
models/controllers/migrations/etc. You will have to make them manually,
although even that doesn’t take too much work.

That said, it sounds like either 1) you have installed Radiant from the
gem without unpacking or 2) something else is messed up with the
paths/configuration/etc.

Thanks Sean for the answer,
this is true, I’ve installed radiant without unpacking, following the
radiantcms weblog instruction. I’m sorry but I’ve some problems to
understand what you mean.

Should I unpack radiant in the vendor folder of my application?
Could you explain me better what I should do?

Thanks,

Fabrizio