New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add project component initializers #2032

Merged
merged 2 commits into from May 9, 2016

Conversation

Projects
None yet
2 participants
@ujifgc
Member

ujifgc commented May 5, 2016

This PR adds the code that requires config/initializers/*.rb before any other project files.

Right now the structure of an initializer (like Sass) is this:

# code run once after Padrino.before_load before Padrino.after_load
# good place to define some plugin-related constants
module CertainInitializer
  def self.registered(app)
    # code run on application `register CertainInitializer`
    # this code is run every time `app.rb` is reloaded
  end
end

The second part involving self.registered could be safely reloaded if we want but this would require placing initializers in lib/plugins folder. If we do this we would not have any more 'run-once' code and it would probably be not an initializer by itself any more.

What would be more useful for development: a run-once initializer (in config) or a reloadable plugin (in lib)?

Reference: #1926

@namusyaka

This comment has been minimized.

Show comment
Hide comment
@namusyaka

namusyaka May 5, 2016

Member

Your concept looks cool for me. Btw, tests are failed because old places of initializers are still expected.

Member

namusyaka commented May 5, 2016

Your concept looks cool for me. Btw, tests are failed because old places of initializers are still expected.

@ujifgc ujifgc merged commit c6a1f11 into master May 9, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ujifgc ujifgc referenced this pull request May 9, 2016

Closed

Release 0.13.2 #2030

@nesquena nesquena deleted the initializers branch May 9, 2016

ujifgc added a commit that referenced this pull request Sep 8, 2016

add project component initializers (#2032)
* add project component initializers

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