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
8 changes: 6 additions & 2 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ jobs:
strategy:
matrix:
include:
- ruby-version: '3.4'
gemfile: 'ar_8_0'
- ruby-version: '3.3'
gemfile: 'ar_7_2'
- ruby-version: '3.4'
gemfile: 'ar_8_0'
- ruby-version: '4.0.1'
gemfile: 'ar_8_0'
- ruby-version: '4.0.1'
gemfile: 'ar_8_1'
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
services:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.5
4.0.1
1 change: 1 addition & 0 deletions gemfiles/ar_7_2.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PATH
parser (>= 2.6.5, < 3.4)
pg (~> 1.2)
postgresql_cursor (~> 0.6)
prism
thread_safe (~> 0.3.6)
tty-prompt (~> 0.23.1)
tzinfo (>= 1.1)
Expand Down
4 changes: 3 additions & 1 deletion gemfiles/ar_8_0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PATH
parser (>= 2.6.5, < 3.4)
pg (~> 1.2)
postgresql_cursor (~> 0.6)
prism
thread_safe (~> 0.3.6)
tty-prompt (~> 0.23.1)
tzinfo (>= 1.1)
Expand Down Expand Up @@ -60,7 +61,8 @@ GEM
lint_roller (1.1.0)
logger (1.6.4)
method_source (1.1.0)
minitest (5.25.4)
minitest (6.0.1)
prism (~> 1.5)
oj (3.16.9)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
Expand Down
10 changes: 10 additions & 0 deletions gemfiles/ar_8_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

source 'https://rubygems.org'

active_star_version = '= 8.1.2'

gem 'activemodel', active_star_version
gem 'activerecord', active_star_version

gemspec path: '../'
170 changes: 170 additions & 0 deletions gemfiles/ar_8_1.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
PATH
remote: ..
specs:
sequent (8.2.0)
activemodel (>= 7.2.1)
activerecord (>= 7.2.1)
bcrypt (~> 3.1)
csv (~> 3.3)
gli (~> 2.22)
i18n
logger (~> 1.6)
oj (~> 3.3)
parallel (~> 1.20)
parser (>= 2.6.5, < 3.4)
pg (~> 1.2)
postgresql_cursor (~> 0.6)
prism
thread_safe (~> 0.3.6)
tty-prompt (~> 0.23.1)
tzinfo (>= 1.1)

GEM
remote: https://rubygems.org/
specs:
activemodel (8.1.2)
activesupport (= 8.1.2)
activerecord (8.1.2)
activemodel (= 8.1.2)
activesupport (= 8.1.2)
timeout (>= 0.4.0)
activesupport (8.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.3)
base64 (0.3.0)
bcrypt (3.1.21)
bigdecimal (4.0.1)
coderay (1.1.3)
concurrent-ruby (1.3.6)
connection_pool (3.0.2)
csv (3.3.5)
diff-lcs (1.6.2)
docile (1.4.1)
drb (2.2.3)
gli (2.22.2)
ostruct
i18n (1.14.8)
concurrent-ruby (~> 1.0)
io-console (0.8.2)
json (2.18.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
method_source (1.1.0)
minitest (6.0.1)
prism (~> 1.5)
oj (3.16.13)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
ostruct (0.6.3)
parallel (1.27.0)
parser (3.3.10.1)
ast (~> 2.4.1)
racc
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.6.3-arm64-darwin)
pg (1.6.3-x86_64-linux)
postgresql_cursor (0.6.9)
activerecord (>= 6.0)
prism (1.8.0)
prop_check (1.0.2)
pry (0.16.0)
coderay (~> 1.1)
method_source (~> 1.0)
reline (>= 0.6.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.1)
regexp_parser (2.11.3)
reline (0.6.3)
io-console (~> 0.5)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-collection_matchers (1.2.1)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.7)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.6)
rubocop (1.82.1)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.48.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.2)
simplecov_json_formatter (0.1.4)
thread_safe (0.3.6)
timecop (0.9.10)
timeout (0.6.0)
tty-color (0.6.0)
tty-cursor (0.7.1)
tty-prompt (0.23.1)
pastel (~> 0.8)
tty-reader (~> 0.8)
tty-reader (0.9.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.8)
wisper (~> 2.0)
tty-screen (0.8.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
uri (1.1.1)
wisper (2.0.1)

PLATFORMS
arm64-darwin-24
x86_64-linux

DEPENDENCIES
activemodel (= 8.1.2)
activerecord (= 8.1.2)
prop_check (~> 1.0)
pry (~> 0.13)
rake (~> 13)
rspec (~> 3.10)
rspec-collection_matchers (~> 1.2)
rspec-mocks (~> 3.10)
rubocop (~> 1)
sequent!
simplecov (~> 0.21)
timecop (~> 0.9)

BUNDLED WITH
2.3.13
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,6 @@ def prepare

def commit
@record_store.each do |clazz, records|
@column_cache ||= {}
@column_cache[clazz.name] ||= clazz.columns.reduce({}) do |hash, column|
hash.merge({column.name => column})
end
if records.size > @insert_with_csv_size
csv = CSV.new(StringIO.new)
column_names = clazz.column_names.reject { |name| name == 'id' }
Expand Down Expand Up @@ -364,11 +360,7 @@ def clear
private

def cast_value_to_column_type(clazz, column_name, record)
uncasted_value = ActiveModel::Attribute.from_database(
column_name,
record[column_name],
Sequent::ApplicationRecord.connection.lookup_cast_type_from_column(@column_cache[clazz.name][column_name]),
).value_for_database
uncasted_value = clazz.type_for_attribute(column_name).serialize(record[column_name])
Sequent::ApplicationRecord.connection.type_cast(uncasted_value)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/sequent/generator/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'active_support'
require 'active_support/core_ext/string'
require 'erb'
require 'parser/current'
require_relative 'ruby_parser'

class NoAggregateFound < StandardError; end

Expand All @@ -31,7 +31,7 @@ def name
private

def append_command_handler
ast = Parser::CurrentRuby.parse(File.read("#{path_to_dir}/#{name_underscored}_command_handler.rb"))
ast = RubyParser.parse(File.read("#{path_to_dir}/#{name_underscored}_command_handler.rb"))
target_cursor_position = find_target_cursor_position(ast)

File.open("#{path_to_dir}/#{name_underscored}_command_handler.rb", 'r+') do |f|
Expand Down
16 changes: 16 additions & 0 deletions lib/sequent/generator/ruby_parser.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require 'parser/current'
require 'prism'

class RubyParser
def self.parse(ruby_code)
# parser ruby does not support ruby 3.4 or greater and suggests using prism for newer versions
parser_class = if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.4')
Parser::CurrentRuby
else
Prism::Translation::ParserCurrent
end
parser_class.parse(ruby_code)
end
end
1 change: 1 addition & 0 deletions sequent.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Gem::Specification.new do |s|
s.add_dependency 'parser', '>= 2.6.5', '< 3.4'
s.add_dependency 'pg', '~> 1.2'
s.add_dependency 'postgresql_cursor', '~> 0.6'
s.add_dependency 'prism'
s.add_dependency 'thread_safe', '~> 0.3.6'
s.add_dependency 'tty-prompt', '~> 0.23.1'
s.add_dependency 'tzinfo', '>= 1.1'
Expand Down