mongory 0.7.3-x64-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mongory might be problematic. Click here for more details.

Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +88 -0
  4. data/.yardopts +7 -0
  5. data/CHANGELOG.md +364 -0
  6. data/CODE_OF_CONDUCT.md +84 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +488 -0
  9. data/Rakefile +107 -0
  10. data/SUBMODULE_INTEGRATION.md +325 -0
  11. data/docs/advanced_usage.md +40 -0
  12. data/docs/clang_bridge.md +69 -0
  13. data/docs/field_names.md +30 -0
  14. data/docs/migration.md +30 -0
  15. data/docs/performance.md +61 -0
  16. data/examples/README.md +41 -0
  17. data/examples/benchmark-rails.rb +52 -0
  18. data/examples/benchmark.rb +184 -0
  19. data/ext/mongory_ext/extconf.rb +91 -0
  20. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/array.h +122 -0
  21. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/config.h +161 -0
  22. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/error.h +79 -0
  23. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/memory_pool.h +95 -0
  24. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/table.h +127 -0
  25. data/ext/mongory_ext/mongory-core/include/mongory-core/foundations/value.h +175 -0
  26. data/ext/mongory_ext/mongory-core/include/mongory-core/matchers/matcher.h +76 -0
  27. data/ext/mongory_ext/mongory-core/include/mongory-core.h +12 -0
  28. data/ext/mongory_ext/mongory-core/src/foundations/array.c +287 -0
  29. data/ext/mongory_ext/mongory-core/src/foundations/array_private.h +19 -0
  30. data/ext/mongory_ext/mongory-core/src/foundations/config.c +270 -0
  31. data/ext/mongory_ext/mongory-core/src/foundations/config_private.h +48 -0
  32. data/ext/mongory_ext/mongory-core/src/foundations/error.c +38 -0
  33. data/ext/mongory_ext/mongory-core/src/foundations/memory_pool.c +298 -0
  34. data/ext/mongory_ext/mongory-core/src/foundations/string_buffer.c +65 -0
  35. data/ext/mongory_ext/mongory-core/src/foundations/string_buffer.h +49 -0
  36. data/ext/mongory_ext/mongory-core/src/foundations/table.c +498 -0
  37. data/ext/mongory_ext/mongory-core/src/foundations/utils.c +210 -0
  38. data/ext/mongory_ext/mongory-core/src/foundations/utils.h +70 -0
  39. data/ext/mongory_ext/mongory-core/src/foundations/value.c +500 -0
  40. data/ext/mongory_ext/mongory-core/src/matchers/array_record_matcher.c +164 -0
  41. data/ext/mongory_ext/mongory-core/src/matchers/array_record_matcher.h +47 -0
  42. data/ext/mongory_ext/mongory-core/src/matchers/base_matcher.c +122 -0
  43. data/ext/mongory_ext/mongory-core/src/matchers/base_matcher.h +100 -0
  44. data/ext/mongory_ext/mongory-core/src/matchers/compare_matcher.c +217 -0
  45. data/ext/mongory_ext/mongory-core/src/matchers/compare_matcher.h +83 -0
  46. data/ext/mongory_ext/mongory-core/src/matchers/composite_matcher.c +573 -0
  47. data/ext/mongory_ext/mongory-core/src/matchers/composite_matcher.h +125 -0
  48. data/ext/mongory_ext/mongory-core/src/matchers/existance_matcher.c +147 -0
  49. data/ext/mongory_ext/mongory-core/src/matchers/existance_matcher.h +48 -0
  50. data/ext/mongory_ext/mongory-core/src/matchers/external_matcher.c +124 -0
  51. data/ext/mongory_ext/mongory-core/src/matchers/external_matcher.h +46 -0
  52. data/ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.c +126 -0
  53. data/ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.h +46 -0
  54. data/ext/mongory_ext/mongory-core/src/matchers/literal_matcher.c +314 -0
  55. data/ext/mongory_ext/mongory-core/src/matchers/literal_matcher.h +97 -0
  56. data/ext/mongory_ext/mongory-core/src/matchers/matcher.c +252 -0
  57. data/ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.c +79 -0
  58. data/ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.h +23 -0
  59. data/ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.c +60 -0
  60. data/ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.h +23 -0
  61. data/ext/mongory_ext/mongory_ext.c +683 -0
  62. data/lib/generators/mongory/install/install_generator.rb +42 -0
  63. data/lib/generators/mongory/install/templates/initializer.rb.erb +83 -0
  64. data/lib/generators/mongory/matcher/matcher_generator.rb +56 -0
  65. data/lib/generators/mongory/matcher/templates/matcher.rb.erb +92 -0
  66. data/lib/generators/mongory/matcher/templates/matcher_spec.rb.erb +17 -0
  67. data/lib/mongory/c_query_builder.rb +44 -0
  68. data/lib/mongory/converters/abstract_converter.rb +111 -0
  69. data/lib/mongory/converters/condition_converter.rb +64 -0
  70. data/lib/mongory/converters/converted.rb +81 -0
  71. data/lib/mongory/converters/data_converter.rb +37 -0
  72. data/lib/mongory/converters/key_converter.rb +87 -0
  73. data/lib/mongory/converters/value_converter.rb +52 -0
  74. data/lib/mongory/converters.rb +8 -0
  75. data/lib/mongory/matchers/abstract_matcher.rb +219 -0
  76. data/lib/mongory/matchers/abstract_multi_matcher.rb +124 -0
  77. data/lib/mongory/matchers/and_matcher.rb +72 -0
  78. data/lib/mongory/matchers/array_record_matcher.rb +93 -0
  79. data/lib/mongory/matchers/elem_match_matcher.rb +55 -0
  80. data/lib/mongory/matchers/eq_matcher.rb +46 -0
  81. data/lib/mongory/matchers/every_matcher.rb +56 -0
  82. data/lib/mongory/matchers/exists_matcher.rb +53 -0
  83. data/lib/mongory/matchers/field_matcher.rb +147 -0
  84. data/lib/mongory/matchers/gt_matcher.rb +41 -0
  85. data/lib/mongory/matchers/gte_matcher.rb +41 -0
  86. data/lib/mongory/matchers/hash_condition_matcher.rb +62 -0
  87. data/lib/mongory/matchers/in_matcher.rb +68 -0
  88. data/lib/mongory/matchers/literal_matcher.rb +121 -0
  89. data/lib/mongory/matchers/lt_matcher.rb +41 -0
  90. data/lib/mongory/matchers/lte_matcher.rb +41 -0
  91. data/lib/mongory/matchers/ne_matcher.rb +38 -0
  92. data/lib/mongory/matchers/nin_matcher.rb +68 -0
  93. data/lib/mongory/matchers/not_matcher.rb +40 -0
  94. data/lib/mongory/matchers/or_matcher.rb +68 -0
  95. data/lib/mongory/matchers/present_matcher.rb +55 -0
  96. data/lib/mongory/matchers/regex_matcher.rb +80 -0
  97. data/lib/mongory/matchers/size_matcher.rb +54 -0
  98. data/lib/mongory/matchers.rb +176 -0
  99. data/lib/mongory/mongoid.rb +19 -0
  100. data/lib/mongory/query_builder.rb +257 -0
  101. data/lib/mongory/query_matcher.rb +93 -0
  102. data/lib/mongory/query_operator.rb +28 -0
  103. data/lib/mongory/rails.rb +15 -0
  104. data/lib/mongory/utils/context.rb +48 -0
  105. data/lib/mongory/utils/debugger.rb +125 -0
  106. data/lib/mongory/utils/rails_patch.rb +22 -0
  107. data/lib/mongory/utils/singleton_builder.rb +31 -0
  108. data/lib/mongory/utils.rb +76 -0
  109. data/lib/mongory/version.rb +5 -0
  110. data/lib/mongory.rb +123 -0
  111. data/lib/mongory_ext.so +0 -0
  112. data/mongory.gemspec +62 -0
  113. data/scripts/build_with_core.sh +292 -0
  114. data/sig/mongory.rbs +4 -0
  115. metadata +159 -0
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mongory
4
+ VERSION = '0.7.3'
5
+ end
data/lib/mongory.rb ADDED
@@ -0,0 +1,123 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'time'
4
+ require 'date'
5
+ require 'singleton'
6
+ require_relative 'mongory/version'
7
+ require_relative 'mongory/utils'
8
+ require_relative 'mongory/matchers'
9
+ require_relative 'mongory/query_matcher'
10
+ require_relative 'mongory/query_builder'
11
+ require_relative 'mongory/query_operator'
12
+ require_relative 'mongory/converters'
13
+ require_relative 'mongory/rails' if defined?(Rails::Railtie)
14
+ require_relative 'mongory/mongoid' if defined?(Mongoid)
15
+
16
+ # Main namespace for Mongory DSL and configuration.
17
+ #
18
+ # Provides access to core converters, query construction, and optional
19
+ # integrations with frameworks like Rails or Mongoid.
20
+ #
21
+ # @example Basic usage
22
+ # Mongory.build_query(records).where(age: { :$gt => 18 })
23
+ #
24
+ # @example Enabling DSL snippets
25
+ # Mongory.enable_symbol_snippets!
26
+ # Mongory.register(Array)
27
+ module Mongory
28
+ class Error < StandardError; end
29
+ class TypeError < Error; end
30
+
31
+ # Yields Mongory for configuration and freezes key components.
32
+ #
33
+ # @example Configure converters
34
+ # Mongory.configure do |mc|
35
+ # mc.data_converter.configure do |dc|
36
+ # dc.register(MyType) { transform(self) }
37
+ # end
38
+ #
39
+ # mc.condition_converter.key_converter.configure do |kc|
40
+ # kc.register(MyKeyType) { normalize_key(self) }
41
+ # end
42
+ #
43
+ # mc.condition_converter.value_converter.configure do |vc|
44
+ # vc.register(MyValueType) { cast_value(self) }
45
+ # end
46
+ # end
47
+ #
48
+ # @yieldparam self [Mongory]
49
+ # @return [void]
50
+ def self.configure
51
+ yield self
52
+ data_converter.freeze
53
+ condition_converter.freeze
54
+ Matchers.freeze
55
+ end
56
+
57
+ # Returns the data converter instance.
58
+ #
59
+ # @return [Converters::DataConverter]
60
+ def self.data_converter
61
+ @data_converter ||= Converters::DataConverter.instance
62
+ end
63
+
64
+ # Returns the condition converter instance.
65
+ #
66
+ # @return [Converters::ConditionConverter]
67
+ def self.condition_converter
68
+ @condition_converter ||= Converters::ConditionConverter.instance
69
+ end
70
+
71
+ # Returns the debugger instance.
72
+ #
73
+ # @return [Utils::Debugger]
74
+ def self.debugger
75
+ @debugger ||= Utils::Debugger.instance
76
+ end
77
+
78
+ # Builds a new query over the given record set.
79
+ #
80
+ # @param records [Enumerable] any enumerable object (Array, AR::Relation, etc.)
81
+ # @return [QueryBuilder] a new query builder
82
+ def self.build_query(records)
83
+ QueryBuilder.new(records)
84
+ end
85
+
86
+ # Registers a class to support `.mongory` query DSL.
87
+ # This injects a `#mongory` method into the given class.
88
+ #
89
+ # @param klass [Class] the class to register (e.g., Array, ActiveRecord::Relation)
90
+ # @return [void]
91
+ def self.register(klass)
92
+ klass.include(ClassExtention)
93
+ end
94
+
95
+ # Enables symbol snippets like `:age.gte` or `:name.regex`
96
+ # by dynamically defining methods on `Symbol` for query operators.
97
+ #
98
+ # Skips operators that already exist to avoid patching Mongoid or other gems.
99
+ #
100
+ # @return [void]
101
+ def self.enable_symbol_snippets!
102
+ Matchers.enable_symbol_snippets!
103
+ end
104
+
105
+ # Adds a `#mongory` method to the target class via inclusion.
106
+ #
107
+ # Typically used internally by `Mongory.register(...)`.
108
+ module ClassExtention
109
+ # Returns a query builder scoped to `self`.
110
+ #
111
+ # @return [QueryBuilder]
112
+ def mongory
113
+ Mongory::QueryBuilder.new(self)
114
+ end
115
+ end
116
+ end
117
+
118
+ begin
119
+ require 'mongory_ext'
120
+ require_relative 'mongory/c_query_builder'
121
+ rescue LoadError
122
+ warn('Mongory::CQueryBuilder is disabled because mongory_ext is not loaded')
123
+ end
Binary file
data/mongory.gemspec ADDED
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/mongory/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'mongory'
7
+ spec.version = Mongory::VERSION
8
+ spec.authors = ['koten0224']
9
+ spec.email = ['koten0224@gmail.com']
10
+
11
+ spec.summary = 'MongoDB-like in-memory query DSL for Ruby'
12
+ spec.description = 'A Mongo-like in-memory query DSL for Ruby'
13
+ spec.homepage = 'https://mongoryhq.github.io/mongory-rb/'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.6.0'
16
+
17
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
+ spec.metadata['rubygems_mfa_required'] = 'true'
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
+ spec.metadata['source_code_uri'] = 'https://github.com/mongoryhq/mongory-rb'
21
+ spec.metadata['changelog_uri'] = 'https://github.com/mongoryhq/mongory-rb/blob/main/CHANGELOG.md'
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(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (File.expand_path(f) == __FILE__) ||
28
+ f.start_with?(*%w(bin/ test/ spec/ features/ .git .github appveyor Gemfile))
29
+ end
30
+ end
31
+ spec.bindir = 'exe'
32
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ['lib']
34
+
35
+ # C extension configuration
36
+ spec.extensions = ['ext/mongory_ext/extconf.rb']
37
+
38
+ # Ensure submodule files are included
39
+ spec.files += Dir['ext/mongory_ext/mongory-core/src/foundations/*.{c,h}']
40
+ spec.files += Dir['ext/mongory_ext/mongory-core/src/matchers/*.{c,h}']
41
+ spec.files += Dir['ext/mongory_ext/mongory-core/include/**/*.h']
42
+
43
+ # Include compiled native binaries when present (for native/platform gems)
44
+ spec.files += Dir['lib/**/*.{so,bundle,dll}']
45
+
46
+ # When building a native/platform gem, set platform to current
47
+ if ENV['NATIVE_BUILD'] == '1'
48
+ plat = ENV['RCD_PLATFORM'].to_s
49
+ spec.platform =
50
+ case plat
51
+ when /x86_64-linux-musl/ then Gem::Platform.new('x86_64-linux-musl')
52
+ when /aarch64-linux-musl/ then Gem::Platform.new('aarch64-linux-musl')
53
+ when /x86_64-linux/ then Gem::Platform.new('x86_64-linux')
54
+ when /aarch64-linux/ then Gem::Platform.new('aarch64-linux')
55
+ when /x64-mingw-ucrt/ then Gem::Platform.new('x64-mingw-ucrt')
56
+ when /x64-mingw32/ then Gem::Platform.new('x64-mingw32')
57
+ when /arm64-darwin/ then Gem::Platform.new('arm64-darwin')
58
+ when /x86_64-darwin/ then Gem::Platform.new('x86_64-darwin')
59
+ else Gem::Platform::CURRENT
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,292 @@
1
+ #!/bin/bash
2
+
3
+ # Build script for mongory-rb with mongory-core submodule
4
+ # This script handles submodule initialization, dependency checking, and C extension compilation
5
+
6
+ set -e # Exit on any error
7
+
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
10
+ CORE_DIR="$PROJECT_ROOT/ext/mongory_ext/mongory-core"
11
+
12
+ # Colors for output
13
+ RED='\033[0;31m'
14
+ GREEN='\033[0;32m'
15
+ YELLOW='\033[1;33m'
16
+ BLUE='\033[0;34m'
17
+ NC='\033[0m' # No Color
18
+
19
+ # Function to print colored output
20
+ log() {
21
+ local color=$1
22
+ shift
23
+ echo -e "${color}$*${NC}"
24
+ }
25
+
26
+ # Function to check if command exists
27
+ command_exists() {
28
+ command -v "$1" >/dev/null 2>&1
29
+ }
30
+
31
+ # Function to check system dependencies
32
+ check_dependencies() {
33
+ log $BLUE "🔍 Checking system dependencies..."
34
+
35
+ local missing_deps=()
36
+
37
+ # Check for required tools
38
+ if ! command_exists git; then
39
+ missing_deps+=("git")
40
+ fi
41
+
42
+ if ! command_exists make; then
43
+ missing_deps+=("make")
44
+ fi
45
+
46
+ if ! command_exists gcc && ! command_exists clang; then
47
+ missing_deps+=("gcc or clang")
48
+ fi
49
+
50
+ # Check for pkg-config (optional)
51
+ if ! command_exists pkg-config; then
52
+ missing_deps+=("pkg-config")
53
+ fi
54
+
55
+ if [ ${#missing_deps[@]} -gt 0 ]; then
56
+ log $RED "❌ Missing dependencies: ${missing_deps[*]}"
57
+ log $YELLOW "Please install the missing dependencies:"
58
+
59
+ if [[ "$OSTYPE" == "darwin"* ]]; then
60
+ log $BLUE " macOS (Homebrew): brew install ${missing_deps[*]// /}"
61
+ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
62
+ if command_exists apt; then
63
+ log $BLUE " Ubuntu/Debian: sudo apt update && sudo apt install build-essential pkg-config"
64
+ elif command_exists yum; then
65
+ log $BLUE " CentOS/RHEL: sudo yum install gcc make pkg-config"
66
+ elif command_exists dnf; then
67
+ log $BLUE " Fedora: sudo dnf install gcc make pkg-config"
68
+ fi
69
+ fi
70
+
71
+ exit 1
72
+ fi
73
+
74
+ log $GREEN "✅ All dependencies found"
75
+ }
76
+
77
+ # Function to initialize/update submodules
78
+ init_submodules() {
79
+ log $BLUE "📥 Initializing/updating submodules..."
80
+
81
+ cd "$PROJECT_ROOT"
82
+
83
+ if [ ! -d "$CORE_DIR" ] || [ ! "$(ls -A "$CORE_DIR")" ]; then
84
+ log $YELLOW "Submodule not initialized, initializing now..."
85
+ git submodule update --init --recursive
86
+ else
87
+ log $YELLOW "Updating existing submodule..."
88
+ git submodule update --recursive
89
+ fi
90
+
91
+ if [ ! -f "$CORE_DIR/README.md" ]; then
92
+ log $RED "❌ Failed to initialize mongory-core submodule"
93
+ exit 1
94
+ fi
95
+
96
+ log $GREEN "✅ Submodule initialized/updated successfully"
97
+ }
98
+
99
+ # Function to build mongory-core if needed
100
+ build_core() {
101
+ # mongory-rb 直接由 extconf.rb 編譯 mongory-core 的源碼,不需要獨立建置靜態庫
102
+ # 同時避免觸發 mongory-core 的 CMake(其需要 cJSON 僅用於測試)
103
+ log $YELLOW "Skipping mongory-core standalone build (not required for mongory-rb)"
104
+ }
105
+
106
+ # Function to build the Ruby C extension
107
+ build_extension() {
108
+ log $BLUE "🔨 Building Ruby C extension..."
109
+
110
+ cd "$PROJECT_ROOT"
111
+
112
+ # Clean previous builds
113
+ if [ -d "ext/mongory_ext/Makefile" ]; then
114
+ cd ext/mongory_ext
115
+ make clean 2>/dev/null || true
116
+ cd "$PROJECT_ROOT"
117
+ fi
118
+
119
+ # Build the extension
120
+ cd ext/mongory_ext
121
+
122
+ # Set DEBUG flag if requested
123
+ if [[ "$1" == "--debug" ]]; then
124
+ export DEBUG=1
125
+ log $YELLOW "Building in debug mode..."
126
+ fi
127
+
128
+ ruby extconf.rb
129
+ make
130
+
131
+ if [ $? -eq 0 ]; then
132
+ log $GREEN "✅ C extension built successfully"
133
+ else
134
+ log $RED "❌ Failed to build C extension"
135
+ exit 1
136
+ fi
137
+
138
+ cd "$PROJECT_ROOT"
139
+ }
140
+
141
+ # Function to run tests
142
+ run_tests() {
143
+ log $BLUE "🧪 Running tests..."
144
+
145
+ cd "$PROJECT_ROOT"
146
+
147
+ # Run Ruby tests
148
+ if command_exists bundle; then
149
+ bundle exec rspec
150
+ else
151
+ rspec
152
+ fi
153
+
154
+ if [ $? -eq 0 ]; then
155
+ log $GREEN "✅ All tests passed"
156
+ else
157
+ log $RED "❌ Some tests failed"
158
+ exit 1
159
+ fi
160
+ }
161
+
162
+ # Function to clean build artifacts
163
+ clean() {
164
+ log $BLUE "🧹 Cleaning build artifacts..."
165
+
166
+ cd "$PROJECT_ROOT"
167
+
168
+ # Clean C extension
169
+ if [ -d "ext/mongory_ext" ]; then
170
+ cd ext/mongory_ext
171
+ make clean 2>/dev/null || true
172
+ rm -f Makefile *.o foundations/*.o matchers/*.o mongory_ext.so
173
+ cd "$PROJECT_ROOT"
174
+ fi
175
+
176
+ # Clean mongory-core build
177
+ if [ -d "$CORE_DIR/build" ]; then
178
+ rm -rf "$CORE_DIR/build"
179
+ fi
180
+
181
+ log $GREEN "✅ Cleaned build artifacts"
182
+ }
183
+
184
+ # Function to display help
185
+ show_help() {
186
+ cat << EOF
187
+ Usage: $0 [OPTIONS]
188
+
189
+ Build script for mongory-rb with mongory-core submodule integration.
190
+
191
+ OPTIONS:
192
+ --help Show this help message
193
+ --clean Clean build artifacts and exit
194
+ --debug Build in debug mode
195
+ --no-deps Skip dependency checking
196
+ --no-tests Skip running tests
197
+ --force-rebuild Force rebuild of everything
198
+
199
+ EXAMPLES:
200
+ $0 # Normal build
201
+ $0 --debug # Debug build
202
+ $0 --clean # Clean only
203
+ $0 --no-tests # Build without running tests
204
+
205
+ EOF
206
+ }
207
+
208
+ # Main execution flow
209
+ main() {
210
+ local clean_only=false
211
+ local skip_deps=false
212
+ local skip_tests=false
213
+ local force_rebuild=false
214
+ local debug_mode=false
215
+
216
+ # Parse command line arguments
217
+ while [[ $# -gt 0 ]]; do
218
+ case $1 in
219
+ --help)
220
+ show_help
221
+ exit 0
222
+ ;;
223
+ --clean)
224
+ clean_only=true
225
+ shift
226
+ ;;
227
+ --debug)
228
+ debug_mode=true
229
+ shift
230
+ ;;
231
+ --no-deps)
232
+ skip_deps=true
233
+ shift
234
+ ;;
235
+ --no-tests)
236
+ skip_tests=true
237
+ shift
238
+ ;;
239
+ --force-rebuild)
240
+ force_rebuild=true
241
+ shift
242
+ ;;
243
+ *)
244
+ log $RED "Unknown option: $1"
245
+ show_help
246
+ exit 1
247
+ ;;
248
+ esac
249
+ done
250
+
251
+ log $GREEN "🚀 Starting mongory-rb build process..."
252
+
253
+ # Clean and exit if requested
254
+ if $clean_only; then
255
+ clean
256
+ exit 0
257
+ fi
258
+
259
+ # Force rebuild if requested
260
+ if $force_rebuild; then
261
+ clean
262
+ fi
263
+
264
+ # Check dependencies unless skipped
265
+ if ! $skip_deps; then
266
+ check_dependencies
267
+ fi
268
+
269
+ # Initialize submodules
270
+ init_submodules
271
+
272
+ # Build mongory-core
273
+ build_core
274
+
275
+ # Build Ruby C extension
276
+ if $debug_mode; then
277
+ build_extension --debug
278
+ else
279
+ build_extension
280
+ fi
281
+
282
+ # Run tests unless skipped
283
+ if ! $skip_tests; then
284
+ run_tests
285
+ fi
286
+
287
+ log $GREEN "🎉 Build completed successfully!"
288
+ log $BLUE "You can now use mongory-rb with C extension support."
289
+ }
290
+
291
+ # Run main function with all arguments
292
+ main "$@"
data/sig/mongory.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Mongory
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mongory
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.3
5
+ platform: x64-mingw32
6
+ authors:
7
+ - koten0224
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-08-24 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: A Mongo-like in-memory query DSL for Ruby
13
+ email:
14
+ - koten0224@gmail.com
15
+ executables: []
16
+ extensions:
17
+ - ext/mongory_ext/extconf.rb
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".rspec"
21
+ - ".rubocop.yml"
22
+ - ".yardopts"
23
+ - CHANGELOG.md
24
+ - CODE_OF_CONDUCT.md
25
+ - LICENSE.txt
26
+ - README.md
27
+ - Rakefile
28
+ - SUBMODULE_INTEGRATION.md
29
+ - docs/advanced_usage.md
30
+ - docs/clang_bridge.md
31
+ - docs/field_names.md
32
+ - docs/migration.md
33
+ - docs/performance.md
34
+ - examples/README.md
35
+ - examples/benchmark-rails.rb
36
+ - examples/benchmark.rb
37
+ - ext/mongory_ext/extconf.rb
38
+ - ext/mongory_ext/mongory-core/include/mongory-core.h
39
+ - ext/mongory_ext/mongory-core/include/mongory-core/foundations/array.h
40
+ - ext/mongory_ext/mongory-core/include/mongory-core/foundations/config.h
41
+ - ext/mongory_ext/mongory-core/include/mongory-core/foundations/error.h
42
+ - ext/mongory_ext/mongory-core/include/mongory-core/foundations/memory_pool.h
43
+ - ext/mongory_ext/mongory-core/include/mongory-core/foundations/table.h
44
+ - ext/mongory_ext/mongory-core/include/mongory-core/foundations/value.h
45
+ - ext/mongory_ext/mongory-core/include/mongory-core/matchers/matcher.h
46
+ - ext/mongory_ext/mongory-core/src/foundations/array.c
47
+ - ext/mongory_ext/mongory-core/src/foundations/array_private.h
48
+ - ext/mongory_ext/mongory-core/src/foundations/config.c
49
+ - ext/mongory_ext/mongory-core/src/foundations/config_private.h
50
+ - ext/mongory_ext/mongory-core/src/foundations/error.c
51
+ - ext/mongory_ext/mongory-core/src/foundations/memory_pool.c
52
+ - ext/mongory_ext/mongory-core/src/foundations/string_buffer.c
53
+ - ext/mongory_ext/mongory-core/src/foundations/string_buffer.h
54
+ - ext/mongory_ext/mongory-core/src/foundations/table.c
55
+ - ext/mongory_ext/mongory-core/src/foundations/utils.c
56
+ - ext/mongory_ext/mongory-core/src/foundations/utils.h
57
+ - ext/mongory_ext/mongory-core/src/foundations/value.c
58
+ - ext/mongory_ext/mongory-core/src/matchers/array_record_matcher.c
59
+ - ext/mongory_ext/mongory-core/src/matchers/array_record_matcher.h
60
+ - ext/mongory_ext/mongory-core/src/matchers/base_matcher.c
61
+ - ext/mongory_ext/mongory-core/src/matchers/base_matcher.h
62
+ - ext/mongory_ext/mongory-core/src/matchers/compare_matcher.c
63
+ - ext/mongory_ext/mongory-core/src/matchers/compare_matcher.h
64
+ - ext/mongory_ext/mongory-core/src/matchers/composite_matcher.c
65
+ - ext/mongory_ext/mongory-core/src/matchers/composite_matcher.h
66
+ - ext/mongory_ext/mongory-core/src/matchers/existance_matcher.c
67
+ - ext/mongory_ext/mongory-core/src/matchers/existance_matcher.h
68
+ - ext/mongory_ext/mongory-core/src/matchers/external_matcher.c
69
+ - ext/mongory_ext/mongory-core/src/matchers/external_matcher.h
70
+ - ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.c
71
+ - ext/mongory_ext/mongory-core/src/matchers/inclusion_matcher.h
72
+ - ext/mongory_ext/mongory-core/src/matchers/literal_matcher.c
73
+ - ext/mongory_ext/mongory-core/src/matchers/literal_matcher.h
74
+ - ext/mongory_ext/mongory-core/src/matchers/matcher.c
75
+ - ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.c
76
+ - ext/mongory_ext/mongory-core/src/matchers/matcher_explainable.h
77
+ - ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.c
78
+ - ext/mongory_ext/mongory-core/src/matchers/matcher_traversable.h
79
+ - ext/mongory_ext/mongory_ext.c
80
+ - lib/generators/mongory/install/install_generator.rb
81
+ - lib/generators/mongory/install/templates/initializer.rb.erb
82
+ - lib/generators/mongory/matcher/matcher_generator.rb
83
+ - lib/generators/mongory/matcher/templates/matcher.rb.erb
84
+ - lib/generators/mongory/matcher/templates/matcher_spec.rb.erb
85
+ - lib/mongory.rb
86
+ - lib/mongory/c_query_builder.rb
87
+ - lib/mongory/converters.rb
88
+ - lib/mongory/converters/abstract_converter.rb
89
+ - lib/mongory/converters/condition_converter.rb
90
+ - lib/mongory/converters/converted.rb
91
+ - lib/mongory/converters/data_converter.rb
92
+ - lib/mongory/converters/key_converter.rb
93
+ - lib/mongory/converters/value_converter.rb
94
+ - lib/mongory/matchers.rb
95
+ - lib/mongory/matchers/abstract_matcher.rb
96
+ - lib/mongory/matchers/abstract_multi_matcher.rb
97
+ - lib/mongory/matchers/and_matcher.rb
98
+ - lib/mongory/matchers/array_record_matcher.rb
99
+ - lib/mongory/matchers/elem_match_matcher.rb
100
+ - lib/mongory/matchers/eq_matcher.rb
101
+ - lib/mongory/matchers/every_matcher.rb
102
+ - lib/mongory/matchers/exists_matcher.rb
103
+ - lib/mongory/matchers/field_matcher.rb
104
+ - lib/mongory/matchers/gt_matcher.rb
105
+ - lib/mongory/matchers/gte_matcher.rb
106
+ - lib/mongory/matchers/hash_condition_matcher.rb
107
+ - lib/mongory/matchers/in_matcher.rb
108
+ - lib/mongory/matchers/literal_matcher.rb
109
+ - lib/mongory/matchers/lt_matcher.rb
110
+ - lib/mongory/matchers/lte_matcher.rb
111
+ - lib/mongory/matchers/ne_matcher.rb
112
+ - lib/mongory/matchers/nin_matcher.rb
113
+ - lib/mongory/matchers/not_matcher.rb
114
+ - lib/mongory/matchers/or_matcher.rb
115
+ - lib/mongory/matchers/present_matcher.rb
116
+ - lib/mongory/matchers/regex_matcher.rb
117
+ - lib/mongory/matchers/size_matcher.rb
118
+ - lib/mongory/mongoid.rb
119
+ - lib/mongory/query_builder.rb
120
+ - lib/mongory/query_matcher.rb
121
+ - lib/mongory/query_operator.rb
122
+ - lib/mongory/rails.rb
123
+ - lib/mongory/utils.rb
124
+ - lib/mongory/utils/context.rb
125
+ - lib/mongory/utils/debugger.rb
126
+ - lib/mongory/utils/rails_patch.rb
127
+ - lib/mongory/utils/singleton_builder.rb
128
+ - lib/mongory/version.rb
129
+ - lib/mongory_ext.so
130
+ - mongory.gemspec
131
+ - scripts/build_with_core.sh
132
+ - sig/mongory.rbs
133
+ homepage: https://mongoryhq.github.io/mongory-rb/
134
+ licenses:
135
+ - MIT
136
+ metadata:
137
+ allowed_push_host: https://rubygems.org
138
+ rubygems_mfa_required: 'true'
139
+ homepage_uri: https://mongoryhq.github.io/mongory-rb/
140
+ source_code_uri: https://github.com/mongoryhq/mongory-rb
141
+ changelog_uri: https://github.com/mongoryhq/mongory-rb/blob/main/CHANGELOG.md
142
+ rdoc_options: []
143
+ require_paths:
144
+ - lib
145
+ required_ruby_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: 2.6.0
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ requirements: []
156
+ rubygems_version: 3.6.2
157
+ specification_version: 4
158
+ summary: MongoDB-like in-memory query DSL for Ruby
159
+ test_files: []