merb-gen resource not working

0 views
Skip to first unread message

Calculon

unread,
Oct 6, 2008, 5:53:58 PM10/6/08
to merb
I can't generate a resource using the latest merb-gen

-=[aeufemio@calculon ~/projects/my_new_app]=- merb-gen resource Page
title:string body:text
~ Merb::Orms::DataMapper::Connect block.
~ No database.yml file found in /home/aeufemio/projects/my_new_app/
config, assuming database connection(s) established in the environment
file in /home/aeufemio/projects/my_new_app/config/environments
~ Checking if we need to use DataMapper sessions
~ Merb::Orms::DataMapper::Connect complete
~ Compiling routes...
Usage: merb-gen resource [options] [args]

Generates a new resource.


Options specific for this generator:
--template-engine OPTION Template Engine to use (one of:
erb, haml, markaby, etc...)
--testing-framework OPTION Testing framework to use (one of:
rspec, test_unit)
--orm OPTION Object-Relation Mapper to use
(one of: none, activerecord, datamapper, sequel)
--migration Also generate a dm-migration for
the model

General options:
-p, --pretend Run, but do not make any changes.
-f, --force Overwrite files that already
exist.
-s, --skip Skip files that already exist.
-d, --delete Delete files that have previously
been generated with this generator.
--no-color Don't colorize the output
-h, --help Show this message
--version Show the version
--debug Do not catch errors



Even printing out the version using merb-gen --version doesn't work.

-=[aeufemio@calculon ~/projects/my_new_app]=- merb-gen --version
~ Merb::Orms::DataMapper::Connect block.
~ No database.yml file found in /home/aeufemio/projects/my_new_app/
config, assuming database connection(s) established in the environment
file in /home/aeufemio/projects/my_new_app/config/environments
~ Checking if we need to use DataMapper sessions
~ Merb::Orms::DataMapper::Connect complete
~ Compiling routes...
Usage: merb-gen generator_name [options] [args]

Generate components for your application or entirely new applications.

Available Generators
layout Generates a layout
resource_controller Generates a new resource
controller.
model Generates a new model. You can
specify an ORM different from what the rest
resource Generates a new resource.
migration This is a migration generator
app Generates a merb application.
slice Generates a merb slice.
helper Generates a new helper.
session_migration Generates a new session
migration.
controller Generates a new controller.
part This is a part controller
generator
plugin Merb plugin generator: lets you
kick start your Merb plugin.

General options:
-p, --pretend Run, but do not make any changes.
-f, --force Overwrite files that already
exist.
-s, --skip Skip files that already exist.
-d, --delete Delete files that have previously
been generated with this generator.
--no-color Don't colorize the output
-h, --help Show this message
--version Show the version
--debug Do not catch errors


Halp! :-(

-AE

Calculon

unread,
Oct 6, 2008, 7:24:26 PM10/6/08
to merb
More information:

peach ~/hsom]=- rake db:automigrate
(in /home/aeufemio/hsom)
Logging to #<IO:0xb7d22564>
rake aborted!
can't convert IO into String
/home/aeufemio/hsom/Rakefile:12
(See full trace by running task with --trace)

Running merb-0.9.8 with dm-core-0.9.5

Michael Klishin

unread,
Oct 7, 2008, 4:27:39 AM10/7/08
to me...@googlegroups.com
2008/10/7 Calculon <aeon...@gmail.com>:

> ~ No database.yml file found in /home/aeufemio/projects/my_new_app/
> config, assuming database connection(s) established in the environment
> file in /home/aeufemio/projects/my_new_app/config/environments

It's the very reason. Read output carefully before you make judgements.
--
MK

Jonathan Stott

unread,
Oct 7, 2008, 5:54:23 AM10/7/08
to me...@googlegroups.com

It's nothing to do with that, actually. That's never effected model
generation.

I can confirm that 'merb-gen resource Page' does work without any database.yml. As does 'merb-gen resource Page title:string'. The problem comes when you try 'merb-gen resource Page title:string body:text' (as in, two properties).

Then it just displays the help text.

Regards,
Jon

