Skip to content

Commit e367932

Browse files
committed
Update project configuration and tooling
- Update Rakefile with test tasks and gem building - Update gemspec with dependencies and metadata - Update bin/console for development - Update CHANGELOG.md with recent changes
1 parent abeeef2 commit e367932

File tree

4 files changed

+117
-28
lines changed

4 files changed

+117
-28
lines changed

CHANGELOG.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
## [Unreleased]
1+
# Changelog
22

3-
## [0.1.0] - 2022-02-21
3+
## [0.2.0]
44

5-
- Initial release
5+
### Added
6+
7+
- Complete basic ActiveRecord adapter functionality
8+
- Test structure with unit, integration, and functional tests
9+
- Modernize parameter binding using DuckDB's native parameter binding
10+
- Support for migrations, associations, and validations
11+
12+
## [0.1.0]
13+
14+
### Added
15+
- Initial project structure
16+
- Basic gem setup

Rakefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ Rake::TestTask.new(:test) do |t|
1111
t.verbose = true
1212
end
1313

14-
require "rubocop/rake_task"
15-
16-
task default: %i[test rubocop]
14+
begin
15+
require "rubocop/rake_task"
16+
RuboCop::RakeTask.new
17+
task default: %i[test rubocop]
18+
rescue LoadError
19+
# RuboCop not available, skip it
20+
task default: %i[test]
21+
end
1722

activerecord-duckdb-adapter.gemspec

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,38 @@ require_relative "lib/activerecord_duckdb_adapter/version"
55
Gem::Specification.new do |spec|
66
spec.name = "activerecord-duckdb-adapter"
77
spec.version = ActiveRecordDuckdbAdapter::VERSION
8-
spec.authors = ["okadakk"]
9-
spec.email = ["[email protected]"]
8+
spec.authors = ["okadakk", "Eddie A Tejeda"]
9+
1010

11-
spec.summary = "https://github.com"
12-
spec.description = "https://github.com"
13-
spec.homepage = "https://github.com"
11+
spec.summary = "ActiveRecord adapter for DuckDB database"
12+
spec.description = "A Ruby gem that provides an ActiveRecord adapter for DuckDB, enabling Ruby and Rails applications to use DuckDB as their database backend."
13+
spec.homepage = "https://github.com/red-data-tools/activerecord-duckdb-adapter"
1414
spec.license = "MIT"
15-
spec.required_ruby_version = ">= 2.4.0"
15+
spec.required_ruby_version = ">= 3.1.0"
1616

17-
spec.metadata["allowed_push_host"] = "'https://mygemserver.com'"
17+
spec.metadata = {
18+
"bug_tracker_uri" => "https://github.com/red-data-tools/activerecord-duckdb-adapter/issues",
19+
"changelog_uri" => "https://github.com/red-data-tools/activerecord-duckdb-adapter/blob/main/CHANGELOG.md",
20+
"source_code_uri" => "https://github.com/red-data-tools/activerecord-duckdb-adapter",
21+
"rubygems_mfa_required" => "true"
22+
}
1823

19-
spec.metadata["homepage_uri"] = spec.homepage
20-
spec.metadata["source_code_uri"] = "https://github.com"
21-
spec.metadata["changelog_uri"] = "https://github.com"
22-
23-
# Specify which files should be added to the gem when it is released.
24-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
26-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27-
end
28-
spec.bindir = "exe"
29-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
24+
# Specify files to include in the gem
25+
spec.files = Dir[
26+
"lib/**/*",
27+
"README.md",
28+
"LICENSE.txt",
29+
"CHANGELOG.md"
30+
].select { |f| File.file?(f) }
31+
3032
spec.require_paths = ["lib"]
3133

32-
# Uncomment to register a new dependency of your gem
33-
spec.add_dependency('activerecord')
34-
spec.add_dependency('duckdb')
34+
# Development dependencies with bounded versions
35+
spec.add_development_dependency "bundler", "~> 2.0"
36+
spec.add_development_dependency "rake", "~> 13.0"
37+
spec.add_development_dependency "rspec", "~> 3.13"
38+
39+
# Runtime dependencies with bounded versions
40+
spec.add_dependency "activerecord", "~> 7.1"
41+
spec.add_dependency "duckdb", "~> 1.1"
3542
end

bin/console

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,77 @@
22
# frozen_string_literal: true
33

44
require "bundler/setup"
5-
require "activerecord/duckdb/adapter"
5+
require "activerecord-duckdb-adapter"
6+
require "active_support/logger"
7+
require "yaml"
68

79
# You can add fixtures and/or initialization code here to make experimenting
810
# with your gem easier. You can also use a different console, if you like.
911

12+
puts "Setting up ActiveRecord DuckDB Adapter console..."
13+
14+
# Setup database connection
15+
ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT, level: Logger::INFO)
16+
ActiveRecord::Base.configurations = {
17+
'duckdb' => { adapter: 'duckdb' }
18+
}
19+
ActiveRecord::Base.establish_connection :duckdb
20+
21+
puts "✓ Database connection established"
22+
23+
# Load the schema
24+
load File.expand_path("../../test/schema/schema.rb", __FILE__)
25+
puts "✓ Database schema loaded"
26+
27+
# Load the models
28+
require File.expand_path("../../test/models/author.rb", __FILE__)
29+
require File.expand_path("../../test/models/post.rb", __FILE__)
30+
puts "✓ Models loaded (Author, Post)"
31+
32+
# Set up base directory for file paths
33+
BASE_DIR = File.expand_path("../../", __FILE__)
34+
35+
# Helper method to load fixtures
36+
def load_fixtures
37+
# Clear existing data
38+
Post.delete_all
39+
Author.delete_all
40+
41+
# Load authors from YAML
42+
authors_data = YAML.load_file(File.join(BASE_DIR, "test/fixtures/authors.yml"))
43+
authors_data.each do |key, attrs|
44+
Author.create!(attrs)
45+
end
46+
47+
# Load posts from YAML
48+
posts_data = YAML.load_file(File.join(BASE_DIR, "test/fixtures/posts.yml"))
49+
posts_data.each do |key, attrs|
50+
# Skip posts with author_id: 0 as they don't have valid authors
51+
next if attrs['author_id'] == 0
52+
Post.create!(attrs)
53+
end
54+
55+
puts "✓ Fixtures loaded: #{Author.count} authors, #{Post.count} posts"
56+
end
57+
58+
# Load the fixtures
59+
load_fixtures
60+
61+
puts "\n" + "="*60
62+
puts "ActiveRecord DuckDB Adapter Console Ready!"
63+
puts "="*60
64+
puts "\nAvailable models:"
65+
puts " - Author (#{Author.count} records)"
66+
puts " - Post (#{Post.count} records)"
67+
puts "\nExample usage:"
68+
puts " Author.all"
69+
puts " Post.includes(:author).all"
70+
puts " Author.first.posts"
71+
puts " Post.where(enabled: true)"
72+
puts "\nHelper methods:"
73+
puts " load_fixtures # Reload all fixture data"
74+
puts "\n" + "="*60
75+
1076
# (If you use this, don't forget to add pry to your Gemfile!)
1177
# require "pry"
1278
# Pry.start

0 commit comments

Comments
 (0)