Sha256: dc1e0219213c4fca894a6cedf61db1feda522a4b019ef7080074d7b384fe0a34

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

require "figaro/cli/task"

module Figaro
  class CLI < Thor
    class HerokuSet < Task
      def run
        system(configuration, command)
      end

      private

      def command
        "heroku config:set #{vars} #{for_app} #{for_remote}"
      end

      def for_app
        options[:app] ? "--app=#{options[:app]}" : nil
      end

      def for_remote
        options[:remote] ? "--remote=#{options[:remote]}" : nil
      end

      def vars
        configuration.keys.map { |k| var(k) }.join(" ")
      end

      def var(key)
        Gem.win_platform? ? %(#{key}="%#{key}%") : %(#{key}="$#{key}")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
seielit-figaro-1.1.2 lib/figaro/cli/heroku_set.rb
figaro-1.1.1 lib/figaro/cli/heroku_set.rb
figaro-1.1.0 lib/figaro/cli/heroku_set.rb