dotenvx-rails 0.0.2 → 4.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 393bea298ccd3e1e30b8b5bbdb30d4fe1964412a746c8c314dd781dba10295b6
4
- data.tar.gz: 2f1c6b220362d8afe878a17e31d66c39af726855eb63f6d20d085606f15b981f
3
+ metadata.gz: 6a84f85d61d0c88027432e8d06e3261d16a0035d7c3b19002fc2bd694975e62c
4
+ data.tar.gz: 90194575cd8abda69dd8ae9a89a5e9f08a5d0379f38bcc20564fb8419d6df7cd
5
5
  SHA512:
6
- metadata.gz: a299ce1c21682c67f3466158f03d7dcb4eef037d4d376496684b9b48f4ffae4994e5e6c6a4083ba87573c0a3d457262b3761399087b5fb116eb8ce9e4e849bb3
7
- data.tar.gz: b63420d1c96994cec9ef0abfa5b7285bcc2a5746f0afa6cfcfaee1b28b14954e94ca451772aa5d2426e1c0d6dc422dd9e7e8bf6cceb1b5c6d792516c653f21c8
6
+ metadata.gz: f5437720a3f28b7e3cfa55aeb0e8baff067e93fc1cf6e508ed7aed74590d98f6d57812d991844fe583116ede9f4f644201f37873c938a275b230026cfe1d7e09
7
+ data.tar.gz: 16d5428fbdce1ad387eb284193bac081744536cb74fb82d07acd51103a7409d3b71056b62d460a18c851568db6873cdfb38e3f01d85f11b2ec9ea36343c596dd
data/CHANGELOG.md CHANGED
@@ -2,7 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ## [Unreleased](https://github.com/dotenv-org/dotenvx-ruby/compare/v0.1.0...main)
5
+ ## [Unreleased](https://github.com/dotenvx/dotenvx-ruby/compare/v4.0.0...main)
6
+
7
+ ## [4.0.0](https://github.com/dotenvx/dotenvx-ruby/compare/v0.0.2...v4.0.0)
8
+
9
+ - Load plaintext and encrypted dotenv files through `dotenvx-primitives`.
10
+ - Bundle the Rust implementation as a Magnus native extension.
11
+ - Match the conventional Ruby dotenv loading, parsing, overwrite, and strict
12
+ missing-file APIs.
13
+ - Publish native `dotenvx` gems for Linux, macOS, and Windows from one tag.
6
14
 
7
15
  ## 0.1.0 and prior
8
16
 
