compoundjs / generators Goto Github PK
View Code? Open in Web Editor NEWGenerate model, controller and scaffold.
Home Page: http://compoundjs.github.com/generators
Generate model, controller and scaffold.
Home Page: http://compoundjs.github.com/generators
compound generate crud status
fs.js:338
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory '/data/home/nbryant/src/nodeapps/compound/cv/app/views/status/_form.ejs'
The controller is named incorrectly (singular statu_controller, rather than plural) and internally refers to 'statu'. Model is correct.
If I pluralize the command (compound g crud statuses), the controller, handler, etc all look correct, and only the model file is wrong (plural filename, plural object internally)... but there is only the one file to fix.
I took a stab at finding the problem, but didn't really get anywhere in the time I have. I see vendor/inflection.js and the rules look OK, but I'm not certain... are the first regexes stripping off 's' at the end of a word?
I've tried this with several other nouns: octopus, alias, bus, and all fail when scaffolded in the singular. Nouns not ending in 's' (ox, person, matrix) all work as expected.
We can provide an administration module like django to consume all CRUD files, and create a default user table for authentication?
When helpers are generated for a controller, they do not include the _helper
suffix.
For example when post crud is created, a file called [projecthome]/app/helpers/posts.js
is created. However, it does not show up in the view until it is renamed to [projecthome]/app/helpers/posts_helper.js
.
Although the _helper seems redundant, it's currently required in order for the function to be recognized.
I need a table for 'packages'. Initializing with --coffee, it won't let me make that table, saying it's a reserved word. It will create it happily if the project is javascript, but I want coffee, and I don't see a NOT coffee switch for the scaffolding.
So I renamed it 'appPackage', trying to stick to javascripty formatting.
That breaks the view--at least, the add view, with:
12| h1 New apppackage
13|
> 14| - var form = formFor(apppackage, {action: pathTo.apppackages(), method: 'POST', id: "apppackage_form", class: 'form-horizontal'})
15|
16| != form.begin()
17| include _form
It looks like the schema and models are keeping the CamelCase, but the views are lowercasing everything?
---- Comment from Anatoliy ----
There's no way to correct this behavior currently using generators. But I
agree this makes life harder sometimes. To fix it need to come up with some
naming convention in model/crud generator. For example always assume model
is camelCase singular word. And then just produce all forms used in app:
lowerCase first camelcase singular for instance name, upperCase first
camelcase singilar for class name, lowerCase first plural for collections.
It also may require some fixes in routing helpers generators. Probably it
worth opening issue in co-generators package.
---- Comment from Neil ----
There's never going to be a way to always get automated plurals and casing correct; there're just too many mutations. It might be simpler in other languages, but English at least is about 90% edge-cases.
I would vote for the above (assume camelCase singular), but possibly with override options (-plural xxxx). .NET uses a -tablename option. -collection, or similar might be good options.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.