dotenv-vault-rails 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8a499154451ba66a67fb3ece71dc30da4b7783c643f6feb6b6fc69dbd6fd474f
4
+ data.tar.gz: b949fcf0b583ee543795e208b384770c3d2cf1a2dcbadb43e4d6f7b1ccbe0588
5
+ SHA512:
6
+ metadata.gz: 1be0f5896305aa9a4041a927bd9a2ce4ea1e3896b5dd1fa985e24bce8da0d43b27f2a5fc05eabcb5d5e8790f5d60b66743312ec6bc7e2483a6f9c823d51a1ba7
7
+ data.tar.gz: '058d483c92eb4315b85de5da3ec387dd003c6fc5c666e0cc500f305ceffb597f4a8916c5e6b5de7987eb796584a3cd0a72f94cad28a7ed9d5b7fcbcde4ed4dce'
data/.gitignore ADDED
@@ -0,0 +1,13 @@
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 ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.3
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in dotenv-vault.gemspec
4
+ gemspec name: "dotenv-vault"
5
+ gemspec name: "dotenv-vault-rails"
6
+
7
+ gem "rake", "~> 12.0"
8
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,99 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dotenv-vault (0.2.0)
5
+ dotenv
6
+ dotenv-vault-rails (0.2.0)
7
+ dotenv-rails
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionpack (7.0.4)
13
+ actionview (= 7.0.4)
14
+ activesupport (= 7.0.4)
15
+ rack (~> 2.0, >= 2.2.0)
16
+ rack-test (>= 0.6.3)
17
+ rails-dom-testing (~> 2.0)
18
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
+ actionview (7.0.4)
20
+ activesupport (= 7.0.4)
21
+ builder (~> 3.1)
22
+ erubi (~> 1.4)
23
+ rails-dom-testing (~> 2.0)
24
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
+ activesupport (7.0.4)
26
+ concurrent-ruby (~> 1.0, >= 1.0.2)
27
+ i18n (>= 1.6, < 2)
28
+ minitest (>= 5.1)
29
+ tzinfo (~> 2.0)
30
+ builder (3.2.4)
31
+ byebug (11.1.3)
32
+ concurrent-ruby (1.1.10)
33
+ crass (1.0.6)
34
+ diff-lcs (1.5.0)
35
+ dotenv (2.8.1)
36
+ dotenv-rails (2.8.1)
37
+ dotenv (= 2.8.1)
38
+ railties (>= 3.2)
39
+ erubi (1.11.0)
40
+ i18n (1.12.0)
41
+ concurrent-ruby (~> 1.0)
42
+ loofah (2.19.0)
43
+ crass (~> 1.0.2)
44
+ nokogiri (>= 1.5.9)
45
+ method_source (1.0.0)
46
+ mini_portile2 (2.8.0)
47
+ minitest (5.16.3)
48
+ nokogiri (1.13.8)
49
+ mini_portile2 (~> 2.8.0)
50
+ racc (~> 1.4)
51
+ racc (1.6.0)
52
+ rack (2.2.4)
53
+ rack-test (2.0.2)
54
+ rack (>= 1.3)
55
+ rails-dom-testing (2.0.3)
56
+ activesupport (>= 4.2.0)
57
+ nokogiri (>= 1.6)
58
+ rails-html-sanitizer (1.4.3)
59
+ loofah (~> 2.3)
60
+ railties (7.0.4)
61
+ actionpack (= 7.0.4)
62
+ activesupport (= 7.0.4)
63
+ method_source
64
+ rake (>= 12.2)
65
+ thor (~> 1.0)
66
+ zeitwerk (~> 2.5)
67
+ rake (12.3.3)
68
+ rspec (3.11.0)
69
+ rspec-core (~> 3.11.0)
70
+ rspec-expectations (~> 3.11.0)
71
+ rspec-mocks (~> 3.11.0)
72
+ rspec-core (3.11.0)
73
+ rspec-support (~> 3.11.0)
74
+ rspec-expectations (3.11.0)
75
+ diff-lcs (>= 1.2.0, < 2.0)
76
+ rspec-support (~> 3.11.0)
77
+ rspec-mocks (3.11.1)
78
+ diff-lcs (>= 1.2.0, < 2.0)
79
+ rspec-support (~> 3.11.0)
80
+ rspec-support (3.11.0)
81
+ spring (4.0.0)
82
+ thor (1.2.1)
83
+ tzinfo (2.0.5)
84
+ concurrent-ruby (~> 1.0)
85
+ zeitwerk (2.6.0)
86
+
87
+ PLATFORMS
88
+ ruby
89
+
90
+ DEPENDENCIES
91
+ byebug
92
+ dotenv-vault!
93
+ dotenv-vault-rails!
94
+ rake (~> 12.0)
95
+ rspec (~> 3.0)
96
+ spring
97
+
98
+ BUNDLED WITH
99
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Scott Motte
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.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # dotenv-vault
2
+
3
+ Coming soon
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "bundler/gem_helper"
4
+
5
+ namespace "dotenv-vault" do
6
+ Bundler::GemHelper.install_tasks name: "dotenv-vault"
7
+ end
8
+
9
+ class DotenvVaultRailsGemHelper < 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 "dotenv-vault-rails" do
20
+ DotenvVaultRailsGemHelper.install_tasks name: "dotenv-vault-rails"
21
+ end
22
+
23
+ task build: ["dotenv-vault:build", "dotenv-vault-rails:build"]
24
+ task install: ["dotenv-vault:install", "dotenv-vault-rails:install"]
25
+ task release: ["dotenv-vault:release", "dotenv-vault-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
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dotenv/crypto"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ require_relative 'lib/dotenv-vault/version'
2
+
3
+ Gem::Specification.new "dotenv-vault-rails" do |spec|
4
+ spec.name = "dotenv-vault-rails"
5
+ spec.version = DotenvVault::VERSION
6
+ spec.authors = ["motdotla"]
7
+ spec.email = ["mot@mot.la"]
8
+
9
+ spec.summary = %q{dotenv-vault-rails}
10
+ spec.description = %q{dotenv-vault-rails}
11
+ spec.homepage = "https://github.com/dotenv-org/dotenv-vault-ruby"
12
+ spec.license = "MIT"
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/dotenv-org/dotenv-vault-ruby"
17
+ spec.metadata["changelog_uri"] = "https://github.com/dotenv-org/dotenv-vault-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 "dotenv-rails"
29
+
30
+ spec.add_development_dependency "spring"
31
+ spec.add_development_dependency "byebug"
32
+ end
@@ -0,0 +1,33 @@
1
+ require_relative 'lib/dotenv-vault/version'
2
+
3
+ Gem::Specification.new "dotenv-vault" do |spec|
4
+ spec.name = "dotenv-vault"
5
+ spec.version = DotenvVault::VERSION
6
+ spec.authors = ["motdotla"]
7
+ spec.email = ["mot@mot.la"]
8
+
9
+ spec.summary = %q{dotenv-vault}
10
+ spec.description = %q{dotenv-vault}
11
+ spec.homepage = "https://github.com/dotenv-org/dotenv-vault-ruby"
12
+ spec.license = "MIT"
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/dotenv-org/dotenv-vault-ruby"
17
+ spec.metadata["changelog_uri"] = "https://github.com/dotenv-org/dotenv-vault-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 "dotenv"
29
+
30
+ spec.add_development_dependency "rake"
31
+ spec.add_development_dependency "rspec"
32
+ spec.add_development_dependency "byebug"
33
+ end
@@ -0,0 +1,63 @@
1
+ require "dotenv"
2
+
3
+ # Fix for rake tasks loading in development
4
+ #
5
+ # Dotenv loads environment variables when the Rails application is initialized.
6
+ # When running `rake`, the Rails application is initialized in development.
7
+ # Rails includes some hacks to set `RAILS_ENV=test` when running `rake test`,
8
+ # but rspec does not include the same hacks.
9
+ #
10
+ # See https://github.com/bkeepers/dotenv/issues/219
11
+ if defined?(Rake.application)
12
+ task_regular_expression = /^(default$|parallel:spec|spec(:|$))/
13
+ if Rake.application.top_level_tasks.grep(task_regular_expression).any?
14
+ environment = Rake.application.options.show_tasks ? "development" : "test"
15
+ Rails.env = ENV["RAILS_ENV"] ||= environment
16
+ end
17
+ end
18
+
19
+ DotenvVault.instrumenter = ActiveSupport::Notifications
20
+
21
+ # Watch all loaded env files with Spring
22
+ begin
23
+ require "spring/commands"
24
+ ActiveSupport::Notifications.subscribe(/^dotenv/) do |*args|
25
+ event = ActiveSupport::Notifications::Event.new(*args)
26
+ Spring.watch event.payload[:env].filename if Rails.application
27
+ end
28
+ rescue LoadError, ArgumentError
29
+ # Spring is not available
30
+ end
31
+
32
+ module DotenvVault
33
+ class Railtie < Rails::Railtie
34
+ def load
35
+ Dotenv.load(*dotenv_files)
36
+ end
37
+
38
+ def overload
39
+ Dotenv.overload(*dotenv_files)
40
+ end
41
+
42
+ def root
43
+ Rails.root || Pathname.new(ENV["RAILS_ROOT"] || Dir.pwd)
44
+ end
45
+
46
+ def self.load
47
+ instance.load
48
+ end
49
+
50
+ private
51
+
52
+ def dotenv_files
53
+ [
54
+ root.join(".env.#{Rails.env}.local"),
55
+ (root.join(".env.local") unless Rails.env.test?),
56
+ root.join(".env.#{Rails.env}"),
57
+ root.join(".env")
58
+ ].compact
59
+ end
60
+
61
+ config.before_configuration { load }
62
+ end
63
+ end
@@ -0,0 +1,3 @@
1
+ module DotenvVault
2
+ VERSION = "0.2.0"
3
+ end
@@ -0,0 +1 @@
1
+ require "dotenv-vault/rails"
@@ -0,0 +1,55 @@
1
+ require "dotenv"
2
+ require "dotenv-vault/version"
3
+
4
+ module DotenvVault
5
+ class Error < StandardError; end
6
+
7
+ class << self
8
+ attr_accessor :instrumenter
9
+ end
10
+
11
+ module_function
12
+
13
+ def load(*filenames)
14
+ Dotenv.load(*filenames)
15
+ end
16
+
17
+ # same as `load`, but raises Errno::ENOENT if any files don't exist
18
+ def load!(*filenames)
19
+ Dotenv.load!(*filenames)
20
+ end
21
+
22
+ # same as `load`, but will override existing values in `ENV`
23
+ def overload(*filenames)
24
+ Dotenv.overload(*filenames)
25
+ end
26
+
27
+ # same as `overload`, but raises Errno:ENOENT if any files don't exist
28
+ def overload!(*filenames)
29
+ Dotenv.overload!(*filenames)
30
+ end
31
+
32
+ # returns a hash of parsed key/value pairs but does not modify ENV
33
+ def parse(*filenames)
34
+ Dotenv.parse(*filenames)
35
+ end
36
+
37
+ # Internal: Helper to expand list of filenames.
38
+ #
39
+ # Returns a hash of all the loaded environment variables.
40
+ def with(*filenames)
41
+ Dotenv.with(*filenames)
42
+ end
43
+
44
+ def instrument(name, payload = {}, &block)
45
+ Dotenv.instrument(name, payload = {}, &block)
46
+ end
47
+
48
+ def require_keys(*keys)
49
+ Dotenv.require_keys(*keys)
50
+ end
51
+
52
+ def ignoring_nonexistent_files
53
+ Dotenv.ignoring_nonexistent_files
54
+ end
55
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dotenv-vault-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - motdotla
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-09-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dotenv-rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: spring
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: dotenv-vault-rails
56
+ email:
57
+ - mot@mot.la
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - dotenv-vault-rails.gemspec
73
+ - dotenv-vault.gemspec
74
+ - lib/dotenv-vault-rails.rb
75
+ - lib/dotenv-vault.rb
76
+ - lib/dotenv-vault/rails.rb
77
+ - lib/dotenv-vault/version.rb
78
+ homepage: https://github.com/dotenv-org/dotenv-vault-ruby
79
+ licenses:
80
+ - MIT
81
+ metadata:
82
+ homepage_uri: https://github.com/dotenv-org/dotenv-vault-ruby
83
+ source_code_uri: https://github.com/dotenv-org/dotenv-vault-ruby
84
+ changelog_uri: https://github.com/dotenv-org/dotenv-vault-ruby
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 2.3.0
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubygems_version: 3.1.6
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: dotenv-vault-rails
104
+ test_files: []