active_recall 2.0.2 → 2.2.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +9 -9
- data/.gitignore +1 -1
- data/.tool-versions +1 -1
- data/Appraisals +7 -8
- data/CLAUDE.md +194 -0
- data/Gemfile +14 -1
- data/Gemfile.lock +11 -8
- data/active_recall.gemspec +5 -5
- data/bin/flatten +54 -0
- data/gemfiles/rails_7_0.gemfile +2 -0
- data/gemfiles/rails_7_0.gemfile.lock +11 -6
- data/gemfiles/rails_7_1.gemfile +2 -0
- data/gemfiles/rails_7_1.gemfile.lock +11 -6
- data/gemfiles/{rails_6_0.gemfile → rails_8_0.gemfile} +3 -1
- data/gemfiles/rails_8_0.gemfile.lock +259 -0
- data/lib/active_recall/algorithms/fibonacci_sequence.rb +4 -5
- data/lib/active_recall/algorithms/sm2.rb +25 -18
- data/lib/active_recall/version.rb +1 -1
- data/standard.yml +1 -1
- data/tmp/.gitkeep +0 -0
- metadata +31 -33
- data/gemfiles/rails_6_0.gemfile.lock +0 -231
- data/gemfiles/rails_6_1.gemfile +0 -7
- data/gemfiles/rails_6_1.gemfile.lock +0 -231
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b09e91a09c75f943e1bb2ced582d4520674053f5504f8e14fcfe370babbf4300
|
|
4
|
+
data.tar.gz: 9acaaad5775d5ff38694260e9d66983f97cd614ff5c52fde3bc67c7e13d14b01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fffb380767376c2ad2b4bec163b508b2a32a03a33b05eebe755e80e6b0c825c1fd2a53133ae33e2582379e55329ef7a8b32dfbc3565a4fd4bca6ca2a93c994e
|
|
7
|
+
data.tar.gz: 982a9a742fb97e0cc9f0db89d6664f253c7f4534929b030d3ce78d9c3d164b08e2087cc31da79fbda4fb69b2e58e2bd05362a436d37743bebab574a1c529a78a
|
data/.github/workflows/tests.yml
CHANGED
|
@@ -19,10 +19,10 @@ jobs:
|
|
|
19
19
|
- macos
|
|
20
20
|
- ubuntu
|
|
21
21
|
ruby:
|
|
22
|
-
- 3.0
|
|
23
|
-
- 3.1
|
|
24
22
|
- 3.2
|
|
25
23
|
- 3.3
|
|
24
|
+
- 3.4
|
|
25
|
+
- 4.0
|
|
26
26
|
allow_failures:
|
|
27
27
|
- false
|
|
28
28
|
env:
|
|
@@ -37,14 +37,14 @@ jobs:
|
|
|
37
37
|
uses: ruby/setup-ruby@v1
|
|
38
38
|
with:
|
|
39
39
|
ruby-version: ${{ matrix.ruby }}
|
|
40
|
-
bundler-cache:
|
|
40
|
+
bundler-cache: false
|
|
41
|
+
- name: Bundle Install
|
|
42
|
+
run: bundle install
|
|
41
43
|
- name: Install Appraisal Dependencies
|
|
42
44
|
run: bundle exec appraisal install
|
|
43
|
-
- name: Test with Rails 6.0
|
|
44
|
-
run: bundle exec appraisal rails-6-0 rake spec
|
|
45
|
-
- name: Test with Rails 6.1
|
|
46
|
-
run: bundle exec appraisal rails-6-1 rake spec
|
|
47
|
-
- name: Test with Rails 7.0
|
|
48
|
-
run: bundle exec appraisal rails-7-0 rake spec
|
|
49
45
|
- name: Test with Rails 7.0
|
|
50
46
|
run: bundle exec appraisal rails-7-0 rake spec
|
|
47
|
+
- name: Test with Rails 7.1
|
|
48
|
+
run: bundle exec appraisal rails-7-1 rake spec
|
|
49
|
+
- name: Test with Rails 8.0
|
|
50
|
+
run: bundle exec appraisal rails-8-0 rake spec
|
data/.gitignore
CHANGED
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby 3.
|
|
1
|
+
ruby 3.4.8
|
data/Appraisals
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
appraise "rails-6-0" do
|
|
2
|
-
gem "rails", "~> 6.0"
|
|
3
|
-
end
|
|
4
|
-
|
|
5
|
-
appraise "rails-6-1" do
|
|
6
|
-
gem "rails", "~> 6.1"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
1
|
appraise "rails-7-0" do
|
|
10
2
|
gem "rails", "~> 7.0"
|
|
3
|
+
gem "sqlite3", "~> 1.4"
|
|
11
4
|
end
|
|
12
5
|
|
|
13
6
|
appraise "rails-7-1" do
|
|
14
7
|
gem "rails", "~> 7.1"
|
|
8
|
+
gem "sqlite3", "~> 1.4"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
appraise "rails-8-0" do
|
|
12
|
+
gem "rails", "~> 8.0"
|
|
13
|
+
gem "sqlite3", ">= 2.1"
|
|
15
14
|
end
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
ActiveRecall is a Ruby gem that implements a spaced-repetition system (SRS) for ActiveRecord models. It allows treating arbitrary ActiveRecord models as flashcards with configurable scheduling algorithms. The gem is backwards-compatible with the okubo gem and requires Rails 6+ and Ruby 3+.
|
|
8
|
+
|
|
9
|
+
## Common Commands
|
|
10
|
+
|
|
11
|
+
### Testing
|
|
12
|
+
```bash
|
|
13
|
+
# Run all tests (PREFERRED - handles appraisal automatically)
|
|
14
|
+
bin/spec
|
|
15
|
+
|
|
16
|
+
# Run tests against a specific Rails version
|
|
17
|
+
bin/spec rails-7-0
|
|
18
|
+
bin/spec rails-7-1
|
|
19
|
+
bin/spec rails-8-0
|
|
20
|
+
|
|
21
|
+
# Note: Direct bundle exec commands may encounter sqlite3 version conflicts
|
|
22
|
+
# The bin/spec wrapper handles this by using the appropriate appraisal gemfiles
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Linting
|
|
26
|
+
```bash
|
|
27
|
+
# Run StandardRB linter
|
|
28
|
+
bin/lint
|
|
29
|
+
# or
|
|
30
|
+
bundle exec standardrb
|
|
31
|
+
|
|
32
|
+
# Auto-fix issues
|
|
33
|
+
bundle exec standardrb --fix
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Development Setup
|
|
37
|
+
```bash
|
|
38
|
+
# Install dependencies and set up database
|
|
39
|
+
bin/setup
|
|
40
|
+
|
|
41
|
+
# Launch interactive console
|
|
42
|
+
bin/console
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Testing Against Multiple Rails Versions
|
|
46
|
+
```bash
|
|
47
|
+
# Generate gemfiles for different Rails versions (run after Gemfile changes)
|
|
48
|
+
bundle exec appraisal install
|
|
49
|
+
|
|
50
|
+
# Run tests against specific Rails version manually
|
|
51
|
+
bundle exec appraisal rails-7-0 rake spec
|
|
52
|
+
bundle exec appraisal rails-7-1 rake spec
|
|
53
|
+
bundle exec appraisal rails-8-0 rake spec
|
|
54
|
+
|
|
55
|
+
# Note: bin/spec runs tests against all Rails versions automatically
|
|
56
|
+
# This is defined in the Appraisals file and creates separate gemfiles in gemfiles/
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Gem Management
|
|
60
|
+
```bash
|
|
61
|
+
# Build the gem
|
|
62
|
+
bundle exec rake build
|
|
63
|
+
|
|
64
|
+
# Install gem locally
|
|
65
|
+
bundle exec rake install
|
|
66
|
+
|
|
67
|
+
# Release new version (requires updating lib/active_recall/version.rb first)
|
|
68
|
+
bundle exec rake release
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Architecture
|
|
72
|
+
|
|
73
|
+
### Core Components
|
|
74
|
+
|
|
75
|
+
1. **ActiveRecall::Base** (lib/active_recall/base.rb)
|
|
76
|
+
- Provides `has_deck` class method that makes any ActiveRecord model a deck owner
|
|
77
|
+
- Mixes in DeckMethods and ItemMethods when invoked
|
|
78
|
+
- Sets up polymorphic relationship between users and their decks
|
|
79
|
+
|
|
80
|
+
2. **ActiveRecall::Deck** (lib/active_recall/models/deck.rb)
|
|
81
|
+
- Polymorphic model representing a collection of items to review
|
|
82
|
+
- Belongs to a user (polymorphic), has many items
|
|
83
|
+
- Key methods: `review`, `next`, `untested`, `failed`, `known`, `expired`, `box(n)`
|
|
84
|
+
- Handles database adapter differences (MySQL vs others) for random ordering
|
|
85
|
+
|
|
86
|
+
3. **ActiveRecall::Item** (lib/active_recall/models/item.rb)
|
|
87
|
+
- Represents individual flashcard items in a deck
|
|
88
|
+
- Polymorphic association to source objects (the actual flashcard content)
|
|
89
|
+
- Methods: `score!(grade)`, `right!`, `wrong!`
|
|
90
|
+
- Delegates to configured algorithm for calculating next review dates
|
|
91
|
+
|
|
92
|
+
4. **Algorithms** (lib/active_recall/algorithms/)
|
|
93
|
+
- Each algorithm class implements: `type`, `required_attributes`, `right`, `wrong`, and optionally `score`
|
|
94
|
+
- Algorithm types: `:binary` (right/wrong only) or `:gradable` (accepts scores)
|
|
95
|
+
- Binary algorithms: LeitnerSystem (default), SoftLeitnerSystem, FibonacciSequence
|
|
96
|
+
- Gradable algorithm: SM2
|
|
97
|
+
- All algorithms are stateless; they accept current state and return new state as a hash
|
|
98
|
+
|
|
99
|
+
5. **Configuration** (lib/active_recall/configuration.rb)
|
|
100
|
+
- Global configuration via `ActiveRecall.configure`
|
|
101
|
+
- Primary setting: `algorithm_class` (defaults to LeitnerSystem)
|
|
102
|
+
- Configuration should be set in Rails initializers
|
|
103
|
+
|
|
104
|
+
### Data Flow
|
|
105
|
+
|
|
106
|
+
1. A model calls `has_deck :items_name` to enable SRS functionality
|
|
107
|
+
2. This creates a Deck record (polymorphic, user_id/user_type)
|
|
108
|
+
3. Items are added to deck with `<<` operator, creating Item records
|
|
109
|
+
4. Item records store: box number, review dates, times_right/times_wrong, easiness_factor (for SM2)
|
|
110
|
+
5. User calls `right_answer_for!(item)` or `wrong_answer_for!(item)` (or `score!(grade, item)` for gradable algorithms)
|
|
111
|
+
6. This delegates to Item's `right!`/`wrong!`/`score!` which calls the configured algorithm
|
|
112
|
+
7. Algorithm returns hash of updated attributes (box, next_review, etc.)
|
|
113
|
+
8. Deck provides query methods that filter items by state and return source objects
|
|
114
|
+
|
|
115
|
+
### Key Design Patterns
|
|
116
|
+
|
|
117
|
+
- **Polymorphic associations**: Decks belong to any "user" model, Items reference any "source" model
|
|
118
|
+
- **Strategy pattern**: Algorithms are swappable via configuration
|
|
119
|
+
- **Delegation**: Deck methods delegate to Item scopes, which use the configured algorithm
|
|
120
|
+
- **Stateless algorithms**: All algorithm classes are stateless with class methods only (except FibonacciSequence which caches Fibonacci numbers in instances)
|
|
121
|
+
|
|
122
|
+
## Database Schema
|
|
123
|
+
|
|
124
|
+
The gem creates two tables via generators:
|
|
125
|
+
- `active_recall_decks`: id, user_id (polymorphic), user_type, created_at, updated_at
|
|
126
|
+
- `active_recall_items`: id, deck_id, source_id (polymorphic), source_type, box, times_right, times_wrong, last_reviewed, next_review, easiness_factor, created_at, updated_at
|
|
127
|
+
|
|
128
|
+
## Migration from Okubo
|
|
129
|
+
|
|
130
|
+
The gem includes a migration template (`migrate_okubo_to_active_recall.rb`) that renames tables from okubo_* to active_recall_*. Use `rails generate active_recall --migrate_data true` to generate this migration.
|
|
131
|
+
|
|
132
|
+
## Code Style
|
|
133
|
+
|
|
134
|
+
- Uses StandardRB for linting (config in standard.yml)
|
|
135
|
+
- All files have `# frozen_string_literal: true` pragma
|
|
136
|
+
- Ruby 3.2+ syntax required
|
|
137
|
+
|
|
138
|
+
## Testing Conventions
|
|
139
|
+
|
|
140
|
+
### Test File Structure
|
|
141
|
+
- Spec files mirror lib/ directory structure (e.g., `lib/active_recall/foo.rb` → `spec/active_recall/foo_spec.rb`)
|
|
142
|
+
- All spec files start with `# frozen_string_literal: true` and `require "spec_helper"`
|
|
143
|
+
- Use `describe ClassName` for top-level blocks
|
|
144
|
+
- Use `context` blocks to organize different scenarios
|
|
145
|
+
- Use `subject { described_class.new }` for the class under test
|
|
146
|
+
|
|
147
|
+
### Common Patterns
|
|
148
|
+
```ruby
|
|
149
|
+
# Basic structure
|
|
150
|
+
describe ActiveRecall::SomeClass do
|
|
151
|
+
subject { described_class.new }
|
|
152
|
+
|
|
153
|
+
describe "#method_name" do
|
|
154
|
+
it "describes expected behavior" do
|
|
155
|
+
expect(subject.method_name).to eq(expected_value)
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
context "when specific condition" do
|
|
160
|
+
it "behaves differently" do
|
|
161
|
+
# test implementation
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Shared Examples
|
|
168
|
+
- Algorithm specs use shared examples for common behavior (see spec/active_recall/algorithms/algorithm_spec.rb)
|
|
169
|
+
- Binary algorithms share: `it_behaves_like "binary spaced repetition algorithms"`
|
|
170
|
+
- This ensures consistent testing across algorithm implementations
|
|
171
|
+
|
|
172
|
+
### Test Data Setup
|
|
173
|
+
- Use `let` blocks for test data that needs to be created
|
|
174
|
+
- Use `before` blocks for setup that must run before each test
|
|
175
|
+
- The spec_helper.rb defines Word and User models for testing deck functionality
|
|
176
|
+
|
|
177
|
+
### Running Specific Tests
|
|
178
|
+
While `bin/spec` is preferred for full test runs, you can run individual specs during development:
|
|
179
|
+
```bash
|
|
180
|
+
# During active development, you may need to specify the appraisal
|
|
181
|
+
bundle exec appraisal rails-8-0 rspec spec/active_recall/configuration_spec.rb
|
|
182
|
+
|
|
183
|
+
# Or run all specs via bin/spec which handles all Rails versions
|
|
184
|
+
bin/spec
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Test Infrastructure Notes
|
|
188
|
+
- Tests use an in-memory SQLite database (`:memory:`) configured in spec/spec_helper.rb
|
|
189
|
+
- Different Rails versions require different sqlite3 gem versions:
|
|
190
|
+
- Rails 7.0/7.1 use sqlite3 ~> 1.4
|
|
191
|
+
- Rails 8.0 uses sqlite3 >= 2.1
|
|
192
|
+
- The appraisal system manages these version conflicts via separate gemfiles
|
|
193
|
+
- Always use `bin/spec` to avoid sqlite3 version conflict errors
|
|
194
|
+
- Direct `bundle exec rspec` commands will fail with "can't activate sqlite3" errors
|
data/Gemfile
CHANGED
|
@@ -4,5 +4,18 @@ source "https://rubygems.org"
|
|
|
4
4
|
|
|
5
5
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
6
6
|
|
|
7
|
-
# Specify your gem's dependencies in active_recall.gemspec
|
|
8
7
|
gemspec
|
|
8
|
+
|
|
9
|
+
# TODO: Remove conditional dependency after dropping support for Ruby 3.2
|
|
10
|
+
begin
|
|
11
|
+
ruby_version = Gem::Version.new(RUBY_VERSION)
|
|
12
|
+
if ruby_version >= Gem::Version.new("3.4.0")
|
|
13
|
+
gem "nokogiri", ">= 1.16.2"
|
|
14
|
+
end
|
|
15
|
+
if ruby_version >= Gem::Version.new("4.0.0")
|
|
16
|
+
gem "benchmark"
|
|
17
|
+
gem "ostruct"
|
|
18
|
+
gem "logger"
|
|
19
|
+
end
|
|
20
|
+
rescue
|
|
21
|
+
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
active_recall (2.0
|
|
5
|
-
activerecord (>=
|
|
6
|
-
activesupport (>=
|
|
4
|
+
active_recall (2.2.0)
|
|
5
|
+
activerecord (>= 7.0, < 9.0)
|
|
6
|
+
activesupport (>= 7.0, < 9.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
@@ -132,10 +132,10 @@ GEM
|
|
|
132
132
|
net-smtp (0.4.0.1)
|
|
133
133
|
net-protocol
|
|
134
134
|
nio4r (2.7.0)
|
|
135
|
-
nokogiri (1.
|
|
135
|
+
nokogiri (1.18.7)
|
|
136
136
|
mini_portile2 (~> 2.8.2)
|
|
137
137
|
racc (~> 1.4)
|
|
138
|
-
nokogiri (1.
|
|
138
|
+
nokogiri (1.18.7-x86_64-linux-gnu)
|
|
139
139
|
racc (~> 1.4)
|
|
140
140
|
parallel (1.24.0)
|
|
141
141
|
parser (3.3.1.0)
|
|
@@ -217,7 +217,9 @@ GEM
|
|
|
217
217
|
rubocop-ast (>= 1.30.0, < 2.0)
|
|
218
218
|
ruby-progressbar (1.13.0)
|
|
219
219
|
ruby2_keywords (0.0.5)
|
|
220
|
-
sqlite3 (
|
|
220
|
+
sqlite3 (2.5.0)
|
|
221
|
+
mini_portile2 (~> 2.8.0)
|
|
222
|
+
sqlite3 (2.5.0-x86_64-linux-gnu)
|
|
221
223
|
standard (1.35.1)
|
|
222
224
|
language_server-protocol (~> 3.17.0.2)
|
|
223
225
|
lint_roller (~> 1.0)
|
|
@@ -248,11 +250,12 @@ PLATFORMS
|
|
|
248
250
|
DEPENDENCIES
|
|
249
251
|
active_recall!
|
|
250
252
|
appraisal
|
|
251
|
-
|
|
253
|
+
nokogiri (>= 1.16.2)
|
|
254
|
+
rails (>= 7.0, < 9.0)
|
|
252
255
|
rake (>= 12.0)
|
|
253
256
|
rdoc
|
|
254
257
|
rspec (>= 3.0)
|
|
255
|
-
sqlite3
|
|
258
|
+
sqlite3 (~> 2.1)
|
|
256
259
|
standard
|
|
257
260
|
|
|
258
261
|
BUNDLED WITH
|
data/active_recall.gemspec
CHANGED
|
@@ -33,13 +33,13 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.require_paths = ["lib"]
|
|
34
34
|
|
|
35
35
|
spec.add_development_dependency "appraisal"
|
|
36
|
-
spec.add_development_dependency "rails", ">=
|
|
36
|
+
spec.add_development_dependency "rails", ">= 7.0", "< 9.0"
|
|
37
37
|
spec.add_development_dependency "rake", ">= 12.0"
|
|
38
38
|
spec.add_development_dependency "rdoc"
|
|
39
39
|
spec.add_development_dependency "rspec", ">= 3.0"
|
|
40
|
-
spec.add_development_dependency "sqlite3"
|
|
40
|
+
spec.add_development_dependency "sqlite3", "~> 2.1"
|
|
41
41
|
spec.add_development_dependency "standard"
|
|
42
|
-
spec.add_runtime_dependency "activerecord", ">=
|
|
43
|
-
spec.add_runtime_dependency "activesupport", ">=
|
|
44
|
-
spec.required_ruby_version = ">= 3.
|
|
42
|
+
spec.add_runtime_dependency "activerecord", ">= 7.0", "< 9.0"
|
|
43
|
+
spec.add_runtime_dependency "activesupport", ">= 7.0", "< 9.0"
|
|
44
|
+
spec.required_ruby_version = ">= 3.2"
|
|
45
45
|
end
|
data/bin/flatten
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
app_root = Dir.pwd
|
|
6
|
+
app_name = File.basename(app_root)
|
|
7
|
+
|
|
8
|
+
# Create tmp directory
|
|
9
|
+
tmp_dir = File.join(app_root, 'tmp')
|
|
10
|
+
FileUtils.mkdir_p(tmp_dir)
|
|
11
|
+
|
|
12
|
+
# Define directories and file patterns to include in the search, excluding specific files and directories
|
|
13
|
+
include_patterns = [
|
|
14
|
+
File.join(app_root, 'bin', '**', '*'),
|
|
15
|
+
File.join(app_root, 'lib', '**', '*'),
|
|
16
|
+
File.join(app_root, 'spec', '**', '*'),
|
|
17
|
+
File.join(app_root, '.github', '**', '*'),
|
|
18
|
+
File.join(app_root, '*.{md,rss,json,rb,gemspec,lock,yml,gitignore,rspec,tool-versions,Appraisals,Rakefile}')
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
# Find all matching files
|
|
22
|
+
files = include_patterns.flat_map { |pattern| Dir.glob(pattern, File::FNM_DOTMATCH) }
|
|
23
|
+
files.select! { |f| File.file?(f) }
|
|
24
|
+
|
|
25
|
+
# Exclude the gemfiles directory and the top-level Gemfile.lock
|
|
26
|
+
files.reject! do |file|
|
|
27
|
+
file.start_with?(File.join(app_root, 'gemfiles')) || file == File.join(app_root, 'Gemfile.lock')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Output file
|
|
31
|
+
output_file = File.join(tmp_dir, "#{app_name}_flat_file.txt")
|
|
32
|
+
|
|
33
|
+
File.open(output_file, 'w') do |file|
|
|
34
|
+
files.each do |file_path|
|
|
35
|
+
relative_path = file_path.sub("#{app_root}/", '')
|
|
36
|
+
extension = File.extname(file_path).delete_prefix('.')
|
|
37
|
+
|
|
38
|
+
file.puts "#{relative_path}:"
|
|
39
|
+
|
|
40
|
+
content = File.read(file_path)
|
|
41
|
+
if extension == 'md'
|
|
42
|
+
file.puts content
|
|
43
|
+
else
|
|
44
|
+
file.puts "```#{extension}"
|
|
45
|
+
file.puts content
|
|
46
|
+
file.puts "```"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
file.puts ""
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Print the path to the generated flat file
|
|
54
|
+
puts "Flat file created at: #{output_file}"
|
data/gemfiles/rails_7_0.gemfile
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
active_recall (2.0
|
|
5
|
-
activerecord (>=
|
|
6
|
-
activesupport (>=
|
|
4
|
+
active_recall (2.2.0)
|
|
5
|
+
activerecord (>= 7.0, < 9.0)
|
|
6
|
+
activesupport (>= 7.0, < 9.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
@@ -119,6 +119,7 @@ GEM
|
|
|
119
119
|
net-smtp
|
|
120
120
|
marcel (1.0.2)
|
|
121
121
|
mini_mime (1.1.5)
|
|
122
|
+
mini_portile2 (2.8.8)
|
|
122
123
|
minitest (5.21.2)
|
|
123
124
|
mutex_m (0.2.0)
|
|
124
125
|
net-imap (0.4.9.1)
|
|
@@ -131,7 +132,7 @@ GEM
|
|
|
131
132
|
net-smtp (0.4.0.1)
|
|
132
133
|
net-protocol
|
|
133
134
|
nio4r (2.7.0)
|
|
134
|
-
nokogiri (1.
|
|
135
|
+
nokogiri (1.18.7-arm64-darwin)
|
|
135
136
|
racc (~> 1.4)
|
|
136
137
|
parallel (1.24.0)
|
|
137
138
|
parser (3.3.1.0)
|
|
@@ -216,7 +217,8 @@ GEM
|
|
|
216
217
|
rubocop-ast (>= 1.30.0, < 2.0)
|
|
217
218
|
ruby-progressbar (1.13.0)
|
|
218
219
|
ruby2_keywords (0.0.5)
|
|
219
|
-
sqlite3 (1.7.
|
|
220
|
+
sqlite3 (1.7.3)
|
|
221
|
+
mini_portile2 (~> 2.8.0)
|
|
220
222
|
standard (1.35.1)
|
|
221
223
|
language_server-protocol (~> 3.17.0.2)
|
|
222
224
|
lint_roller (~> 1.0)
|
|
@@ -243,15 +245,18 @@ GEM
|
|
|
243
245
|
|
|
244
246
|
PLATFORMS
|
|
245
247
|
arm64-darwin-23
|
|
248
|
+
arm64-darwin-24
|
|
249
|
+
arm64-darwin-25
|
|
246
250
|
|
|
247
251
|
DEPENDENCIES
|
|
248
252
|
active_recall!
|
|
249
253
|
appraisal
|
|
254
|
+
nokogiri (>= 1.16.2)
|
|
250
255
|
rails (~> 7.0)
|
|
251
256
|
rake (>= 12.0)
|
|
252
257
|
rdoc
|
|
253
258
|
rspec (>= 3.0)
|
|
254
|
-
sqlite3
|
|
259
|
+
sqlite3 (~> 1.4)
|
|
255
260
|
standard
|
|
256
261
|
|
|
257
262
|
BUNDLED WITH
|
data/gemfiles/rails_7_1.gemfile
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
active_recall (2.0
|
|
5
|
-
activerecord (>=
|
|
6
|
-
activesupport (>=
|
|
4
|
+
active_recall (2.2.0)
|
|
5
|
+
activerecord (>= 7.0, < 9.0)
|
|
6
|
+
activesupport (>= 7.0, < 9.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
@@ -119,6 +119,7 @@ GEM
|
|
|
119
119
|
net-smtp
|
|
120
120
|
marcel (1.0.2)
|
|
121
121
|
mini_mime (1.1.5)
|
|
122
|
+
mini_portile2 (2.8.8)
|
|
122
123
|
minitest (5.21.2)
|
|
123
124
|
mutex_m (0.2.0)
|
|
124
125
|
net-imap (0.4.9.1)
|
|
@@ -131,7 +132,7 @@ GEM
|
|
|
131
132
|
net-smtp (0.4.0.1)
|
|
132
133
|
net-protocol
|
|
133
134
|
nio4r (2.7.0)
|
|
134
|
-
nokogiri (1.
|
|
135
|
+
nokogiri (1.18.7-arm64-darwin)
|
|
135
136
|
racc (~> 1.4)
|
|
136
137
|
parallel (1.24.0)
|
|
137
138
|
parser (3.3.1.0)
|
|
@@ -216,7 +217,8 @@ GEM
|
|
|
216
217
|
rubocop-ast (>= 1.30.0, < 2.0)
|
|
217
218
|
ruby-progressbar (1.13.0)
|
|
218
219
|
ruby2_keywords (0.0.5)
|
|
219
|
-
sqlite3 (1.7.
|
|
220
|
+
sqlite3 (1.7.3)
|
|
221
|
+
mini_portile2 (~> 2.8.0)
|
|
220
222
|
standard (1.35.1)
|
|
221
223
|
language_server-protocol (~> 3.17.0.2)
|
|
222
224
|
lint_roller (~> 1.0)
|
|
@@ -243,15 +245,18 @@ GEM
|
|
|
243
245
|
|
|
244
246
|
PLATFORMS
|
|
245
247
|
arm64-darwin-23
|
|
248
|
+
arm64-darwin-24
|
|
249
|
+
arm64-darwin-25
|
|
246
250
|
|
|
247
251
|
DEPENDENCIES
|
|
248
252
|
active_recall!
|
|
249
253
|
appraisal
|
|
254
|
+
nokogiri (>= 1.16.2)
|
|
250
255
|
rails (~> 7.1)
|
|
251
256
|
rake (>= 12.0)
|
|
252
257
|
rdoc
|
|
253
258
|
rspec (>= 3.0)
|
|
254
|
-
sqlite3
|
|
259
|
+
sqlite3 (~> 1.4)
|
|
255
260
|
standard
|
|
256
261
|
|
|
257
262
|
BUNDLED WITH
|