diff --git a/.gitmodules b/.gitmodules index b9efa1a1..0f95dc17 100644 --- a/.gitmodules +++ b/.gitmodules @@ -202,6 +202,9 @@ [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 [submodule "gems/activerecord-import/1.5/_src"] path = gems/activerecord-import/1.5/_src url = https://github.com/zdennis/activerecord-import.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/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 new file mode 100644 index 00000000..899e9f4e --- /dev/null +++ b/gems/dotenv-rails/2.8/_test/test.rb @@ -0,0 +1,18 @@ +# Write Ruby code to test the RBS. +# It is type checked by `steep check` command. + +require 'dotenv' + +Dotenv.load +Dotenv.load('./env_files/file1.env', './env_files/file2.env') +Dotenv.load('./env_files/file3.env') + +Dotenv.load! +Dotenv.load!('./env_files/file1.env', './env_files/file2.env') + +Dotenv.require_keys('KEY1', 'KEY2') + +pp Dotenv.parse('./env_files/file1.env', './env_files/file2.env')['KEY1'] + +Dotenv.overload('./env_files/file1.env', './env_files/file2.env') +Dotenv.overload!('./env_files/file1.env', './env_files/file2.env') 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..f8063557 --- /dev/null +++ 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