Skip to content

Instantly share code, notes, and snippets.

@fgarcia
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgarcia/c2e310d99e1fcb2f75f1 to your computer and use it in GitHub Desktop.
Save fgarcia/c2e310d99e1fcb2f75f1 to your computer and use it in GitHub Desktop.
Pademo Rough Edges

Current load_path defaults

Padrino.load! does a recursive require in the whole ./lib folder, but normally I expect gems to take care of their own loading with the './lib/my-gem' file. Sometimes some things are left out:

Here is a case where I had some problems to share some test code.

Gem generation

Padrino and Bundler have a different style of subgem generation. In Pademo there are subgems named with the 'pademo-' prefix. Generating 'pademo-hello' will be:

Padrino:
  ./lib/pademo-hello
  namespace -> pademo-hello

Bundler:
   ./lib/pademo/hello
    namespace -> pademo::hello

The current Padrino generation matches Padrino source code style. However considering the weight of Bundler within Ruby, I am wondering if it should be considered as 'standard' practice

??? Is Padrino making assumptions on the gemified string names that depend on such style?

Folder layout

Using gem apps encourages other folder layout style

app/    anything internal to the app
lib/    anything that we might "require" outside the gem
assets/ non Ruby files to be shared

... because using multiple gems increase/change need of sharing resources between gems.. that can happen also through URL conventions

...TODO

Dual boot configuration

In order to provide isolated independent gems, a dual configuration is needed when a Gem is loaded as part of the whole system, or as an independent Gem during development/testing

For example, this configuration code applies only to a sub-gem but cannot be placed in its './config/boot.rb' file because on production the main boot.rb file will be used, not the gem one.

Routes

Non Padrino apps like '/sinapi' (Sinatra) or '/assets' (Sprockets) are not shown with the rake routes command

Padrino gem generator

The gemspec generator depends just on padrino-core but the core gem needs full padrino while the others need the core gem (inheriting its gems)

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