Contributing¶
Thank you for your interest in contributing to DebugMe! This guide will help you get started.
Getting Started¶
Prerequisites¶
- Ruby >= 3.2.0
- Git
- Bundler
Setup¶
- Fork the repository on GitHub
- Clone your fork locally:
- Install dependencies:
- Verify the tests pass:
Development Workflow¶
Running Tests¶
# Run all tests
bundle exec rake test
# Run a specific test file
bundle exec ruby tests/debug_me_test.rb
# Run with verbose output
bundle exec ruby tests/debug_me_test.rb -v
Code Style¶
- Follow standard Ruby conventions
- Use 2 spaces for indentation
- Keep lines under 100 characters when practical
- Add comments for complex logic
Making Changes¶
- Create a feature branch:
- Make your changes
- Add or update tests as needed
- Ensure all tests pass
- Commit your changes with a descriptive message
Submitting Changes¶
Pull Request Process¶
- Push your branch to your fork:
- Open a Pull Request on GitHub
- In the PR description, cover:
- What changed
- Motivation for the change
- Any breaking changes
- Test coverage
PR Guidelines¶
- One feature per PR - Keep changes focused
- Include tests - All new functionality should have tests
- Update documentation - Update README and docs if needed
- Follow conventions - Match existing code style
Types of Contributions¶
Bug Reports¶
When filing a bug report, include:
- Ruby version (
ruby -v) - DebugMe version
- Operating system
- Minimal code example reproducing the issue
- Expected vs actual behavior
Feature Requests¶
For new features, please describe:
- The use case
- Proposed API/interface
- Any alternatives considered
Documentation¶
Documentation improvements are always welcome:
- Fix typos
- Clarify explanations
- Add examples
- Improve organization
Code Contributions¶
Ideas for contributions:
- Performance improvements
- New output formats
- Additional variable types
- Better error messages
- Test coverage improvements
Testing Guidelines¶
Test Structure¶
Tests are located in the tests/ directory and use Minitest's spec style (describe / it). Name a new file tests/<topic>_test.rb; rake test only runs files matching tests/*_test.rb. tests/timestamp_test.rb is a complete example:
# frozen_string_literal: true
require 'minitest/autorun'
require_relative '../lib/debug_me'
describe 'your feature' do
# Turn debug_me on even when the shell has DEBUG_ME=false
before do
@saved_debug_me = $DEBUG_ME
$DEBUG_ME = true
end
after { $DEBUG_ME = @saved_debug_me }
it 'describes the behavior' do
@value = 42
output = DebugMe.debug_me(file: nil, header: false, time: false) { :@value }
_(output).must_equal "DEBUG @value -=> 42\n"
end
end
Writing Good Tests¶
- Test one behavior per
itblock - Give each
describeandita descriptive name - Include edge cases
- Test both success and failure scenarios
Test Categories¶
- Source header tests - Verify file/line output
- Variable tests - Local, instance, class variables
- Option tests - Each configuration option
- Integration tests - Logger, file output
- Edge cases - Empty blocks, nil values
Release Process¶
Releases are managed by the maintainer:
- Update version in
lib/debug_me/version.rb - Update CHANGELOG.md
- Create git tag
- Build and push gem
Code of Conduct¶
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
Questions?¶
- Open a GitHub issue for questions
- Check existing issues before creating new ones
- Tag issues appropriately
License¶
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to DebugMe!