diff --git a/lib/generators/addon/addon_generator.rb b/lib/generators/addon/addon_generator.rb index 79b7e0902..5ef5a0892 100644 --- a/lib/generators/addon/addon_generator.rb +++ b/lib/generators/addon/addon_generator.rb @@ -176,7 +176,12 @@ class AddonGenerator < Rails::Generators::NamedBase copy_file('.gitignore', "addons/#{@addon_name}/.gitignore") copy_file('Gemfile', "addons/#{@addon_name}/Gemfile") copy_file('LICENSE.txt', "addons/#{@addon_name}/LICENSE.txt") - copy_file('README.md', "addons/#{@addon_name}/README.md") + file_path = "addons/#{@addon_name}/README.md" + copy_file('README.md', file_path) + gsub_file(file_path, '${ADDON_NAME}', @addon_name) + gsub_file(file_path, '${FULL_UNDERSCORE_NAME}', @full_underscore_name) + gsub_file(file_path, '${NAME}', name) + gsub_file(file_path, '${FOLDERS_PATH}', @folders_path) # Rakefile file_path = "addons/#{@addon_name}/Rakefile" diff --git a/lib/generators/addon/templates/README.md b/lib/generators/addon/templates/README.md index f87f5c14c..800a77c08 100644 --- a/lib/generators/addon/templates/README.md +++ b/lib/generators/addon/templates/README.md @@ -1 +1,35 @@ -# TODO \ No newline at end of file +# sciNote addon - `${ADDON_NAME}` + +## How to include this addon inside main sciNote application + +* Inside `Gemfile`, add the following reference: + +```ruby +gem '${FULL_UNDERSCORE_NAME}', + path: 'addons/${ADDON_NAME}' +``` + +* Inside `config/routes.rb`, add the following reference: + +```ruby +mount ${NAME}::Engine => '/' +``` + +* If you have any addon-specific JavaScript code, add the following reference inside `app/assets/javascripts/application.js.erb`: + +```js +//= require ${FOLDERS_PATH} +``` + +* If you have any addon-specific CSS code, add the following reference inside `app/assets/stylesheets/application.scss` (starting comment): + +```css + *= require ${FOLDERS_PATH}/application +``` + +Then, do the following: + +1. Run `make docker`, +2. Run `make cli` -> `rake db:migrate`, +3. (optional) setup any addon initializers/settings, +4. Start application (`make run`)!