voltrb / volt

A Ruby web framework where your Ruby runs on both server and client
MIT License
3.22k stars 196 forks source link

.rb files included in config directory may not belong to volt #80

Closed BlueUpton closed 9 years ago

BlueUpton commented 9 years ago

Gems like Capistrano and Whenever use the /config directory for their configuration files, but volt attempts to load those files at runtime. This can result in errors.

I looked at the rails code to see how they treat /config, and it appears that they only load the specific filenames associated with rails, ignoring the rest of the files in /config.

So far, it seems like /config/app.rb is the only file that needs to be loaded here: https://github.com/voltrb/volt/blob/master/lib/volt/config.rb#L67

Perhaps a hard-coded array of volt-specific config files could be fed into the .each method? I would be happy to submit a PR that fits your design decision.

ryanstout commented 9 years ago

@BlueUpton I should have thought about that. Sounds like we need to change it. I liked the idea of auto loading config files, maybe we need a different folder name (though config is pretty standard). Let me sleep on this and come up with a solution.

BlueUpton commented 9 years ago

@ryanstout Using rails as inspiration: while their /config filenames are predefined, they have a /config/initializers directory where every file in that directory is auto-loaded. Perhaps a sub-directory of /config is a solution to auto loading additional config files?

DmitryBochkarev commented 9 years ago

@ryanstout do you see meteorjs filestructure? I think some ideas can be used in volt. IMHO meteor very mature and can be used as source of ideas.

ryanstout commented 9 years ago

@DmitryBochkarev anything in particular?

DmitryBochkarev commented 9 years ago

hello @ryanstout ! Yeah i have some things that i like in meteor:

Currently (if i correct undestand) volt uses tasks to subscribe on collections, but i think it should be separated module.

offtopic: currently i have plans to build my project in volt, but another thought is: volt far away from v1.0.

ryanstout commented 9 years ago

@DmitryBochkarev 1) Our data security stuff is almost out the door. 2) So I guess I always felt like meteor's file structure was a bit lacking. Can you explain how you normally structure your project? 3) Yea, I would love to implement DDP or something similar. Right now we haven't just to save time, in the long term we will.

Under the hood volt uses a builtin set of tasks to subscribe on collections, but it's not something you as a developer would interact with.

Volt's getting pretty close to 1.0. I can't give a time estimate since it kind of depends on when we think the API's have settled. Less than 4 months probably, probably more than one :-)

DmitryBochkarev commented 9 years ago

1) glad to hear this! 2) this structure is very stupid/simple.You just name things like they should be and "magic" happens. I place components in lib directory with subdirs client/server/etc and main application uses this components. 3) year i understand reasons, why currently volt uses tasks. how you familar with ddp? have you seen https://github.com/knubie/ruby-ddp-client ? If someone will maintain ddp library will you include this in volt stack?

Yes i understand that developers should'nt iteract with underline protocol, but ddp is kinda standart.

I think i just misunderstood volt versioning scheme. What i want to say is volt not finished and changes are coming:)

P.S. i'm in gitter chat room

ryanstout commented 9 years ago

Check out the change, on master now, config/app.rb is loaded, then config/initializers/*.rb (no longer is all of /config run at start)