data/README.md CHANGED
@@ -1,31 +1,83 @@
1
- >
2
- > Warning: work in progress. until complete, please use [github.com/dotenvx/dotenvx](https://github.com/dotenvx/dotenvx)
3
- >
4
-
5
1
  [![dotenvx](https://dotenvx.com/better-banner.png)](https://dotenvx.com)
6
2
 
7
- *a better dotenv*–from the creator of [`dotenv`](https://github.com/motdotla/dotenv).
8
-
9
- * run anywhere (cross-platform)
10
- * multi-environment
11
- * encrypted envs
12
-
13
-  
3
+ *a secure dotenvfrom the creator of [`dotenv`](https://github.com/motdotla/dotenv).*
14
4
 
5
+ `dotenvx` loads plaintext and encrypted dotenv files through the shared
6
+ [`dotenvx-primitives`](https://crates.io/crates/dotenvx-primitives) Rust
7
+ implementation. The native extension is bundled in the gem; users do not need
8
+ Node.js, a dotenvx CLI, or a Rust toolchain.
15
9
 
16
- ### Quickstart [![Gem Version](https://badge.fury.io/rb/dotenvx.svg)](https://badge.fury.io/rb/dotenvx)
17
-
18
- Install and use it in code just like ruby `dotenv`.
10
+ ## Install
19
11
 
20
12
  ```sh
21
13
  gem install dotenvx
22
14
  ```
15
+
16
+ Or add it to a Gemfile:
17
+
18
+ ```ruby
19
+ gem "dotenvx"
20
+ ```
21
+
22
+ ## Use
23
+
24
+ Load `.env` from the current directory:
25
+
23
26
  ```ruby
24
- # index.rb
25
27
  require "dotenvx/load"
28
+ ```
29
+
30
+ Or load explicitly:
31
+
32
+ ```ruby
33
+ require "dotenvx"
34
+
35
+ Dotenvx.load
36
+ Dotenvx.load(".env.local", ".env")
37
+ ```
38
+
39
+ Existing environment variables win by default:
40
+
41
+ ```ruby
42
+ Dotenvx.load(".env")
43
+ ```
44
+
45
+ To replace existing values:
46
+
47
+ ```ruby
48
+ Dotenvx.load(".env", overwrite: true)
49
+ Dotenvx.overwrite(".env")
50
+ ```
51
+
52
+ Parse without changing `ENV`:
26
53
 
27
- puts "Hello #{ENV["HELLO"]}"
54
+ ```ruby
55
+ values = Dotenvx.parse(".env")
28
56
  ```
29
57
 
30
-  
58
+ Raise when a file is missing:
59
+
60
+ ```ruby
61
+ Dotenvx.load!(".env")
62
+ ```
63
+
64
+ Require configuration keys:
65
+
66
+ ```ruby
67
+ Dotenvx.require_keys("DATABASE_URL", "SECRET_KEY")
68
+ ```
69
+
70
+ Encrypted values are decrypted automatically when the matching private key is
71
+ available through the process environment, `<filename>.keys`, or `.env.keys`.
72
+
73
+ ## Native platforms
74
+
75
+ Tagged releases publish variants of the same `dotenvx` gem for:
76
+
77
+ - Linux x86-64
78
+ - Linux ARM64
79
+ - macOS Intel
80
+ - macOS Apple Silicon
81
+ - Windows x64
31
82
 
83
+ RubyGems selects the correct variant during `gem install dotenvx`.
data/lib/dotenvx/rails.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require "dotenvx"
2
+ require "active_support/notifications"
3
+ require "rails/railtie"
4
+ require "pathname"
2
5
 
3
6
  # Fix for rake tasks loading in development
4
7
  #
@@ -30,9 +33,30 @@ rescue LoadError, ArgumentError
30
33
  end
31
34
 
32
35
  module Dotenvx
33
- class Railtie
36
+ class Railtie < Rails::Railtie
37
+ config.before_configuration { Dotenvx::Railtie.instance.load }
38
+
34
39
  def load
35
40
  Dotenvx.load(*dotenvx_files)
36
41
  end
42
+
43
+ private
44
+
45
+ def dotenvx_files
46
+ environment = Rails.env
47
+ files = [
48
+ root.join(".env.#{environment}.local")
49
+ ]
50
+ files << root.join(".env.local") unless environment == "test"
51
+ files.concat([
52
+ root.join(".env.#{environment}"),
53
+ root.join(".env")
54
+ ])
55
+ files
56
+ end
57
+
58
+ def root
59
+ Pathname.new(Rails.root || ENV["RAILS_ROOT"] || Dir.pwd)
60
+ end
37
61
  end
38
62
  end
data/lib/dotenvx-rails.rb CHANGED
@@ -1 +1,2 @@
1
+ require "dotenvx"
1
2
  require "dotenvx/rails"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotenvx-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - motdotla
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-10-18 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dotenvx
@@ -16,14 +15,28 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 0.0.2
18
+ version: 4.0.0
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 0.0.2
25
+ version: 4.0.0
26
+ - !ruby/object:Gem::Dependency
27
+ name: railties
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '5.0'
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: spring
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -59,21 +72,11 @@ executables: []
59
72
  extensions: []
60
73
  extra_rdoc_files: []
61
74
  files:
62
- - ".gitignore"
63
- - ".rspec"
64
75
  - CHANGELOG.md
65
- - DEVELOPMENT.md
66
- - Gemfile
67
- - Gemfile.lock
68
76
  - LICENSE
69
77
  - README.md
70
- - Rakefile
71
- - dotenvx-rails.gemspec
72
- - dotenvx.gemspec
73
78
  - lib/dotenvx-rails.rb
74
- - lib/dotenvx.rb
75
79
  - lib/dotenvx/rails.rb
76
- - lib/dotenvx/version.rb
77
80
  homepage: https://github.com/dotenvx/dotenvx-ruby
78
81
  licenses:
79
82
  - BSD-3-Clause
@@ -81,7 +84,6 @@ metadata:
81
84
  homepage_uri: https://github.com/dotenvx/dotenvx-ruby
82
85
  source_code_uri: https://github.com/dotenvx/dotenvx-ruby
83
86
  changelog_uri: https://github.com/dotenvx/dotenvx-ruby
84
- post_install_message:
85
87
  rdoc_options: []
86
88
  require_paths:
87
89
  - lib
@@ -89,15 +91,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
91
  requirements:
90
92
  - - ">="
91
93
  - !ruby/object:Gem::Version
92
- version: 2.3.0
94
+ version: 2.6.0
93
95
  required_rubygems_version: !ruby/object:Gem::Requirement
94
96
  requirements:
95
97
  - - ">="
96
98
  - !ruby/object:Gem::Version
97
99
  version: '0'
98
100
  requirements: []
99
- rubygems_version: 3.5.11
100
- signing_key:
101
+ rubygems_version: 3.6.9
101
102
  specification_version: 4
102
103
  summary: "[dotenvx.com] a better dotenv–from the creator of `dotenv`"
103
104
  test_files: []
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
- .DS_Store
13
- .byebug_history
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/DEVELOPMENT.md DELETED
@@ -1,4 +0,0 @@
1
- ## Development
2
-
3
- 1. Bump `dotenvx/version.rb` and tag version
4
- 2. rake release
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in dotenvx.gemspec
4
- gemspec name: "dotenvx"
5
- gemspec name: "dotenvx-rails"
6
-
7
- gem "rake", "~> 12.0"
8
- gem "rspec", "~> 3.0"
data/Gemfile.lock DELETED
@@ -1,42 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- dotenvx (0.0.1)
5
- dotenvx-rails (0.0.1)
6
- dotenvx (= 0.0.1)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- byebug (11.1.3)
12
- diff-lcs (1.5.1)
13
- rake (12.3.3)
14
- rspec (3.13.0)
15
- rspec-core (~> 3.13.0)
16
- rspec-expectations (~> 3.13.0)
17
- rspec-mocks (~> 3.13.0)
18
- rspec-core (3.13.1)
19
- rspec-support (~> 3.13.0)
20
- rspec-expectations (3.13.3)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.13.0)
23
- rspec-mocks (3.13.2)
24
- diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.13.0)
26
- rspec-support (3.13.1)
27
- spring (4.2.1)
28
-
29
- PLATFORMS
30
- arm64-darwin-23
31
- ruby
32
-
33
- DEPENDENCIES
34
- byebug
35
- dotenvx!
36
- dotenvx-rails!
37
- rake (~> 12.0)
38
- rspec (~> 3.0)
39
- spring
40
-
41
- BUNDLED WITH
42
- 2.5.11
data/Rakefile DELETED
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env rake
2
-
3
- require "bundler/gem_helper"
4
-
5
- namespace "dotenvx" do
6
- Bundler::GemHelper.install_tasks name: "dotenvx"
7
- end
8
-
9
- class DotenvxRailsGemHelper < Bundler::GemHelper
10
- def guard_already_tagged
11
- # noop
12
- end
13
-
14
- def tag_version
15
- # noop
16
- end
17
- end
18
-
19
- namespace "dotenvx-rails" do
20
- DotenvxRailsGemHelper.install_tasks name: "dotenvx-rails"
21
- end
22
-
23
- task build: ["dotenvx:build", "dotenvx-rails:build"]
24
- task install: ["dotenvx:install", "dotenvx-rails:install"]
25
- task release: ["dotenvx:release", "dotenvx-rails:release"]
26
-
27
- require "rspec/core/rake_task"
28
-
29
- desc "Run all specs"
30
- RSpec::Core::RakeTask.new(:spec) do |t|
31
- t.rspec_opts = %w[--color]
32
- t.verbose = false
33
- end
34
-
35
- task :default => :spec
@@ -1,32 +0,0 @@
1
- require_relative 'lib/dotenvx/version'
2
-
3
- Gem::Specification.new "dotenvx-rails" do |spec|
4
- spec.name = "dotenvx-rails"
5
- spec.version = Dotenvx::VERSION
6
- spec.authors = ["motdotla"]
7
- spec.email = ["mot@mot.la"]
8
-
9
- spec.summary = %q{[dotenvx.com] a better dotenv–from the creator of `dotenv`}
10
- spec.description = %q{[dotenvx.com] a better dotenv–from the creator of `dotenv`}
11
- spec.homepage = "https://github.com/dotenvx/dotenvx-ruby"
12
- spec.license = "BSD-3-Clause"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
-
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://github.com/dotenvx/dotenvx-ruby"
17
- spec.metadata["changelog_uri"] = "https://github.com/dotenvx/dotenvx-ruby"
18
-
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
- end
24
- spec.bindir = "exe"
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
27
-
28
- spec.add_dependency "dotenvx", Dotenvx::VERSION
29
-
30
- spec.add_development_dependency "spring"
31
- spec.add_development_dependency "byebug"
32
- end
data/dotenvx.gemspec DELETED
@@ -1,31 +0,0 @@
1
- require_relative 'lib/dotenvx/version'
2
-
3
- Gem::Specification.new "dotenvx" do |spec|
4
- spec.name = "dotenvx"
5
- spec.version = Dotenvx::VERSION
6
- spec.authors = ["motdotla"]
7
- spec.email = ["mot@mot.la"]
8
-
9
- spec.summary = %q{[dotenvx.com] a better dotenv–from the creator of `dotenv`}
10
- spec.description = %q{[dotenvx.com] a better dotenv–from the creator of `dotenv`}
11
- spec.homepage = "https://github.com/dotenvx/dotenvx-ruby"
12
- spec.license = "BSD-3-Clause"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
-
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://github.com/dotenvx/dotenvx-ruby"
17
- spec.metadata["changelog_uri"] = "https://github.com/dotenvx/dotenvx-ruby"
18
-
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
- end
24
- spec.bindir = "exe"
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
27
-
28
- spec.add_development_dependency "rake"
29
- spec.add_development_dependency "rspec"
30
- spec.add_development_dependency "byebug"
31
- end
@@ -1,3 +0,0 @@
1
- module Dotenvx
2
- VERSION = "0.0.2"
3
- end
data/lib/dotenvx.rb DELETED
@@ -1,7 +0,0 @@
1
- require "dotenvx/version"
2
-
3
- module Dotenvx
4
- def load(*filenames)
5
- raise "go to [github.com/dotenvx/dotenvx] and follow ruby directions there"
6
- end
7
- end