├── .gitignore ├── Changelog.md ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── dotenv-deployment.gemspec └── lib └── dotenv ├── deployment.rb └── deployment ├── capistrano.rb ├── capistrano └── recipes.rb └── version.rb /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | .bundle 4 | .config 5 | .yardoc 6 | .idea 7 | Gemfile.lock 8 | InstalledFiles 9 | _yardoc 10 | coverage 11 | doc/ 12 | lib/bundler/man 13 | pkg 14 | rdoc 15 | spec/reports 16 | test/tmp 17 | test/version_tmp 18 | tmp 19 | -------------------------------------------------------------------------------- /Changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.3.0 - Mar 5, 2014 4 | 5 | * This gem is now deprecated. 6 | 7 | ## 0.2.0 - Oct 3, 2014 8 | 9 | * Declare dependency on dotenv ~>1.0 10 | 11 | * Fix ruby warnings [#12](https://github.com/bkeepers/dotenv-deployment/pull/12) 12 | 13 | * Capistrano 2: fix `set :dotenv_role` ([#15](https://github.com/bkeepers/dotenv-deployment/pull/15)) 14 | 15 | [Full Changelog](https://github.com/bkeepers/dotenv-deployment/compare/v0.0.2...v0.2.0) 16 | 17 | ## 0.0.2 - Apr 22, 2014 18 | 19 | * Fix syntax errors after extracting from `dotenv` 20 | 21 | [Full Changelog](https://github.com/bkeepers/dotenv-deployment/compare/v0.0.1...v0.0.2) 22 | 23 | ## 0.0.1 - Apr 21, 2014 24 | 25 | * Extract from https://github.com/bkeepers/dotenv 26 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gemspec 3 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Brandon Keepers 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dotenv-deployment 2 | 3 | **This gem is deprecated and no longer maintained. Use `dotenv-rails`, or manually configure [dotenv](https://github.com/bkeepers/dotenv) to meet your own needs.** 4 | 5 | If the environment files for your Rails application are in `config`, add the following lines to `config/application.rb` to maintain the behavior that this gem provided. 6 | 7 | ```ruby 8 | # Load defaults from config/*.env in config 9 | Dotenv.load *Dir.glob(Rails.root.join("config/**/*.env"), File::FNM_DOTMATCH) 10 | 11 | # Override any existing variables if an environment-specific file exists 12 | Dotenv.overload *Dir.glob(Rails.root.join("config/**/*.env.#{Rails.env}"), File::FNM_DOTMATCH) 13 | ``` 14 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | -------------------------------------------------------------------------------- /dotenv-deployment.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'dotenv/deployment/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "dotenv-deployment" 8 | spec.version = Dotenv::Deployment::VERSION 9 | spec.authors = ["Brandon Keepers"] 10 | spec.email = ["brandon@opensoul.org"] 11 | spec.summary = %q{Deployment concerns for dotenv} 12 | spec.homepage = "https://github.com/bkeepers/dotenv-deployment" 13 | spec.license = "MIT" 14 | 15 | spec.files = `git ls-files`.split($/) 16 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 17 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 18 | spec.require_paths = ["lib"] 19 | 20 | spec.add_dependency "dotenv", "~>1.0" 21 | 22 | spec.add_development_dependency "bundler", "~> 1.5" 23 | spec.add_development_dependency "rake" 24 | end 25 | -------------------------------------------------------------------------------- /lib/dotenv/deployment.rb: -------------------------------------------------------------------------------- 1 | require "dotenv" 2 | require "dotenv/deployment/version" 3 | 4 | warn "[DEPRECATION] the dotenv-deployment gem is deprecated. See https://github.com/bkeepers/dotenv-deployment#readme." 5 | 6 | rails_root = Rails.root || Dir.pwd if defined?(Rails) 7 | 8 | # Load defaults from .env or *.env in config 9 | Dotenv.load('.env') 10 | Dotenv.load(*Dir.glob("#{rails_root}/config/**/*.env")) if defined?(Rails) 11 | 12 | # Override any existing variables if an environment-specific file exists 13 | if environment = ENV['RACK_ENV'] || (defined?(Rails) && Rails.env) 14 | Dotenv.overload(".env.#{environment}") 15 | if defined?(Rails) 16 | config_env = Dir.glob("#{rails_root}/config/**/*.env.#{environment}", File::FNM_DOTMATCH) 17 | Dotenv.overload(*config_env) if config_env.any? 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/dotenv/deployment/capistrano.rb: -------------------------------------------------------------------------------- 1 | require 'capistrano/version' 2 | 3 | if defined?(Capistrano::VERSION) && Capistrano::VERSION >= '3.0' 4 | raise 'Please read https://github.com/bkeepers/dotenv-deployment#capistrano to update your dotenv configuration for new Capistrano version' 5 | else 6 | require 'dotenv/deployment/capistrano/recipes' 7 | 8 | Capistrano::Configuration.instance(:must_exist).load do 9 | before "deploy:finalize_update", "dotenv:symlink" 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/dotenv/deployment/capistrano/recipes.rb: -------------------------------------------------------------------------------- 1 | Capistrano::Configuration.instance(:must_exist).load do 2 | _cset(:dotenv_path){ "#{shared_path}/.env" } 3 | 4 | symlink_args = (role = fetch(:dotenv_role, nil)) ? {:roles => role} : {} 5 | 6 | namespace :dotenv do 7 | desc "Symlink shared .env to current release" 8 | task :symlink, symlink_args do 9 | run "ln -nfs #{dotenv_path} #{release_path}/.env" 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/dotenv/deployment/version.rb: -------------------------------------------------------------------------------- 1 | module Dotenv 2 | module Deployment 3 | VERSION = "0.3.0" 4 | end 5 | end 6 | --------------------------------------------------------------------------------