A command-line tool for fetching and summarizing news articles from various sources.
- Clone the repository
- Run
bundle installto install dependencies - Set up your OpenAI API key:
./bin/news configure openai.api_key your-api-key
# Fetch articles from BBC News (default: 5 articles)
./bin/news fetch bbc
# Fetch specific number of articles
./bin/news fetch bbc --limit 2# Like a topic
./bin/news topics like technology
# Dislike a topic
./bin/news topics dislike politics./bin/news sources# Run all tests
rake test
# Run specific test file
ruby -Ilib test/test_bbc_source.rbThe project uses VCR to record and replay HTTP interactions in tests. This ensures tests are fast and deterministic while still testing real-world scenarios.
To record new VCR cassettes:
-
Delete existing cassettes you want to re-record:
rm test/fixtures/vcr_cassettes/bbc_*.yml -
Run tests with recording enabled:
VCR_RECORD=1 ruby -Ilib test/test_bbc_source.rb
- Don't commit cassettes with sensitive data
- Re-record cassettes periodically to test against real responses
- Review cassettes before committing to ensure they don't contain sensitive data
- Use
VCR_RECORD=1when site content changes significantly
bin/
news # CLI executable
lib/
news_cli/
cli.rb # CLI implementation
config.rb # Configuration management
news_source.rb # Base class for news sources
summarizer.rb # Article summarization
sources/
bbc.rb # BBC news source implementation
test/
fixtures/
vcr_cassettes/ # VCR cassettes
test_helper.rb # Test configuration
test_* # Test files
Configuration is stored in ~/.news_cli/config.yml and includes:
- OpenAI API settings
- News source configurations
- User preferences (liked/disliked topics)
- Write tests for new features
- Update documentation
- Follow the Ruby style guide
- Create a pull request
MIT License