Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*.rbc
/.config
/coverage/
/doc/
/.yardoc
/InstalledFiles
/pkg/
/spec/reports/
Expand Down
12 changes: 12 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--markup markdown
--markup-provider kramdown
--output-dir doc
--readme README.md
--title "Braintrust Ruby SDK Documentation"
--protected
--no-private
--hide-warnings
lib/**/*.rb
-
README.md
CONTRIBUTING.md
7 changes: 6 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
braintrust (0.0.1)
braintrust (0.0.2)
openssl (~> 3.3.1)
opentelemetry-exporter-otlp (~> 0.28)
opentelemetry-sdk (~> 1.0)
Expand Down Expand Up @@ -37,6 +37,8 @@ GEM
google-protobuf (~> 4.26)
hashdiff (1.2.1)
json (2.15.1)
kramdown (2.5.1)
rexml (>= 3.3.9)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
minitest (5.26.0)
Expand Down Expand Up @@ -123,6 +125,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
yard (0.9.37)

PLATFORMS
arm64-darwin-23
Expand All @@ -134,13 +137,15 @@ PLATFORMS
DEPENDENCIES
appraisal (~> 2.5)
braintrust!
kramdown (~> 2.0)
minitest (~> 5.0)
minitest-reporters (~> 1.6)
rake (~> 13.0)
simplecov (~> 0.22)
standard (~> 1.0)
vcr (~> 6.0)
webmock (~> 3.0)
yard (~> 0.9)

BUNDLED WITH
2.4.19
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Braintrust Ruby SDK

[![Gem Version](https://badge.fury.io/rb/braintrust.svg)](https://badge.fury.io/rb/braintrust)
[![Documentation](https://img.shields.io/badge/docs-rubydoc.info-blue.svg)](https://rubydoc.info/gems/braintrust)
![Beta](https://img.shields.io/badge/status-beta-yellow)

## Overview
Expand Down
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ desc "Remove Ruby build artifacts"
task :clean do
FileUtils.rm_rf("pkg")
FileUtils.rm_rf("coverage")
FileUtils.rm_rf("doc")
FileUtils.rm_rf(".yardoc")
FileUtils.rm_rf("tmp")
FileUtils.rm_f(Dir.glob("*.gem"))
FileUtils.rm_f("changelog.md")
Expand Down Expand Up @@ -65,6 +67,11 @@ task build: [:clean] do
sh "gem build braintrust.gemspec"
end

desc "Generate YARD documentation"
task :yard do
sh "bundle exec yard doc"
end

desc "Run tests and open coverage report"
task coverage: :test do
coverage_file = "coverage/index.html"
Expand Down
6 changes: 4 additions & 2 deletions braintrust.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Gem::Specification.new do |spec|
spec.email = ["info@braintrust.dev"]

spec.summary = "Ruby SDK for Braintrust"
spec.description = "OpenTelemetry-based SDK for Braintrust with tracing, OpenAI integration, and evals"
spec.description = "Braintrust Ruby SDK for evals, tracing and more. "
spec.homepage = "https://github.com/braintrustdata/braintrust-sdk-ruby"
spec.license = "Apache-2.0"
spec.required_ruby_version = ">= 3.2.0"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
spec.metadata["changelog_uri"] = "#{spec.homepage}/releases"

# Specify which files should be added to the gem when it is released.
spec.files = Dir.glob(%w[
Expand Down Expand Up @@ -46,4 +46,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "vcr", "~> 6.0"
spec.add_development_dependency "webmock", "~> 3.0"
spec.add_development_dependency "appraisal", "~> 2.5"
spec.add_development_dependency "yard", "~> 0.9"
spec.add_development_dependency "kramdown", "~> 2.0"
end
2 changes: 1 addition & 1 deletion lib/braintrust/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Braintrust
VERSION = "0.0.1"
VERSION = "0.0.2"
end
15 changes: 14 additions & 1 deletion mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@ run = "watchexec --exts rb --watch lib --watch test --restart --clear -- rake te

[tasks.precommit]
description = "Run linter before commit (full CI runs on push)"
run = "bundle exec rake lint"
run = """
bundle check > /dev/null 2>&1 || bundle install --quiet
if ! git diff --quiet --exit-code Gemfile.lock; then
echo ""
echo "Gemfile.lock is out of sync with gemspec"
echo ""
echo "Changes detected:"
git diff Gemfile.lock | head -20
echo ""
echo "Fix: git add Gemfile.lock"
exit 1
fi
bundle exec rake lint
"""

[hooks]
postinstall = """
Expand Down
39 changes: 24 additions & 15 deletions scripts/generate-release-notes.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
#!/usr/bin/env bash
# Script to generate release notes for GitHub Release
# Compares current tag with previous tag
# Shows commits between two points in history
# Expected tag format: v0.0.1, v0.0.2, etc. (with 'v' prefix)

set -euo pipefail

# Get the repository root
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"

# Get current tag
CURRENT_TAG="${GITHUB_REF_NAME:-$(git describe --tags --exact-match 2>/dev/null || echo "")}"
# Determine END commit (what to release)
# Priority: arg > GITHUB_REF_NAME > current tag > HEAD
END="${1:-${GITHUB_REF_NAME:-$(git describe --tags --exact-match 2>/dev/null || echo "HEAD")}}"

if [ -z "$CURRENT_TAG" ]; then
echo "Error: No tag found. This script should be run on a tagged commit."
# Validate tag format if not HEAD
if [ "$END" != "HEAD" ] && [[ ! "$END" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Error: Invalid tag format. Expected format: v0.0.1 or HEAD"
echo "Got: $END"
exit 1
fi

# Get previous tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${CURRENT_TAG}^" 2>/dev/null || echo "")
# Determine START commit (previous release)
if [ "$END" = "HEAD" ]; then
# Local: show unreleased changes since last tag
START=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
else
# CI: show changes since previous tag
START=$(git describe --tags --abbrev=0 "${END}^" 2>/dev/null || echo "")
fi

# Generate changelog
echo "## Changelog"
echo ""

# Generate release notes
if [ -n "$PREVIOUS_TAG" ]; then
echo "## Changes since $PREVIOUS_TAG"
echo ""
git log "${PREVIOUS_TAG}..${CURRENT_TAG}" --pretty=format:"- %s (%h)" --no-merges
if [ -n "$START" ]; then
git log "${START}..${END}" --pretty=format:"- %s (%h)" --no-merges
else
echo "## Initial Release"
echo ""
echo "First release of the Braintrust Ruby SDK"
echo "Initial beta version of the Ruby SDK."
fi