From 51acf9475698dbc69eb3dfabc169244112dd231f Mon Sep 17 00:00:00 2001 From: m11o Date: Thu, 28 Sep 2023 23:46:16 +0900 Subject: [PATCH 1/5] init dotenv-rails gem types --- .gitmodules | 3 +++ gems/dotenv-rails/2.8/_scripts/test | 21 +++++++++++++++++++++ gems/dotenv-rails/2.8/_src | 1 + gems/dotenv-rails/2.8/_test/Steepfile | 11 +++++++++++ gems/dotenv-rails/2.8/_test/test.rb | 4 ++++ gems/dotenv-rails/2.8/dotenv-rails.rbs | 0 gems/dotenv-rails/2.8/manifest.yaml | 7 +++++++ 7 files changed, 47 insertions(+) create mode 100755 gems/dotenv-rails/2.8/_scripts/test create mode 160000 gems/dotenv-rails/2.8/_src create mode 100644 gems/dotenv-rails/2.8/_test/Steepfile create mode 100644 gems/dotenv-rails/2.8/_test/test.rb create mode 100644 gems/dotenv-rails/2.8/dotenv-rails.rbs create mode 100644 gems/dotenv-rails/2.8/manifest.yaml diff --git a/.gitmodules b/.gitmodules index 7952d1f2..3fdbad00 100644 --- a/.gitmodules +++ b/.gitmodules @@ -202,3 +202,6 @@ [submodule "gems/recaptcha/5.15/_src"] path = gems/recaptcha/5.15/_src url = https://github.com/ambethia/recaptcha.git +[submodule "gems/dotenv-rails/2.8/_src"] + path = gems/dotenv-rails/2.8/_src + url = https://github.com/bkeepers/dotenv.git diff --git a/gems/dotenv-rails/2.8/_scripts/test b/gems/dotenv-rails/2.8/_scripts/test new file mode 100755 index 00000000..106695f3 --- /dev/null +++ b/gems/dotenv-rails/2.8/_scripts/test @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Exit command with non-zero status code, Output logs of every command executed, Treat unset variables as an error when substituting. +set -eou pipefail +# Internal Field Separator - Linux shell variable +IFS=$'\n\t' +# Print shell input lines +set -v + +# Set RBS_DIR variable to change directory to execute type checks using `steep check` +RBS_DIR=$(cd $(dirname $0)/..; pwd) +# Set REPO_DIR variable to validate RBS files added to the corresponding folder +REPO_DIR=$(cd $(dirname $0)/../../..; pwd) +# Validate RBS files, using the bundler environment present +bundle exec rbs --repo $REPO_DIR -r dotenv-rails:2.8 validate --silent + +cd ${RBS_DIR}/_test +# Run type checks +bundle exec steep check + +$(git rev-parse --show-toplevel)/bin/check-untyped-call.rb diff --git a/gems/dotenv-rails/2.8/_src b/gems/dotenv-rails/2.8/_src new file mode 160000 index 00000000..45b712a5 --- /dev/null +++ b/gems/dotenv-rails/2.8/_src @@ -0,0 +1 @@ +Subproject commit 45b712a5c17d707959df69595b1dd12e0a18cfd1 diff --git a/gems/dotenv-rails/2.8/_test/Steepfile b/gems/dotenv-rails/2.8/_test/Steepfile new file mode 100644 index 00000000..a7e92930 --- /dev/null +++ b/gems/dotenv-rails/2.8/_test/Steepfile @@ -0,0 +1,11 @@ +D = Steep::Diagnostic + +target :test do + check "." + signature "." + + repo_path "../../../" + library "dotenv-rails" + + configure_code_diagnostics(D::Ruby.all_error) +end diff --git a/gems/dotenv-rails/2.8/_test/test.rb b/gems/dotenv-rails/2.8/_test/test.rb new file mode 100644 index 00000000..d73d9bf9 --- /dev/null +++ b/gems/dotenv-rails/2.8/_test/test.rb @@ -0,0 +1,4 @@ +# Write Ruby code to test the RBS. +# It is type checked by `steep check` command. + +require "dotenv-rails" diff --git a/gems/dotenv-rails/2.8/dotenv-rails.rbs b/gems/dotenv-rails/2.8/dotenv-rails.rbs new file mode 100644 index 00000000..e69de29b diff --git a/gems/dotenv-rails/2.8/manifest.yaml b/gems/dotenv-rails/2.8/manifest.yaml new file mode 100644 index 00000000..a0cb4d14 --- /dev/null +++ b/gems/dotenv-rails/2.8/manifest.yaml @@ -0,0 +1,7 @@ +# manifest.yaml describes dependencies which do not appear in the gemspec. +# If this gem includes such dependencies, comment-out the following lines and +# declare the dependencies. +# If all dependencies appear in the gemspec, you should remove this file. +# +# dependencies: +# - name: pathname From 0cf1ebd84cafa0434f30808eb2e7d61baa714c84 Mon Sep 17 00:00:00 2001 From: m11o Date: Fri, 29 Sep 2023 00:56:52 +0900 Subject: [PATCH 2/5] Add dotenv-rails rbs --- gems/dotenv-rails/2.8/dotenv-rails.rbs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gems/dotenv-rails/2.8/dotenv-rails.rbs b/gems/dotenv-rails/2.8/dotenv-rails.rbs index e69de29b..f8063557 100644 --- a/gems/dotenv-rails/2.8/dotenv-rails.rbs +++ b/gems/dotenv-rails/2.8/dotenv-rails.rbs @@ -0,0 +1,21 @@ +module Dotenv + def self.load: (*String filenames) -> void + | () -> void + def self.load!: (*String filenames) -> void + | () -> void + + def self.require_keys: (*String keys) -> void + def self.parse: (*String filenames) -> Environment + + def self.overload: (*String filenames) -> void + | () -> void + def self.overload!: (*String filenames) -> void + | () -> void + + class Environment < Hash[String, untyped] + attr_reader filename: String + + def initialize: (String filename, boolish is_load) -> void + def load: (boolish is_load) -> self + end +end From 02bdda92092533656f2eb55628379590b39ca20f Mon Sep 17 00:00:00 2001 From: m11o Date: Fri, 29 Sep 2023 00:57:08 +0900 Subject: [PATCH 3/5] Add dotenv-rails rbs test --- gems/dotenv-rails/2.8/_test/test.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gems/dotenv-rails/2.8/_test/test.rb b/gems/dotenv-rails/2.8/_test/test.rb index d73d9bf9..0853b292 100644 --- a/gems/dotenv-rails/2.8/_test/test.rb +++ b/gems/dotenv-rails/2.8/_test/test.rb @@ -1,4 +1,17 @@ # Write Ruby code to test the RBS. # It is type checked by `steep check` command. -require "dotenv-rails" +require 'dotenv' + +Dotenv.load +Dotenv.load('file1.env', 'file2.env') + +Dotenv.load! +Dotenv.load!('file1.env', 'file2.env') + +Dotenv.require_keys('KEY1', 'KEY2') + +Dotenv.parse('file1.env', 'file2.env')['KEY1'] + +Dotenv.overload('file1.env', 'file2.env') +Dotenv.overload!('file1.env', 'file2.env') From 56fcbba69cc5d757de5a348e246c506d32e873a1 Mon Sep 17 00:00:00 2001 From: m11o Date: Fri, 29 Sep 2023 01:06:09 +0900 Subject: [PATCH 4/5] remove manifest.yml --- gems/dotenv-rails/2.8/manifest.yaml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 gems/dotenv-rails/2.8/manifest.yaml diff --git a/gems/dotenv-rails/2.8/manifest.yaml b/gems/dotenv-rails/2.8/manifest.yaml deleted file mode 100644 index a0cb4d14..00000000 --- a/gems/dotenv-rails/2.8/manifest.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# manifest.yaml describes dependencies which do not appear in the gemspec. -# If this gem includes such dependencies, comment-out the following lines and -# declare the dependencies. -# If all dependencies appear in the gemspec, you should remove this file. -# -# dependencies: -# - name: pathname From f69dca42fde14507cad0627d93e570f2d5d7208e Mon Sep 17 00:00:00 2001 From: m11o Date: Fri, 29 Sep 2023 07:47:56 +0900 Subject: [PATCH 5/5] fix types test --- gems/dotenv-rails/2.8/_test/env_files/file1.env | 1 + gems/dotenv-rails/2.8/_test/env_files/file2.env | 2 ++ gems/dotenv-rails/2.8/_test/test.rb | 11 ++++++----- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 gems/dotenv-rails/2.8/_test/env_files/file1.env create mode 100644 gems/dotenv-rails/2.8/_test/env_files/file2.env diff --git a/gems/dotenv-rails/2.8/_test/env_files/file1.env b/gems/dotenv-rails/2.8/_test/env_files/file1.env new file mode 100644 index 00000000..3f094562 --- /dev/null +++ b/gems/dotenv-rails/2.8/_test/env_files/file1.env @@ -0,0 +1 @@ +KEY1=key1 diff --git a/gems/dotenv-rails/2.8/_test/env_files/file2.env b/gems/dotenv-rails/2.8/_test/env_files/file2.env new file mode 100644 index 00000000..99d6ce17 --- /dev/null +++ b/gems/dotenv-rails/2.8/_test/env_files/file2.env @@ -0,0 +1,2 @@ +KEY1=key1-hoge +KEY2=key2 diff --git a/gems/dotenv-rails/2.8/_test/test.rb b/gems/dotenv-rails/2.8/_test/test.rb index 0853b292..899e9f4e 100644 --- a/gems/dotenv-rails/2.8/_test/test.rb +++ b/gems/dotenv-rails/2.8/_test/test.rb @@ -4,14 +4,15 @@ require 'dotenv' Dotenv.load -Dotenv.load('file1.env', 'file2.env') +Dotenv.load('./env_files/file1.env', './env_files/file2.env') +Dotenv.load('./env_files/file3.env') Dotenv.load! -Dotenv.load!('file1.env', 'file2.env') +Dotenv.load!('./env_files/file1.env', './env_files/file2.env') Dotenv.require_keys('KEY1', 'KEY2') -Dotenv.parse('file1.env', 'file2.env')['KEY1'] +pp Dotenv.parse('./env_files/file1.env', './env_files/file2.env')['KEY1'] -Dotenv.overload('file1.env', 'file2.env') -Dotenv.overload!('file1.env', 'file2.env') +Dotenv.overload('./env_files/file1.env', './env_files/file2.env') +Dotenv.overload!('./env_files/file1.env', './env_files/file2.env')