mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
New plugin env.rb to make env vars available in templates
This commit is contained in:
parent
e4b8f0c7dd
commit
adef074df5
2 changed files with 24 additions and 0 deletions
|
@ -3,5 +3,9 @@ rvm:
|
||||||
- "2.0.0"
|
- "2.0.0"
|
||||||
sudo: false
|
sudo: false
|
||||||
cache: bundler
|
cache: bundler
|
||||||
|
env:
|
||||||
|
# http://docs.travis-ci.com/user/environment-variables/#Global-Variables
|
||||||
|
global:
|
||||||
|
- BITCOINORG_BUILD_TYPE=deployment
|
||||||
|
|
||||||
script: make travis
|
script: make travis
|
||||||
|
|
20
_plugins/env.rb
Normal file
20
_plugins/env.rb
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# This file is licensed under the MIT License (MIT) available on
|
||||||
|
# http://opensource.org/licenses/MIT.
|
||||||
|
|
||||||
|
## env.rb takes select environmental variables and makes them available
|
||||||
|
## to the site templates. Currently, only variables starting with
|
||||||
|
## BITCOINORG_ are exported
|
||||||
|
|
||||||
|
module Jekyll
|
||||||
|
class EnvGenerator < Generator
|
||||||
|
def generate(site)
|
||||||
|
## If necessary, initialize env hash table
|
||||||
|
site.config["env"] = site.config["env"] ? site.config["env"] : {}
|
||||||
|
|
||||||
|
## Load matching environmental variables in to array
|
||||||
|
ENV.keys.grep /^BITCOINORG_/ do |key|
|
||||||
|
site.config['env'].merge!({ key => ENV[key] })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue