From 871adedbb8f962eda857ae38e23b810cb7c44026 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 12 Nov 2025 23:50:07 +0000 Subject: [PATCH 1/2] Update dependencies and modernize development tooling This commit modernizes the gem's dependencies and development infrastructure: Dependencies: - Update Faraday from ~> 1.4 to ~> 2.0 - Update Hashie from ~> 4.1 to ~> 5.0 - Update Bundler requirement from ~> 2.2 to >= 2.2 - Add RuboCop and related plugins as development dependencies CI/CD: - Update Travis CI to test Ruby 3.1, 3.2, and 3.3 - Add GitHub Actions CI workflow for automated testing and linting - Remove Bundler version lock in Travis CI Code Quality: - Add RuboCop configuration (.rubocop.yml) - Fix duplicate 'private' keyword in lib/alphavantage/validations.rb Documentation: - Add CHANGELOG.md following Keep a Changelog format Development: - Add .ruby-version (3.3.6) to repository (removed from .gitignore) All existing tests pass with the updated dependencies (71 examples, 0 failures). --- .github/workflows/ci.yml | 42 +++++++++++++++++++++++ .gitignore | 1 - .rubocop.yml | 58 +++++++++++++++++++++++++++++++ .ruby-version | 1 + .travis.yml | 6 ++-- CHANGELOG.md | 60 +++++++++++++++++++++++++++++++++ alphavantage.gemspec | 9 +++-- lib/alphavantage/validations.rb | 2 -- 8 files changed, 171 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .rubocop.yml create mode 100644 .ruby-version create mode 100644 CHANGELOG.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f1c5e8f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby-version: ['3.1', '3.2', '3.3'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Run tests + run: bundle exec rake spec + + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + + - name: Run RuboCop + run: bundle exec rubocop diff --git a/.gitignore b/.gitignore index def4703..51b50af 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,5 @@ .byebug_history .DS_Store -.ruby-version *.gem Gemfile.lock diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..1b1f6ba --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,58 @@ +require: + - rubocop-rake + - rubocop-rspec + +AllCops: + TargetRubyVersion: 3.1 + NewCops: enable + Exclude: + - 'vendor/**/*' + - 'bin/**/*' + +# Style preferences +Style/StringLiterals: + EnforcedStyle: double_quotes + +Style/Documentation: + Enabled: false + +Style/FrozenStringLiteralComment: + Enabled: false + +# Layout preferences +Layout/LineLength: + Max: 120 + Exclude: + - 'spec/**/*' + +# Metrics +Metrics/MethodLength: + Max: 15 + Exclude: + - 'spec/**/*' + +Metrics/BlockLength: + Exclude: + - 'spec/**/*' + - '*.gemspec' + +Metrics/AbcSize: + Max: 20 + Exclude: + - 'spec/**/*' + +# Naming +Naming/MethodParameterName: + AllowedNames: + - 'to' + - 'fx' + +# RSpec specific +RSpec/ExampleLength: + Max: 10 + +RSpec/MultipleExpectations: + Max: 5 + +RSpec/NestedGroups: + Max: 4 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..9c25013 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.3.6 diff --git a/.travis.yml b/.travis.yml index 2c49231..79e40bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,7 @@ sudo: false language: ruby cache: bundler rvm: - - 2.6.3 -before_install: gem install bundler -v 1.17.2 + - 3.3.6 + - 3.2.6 + - 3.1.6 +before_install: gem install bundler diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2ca3b09 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,60 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Changed +- Updated Faraday dependency from ~> 1.4 to ~> 2.0 +- Updated Hashie dependency from ~> 4.1 to ~> 5.0 +- Updated Bundler requirement from ~> 2.2 to >= 2.2 +- Updated Travis CI to test against Ruby 3.1, 3.2, and 3.3 +- Removed Bundler version lock in Travis CI + +### Added +- Added GitHub Actions CI workflow +- Added RuboCop and related plugins (rubocop-rake, rubocop-rspec) as development dependencies +- Added .rubocop.yml configuration file +- Added .ruby-version file (3.3.6) to repository +- Added CHANGELOG.md + +### Fixed +- Removed duplicate `private` keyword in lib/alphavantage/validations.rb + +## [1.2.0] - (Date from git history) + +### Added +- Intraday extended history support +- API key validation (raises error on missing API key) + +### Changed +- Updated API error handling + +### Fixed +- Fixed bin/console script + +## [1.1.0] - (Date from git history) + +### Added +- Support for technical indicators including: + - VWAP, BOP, TRANGE, AD, OBV + - SMA, EMA, WMA, DEMA, TEMA, TRIMA, KAMA, MAMA, T3 + - RSI, MOM, CMO, ROC, ROCR, TRIX, MIDPOINT + - And many more indicators + +### Changed +- Refactored validations +- Trimmed spec fixtures + +## [1.0.2] - (Date from git history) + +### Changed +- Initial public release with core functionality + +[Unreleased]: https://github.com/codespore/alphavantage_ruby/compare/v1.2.0...HEAD +[1.2.0]: https://github.com/codespore/alphavantage_ruby/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/codespore/alphavantage_ruby/compare/v1.0.2...v1.1.0 +[1.0.2]: https://github.com/codespore/alphavantage_ruby/releases/tag/v1.0.2 diff --git a/alphavantage.gemspec b/alphavantage.gemspec index 2eec803..d28ea62 100644 --- a/alphavantage.gemspec +++ b/alphavantage.gemspec @@ -35,12 +35,15 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "faraday", "~> 1.4" - spec.add_dependency "hashie", "~> 4.1" + spec.add_dependency "faraday", "~> 2.0" + spec.add_dependency "hashie", "~> 5.0" - spec.add_development_dependency "bundler", "~> 2.2" + spec.add_development_dependency "bundler", ">= 2.2" spec.add_development_dependency "rake", ">= 12.3.3" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "webmock" spec.add_development_dependency "byebug" + spec.add_development_dependency "rubocop", "~> 1.60" + spec.add_development_dependency "rubocop-rake", "~> 0.6" + spec.add_development_dependency "rubocop-rspec", "~> 2.26" end diff --git a/lib/alphavantage/validations.rb b/lib/alphavantage/validations.rb index 18c0c0a..994d330 100644 --- a/lib/alphavantage/validations.rb +++ b/lib/alphavantage/validations.rb @@ -52,8 +52,6 @@ def is_integer?(str) Integer(str) rescue false end - private - def validate_from_collection(value:, collection:, type:) return value if collection.include?(value.to_sym) From babccf85d4885b9ce75150da6bad053270acaa32 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 12 Nov 2025 23:51:09 +0000 Subject: [PATCH 2/2] Add rspec binstub for easier test execution --- bin/rspec | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/rspec diff --git a/bin/rspec b/bin/rspec new file mode 100755 index 0000000..93e191c --- /dev/null +++ b/bin/rspec @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec")