From ef9f1d7d1330fee711c6f859ad319c008715ceb2 Mon Sep 17 00:00:00 2001 From: kei Date: Fri, 24 Nov 2017 10:09:46 +0900 Subject: [PATCH 1/2] gpgme_ctx_set_engine_info added as a new interface --- lib/gpgme/engine.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/gpgme/engine.rb b/lib/gpgme/engine.rb index 04c0670..529f884 100644 --- a/lib/gpgme/engine.rb +++ b/lib/gpgme/engine.rb @@ -60,6 +60,15 @@ def set_info(proto, file_name, home_dir) raise exc if exc end + # + # this method is supposed to not harming the global GPG status + # + def set_info_safely(proto, ctx, file_name, home_dir) + err = GPGME::gpgme_ctx_set_engine_info(proto, ctx, file_name, home_dir) + exc = GPGME::error_to_exception(err) + raise exc if exc + end + ## # Sets the home dir for the configuration options. This way one could, # for example, load the keys from a customized keychain. From be9e87b92e69b425a5ea405a70d9f616c3e29ec1 Mon Sep 17 00:00:00 2001 From: kei Date: Fri, 24 Nov 2017 15:53:13 +0900 Subject: [PATCH 2/2] moved the method into Ctx class since it belongs to ctx instance --- lib/gpgme/ctx.rb | 9 +++++++++ lib/gpgme/engine.rb | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/gpgme/ctx.rb b/lib/gpgme/ctx.rb index 33fc370..5684813 100644 --- a/lib/gpgme/ctx.rb +++ b/lib/gpgme/ctx.rb @@ -466,6 +466,15 @@ def add_signer(*keys) end end + # + # this method is supposed to not harming the global GPG status + # + def set_info_safely(proto, file_name, home_dir) + err = GPGME::gpgme_ctx_set_engine_info(proto, self, file_name, home_dir) + exc = GPGME::error_to_exception(err) + raise exc if exc + end + # Create a signature for the text. # +plain+ is a data object which contains the text. # +sig+ is a data object where the generated signature is stored. diff --git a/lib/gpgme/engine.rb b/lib/gpgme/engine.rb index 529f884..04c0670 100644 --- a/lib/gpgme/engine.rb +++ b/lib/gpgme/engine.rb @@ -60,15 +60,6 @@ def set_info(proto, file_name, home_dir) raise exc if exc end - # - # this method is supposed to not harming the global GPG status - # - def set_info_safely(proto, ctx, file_name, home_dir) - err = GPGME::gpgme_ctx_set_engine_info(proto, ctx, file_name, home_dir) - exc = GPGME::error_to_exception(err) - raise exc if exc - end - ## # Sets the home dir for the configuration options. This way one could, # for example, load the keys from a customized keychain.