dotenv-vault 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: effd735e13857beefb685220de3bcba69e2d7f62162edbb1faed3b402bceae8c
4
- data.tar.gz: 2961f1d13f73c56d466cda014e32b93a52ba43ae41348641abdd1ceb208bd9a8
3
+ metadata.gz: 7ddafd09fac193dd83a1c76f0a11e5f5fb04a9aa5b253fbe1f2b5e1b47684611
4
+ data.tar.gz: 49ba45a8181eba3ed776c0402b79a198f69a8c76523e35575cc54665fa7d7c06
5
5
  SHA512:
6
- metadata.gz: '0993065198f2ce6f0f97c9956d490e4a3beec8b8de8f9f32f06fea9f7f1873677c026526d77c5989880e9ef5296a5479ba8dc1e5513258b028861f7964f9c560'
7
- data.tar.gz: e82c1f60efa004c8a50454d90422e45ef769322fe6c68b651a719689c444316a19cd499127e6befd6e1e70f7431c65a222d928d81e28b7edebdf17f65ca62312
6
+ metadata.gz: 6e144676abf085056476feb7d59ff9b8d87766364278583201116de8bb0914743588717e2fe8fff87c602f31569f5ccf8016055fc17fa32a67f3677d2e2101f9
7
+ data.tar.gz: f3dce2ed0938a011a3bf274f026294bf67a00e0c361a3bde806e8e9202805e43424103c5eee42a2268f29b4b2725a6be55e215cfa53ff82c27a32e50b8ae8944
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  .DS_Store
13
+ .byebug_history
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in dotenv-crypto.gemspec
4
- gemspec
3
+ # Specify your gem's dependencies in dotenv-vault.gemspec
4
+ gemspec name: "dotenv-vault"
5
+ gemspec name: "dotenv-vault-rails"
5
6
 
6
7
  gem "rake", "~> 12.0"
7
8
  gem "rspec", "~> 3.0"
data/Gemfile.lock CHANGED
@@ -1,12 +1,69 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dotenv-vault (0.1.0)
4
+ dotenv-vault (0.2.0)
5
+ dotenv
6
+ dotenv-vault-rails (0.2.0)
7
+ dotenv-rails
5
8
 
6
9
  GEM
7
10
  remote: https://rubygems.org/
8
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)
9
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)
10
67
  rake (12.3.3)
11
68
  rspec (3.11.0)
12
69
  rspec-core (~> 3.11.0)
@@ -21,14 +78,22 @@ GEM
21
78
  diff-lcs (>= 1.2.0, < 2.0)
22
79
  rspec-support (~> 3.11.0)
23
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)
24
86
 
25
87
  PLATFORMS
26
88
  ruby
27
89
 
28
90
  DEPENDENCIES
91
+ byebug
29
92
  dotenv-vault!
93
+ dotenv-vault-rails!
30
94
  rake (~> 12.0)
31
95
  rspec (~> 3.0)
96
+ spring
32
97
 
33
98
  BUNDLED WITH
34
99
  2.1.4
data/Rakefile CHANGED
@@ -1,6 +1,35 @@
1
- require "bundler/gem_tasks"
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
+
2
27
  require "rspec/core/rake_task"
3
28
 
4
- RSpec::Core::RakeTask.new(:spec)
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
5
34
 
6
35
  task :default => :spec
@@ -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
@@ -1,6 +1,6 @@
1
- require_relative 'lib/dotenv_vault/version'
1
+ require_relative 'lib/dotenv-vault/version'
2
2
 
3
- Gem::Specification.new do |spec|
3
+ Gem::Specification.new "dotenv-vault" do |spec|
4
4
  spec.name = "dotenv-vault"
5
5
  spec.version = DotenvVault::VERSION
6
6
  spec.authors = ["motdotla"]
@@ -8,11 +8,10 @@ Gem::Specification.new do |spec|
8
8
 
9
9
  spec.summary = %q{dotenv-vault}
10
10
  spec.description = %q{dotenv-vault}
11
- spec.homepage = "https://dotenv.org"
11
+ spec.homepage = "https://github.com/dotenv-org/dotenv-vault-ruby"
12
12
  spec.license = "MIT"
13
13
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
14
 
15
- # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
16
15
  spec.metadata["homepage_uri"] = spec.homepage
17
16
  spec.metadata["source_code_uri"] = "https://github.com/dotenv-org/dotenv-vault-ruby"
18
17
  spec.metadata["changelog_uri"] = "https://github.com/dotenv-org/dotenv-vault-ruby"
@@ -25,4 +24,10 @@ Gem::Specification.new do |spec|
25
24
  spec.bindir = "exe"
26
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
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"
28
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
@@ -1,3 +1,3 @@
1
1
  module DotenvVault
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
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 CHANGED
@@ -1,15 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotenv-vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - motdotla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-13 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-09-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dotenv
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: rake
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: rspec
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
+ - !ruby/object:Gem::Dependency
56
+ name: byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
13
69
  description: dotenv-vault
14
70
  email:
15
71
  - mot@mot.la
@@ -27,14 +83,17 @@ files:
27
83
  - Rakefile
28
84
  - bin/console
29
85
  - bin/setup
30
- - dotenv-crypto.gemspec
31
- - lib/dotenv_vault.rb
32
- - lib/dotenv_vault/version.rb
33
- homepage: https://dotenv.org
86
+ - dotenv-vault-rails.gemspec
87
+ - dotenv-vault.gemspec
88
+ - lib/dotenv-vault-rails.rb
89
+ - lib/dotenv-vault.rb
90
+ - lib/dotenv-vault/rails.rb
91
+ - lib/dotenv-vault/version.rb
92
+ homepage: https://github.com/dotenv-org/dotenv-vault-ruby
34
93
  licenses:
35
94
  - MIT
36
95
  metadata:
37
- homepage_uri: https://dotenv.org
96
+ homepage_uri: https://github.com/dotenv-org/dotenv-vault-ruby
38
97
  source_code_uri: https://github.com/dotenv-org/dotenv-vault-ruby
39
98
  changelog_uri: https://github.com/dotenv-org/dotenv-vault-ruby
40
99
  post_install_message:
data/lib/dotenv_vault.rb DELETED
@@ -1,5 +0,0 @@
1
- require "dotenv_vault/version"
2
-
3
- module DotenvVault
4
- class Error < StandardError; end
5
- end