Sha256: e8f5b0491de67c97920f1c96b69fefdc5430147625916780f2eb1fbd0c45042f
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
require "timber/cli/io/messages" module Timber class CLI class Installer attr_reader :io, :api def initialize(io, api) @io = io @api = api end def run(app) raise NotImplementedError.new end private # Determines the API key storage prference (environment variable or inline) def get_api_key_storage_preference io.puts "" io.puts IO::Messages.separator io.puts "" io.puts "For production/staging would you like to store your Timber API key" io.puts "in an environment variable? (TIMBER_API_KEY)" io.puts "" io.puts "y) Yes, store in TIMBER_API_KEY", :blue io.puts "n) No, just paste the API key inline", :blue io.puts "" case io.ask_yes_no("Enter your choice:", event_prompt: "Store API key in env?") when :yes io.puts "" io.puts IO::Messages.http_environment_variables(api.api_key) io.puts "" io.ask_to_proceed :environment when :no :inline end end # Based on the API key storage preference, we generate the proper code. def get_api_key_code(storage_type) case storage_type when :environment "ENV['TIMBER_API_KEY']" when :inline "'#{api.api_key}'" else raise ArgumentError.new("API key storage type not recognized! " \ "#{storage_type.inspect}") end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
timber-2.1.0.rc2 | lib/timber/cli/installer.rb |
timber-2.1.0.rc1 | lib/timber/cli/installer.rb |