Class: Vtasks::TravisCI
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Vtasks::TravisCI
- Includes:
- Utils::Output
- Defined in:
- lib/vtasks/travisci.rb
Overview
Release tasks
Instance Method Summary collapse
- #define_tasks ⇒ Object
- #dotenv ⇒ Object
- #env_vars ⇒ Object
-
#initialize ⇒ TravisCI
constructor
A new instance of TravisCI.
-
#travis_slug ⇒ Object
def define_tasks.
Methods included from Utils::Output
Constructor Details
#initialize ⇒ TravisCI
Returns a new instance of TravisCI.
10 11 12 |
# File 'lib/vtasks/travisci.rb', line 10 def initialize define_tasks end |
Instance Method Details
#define_tasks ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vtasks/travisci.rb', line 14 def define_tasks begin require 'dotenv' require 'travis/auto_login' rescue LoadError nil # Might be in a group that is not installed rescue Travis::Client::AutoLogin::NoTokenError warn 'No suitable github token found' end namespace :travis do desc 'Sync environment with TravisCI' task :env do info "Hello #{::Travis::User.current.name}!" # Update environment variables dotenv.each do |key, value| info "Updating #{key}" env_vars.upsert(key, value, public: false) end # Remove remote environment variables env_vars.each do |var| unless dotenv.keys.include?(var.name) warn "Deleting #{var.name}" var.delete end end end end end |
#dotenv ⇒ Object
54 55 56 |
# File 'lib/vtasks/travisci.rb', line 54 def dotenv @dotenv ||= ::Dotenv.load end |
#env_vars ⇒ Object
50 51 52 |
# File 'lib/vtasks/travisci.rb', line 50 def env_vars @env_vars ||= ::Travis::Repository.find(travis_slug).env_vars end |
#travis_slug ⇒ Object
def define_tasks
46 47 48 |
# File 'lib/vtasks/travisci.rb', line 46 def travis_slug @travis_slug ||= `git config --get travis.slug`.chomp end |