- What are Gems
- Gems are Ruby extensions, including Rails itself
- Gems can be standalone or depend on other gems
- Project Structure
- Gemfile contains gems and their dependencies
- Gemfile.lock locks gems to specific versions
- Bundler is the package manager for gem management
- Gemfile Features
- Gemfiles require RubyGems server URL as source
- Version specifiers like >= and ~> control gem compatibility
- Git repositories can be used as gem sources
- Dependencies can be grouped and installed together
- Gemsets
- Gemsets allow keeping gems separate for different projects
- RVM provides global gemset per ruby interpreter
- Gemsets can be created, copied, and deleted
- RVM initializes gemsets during ruby installations
- Best Practices
- Add comments to Gemfile for documentation
- Follow Semantic Versioning 2.0.0 principle
- Use Ruby version specification in Gemfile