Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not call .setup on Singleton when loading the main lib #51

Conversation

tiagoamaro
Copy link

Hi @kernow,

First, thank you very much for this incredible library. It helped me a lot setting up configurable templates for my CMS 馃帀

This PR aims to fix the following issue: after I installed Shortcode latest version, I kept reading on my logs the [DEPRECATION] singleton Shortcode.setup warning, which was not true in my case. I barely installed the gem, how I was calling the Shortcode.setup method? 馃. I didn't know where this was coming, until I checked out the library code.

Based on latest master, I noticed that the Shortcode.setup delegates its call to the .singleton method, which initializes a new instance of the Shortcode object. This will trigger the library default configuration, calling Shortcode.setup or not.

This behavior also makes the Shortcode.setup {} call at the end of the lib/shortcode.rb file unnecessary (

Shortcode.setup {}
), removing the deprecation warning for users using the library latest version 馃槂

Also tested it locally running appraisal rspec, and all tests are green 馃槃

@coveralls
Copy link

coveralls commented Jul 17, 2017

Coverage Status

Coverage decreased (-0.004%) to 97.794% when pulling fcc2c65 on tiagoamaro:do-not-call-setup-on-initalization into 8f539c8 on kernow:master.

@kernow
Copy link
Owner

kernow commented Nov 2, 2017

@tiagoamaro thank you for this PR, I've released 2.0.0.pre today which removes the singleton usage from the gem. I'll close the PR as it's covered in the 2.0 branch. If you could test out the prerelease and provide any feedback that would be great.

@kernow kernow closed this Nov 2, 2017
@tiagoamaro tiagoamaro deleted the do-not-call-setup-on-initalization branch November 2, 2017 22:17
@tiagoamaro
Copy link
Author

@kernow, just ran my test suite against 2.0.0.pre and everything was fine! No more deprecation warnings 馃帀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants