env_check 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 76261979114cfd50eff2593a9d62633313d2f4e2e3c01bb891768f3b7c535cf1
4
+ data.tar.gz: 2517760bfbc532e75c0508de1c12cc4a1ed382cfaa27758cfa9f4f0c36dc86e8
5
+ SHA512:
6
+ metadata.gz: 34d26caaacf2100c9389c94a87ebc17b332001fc705f7051adb752b96920178f68c2e873ff401bf50045daf48b9e67df508d0c92a3f4ad7137e976c6a25b83e4
7
+ data.tar.gz: 13c03e66845d8afe48d1e62c400b35d89b25a6f01ce2f8b62c701a6359f91c19deceae59ebdef84e07bd8e2efc42204faa87238699e68fdbfbb9a06fd7a1a073
data/.env_check.yml ADDED
@@ -0,0 +1,15 @@
1
+ # EnvCheck Configuration (Root Level)
2
+ # Configure required and optional environment variables for your application
3
+
4
+ # Required environment variables (must be present and non-empty)
5
+ required:
6
+ - DATABASE_URL
7
+ - SECRET_KEY_BASE
8
+
9
+ # Optional environment variables with type validation
10
+ optional:
11
+ DEBUG: boolean # true, false, 1, 0, yes, no (case-insensitive)
12
+ PORT: integer # numeric values only
13
+ API_URL: url # must start with http:// or https://
14
+ ADMIN_EMAIL: email # valid email format
15
+ LOG_LEVEL: string # any string value
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,41 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+
6
+ Metrics/AbcSize:
7
+ Max: 20
8
+
9
+ Metrics/MethodLength:
10
+ Max: 20
11
+
12
+ Metrics/CyclomaticComplexity:
13
+ Max: 10
14
+
15
+ Metrics/PerceivedComplexity:
16
+ Max: 10
17
+
18
+ Metrics/ClassLength:
19
+ Max: 100
20
+ Exclude:
21
+ - "bin/*" # CLI classes can be longer
22
+
23
+ Metrics/BlockLength:
24
+ Exclude:
25
+ - "spec/**/*"
26
+ - "*.gemspec"
27
+
28
+ Layout/LineLength:
29
+ Max: 120
30
+
31
+ Style/Documentation:
32
+ Enabled: false
33
+
34
+ Gemspec/DevelopmentDependencies:
35
+ Enabled: false
36
+
37
+ Style/StringLiterals:
38
+ EnforcedStyle: double_quotes
39
+
40
+ Style/StringLiteralsInInterpolation:
41
+ EnforcedStyle: double_quotes
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.5
data/CHANGELOG.md ADDED
@@ -0,0 +1,57 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ This project adheres to [Semantic Versioning](https://semver.org).
6
+
7
+ ---
8
+
9
+ ## [0.1.0] - 2025-01-29
10
+
11
+ ### Added
12
+
13
+ - โœจ **Smart Config Discovery** - Auto-detects `.env_check.yml` (root) or `config/env_check.yml` (Rails)
14
+ - โœจ **Enhanced Validator Suite** - Comprehensive validation types:
15
+ - `boolean` - Validates boolean values including `true/false`, `1/0`, `yes/no`, `on/off`
16
+ - `integer` - Validates integer numbers (including negative)
17
+ - `float` - Validates floating point numbers
18
+ - `string` - Validates any string value
19
+ - `url` - Validates URLs starting with `http://` or `https://`
20
+ - `email` - Validates email format
21
+ - `port` - Validates port numbers (1-65535)
22
+ - `path` - Validates file/directory paths
23
+ - `json` - Validates JSON strings
24
+ - ๐ŸŽฏ **Result Object** - `EnvCheck.verify` returns a `Result` object with `success?`, `errors`, `warnings`, and `valid_vars` properties
25
+ - ๏ฟฝ **Enhanced CLI** with `check`, `version`, and `init` commands with professional UX
26
+ - ๐Ÿ—๏ธ **Environment-specific Configuration** - Support for development, test, production sections
27
+ - ๐Ÿงช **Comprehensive Test Suite** - 21 test cases covering all functionality
28
+ - ๏ฟฝ **Flexible YAML Configuration** - Supports both hash and array formats for optional variables
29
+ - ๐Ÿ“ **Rake Task Integration** - `rake env:check` for CI usage
30
+ - ๐Ÿ“– **Comprehensive Documentation** and examples
31
+
32
+ ### Features
33
+
34
+ - **Smart Configuration Discovery**: Prioritizes `.env_check.yml` (simple projects) over `config/env_check.yml` (Rails)
35
+ - **Type Validation**: Robust validation with helpful error messages for all supported types
36
+ - **Environment-specific Settings**: Different validation rules for development, test, and production
37
+ - **Flexible YAML Formats**: Supports both `optional: { VAR: type }` and `optional: [{ VAR: type }]` formats
38
+ - **CLI Tools**: Professional command-line interface for initialization and validation
39
+ - **Rails Integration**: Seamless integration with Rails 7.1+ applications
40
+ - **Dotenv Support**: Automatic `.env` file loading when available
41
+ - **Null/Empty Handling**: Graceful handling of missing and empty environment variables
42
+
43
+ ### Technical Implementation
44
+
45
+ - **Modular Architecture**: Separate `Config`, `Validators`, and `Result` classes
46
+ - **Error Handling**: Structured result objects with detailed error reporting
47
+ - **Code Quality**: Zero RuboCop offenses, comprehensive test coverage
48
+ - **Thread-safe**: Safe for concurrent usage
49
+ - **Framework Agnostic**: Works with any Ruby application, optimized for Rails
50
+
51
+ ### Compatibility
52
+
53
+ - **Ruby**: 3.0+
54
+ - **Rails**: 7.1+ through 8.0+ (framework-agnostic design)
55
+ - **CI/CD**: Comprehensive GitHub Actions integration
56
+
57
+ ---
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mohammad Nadeem
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,36 @@
1
+ ## Rails Version Support Summary
2
+
3
+ Based on the Rails upgrade guide analysis and Ruby version compatibility, this gem supports:
4
+
5
+ ### Currently Supported Rails Versions
6
+
7
+ | Rails Version | Ruby Requirement | env_check Support | Status |
8
+ |---------------|------------------|-------------------|---------|
9
+ | **Rails 8.0** | Ruby 3.0+ | โœ… Full | Latest |
10
+ | **Rails 7.2** | Ruby 3.0+ | โœ… Full | LTS |
11
+ | **Rails 7.1** | Ruby 3.0+ | โœ… Full | Maintenance |
12
+
13
+ ### Why This Gem Works Across Rails Versions
14
+
15
+ 1. **Framework Agnostic**: env_check doesn't depend on Rails directly
16
+ 2. **Pure Ruby**: Uses only standard Ruby libraries (YAML, ENV)
17
+ 3. **Simple API**: No reliance on Rails-specific methods or constants
18
+ 4. **Minimal Dependencies**: Only depends on dotenv and yaml gems
19
+
20
+ ### Rails Integration Features
21
+
22
+ - **Rake Tasks**: Works with all Rails versions that support custom Rake tasks
23
+ - **Initializers**: Compatible with Rails initialization process
24
+ - **Environment Variables**: Follows Rails conventions for env var naming
25
+ - **Configuration**: YAML configuration files work identically across versions
26
+
27
+ ### Testing Matrix
28
+
29
+ The gem is automatically tested against:
30
+ - Ruby 3.0, 3.1, 3.2, 3.3, 3.4
31
+ - Rails 7.1, 7.2, 8.0 (in CI)
32
+ - Ubuntu, macOS, Windows platforms
33
+
34
+ ### Migration Notes
35
+
36
+ When upgrading Rails versions, env_check configurations remain compatible. The gem follows semantic versioning and maintains backward compatibility.
data/README.md ADDED
@@ -0,0 +1,384 @@
1
+ # ๐Ÿ” EnvCheck
2
+
3
+ [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%203.0-red.svg)](https://ruby-lang.org)
4
+ [![Gem Version](https://badge.fury.io/rb/env_check.svg)](https://badge.fury.io/rb/env_check)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ `env_check` is a lightweight Ruby gem to validate and document your environment variables.
8
+ It ensures critical env vars are present and properly formatted before your app boots or deploys.
9
+
10
+ ---
11
+
12
+ ## ๐Ÿš€ Features
13
+
14
+ - โœ… Validate required environment variables
15
+ - โš ๏ธ Warn on missing or invalid optional variables
16
+ - ๐Ÿ”’ Type checking (boolean, integer, URL, email)
17
+ - ๐Ÿ“ YAML-based configuration
18
+ - ๐Ÿ”ง Works with any Ruby or Rails app
19
+ - ๐ŸŒฑ Supports `.env` file via `dotenv` (optional)
20
+ - ๐ŸŽฏ Programmatic API for custom integrations
21
+ - ๐Ÿ“Š Detailed validation results
22
+
23
+ ---
24
+
25
+ ## Installation
26
+
27
+ Add this line to your application's Gemfile:
28
+
29
+ ```ruby
30
+ gem 'env_check'
31
+ ```
32
+
33
+ And then execute:
34
+
35
+ $ bundle install
36
+
37
+ ## Ruby and Rails Compatibility
38
+
39
+ ### Ruby Version Support
40
+ - **Ruby 3.0+** - Fully supported
41
+ - **Ruby 3.1+** - Fully supported
42
+ - **Ruby 3.2+** - Fully supported
43
+ - **Ruby 3.3+** - Fully supported
44
+ - **Ruby 3.4+** - Fully supported
45
+
46
+ ### Rails Version Support
47
+
48
+ This gem is framework-agnostic and works with any Ruby application. For Rails applications, it supports:
49
+
50
+ | Rails Version | Ruby Version | Support Status |
51
+ |---------------|--------------|----------------|
52
+ | Rails 8.0+ | Ruby 3.2+ | โœ… Supported |
53
+ | Rails 7.2+ | Ruby 3.1+ | โœ… Supported |
54
+ | Rails 7.1+ | Ruby 3.1+ | โœ… Supported |
55
+ | Rails 7.0+ | Ruby 2.7+ | โœ… Supported |
56
+ | Rails 6.1+ | Ruby 2.5+ | โœ… Supported |
57
+ | Rails 6.0+ | Ruby 2.5+ | โœ… Supported |
58
+ | Rails 5.x | Ruby 2.2+ | โš ๏ธ Should work but not actively tested |
59
+
60
+ **Note**: While the gem doesn't directly depend on Rails, it's been designed to work seamlessly in Rails environments and integrates well with Rails' environment variable patterns.
61
+
62
+ Or install manually:
63
+ ```bash
64
+ gem install env_check
65
+ ```
66
+
67
+ ---
68
+
69
+ ## โšก Quick Start
70
+
71
+ ### 1. Generate Configuration
72
+
73
+ ```bash
74
+ env_check init
75
+ ```
76
+
77
+ This creates a configuration file using smart defaults:
78
+ - **Simple projects**: `.env_check.yml` (root level, pairs with `.env`)
79
+ - **Rails projects**: `config/env_check.yml` (Rails convention)
80
+
81
+ **Example configuration:**
82
+
83
+ ```yaml
84
+ # EnvCheck Configuration
85
+ # Required environment variables (must be present and non-empty)
86
+ required:
87
+ - DATABASE_URL
88
+ - SECRET_KEY_BASE
89
+
90
+ # Optional environment variables with type validation
91
+ optional:
92
+ DEBUG: boolean # true, false, 1, 0, yes, no
93
+ PORT: integer # numeric values only
94
+ API_URL: url # must start with http:// or https://
95
+ ADMIN_EMAIL: email # valid email format
96
+ ```
97
+
98
+ ### 2. Validate Environment
99
+
100
+ ```bash
101
+ env_check check
102
+ ```
103
+
104
+ Output:
105
+ ```
106
+ โœ… DATABASE_URL is set
107
+ โœ… SECRET_KEY_BASE is set
108
+ โš ๏ธ DEBUG should be a boolean, got 'maybe'
109
+ โŒ Missing required ENV: API_KEY
110
+ ```
111
+
112
+ ---
113
+
114
+ ## ๐Ÿ›  Usage
115
+
116
+ ### Command Line Interface
117
+
118
+ ```bash
119
+ # Create configuration file
120
+ env_check init
121
+
122
+ # Validate environment variables
123
+ env_check check
124
+
125
+ # Show version
126
+ env_check version
127
+ ```
128
+
129
+ ### Programmatic Usage
130
+
131
+ ```ruby
132
+ require 'env_check'
133
+
134
+ # Basic validation (returns Result object)
135
+ result = EnvCheck.verify
136
+
137
+ if result.success?
138
+ puts "โœ… All environment variables are valid!"
139
+ puts "Valid vars: #{result.valid_vars.join(', ')}"
140
+ else
141
+ puts "โŒ Validation failed!"
142
+ puts "Errors: #{result.errors.join(', ')}"
143
+ puts "Warnings: #{result.warnings.join(', ')}"
144
+ end
145
+
146
+ # Validate with custom config file
147
+ result = EnvCheck.verify("path/to/custom.yml")
148
+
149
+ # Validate with inline configuration
150
+ result = EnvCheck.verify_with_config({
151
+ "required" => ["API_KEY", "DATABASE_URL"],
152
+ "optional" => { "DEBUG" => "boolean" }
153
+ })
154
+
155
+ # Legacy method (raises exception on failure)
156
+ begin
157
+ EnvCheck.verify!
158
+ puts "โœ… Validation passed!"
159
+ rescue EnvCheck::Error => e
160
+ puts "โŒ #{e.message}"
161
+ exit 1
162
+ end
163
+ ```
164
+
165
+ ### Rails Integration
166
+
167
+ Add to your `config/application.rb` or initializer:
168
+
169
+ ```ruby
170
+ # config/initializers/env_check.rb
171
+ EnvCheck.verify! if Rails.env.production?
172
+ ```
173
+
174
+ #### Advanced Rails Integration Patterns
175
+
176
+ **1. Environment-Specific Validation**
177
+
178
+ ```ruby
179
+ # config/initializers/env_check.rb
180
+ Rails.application.config.after_initialize do
181
+ # Load Rails-specific config
182
+ config_file = Rails.root.join('config', 'env_check.yml')
183
+
184
+ if config_file.exist?
185
+ result = EnvCheck.verify(config_file)
186
+ unless result.success?
187
+ Rails.logger.error "Environment validation failed: #{result.errors.join(', ')}"
188
+
189
+ # Only raise in production
190
+ raise EnvCheck::Error, result.errors.join(', ') if Rails.env.production?
191
+ end
192
+ end
193
+ end
194
+ ```
195
+
196
+ **2. Controller Integration**
197
+
198
+ ```ruby
199
+ class ApplicationController < ActionController::Base
200
+ before_action :validate_critical_env_vars, if: -> { Rails.env.production? }
201
+
202
+ private
203
+
204
+ def validate_critical_env_vars
205
+ result = EnvCheck.verify_with_config({
206
+ "required" => ["DATABASE_URL", "SECRET_KEY_BASE", "RAILS_MASTER_KEY"]
207
+ })
208
+
209
+ unless result.success?
210
+ render json: { error: 'Service temporarily unavailable' }, status: 503
211
+ end
212
+ end
213
+ end
214
+ ```
215
+
216
+ **3. Health Check Endpoint**
217
+
218
+ ```ruby
219
+ # config/routes.rb
220
+ Rails.application.routes.draw do
221
+ get '/health/env', to: 'health#env_check'
222
+ end
223
+
224
+ # app/controllers/health_controller.rb
225
+ class HealthController < ApplicationController
226
+ def env_check
227
+ result = EnvCheck.verify
228
+
229
+ if result.success?
230
+ render json: {
231
+ status: 'ok',
232
+ valid_vars: result.valid_vars.count,
233
+ warnings: result.warnings
234
+ }
235
+ else
236
+ render json: {
237
+ status: 'error',
238
+ errors: result.errors
239
+ }, status: 422
240
+ end
241
+ end
242
+ end
243
+ ```
244
+
245
+ **4. Environment-Specific Configuration**
246
+
247
+ Create your config file (`.env_check.yml` or `config/env_check.yml`):
248
+
249
+ ```yaml
250
+ default: &default
251
+ optional:
252
+ DEBUG: boolean
253
+ LOG_LEVEL: string
254
+
255
+ development:
256
+ <<: *default
257
+ required:
258
+ - DATABASE_URL
259
+ - SECRET_KEY_BASE
260
+
261
+ test:
262
+ <<: *default
263
+ required:
264
+ - SECRET_KEY_BASE
265
+ optional:
266
+ DATABASE_URL: url
267
+
268
+ production:
269
+ <<: *default
270
+ required:
271
+ - DATABASE_URL
272
+ - SECRET_KEY_BASE
273
+ - RAILS_MASTER_KEY
274
+ - REDIS_URL
275
+ optional:
276
+ MEMCACHED_URL: url
277
+ CDN_HOST: url
278
+ SMTP_HOST: string
279
+ ```
280
+
281
+ ### Rake Integration
282
+
283
+ ```ruby
284
+ # In your Rakefile or Rails app
285
+ require 'env_check'
286
+
287
+ # Use the built-in rake task
288
+ rake env:check
289
+ ```
290
+
291
+ ---
292
+
293
+ ## ๐Ÿ”ง Configuration
294
+
295
+ ### Supported Types
296
+
297
+ - **`boolean`**: `true`, `false`, `1`, `0`, `yes`, `no` (case-insensitive)
298
+ - **`integer`**: Positive or negative integers (`123`, `-456`)
299
+ - **`url`**: URLs starting with `http://` or `https://`
300
+ - **`email`**: Valid email addresses
301
+ - **`string`**: Any value (default, no validation)
302
+
303
+ ### Configuration File
304
+
305
+ ```yaml
306
+ # config/env_check.yml
307
+ required:
308
+ - DATABASE_URL
309
+ - SECRET_KEY_BASE
310
+ - API_KEY
311
+
312
+ optional:
313
+ # Type validations
314
+ DEBUG: boolean
315
+ PORT: integer
316
+ API_URL: url
317
+ ADMIN_EMAIL: email
318
+
319
+ # Environment-specific
320
+ RAILS_ENV: string
321
+ RACK_ENV: string
322
+ ```
323
+
324
+ ### Smart Configuration Discovery
325
+
326
+ EnvCheck automatically discovers your configuration file using this priority:
327
+
328
+ 1. **`.env_check.yml`** (root level - simple projects, pairs with `.env`)
329
+ 2. **`config/env_check.yml`** (Rails convention - if `config/` directory exists)
330
+ 3. **Custom path** via `--config` flag or `ENV_CHECK_CONFIG` environment variable
331
+
332
+ ```bash
333
+ # Auto-discovery (checks .env_check.yml, then config/env_check.yml)
334
+ env_check check
335
+
336
+ # Explicit path
337
+ env_check check --config custom/path.yml
338
+
339
+ # Via environment variable
340
+ ENV_CHECK_CONFIG=custom/path.yml env_check check
341
+
342
+ # Via Ruby API
343
+ EnvCheck.verify("custom/path.yml")
344
+ ```
345
+
346
+ ---
347
+
348
+ ## ๐Ÿงช Testing
349
+
350
+ Run the test suite:
351
+
352
+ ```bash
353
+ bundle exec rspec
354
+ ```
355
+
356
+ Run linting:
357
+
358
+ ```bash
359
+ bundle exec rubocop
360
+ ```
361
+
362
+ ---
363
+
364
+ ## ๐Ÿค Contributing
365
+
366
+ 1. Fork it
367
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
368
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
369
+ 4. Push to the branch (`git push origin my-new-feature`)
370
+ 5. Create a new Pull Request
371
+
372
+ Please make sure to update tests and run the linter before submitting.
373
+
374
+ ---
375
+
376
+ ## ๐Ÿ“„ License
377
+
378
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
379
+
380
+ ---
381
+
382
+ ## ๐Ÿ™ Changelog
383
+
384
+ See [CHANGELOG.md](CHANGELOG.md) for version history and changes.