vagrant-dotenv 0.1.0.dev

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
+ SHA1:
3
+ metadata.gz: dc92588d7cd7a7509cbbe4938c5c2792d99d7672
4
+ data.tar.gz: 476f0cdd376c9ef3b44ca9e1b15dfe00321b55f9
5
+ SHA512:
6
+ metadata.gz: 0b09d46de9000b1060658ac481f851c1ca6e6cf3bfdc9e0204c12bfc93ff842ca1e0bfa6a6a0c8b305f81dac58f5907df308bd0d2df5a0607310f787675d86e6
7
+ data.tar.gz: 58c9ebe5f8ed2b8864e91cbb91dedf60efec49f3559229559468ca1753289d3ab99e27dea00d906b6697a6ecb5edb2f6eeaa0824fd0fbeae6fd35639cf8ba16d
data/.coveralls.yml ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ service_name: travis-pro
3
+ repo_token: c2swnhe3dMAzbAxzpDPBwCOwqASIvLdYf
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ .bin/
18
+ tmp/
19
+ bundle/
20
+ vendor/
21
+ bin/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ ---
2
+ language: ruby
3
+ script: rake test
4
+ branches:
5
+ only:
6
+ - master
7
+ rvm:
8
+ - 2.1.0
9
+ - 2.0.0
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: ruby-head
13
+
data/Gemfile ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ source 'https://rubygems.org'
3
+ ruby '2.0.0'
4
+
5
+ gemspec
6
+
7
+ gem 'coveralls', require: false
8
+ gem 'rake'
9
+ gem 'minitest'
10
+
11
+ group :development do
12
+ gem 'guard-minitest'
13
+ end
14
+
15
+ group :integration do
16
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant',
17
+ ref: ENV.fetch('VAGRANT_VERSION', 'v1.5.0')
18
+ end
19
+
20
+ group :plugins do
21
+ gem 'vagrant-dotenv', path: '.'
22
+ end
23
+
24
+
data/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ Copyright 2014 John Bellone (<john.bellone.jr@gmail.com>)
2
+ Copyright 2014 Bloomberg Finance L.P.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # vagrant-dotenv
2
+ [![Gem Version](https://badge.fury.io/rb/vagrant-dotenv.png)](http://badge.fury.io/rb/vagrant-dotenv)
3
+ [![Build Status](https://travis-ci.org/johnbellone/vagrant-dotenv.png?branch=master)](https://travis-ci.org/johnbellone/vagrant-dotenv)
4
+ [![Dependency Status](https://gemnasium.com/johnbellone/vagrant-dotenv.png)](https://gemnasium.com/johnbellone/vagrant-dotenv)
5
+ [![Code Climate](https://codeclimate.com/github/johnbellone/vagrant-dotenv.png)](https://codeclimate.com/github/johnbellone/vagrant-dotenv)
6
+ [![Coverage Status](https://coveralls.io/repos/johnbellone/vagrant-dotenv/badge.png)](https://coveralls.io/r/johnbellone/vagrant-dotenv)
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ vagraint plugin install vagrant-dotenv
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```rb
17
+ Vagrant.configure('2') do |config|
18
+ config.dotenv.enabled = true
19
+ end
20
+ ```
21
+
22
+ ```bash
23
+ CHEF_ENV=test
24
+ HTTP_PROXY=$HTTP_PROXY
25
+ ```
26
+
27
+ ## Authors
28
+ - John Bellone - [@johnbellone][1] - (<[john.bellone.jr@gmail.com](mailto:john.bellone.jr+vagrant-dotenv@gmail.com)>)
29
+
30
+ [1]: https://twitter.com/johnbellone/
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # coding: utf-8
2
+ require 'bundler/gem_tasks'
3
+
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new do |t|
6
+ t.pattern = 'test/**/*_test.rb'
7
+ t.libs = ['lib', 'test']
8
+ end
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ module VagrantPlugins
3
+ module Dotenv
4
+ class IsEnabled
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ env[:result] = plugin_enabled?(env[:machine].config.proxy)
11
+ @app.call(env)
12
+ end
13
+
14
+ private
15
+
16
+ def plugin_enabled?(config)
17
+ config.enabled and config.enabled != ''
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ module VagrantPlugins
3
+ module Dotenv
4
+ class LoadEnvironment
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ config = env[:machine].config
11
+
12
+ if config.dotenv.load_files
13
+ Dotenv.load(config.dotenv.load_files)
14
+ else
15
+ Dotenv.load(env.root_path.join('.env'))
16
+ Dotenv.load(env.user_path.join('.env'))
17
+ end
18
+
19
+ if config.dotenv.overload_files
20
+ Dotenv.load(config.dotenv.overload_files)
21
+ end
22
+
23
+ @app.call(env)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ require 'vagrant/action/builtin/call'
3
+ require 'vagrant-dotenv/action/is_enabled'
4
+ require 'vagrant-dotenv/action/load_environment'
5
+
6
+ module VagrantPlugins
7
+ module Dotenv
8
+ class Action
9
+ def self.configure(opts = {})
10
+ Vagrant::Action::Builder.new.tap do |b|
11
+ b.use Builtin::Call, IsEnabled do |env, b1|
12
+ next unless env[:result]
13
+ b1.use LoadEnvironment
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ module VagrantPlugins
3
+ module Dotenv
4
+ # Default onfiguration for the dotenv configuration.
5
+ #
6
+ # @!parse class Config < Vagrant::Plugin::V2::Config; end
7
+ class Config < Vagrant.plugin('2', :config)
8
+ # Defines the mode of the plugin.
9
+ # @return [Boolean]
10
+ key :enabled, env_var: 'VAGRANT_DOTENV'
11
+
12
+ # @return [Array]
13
+ key :load_files
14
+
15
+ # @return [Array]
16
+ key :overload_files
17
+
18
+ def initialize
19
+ @enabled = UNSET_VALUE
20
+ @load_files = UNSET_VALUE
21
+ @overload_files = UNSET_VALUE
22
+ end
23
+
24
+ def finalize!
25
+ @enabled = false if @enabled == UNSET_VALUE
26
+ @load_files = nil if @load_files == UNSET_VALUE
27
+ @overload_files = nil if @load_files == UNSET_VALUE
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ module VagrantPlugins
3
+ module Dotenv
4
+ class Plugin < Vagrant.plugin('2')
5
+ # Compatible Vagrant versions.
6
+ VAGRANT_VERSION_REQUIREMENT = '>= 1.5.0'
7
+
8
+ name 'vagrant-dotenv'
9
+ description ''
10
+
11
+ config 'dotenv' do
12
+ require 'vagrant-dotenv/config'
13
+ Config
14
+ end
15
+
16
+ action_hook 'dotenv_configure', :environment_load do |hook|
17
+ require 'vagrant-dotenv/action'
18
+ hook.before Action.configure
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,6 @@
1
+ # coding: utf-8
2
+ module VagrantPlugins
3
+ module Dotenv
4
+ VERSION = '0.1.0.dev'
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ # coding: utf-8
2
+ require 'vagrant-dotenv/plugin'
3
+ require 'vagrant-dotenv/version'
4
+ module VagrantPlugins
5
+ module Dotenv
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # coding: utf-8
2
+ require 'minitest/autorun'
3
+ require 'coveralls'
4
+ Coveralls.wear!
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ $:.unshift(File.expand_path('../lib', __FILE__))
3
+ require 'vagrant-dotenv/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'vagrant-dotenv'
7
+ spec.version = VagrantPlugins::Dotenv::VERSION
8
+ spec.authors = ['John Bellone']
9
+ spec.description = 'A Vagrant plugin which configures environment variables.'
10
+ spec.summary = spec.description
11
+ spec.homepage = 'https://github.com/johnbellone/vagrant-dotenv'
12
+ spec.license = 'Apache 2.0'
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_dependency 'dotenv', '~> 0.10'
20
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-dotenv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.dev
5
+ platform: ruby
6
+ authors:
7
+ - John Bellone
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-13 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.10'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.10'
27
+ description: A Vagrant plugin which configures environment variables.
28
+ email:
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .coveralls.yml
34
+ - .gitignore
35
+ - .ruby-version
36
+ - .travis.yml
37
+ - Gemfile
38
+ - LICENSE
39
+ - README.md
40
+ - Rakefile
41
+ - lib/vagrant-dotenv.rb
42
+ - lib/vagrant-dotenv/action.rb
43
+ - lib/vagrant-dotenv/action/is_enabled.rb
44
+ - lib/vagrant-dotenv/action/load_environment.rb
45
+ - lib/vagrant-dotenv/config.rb
46
+ - lib/vagrant-dotenv/plugin.rb
47
+ - lib/vagrant-dotenv/version.rb
48
+ - test/test_helper.rb
49
+ - vagrant-dotenv.gemspec
50
+ homepage: https://github.com/johnbellone/vagrant-dotenv
51
+ licenses:
52
+ - Apache 2.0
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>'
66
+ - !ruby/object:Gem::Version
67
+ version: 1.3.1
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.0.14
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: A Vagrant plugin which configures environment variables.
74
+ test_files:
75
+ - test/test_helper.rb