tapioca_dsl_compiler_store_model 0.1.0 → 0.1.2
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/README.md +3 -13
- data/bump_version.sh +115 -0
- data/lib/tapioca/dsl/compilers/store_model.rb +0 -2
- data/lib/tapioca_dsl_compiler_store_model/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8695b3c4b636d2021926bf0c9c2e24214f187a51932082f2d707de39c77b7c1c
|
4
|
+
data.tar.gz: 88a4e945bfd61b5b18e4abec1a4fa985b3e8417b6f37d333d56ae7dd77323f22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 388d30a2d63a7300c8c10f6b3a8c1d84d8f32fdf699e937409e173f881fa06057f8be52904625c292f7081eb67d3ff7ed58d0eceff6708e3a8d7f7eb2ef70a1b
|
7
|
+
data.tar.gz: 8eeab3c0cc6465d334556892c77bd353cda98a032fa5e42650af3cb553ced879a4d62b1fc46b76f37bad29997b5abc872d900bfd746a1ff66006a26285429be8
|
data/README.md
CHANGED
@@ -2,15 +2,6 @@
|
|
2
2
|
|
3
3
|
A [Tapioca](https://github.com/Shopify/tapioca) DSL compiler that generates RBI files for [StoreModel](https://github.com/DmitryTsepelev/store_model) attributes in ActiveRecord models.
|
4
4
|
|
5
|
-
StoreModel adds JSON-backed attributes to ActiveRecord models, and this gem provides Sorbet type signatures for the methods that StoreModel dynamically generates.
|
6
|
-
|
7
|
-
## Features
|
8
|
-
|
9
|
-
- **Automatic RBI Generation**: Generates Sorbet RBI files for StoreModel attributes
|
10
|
-
- **Comprehensive Type Coverage**: Supports both single and array StoreModel types
|
11
|
-
- **Build Methods**: Generates signatures for `build_*` methods created by StoreModel
|
12
|
-
- **Tapioca Integration**: Follows Tapioca's standard compiler patterns and is automatically discovered
|
13
|
-
|
14
5
|
## Installation
|
15
6
|
|
16
7
|
Add this line to your application's Gemfile:
|
@@ -33,7 +24,7 @@ $ gem install tapioca_dsl_compiler_store_model
|
|
33
24
|
|
34
25
|
## Usage
|
35
26
|
|
36
|
-
Once installed, Tapioca will automatically discover and use
|
27
|
+
Once installed, Tapioca will automatically discover and use this compiler when generating RBI files with `bundle exec tapioca dsl`.
|
37
28
|
|
38
29
|
### Example
|
39
30
|
|
@@ -117,10 +108,9 @@ These features may be added in future versions.
|
|
117
108
|
|
118
109
|
## Requirements
|
119
110
|
|
120
|
-
- Ruby 2
|
121
|
-
- [Tapioca](https://github.com/Shopify/tapioca) 0.
|
111
|
+
- Ruby 3.2+
|
112
|
+
- [Tapioca](https://github.com/Shopify/tapioca) 0.11+
|
122
113
|
- [StoreModel](https://github.com/DmitryTsepelev/store_model) 1.0+
|
123
|
-
- ActiveRecord 6.0+
|
124
114
|
|
125
115
|
## Development
|
126
116
|
|
data/bump_version.sh
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Script to bump gem version
|
4
|
+
# Usage examples:
|
5
|
+
# ./bump_version.sh patch
|
6
|
+
# ./bump_version.sh minor
|
7
|
+
# ./bump_version.sh major
|
8
|
+
# ./bump_version.sh 1.2.3
|
9
|
+
|
10
|
+
set -e
|
11
|
+
|
12
|
+
BUMP_TYPE="$1"
|
13
|
+
|
14
|
+
if [ -z "$BUMP_TYPE" ]; then
|
15
|
+
echo "Usage: $0 <patch|minor|major|x.y.z>"
|
16
|
+
echo "Examples:"
|
17
|
+
echo " $0 patch # 1.0.0 -> 1.0.1"
|
18
|
+
echo " $0 minor # 1.0.1 -> 1.1.0"
|
19
|
+
echo " $0 major # 1.1.0 -> 2.0.0"
|
20
|
+
echo " $0 1.2.3 # Set specific version"
|
21
|
+
exit 1
|
22
|
+
fi
|
23
|
+
|
24
|
+
# Get current version
|
25
|
+
get_current_version() {
|
26
|
+
# Try to find version.rb in common locations
|
27
|
+
for version_file in lib/version.rb lib/*/version.rb; do
|
28
|
+
if [ -f "$version_file" ]; then
|
29
|
+
grep -o "VERSION = ['\"][^'\"]*['\"]" "$version_file" | cut -d"'" -f2 | cut -d'"' -f2
|
30
|
+
return
|
31
|
+
fi
|
32
|
+
done
|
33
|
+
echo "0.0.0"
|
34
|
+
}
|
35
|
+
|
36
|
+
# Bump version
|
37
|
+
bump_version() {
|
38
|
+
local current="$1"
|
39
|
+
local type="$2"
|
40
|
+
|
41
|
+
IFS='.' read -ra VERSION_PARTS <<< "$current"
|
42
|
+
local major="${VERSION_PARTS[0]}"
|
43
|
+
local minor="${VERSION_PARTS[1]}"
|
44
|
+
local patch="${VERSION_PARTS[2]}"
|
45
|
+
|
46
|
+
case "$type" in
|
47
|
+
"patch")
|
48
|
+
patch=$((patch + 1))
|
49
|
+
;;
|
50
|
+
"minor")
|
51
|
+
minor=$((minor + 1))
|
52
|
+
patch=0
|
53
|
+
;;
|
54
|
+
"major")
|
55
|
+
major=$((major + 1))
|
56
|
+
minor=0
|
57
|
+
patch=0
|
58
|
+
;;
|
59
|
+
*)
|
60
|
+
# Specific version is provided
|
61
|
+
echo "$type"
|
62
|
+
return
|
63
|
+
;;
|
64
|
+
esac
|
65
|
+
|
66
|
+
echo "${major}.${minor}.${patch}"
|
67
|
+
}
|
68
|
+
|
69
|
+
# Update files
|
70
|
+
update_files() {
|
71
|
+
local new_version="$1"
|
72
|
+
|
73
|
+
# Update version.rb
|
74
|
+
if [ -f "lib/version.rb" ]; then
|
75
|
+
sed -i.bak "s/VERSION = ['\"][^'\"]*['\"]/VERSION = \"${new_version}\"/" lib/version.rb
|
76
|
+
rm lib/version.rb.bak
|
77
|
+
fi
|
78
|
+
|
79
|
+
# Update lib/gem_name/version.rb
|
80
|
+
for version_file in lib/*/version.rb; do
|
81
|
+
if [ -f "$version_file" ]; then
|
82
|
+
sed -i.bak "s/VERSION = ['\"][^'\"]*['\"]/VERSION = \"${new_version}\"/" "$version_file"
|
83
|
+
rm "${version_file}.bak"
|
84
|
+
fi
|
85
|
+
done
|
86
|
+
}
|
87
|
+
|
88
|
+
# Main process
|
89
|
+
CURRENT_VERSION=$(get_current_version)
|
90
|
+
echo "Current version: $CURRENT_VERSION"
|
91
|
+
|
92
|
+
NEW_VERSION=$(bump_version "$CURRENT_VERSION" "$BUMP_TYPE")
|
93
|
+
echo "New version: $NEW_VERSION"
|
94
|
+
|
95
|
+
# Confirmation
|
96
|
+
read -p "Update version to $NEW_VERSION? (y/N): " -n 1 -r
|
97
|
+
echo
|
98
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
99
|
+
update_files "$NEW_VERSION"
|
100
|
+
echo "Version updated to $NEW_VERSION"
|
101
|
+
|
102
|
+
# Update Gemfile.lock if gem references itself
|
103
|
+
if grep -q "remote: \." Gemfile.lock 2>/dev/null; then
|
104
|
+
echo "Updating Gemfile.lock..."
|
105
|
+
bundle update tapioca_dsl_compiler_store_model
|
106
|
+
fi
|
107
|
+
|
108
|
+
echo "Don't forget to:"
|
109
|
+
echo " 1. git add -A"
|
110
|
+
echo " 2. git commit -m 'Bump version to $NEW_VERSION'"
|
111
|
+
echo " 3. git tag v$NEW_VERSION"
|
112
|
+
echo " 4. git push origin main --tags"
|
113
|
+
else
|
114
|
+
echo "Version update cancelled"
|
115
|
+
fi
|
@@ -5,8 +5,6 @@ module Tapioca
|
|
5
5
|
module Dsl
|
6
6
|
module Compilers
|
7
7
|
class StoreModel < Tapioca::Dsl::Compiler
|
8
|
-
ConstantType = type_member { { fixed: T.class_of(ActiveRecord::Base) } }
|
9
|
-
|
10
8
|
sig { override.returns(T::Enumerable[Module]) }
|
11
9
|
def self.gather_constants
|
12
10
|
return [] unless defined?(::StoreModel)
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapioca_dsl_compiler_store_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- speria-jp
|
8
|
+
autorequire:
|
8
9
|
bindir: exe
|
9
10
|
cert_chain: []
|
10
|
-
date:
|
11
|
+
date: 2025-06-29 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
13
|
- !ruby/object:Gem::Dependency
|
13
14
|
name: store_model
|
@@ -47,6 +48,7 @@ extra_rdoc_files: []
|
|
47
48
|
files:
|
48
49
|
- README.md
|
49
50
|
- Rakefile
|
51
|
+
- bump_version.sh
|
50
52
|
- lib/tapioca/dsl/compilers/store_model.rb
|
51
53
|
- lib/tapioca_dsl_compiler_store_model.rb
|
52
54
|
- lib/tapioca_dsl_compiler_store_model/version.rb
|
@@ -58,6 +60,7 @@ metadata:
|
|
58
60
|
homepage_uri: https://github.com/speria-jp/tapioca_dsl_compiler_store_model
|
59
61
|
source_code_uri: https://github.com/speria-jp/tapioca_dsl_compiler_store_model
|
60
62
|
rubygems_mfa_required: 'true'
|
63
|
+
post_install_message:
|
61
64
|
rdoc_options: []
|
62
65
|
require_paths:
|
63
66
|
- lib
|
@@ -72,7 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
75
|
- !ruby/object:Gem::Version
|
73
76
|
version: '0'
|
74
77
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
78
|
+
rubygems_version: 3.5.22
|
79
|
+
signing_key:
|
76
80
|
specification_version: 4
|
77
81
|
summary: Tapioca DSL compiler for StoreModel
|
78
82
|
test_files: []
|