Hacker News new | ask | show | jobs
by Argorak 5270 days ago
(Wrong parent - this was intended to land in the other thread.)

I didn't understand it that way :).

Well, the thing is that I see your approach as equally "structured" as Padrino. If I want to use Vesper Plugins, I have to use Vesper. So your approach - in my eyes - is not "more unstructured", its more "a different kind of structure". As far as I can see it, you don't put a lot of weight into controller/routing-things, but have more emphasis on plugins, which Padrino mostly lacks.

But the fact that you didn't use Padrino and implemented your own structure on top of Sinatra shows that Padrino didn't fit your bill - so my curiosity just springs from the that fact. I always see this as a chance to find new needs and insprirations that Padrino can support and use. So, rant away :).

Aside from the asset-handling problem, bundler can easily support loading plugins from git(hub), as long as they are gems. Why didn't you just settle for that? Then, the only problem that remains is asset handling. There, I am quite in favor of not polluting the main project, but I also don't want to add a asset compilation toolchain just for that :/.

1 comments

Ah, I think more explanation is in order.

Aside from the plugins, the structure of Vesper is just Sinatra, Rack and Rake (/public, /views, config.ru, Gemfile, Rakefile, etc.) plus application and config directories. When the app is run, it does all the normal rackup stuff, and loads everything in /config and /application. There wasn't a need to do anything more.

That's where this whole thing started. I got tired of the routes file in Rails (my biggest Rails complaint), so I switched to Sinatra, and this is how I ended up writing a lot of apps.

Sidenote: /data and /tests are both generated by default plugins.

By unstructured, I just meant the MVC thing. Most frameworks I've used start off with the assumption that I want to use MVC directories. Sometimes I do, sometimes I don't. Most of the time I want to use the concept of models and controllers, but instead of separating them into different directories and files, I want to group related models and controllers together - i.e. a users.rb file with the User class and the associated routes for sign in, profile editing, etc.

The plugins were extracted from code I use in a lot of apps, but not all. That's why a plugin is so similar to a full project, with a few extras thrown in, like hooks (they just run code are certain times during loading). I'm mixed as to polluting the main project with assets, so I just did both. A plugin's /application, gemfile and /tasks don't get moved into the main project. But sometimes it makes sense, such as DataMapper and a /data folder, and MiniTest and a /tests folder. It's really optional.

Now for gems: There's nothing stopping anyone from adding gems to a project. They should work just fine, and I do it all the time. But at the same time, I work with a lot of designers and just-getting-started programmers who have no idea how to write a gem, but still have code they reuse a lot. The 'plugins-as-a-repo-in-a-live-folder' allow for that, while not stopping them from using gems if they fit the bill. A few of the plugins are nothing more than wrappers for gems with a little config pre-written.