Michael Klishin

unread,
Oct 7, 2008, 6:38:44 AM10/7/08
to me...@googlegroups.com
2008/10/7 Jonathan Stott <jonatha...@gmail.com>:

> I can confirm that 'merb-gen resource Page' does work without any database.yml. As does 'merb-gen resource Page title:string'. The problem comes when you try 'merb-gen resource Page title:string body:text' (as in, two properties).

Let me see if I understand the real problem correctly. Specifying
multiple attributes causes generator misbehavior, right?
--
MK

Calculon

unread,
Oct 7, 2008, 8:29:50 AM10/7/08
to merb
The database connection is set in config/init.rb or config/environment/
<env>.rb as instructed to do so in the MEAP Merb book which worked in
version 0.9.3. Running merb-gen resource <resourcename> without any
other parameters works properly but when I try to run a migration
after editing the associated <model>.rb file it throws the second
error.

-AE

On Oct 7, 2:54 am, Jonathan Stott <jonathan.st...@gmail.com> wrote:
> On Tue, 7 Oct 2008 11:27:39 +0300
>
> "Michael Klishin" <michael.s.klis...@gmail.com> wrote:
>
> > 2008/10/7 Calculon <aeon2...@gmail.com>:

Jonas Nicklas

unread,
Oct 8, 2008, 12:59:48 AM10/8/08
to me...@googlegroups.com
This is because the syntax for specyfying multiple arguments has changed. I changed it in Templater edge, which assuming by now has been released. So now this:


    merb-gen resource Page title:string body:text

should be written as:

    merb-gen resource Page title:string,body:text

not the comma. The reason is that the latter removes ambiguity in parsing the arguments, at the expense of deviating from the "Rails standard". This is probably quite poorly documented at the moment.

/Jonas

Matt Aimonetti

unread,
Oct 8, 2008, 8:48:23 PM10/8/08
to me...@googlegroups.com
This is just wrong :( 

merb-gen resource Page title:string, body:text  won't even work

merb-gen resource Page title:string body:text  fails and don't tell you wrong.

I really really really feel that it's a backward move and we need to get that reverted before 1.0RC1

Yehuda, what do you think?

-Matt

Ryan Bigg

unread,
Oct 19, 2008, 2:47:34 AM10/19/08
to merb
Putting in spaces after your commas is what causing the errors. Try it
without the spaces. I personally like no commas and separating each
field with spaces.

Mark Watson

unread,
Oct 19, 2008, 10:49:36 AM10/19/08
to merb
Hello Matt,

First, let me say that I enjoyed your and the other talks at MerbCamp
- thanks!

This also hit me yesterday: adding a space after the comma --> fail.
Not good. It might be an OK syntax to put all the properties as a
single string (in quotes) so the properties are parsed as a single
argument.

-Mark


On Oct 8, 5:48 pm, "Matt Aimonetti" <mattaimone...@gmail.com> wrote:
> This is just wrong :(
>
> merb-gen resource Page title:string, body:text  won't even work
>
> merb-gen resource Page title:string body:text  fails and don't tell you
> wrong.
>
> I really really really feel that it's a backward move and we need to get
> that reverted before 1.0RC1
>
> Yehuda, what do you think?
>
> -Matt
>
> On Tue, Oct 7, 2008 at 9:59 PM, Jonas Nicklas <jonas.nick...@gmail.com>wrote:
>
> > This is because the syntax for specyfying multiple arguments has changed. I
> > changed it in Templater edge, which assuming by now has been released. So
> > now this:
>
> >     merb-gen resource Page title:string body:text
>
> > should be written as:
>
> >     merb-gen resource Page title:string,body:text
>
> > not the comma. The reason is that the latter removes ambiguity in parsing
> > the arguments, at the expense of deviating from the "Rails standard". This
> > is probably quite poorly documented at the moment.
>
> > /Jonas
>
> > On Tue, Oct 7, 2008 at 6:38 AM, Michael Klishin <
> > michael.s.klis...@gmail.com> wrote:
>
> >> 2008/10/7 Jonathan Stott <jonathan.st...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages