From 5aadce63fd97a27466eef084f8e8128050cc5698 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sun, 1 Jan 2023 13:00:54 -0500 Subject: [PATCH] All the updates! --- .github/workflows/workflow.yml | 14 ------- .gitignore | 1 + .rubocop.yml | 4 +- .rubocop_todo.yml | 2 +- Gemfile | 4 +- Gemfile.lock | 75 ++++++++++++++++++++-------------- LICENSE | 2 +- config.ru | 2 +- mini_s3put.rb | 19 ++++----- 9 files changed, 60 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/workflow.yml diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml deleted file mode 100644 index ef99922..0000000 --- a/.github/workflows/workflow.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Do Things -on: [push] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: actions/setup-ruby@v1 - with: - ruby-version: '2.6.x' - - run: | - gem install bundler - bundle install --jobs 4 --retry 3 - bundle exec rake diff --git a/.gitignore b/.gitignore index 5f91bce..48fab0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .*env *.csv .ruby-version +.envrc diff --git a/.rubocop.yml b/.rubocop.yml index d6fa38e..dbc55a8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,9 @@ inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 2.6 + NewCops: enable + SuggestExtensions: false + TargetRubyVersion: 3.2 Style/Documentation: Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 102c2cf..d0169f5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-01-11 15:25:31 -0500 using RuboCop version 0.78.0. +# on 2023-01-01 17:49:35 UTC using RuboCop version 1.42.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new diff --git a/Gemfile b/Gemfile index 748a420..7daa627 100644 --- a/Gemfile +++ b/Gemfile @@ -2,9 +2,9 @@ source 'https://rubygems.org' -ruby '2.7.2' if ENV.key?('DYNO') +ruby '3.2.0' if ENV.key?('DYNO') -gem 'aws-sdk', '~> 2' +gem 'aws-sdk-s3', '~> 1' gem 'pry', group: %i[development test] gem 'rack' gem 'rake' diff --git a/Gemfile.lock b/Gemfile.lock index fd9bc0c..4bb864a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,45 +1,58 @@ GEM remote: https://rubygems.org/ specs: - ast (2.4.0) - aws-eventstream (1.0.3) - aws-sdk (2.11.421) - aws-sdk-resources (= 2.11.421) - aws-sdk-core (2.11.421) - aws-sigv4 (~> 1.0) - jmespath (~> 1.0) - aws-sdk-resources (2.11.421) - aws-sdk-core (= 2.11.421) - aws-sigv4 (1.1.0) - aws-eventstream (~> 1.0, >= 1.0.2) - coderay (1.1.2) - jaro_winkler (1.5.4) - jmespath (1.4.0) - method_source (0.9.2) - parallel (1.19.1) - parser (2.7.0.1) - ast (~> 2.4.0) - pry (0.12.2) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - rack (2.0.8) - rainbow (3.0.0) - rake (13.0.1) - rubocop (0.78.0) - jaro_winkler (~> 1.5.1) + ast (2.4.2) + aws-eventstream (1.2.0) + aws-partitions (1.686.0) + aws-sdk-core (3.168.4) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.5) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.61.0) + aws-sdk-core (~> 3, >= 3.165.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.117.2) + aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.2) + aws-eventstream (~> 1, >= 1.0.2) + coderay (1.1.3) + jmespath (1.6.2) + json (2.6.3) + method_source (1.0.0) + parallel (1.22.1) + parser (3.1.3.0) + ast (~> 2.4.1) + pry (0.14.1) + coderay (~> 1.1) + method_source (~> 1.0) + rack (3.0.3) + rainbow (3.1.1) + rake (13.0.6) + regexp_parser (2.6.1) + rexml (3.2.5) + rubocop (1.42.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - ruby-progressbar (1.10.1) - unicode-display_width (1.6.0) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.24.1) + parser (>= 3.1.1.0) + ruby-progressbar (1.11.0) + unicode-display_width (2.3.0) PLATFORMS ruby DEPENDENCIES - aws-sdk (~> 2) + aws-sdk-s3 (~> 1) pry rack rake diff --git a/LICENSE b/LICENSE index 5715ce1..73e1417 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright © 2020 Dan Buch +Copyright © 2023 Dan Buch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/config.ru b/config.ru index 5486f53..c45ab08 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1,3 @@ # frozen_string_literal: true -run ->(*) { [301, { 'Location' => ENV['CPI_FEED_URL'] }, []] } +run ->(*) { [301, { 'Location' => ENV.fetch('CPI_FEED_URL', nil) }, []] } diff --git a/mini_s3put.rb b/mini_s3put.rb index cbc6b14..a4f8087 100644 --- a/mini_s3put.rb +++ b/mini_s3put.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'aws-sdk' +require 'aws-sdk-s3' class MiniS3put def initialize(key: nil, instream: $stdin) @@ -13,19 +13,14 @@ class MiniS3put private :bucket, :key, :instream def put - Aws::S3::Resource.new.bucket(bucket).object(key).put( - body: instream.read - ).on_success(&method(:on_put_success)) - end + body = instream.read + puts Aws::S3::Resource.new.bucket(bucket).object(key).put(body:) - private def on_put_success(response) - puts response.data + puts body - Aws::S3::Client.new.put_object_acl( - bucket: bucket, key: key, acl: 'public-read' - ).on_success do |acl_response| - puts acl_response.data - end + puts Aws::S3::Client.new.put_object_acl( + bucket:, key:, acl: 'public-read' + ) end end