Skip to content

Conversation

robzolkos
Copy link

This commit fixes a critical issue where users installing the leva gem would encounter LoadError crashes when running Rails in development mode or executing any rake tasks, if they didn't have the annotate gem installed.

Fixed #17

Problem:

  • The auto_annotate_models.rake task was unconditionally requiring 'annotate'
  • Rails engines automatically load all rake tasks to host applications
  • Users without annotate gem would get LoadError during Rails boot or rake execution
  • This affected basic operations like 'rails leva:install:migrations'

Solution:

  1. Add annotate as development dependency in gemspec

    • Ensures leva gem contributors get annotate automatically
    • Follows proper dependency management practices
  2. Add defensive LoadError rescue in rake task

    • Gracefully skips annotation tasks if annotate gem unavailable
    • Maintains functionality for users who do have annotate installed
    • Prevents crashes for users who don't need annotation features

The annotate functionality is purely for maintaining leva's own model documentation and provides no runtime value to end users.

Fixes issues with:

  • Rails server startup in development
  • Running any rake tasks (leva:install:migrations, db:migrate, etc.)
  • Basic gem installation and usage

This commit fixes a critical issue where users installing the leva gem
would encounter LoadError crashes when running Rails in development mode
or executing any rake tasks, if they didn't have the annotate gem installed.

Problem:
- The auto_annotate_models.rake task was unconditionally requiring 'annotate'
- Rails engines automatically load all rake tasks to host applications
- Users without annotate gem would get LoadError during Rails boot or rake execution
- This affected basic operations like 'rails leva:install:migrations'

Solution:
1. Add annotate as development dependency in gemspec
   - Ensures leva gem contributors get annotate automatically
   - Follows proper dependency management practices

2. Add defensive LoadError rescue in rake task
   - Gracefully skips annotation tasks if annotate gem unavailable
   - Maintains functionality for users who do have annotate installed
   - Prevents crashes for users who don't need annotation features

The annotate functionality is purely for maintaining leva's own model
documentation and provides no runtime value to end users.

Fixes issues with:
- Rails server startup in development
- Running any rake tasks (leva:install:migrations, db:migrate, etc.)
- Basic gem installation and usage
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.

Annotate gem required?
1 participant