From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 9aOAFw2euWD43QAAgWs5BA (envelope-from ) for ; Fri, 04 Jun 2021 05:29:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QAArEg2euWBYNwAA1q6Kng (envelope-from ) for ; Fri, 04 Jun 2021 03:29:17 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E4699EC87 for ; Fri, 4 Jun 2021 05:29:16 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 0FA6129C45; Thu, 3 Jun 2021 23:29:09 -0400 (EDT) Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by mail.notmuchmail.org (Postfix) with ESMTPS id 8017220017 for ; Thu, 3 Jun 2021 23:29:05 -0400 (EDT) Received: by mail-oi1-x232.google.com with SMTP id v22so8486320oic.2 for ; Thu, 03 Jun 2021 20:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UACMGNJvEn5Ebi6rx0Z4BoiZhSPezDUL9AW8diocZ/A=; b=j8LdQEHkcYA71PCkAEJu8IqPXzYzHXluzZEhO6qVtlOXxybvn3nWL0bZdCiNMHBvqY n65rRIfJnS05EtxLPMrLMYogFSj/l00YR1b1w3OsRa7+QMmKiFVm+qeWYac1bOqndFcA 3hqu/QHh3Lr9VMY4F/TyuvnHOG2mg5Q5ZiA1294aWeEOJ8biENJFxHMzTOAi79H50pwu EGJuS31AmoJUBaYv2OtVBKdHRLy5/WAe54hLx6FyQ+qPYTkos8ZSAejcUnEXWhpZqV4P 9FsBAfSAJD06JY8u5YyJhiuHw5ZYvlFSyxvjss+bn5+rxWXkzPzkMpjYEnG98XC5YRHS bejA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UACMGNJvEn5Ebi6rx0Z4BoiZhSPezDUL9AW8diocZ/A=; b=UKhFx+WlWB9ELqsPKzKeDEDU+n7UFHN1QqWgFlvRevkqhEMYyvoLAif0ZJxZHGyAGp UVXGVsiu+jq/gf2h4s5J3nUXgKTqMNeyp+nDKcaH8aAfN9JasWbOorJnvy+pLiu8lq6x WvKnkZ2K12YSJddwmLv6wp+tkYLQtBYLv5hIPY/tm6peMvvxm7T2UB9xKXjMFHlQbt+f wINOPNrQq8NXrYc9FuODZTxheuVYC+oZHeDXB0W8hjhatVxmb+qtPhhc41K2aWtPkSHZ k3Vt8ZSQjVPAosPTrg9xXYe1qZbrDolENaXt6EubkS6wHFT68F+z+4LHl4ebKycQjbt1 hYaQ== X-Gm-Message-State: AOAM5301E5vLQUOAQZfd6C9Rq/Bj8kPtWr2bo3M9RH0p/JqLXYCkObGG yypKMmHQWxg12Higt4aNM3rz9r1Y6TSoug== X-Google-Smtp-Source: ABdhPJwlCbD+wu4IP+C/xs0rKBcBsNdHyeCxqWfZy15E8yNxZGYc0L7JSp0wQuYuhRwhWyQlyg6Ccw== X-Received: by 2002:a54:4e81:: with SMTP id c1mr1680553oiy.119.1622777343457; Thu, 03 Jun 2021 20:29:03 -0700 (PDT) Received: from localhost (fixed-187-190-78-172.totalplay.net. [187.190.78.172]) by smtp.gmail.com with ESMTPSA id 94sm212242otj.33.2021.06.03.20.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 20:29:03 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Cc: David Bremner , Felipe Contreras Subject: [PATCH 0/3] ruby: add latest config API Date: Thu, 3 Jun 2021 22:28:58 -0500 Message-Id: <20210604032901.3815539-1-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.32.0.rc2 MIME-Version: 1.0 Message-ID-Hash: FBODUOPVRIZ2AWQ2ITMPG3JJCQIHX3AY X-Message-ID-Hash: FBODUOPVRIZ2AWQ2ITMPG3JJCQIHX3AY X-MailFrom: felipe.contreras@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622777357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=mx1mqNSFBLk0dvi86CnjHqhCJME4AyHBq18D/iL9eIE=; b=bun9174DHR288hjMNeQBKB0gUIoXFrGoL/Z5e/haK1VlWKPXbNgKrlNObv1PAwVYjFLnP4 pZ3e9/YyHlL9hlVu5KcjX9eFeupqOrJ5d9k/uUDGLXyAn1/6b/A0zH84/yxrQn6HLi/kUA Y/YxPs94YJDe9J5YQ4o45vliTJx+ECjk5wxW9Pzj6ufwaqj+/EdWMrnxupzL1fHb3tau7n PFZGbZa+QF0Zd4gc2dnxIxxbtML3+GaV/LlhC9Hv6cKzBlDhT18nwPclLGcOTH06EmOcJS rSzvQ2Ma6eVIl/Z9Qq1hqKH92LH/Qdcwcjbtf7m4CE/qk2Ey8AGp4KU/bh/A7Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622777357; a=rsa-sha256; cv=none; b=ZW9HBBP65fsqMf0AnSKvQUAk4diInIEAPR0M1cGNga3X8Zw5qpVo+SQN/25EJZtmuCCd9C Edf8rsLwn/I2WUw0lCATfu7wP+0LxqN4LYHijuOSoG61vCB8AdhlXClGNFeNi8l1Dubq9c E+uz78ckkpl2xNuloc0GyLQ5YhpGUQ1WhjFpd1oWX12zE9o6SbicLDFpHvP3Gbc5iBQCRi I9PDGBfkU2ZqLF43TX8nnIQNH9CIEOz5lYHuiuMjsUQ3H1V3UYzVkeCtyBLgl48gIEkK5q 7ulI6OGSLDz2VtBXgv8WNduIsWb9kos+Srbcy/2EYz+rcp95Lnn5l7lZAtHI3g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=j8LdQEHk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.94 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20161025 header.b=j8LdQEHk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: E4699EC87 X-Spam-Score: -0.94 X-Migadu-Scanner: scn0.migadu.com X-TUID: k8SuUqe6EI1U Currently the simplest way to open the notmuch database properly a client must do: $config = IO.popen(%w[notmuch config list]) do |io| io.each(chomp: true).map { |e| e.split('=') }.to_h end $db_name = config['database.path'] $db = Notmuch::Database.new($db_name) While this works and it's not too overly complicated, the notmuch API already has much better constucts. This patch series allows the user to simply do: $db = Notmuch::Database.open_with_config $config = $db.config.to_h And much more. Felipe Contreras (3): ruby: add new Database.open_with_config ruby: add db.config ruby: make db.config return an enumerator bindings/ruby/database.c | 95 ++++++++++++++++++++++++++++++++++++++++ bindings/ruby/defs.h | 10 +++++ bindings/ruby/init.c | 2 + test/T395-ruby.sh | 13 ++++++ 4 files changed, 120 insertions(+) -- 2.32.0.rc2