Sha256: cbd6ca29785000c06dc590373475a77fa694b4626686114c64ac42e6ba7e13b5
Contents?: true
Size: 1.32 KB
Versions: 6
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require 'rake_factory' require 'ruby_gpg2' require_relative '../../home' module RakeGPG module Tasks module Keys class Import < RakeFactory::Task default_name :import default_description 'Import a GPG key' parameter :key_file_path, required: true parameter :work_directory, default: '/tmp' parameter :home_directory, default: :temporary action do make_work_directory log_importing_key in_home_directory do |home_directory| import(home_directory) end log_done end private def in_home_directory(&block) Home.new(work_directory, home_directory) .with_resolved_directory do |home_directory| block.call(home_directory) end end def make_work_directory mkdir_p(work_directory) end def import(home_directory) RubyGPG2.import( key_file_paths: [key_file_path], home_directory: ) end def log_importing_key $stdout.puts( "Importing GPG key from #{key_file_path} into #{home_directory}..." ) end def log_done $stdout.puts 'Done.' end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems