Geddy model command? #130

Closed
czhae opened this Issue Apr 28, 2012 · 14 comments

Projects

None yet

3 participants

@czhae

Geddy controller [controller name] correctly generates a controller. But I was unable to create a model, using Geddy model.

@mde

The assumption has been that if you want a model, you always want a controller, but sometimes you might want a "bare" controller with no associated model.

You can always run "geddy resource" to get a model and controller, and just not use the controller.

Do you think we need the ability to create bare models?

@mde

@Techwraith, what do you think on this one?

@Techwraith

Personally, I see a use for having a model without a controller, but it's kinda edge case-ish.

@mde

Right on, shouldn't be hard to expose the model part of the Jake task for resources.

@czhae

Correct me if I am wrong as I am pretty new to the MVC paradigm.

Right now I am trying to see if I can re-create one of my apps using geddy.
The app uses Google Map API so there are only the map itself and data for markers in JSON.
I needed model and controller for the markers to parse the data and create markers on the map.
However, I did not necessarily need views explicit to markers data.

In this case, I believe I did not need the full package that 'geddy resource' generates.

@mde

That sounds correct. You could generate a full resource, and then just ignore the controller, or even delete the unneeded files.

@mde

Okay, I've fixed this in master. Can you build from master and verify it works for you?

@czhae

I know I am going to sound like a total noob but how do I build from master -_-?

@mde

It's easy, on Mac/Linux:

git clone git://github.com/mde/geddy.git
cd geddy
make && sudo make install

There's not an easy way to do it like that on Windows.

Let me know if you have problems. :)

@czhae

hmm I got this error

/usr/local/lib/node_modules/geddy/bin/cli.js:167
throw err;
^
Error: Command failed: jake aborted.
Error: ENOENT, no such file or directory 'app/models/markers.js'
at Object.openSync (fs.js:238:18)
at Object.writeFileSync (fs.js:626:15)
at /usr/local/lib/node_modules/geddy/Jakefile:24:12
at [object Object].action (/usr/local/lib/node_modules/geddy/Jakefile:93:5)
at [object Object].run (/usr/local/lib/node_modules/jake/lib/task/task.js:204:19)
at [object Object].runPrereqs (/usr/local/lib/node_modules/jake/lib/task/task.js:115:12)
at [object Object].invoke (/usr/local/lib/node_modules/jake/lib/task/task.js:95:10)
at [object Object].nextPrereq (/usr/local/lib/node_modules/jake/lib/task/task.js:162:21)
at [object Object].runPrereqs (/usr/local/lib/node_modules/jake/lib/task/task.js:112:12)
at [object Object].invoke (/usr/local/lib/node_modules/jake/lib/task/task.js:95:10)

at ChildProcess.exithandler (child_process.js:282:15)
at ChildProcess.emit (events.js:70:17)
at maybeExit (child_process.js:360:16)
at Process.onexit (child_process.js:396:5)
@mde

Can you tell me exactly what sequence of commands you ran to get this to happen? Also, what OS and version of Node?

@mde

I just installed master, and did this:

 mdes-mbp:work mde$ geddy app foo
 Created app foo.
 mdes-mbp:work mde$ cd foo/
 mdes-mbp:foo mde$ geddy model frang
 [ADDED] app/models/frang.js

Seems to be fine.

@czhae

I ran my code again and it worked. Sorry for the inconvenience and thank you for the update!

@czhae czhae closed this Apr 30, 2012
@mde

Excellent. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment