Sha256: bb6ad6c34ceccde91a1197729c6c6ac3e9245de49f3503e90476c20cfba0eee0
Contents?: true
Size: 1.61 KB
Versions: 8
Compression:
Stored size: 1.61 KB
Contents
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2020 Couchbase, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <generated_config.hxx> #include <spdlog/spdlog.h> #include <ruby.h> void run_script(const char* script) { spdlog::info("run script:\n----------------------------------------{}---------------------------------------\n", script); int status = 0; rb_eval_string_protect(script, &status); if (status != 0) { VALUE rbError = rb_funcall(rb_gv_get("$!"), rb_intern("message"), 0); spdlog::critical("ruby execution failure: {}", StringValuePtr(rbError)); exit(EXIT_FAILURE); } } int main() { ruby_init(); ruby_init_loadpath(); rb_require(LIBCOUCHBASE_EXT_PATH); rb_require("json"); run_script(R"( p Couchbase::VERSION B = Couchbase::Backend.new B.open("localhost", "Administrator", "password") pp B.document_view("beer-sample", "test", "get_all", :development, { keys: [JSON.generate("21st_amendment_brewery_cafe-563_stout")] }) )"); ruby_finalize(); return 0; }
Version data entries
8 entries across 8 versions & 1 rubygems