Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make template work for existing applications
Not every RES adopter wants to generate new app from scratch. Some of them potentially wants to put it in the existing application. Template can be used in that manner: - cd to your rails app directory - bin/rails app:template LOCATION=https://railseventstore.org/new - that's it, RES is installed and preconfigured in existing app run_after_bundle_callbacks had to be used explicitly since if the bundle is present (it is in exising app), the after_bundle hook won't be run. Conditional run_bundle is also necessary to install RES after adding it to Gemfile in existing app, so we can generate the migration and execute it. Determining database kind based on options only makes sense for the new app, since it lives in generator options (e.g. --database=postgresql), but for the existing app, we need to figure it out based on ActiveRecord connection settings. Those are available for the generator already. Generator options will contain default value which is "sqlite3". Co-authored-by: Łukasz Reszke <lukaszreszke93@gmail.com>
- Loading branch information