rodoo 0.2.0 → 0.3.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/.claude/skills/release/SKILL.md +133 -0
- data/CHANGELOG.md +6 -0
- data/lib/rodoo/model.rb +39 -13
- data/lib/rodoo/models/accounting_entry.rb +9 -7
- data/lib/rodoo/models/project.rb +2 -1
- data/lib/rodoo/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03ac273092ec11431199a18290e4d411f7a900e8236b2762817182b8906bd27a
|
|
4
|
+
data.tar.gz: 8160dffa4ffd00dea1654be504b9900dfff1f8980083037abda70a5bd3751eee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 830a2ccb8769ae5731f349d59c04f52d48dc2645bcce94e85dd74e9e512b8aaa3ff12b772dff5b89d9e7ecfd56015b68b2cf27b98caeb7105d22f3cd634094b3
|
|
7
|
+
data.tar.gz: 4d40594ee7327b47ae32cca4ec5c31805ea081ff380ddf6d1234d056ab32dff29b2c5210daf79f035887bd89827a8126fdd6d2ed28da25afc2b74cf86d2d5716
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: release
|
|
3
|
+
description: Release the Rodoo gem to RubyGems with automatic versioning and changelog
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Release Rodoo gem
|
|
8
|
+
|
|
9
|
+
## Current state
|
|
10
|
+
|
|
11
|
+
Last tag: !`git describe --tags --abbrev=0 2>/dev/null`
|
|
12
|
+
Current branch: !`git rev-parse --abbrev-ref HEAD`
|
|
13
|
+
Uncommitted changes: !`git status --short`
|
|
14
|
+
|
|
15
|
+
## Instructions
|
|
16
|
+
|
|
17
|
+
Follow these steps precisely to release the gem.
|
|
18
|
+
|
|
19
|
+
### 1. Validate prerequisites
|
|
20
|
+
|
|
21
|
+
- Ensure you're on the `develop` branch
|
|
22
|
+
- Ensure working directory is clean (no uncommitted changes)
|
|
23
|
+
- Run `rake` to verify tests and linter pass
|
|
24
|
+
|
|
25
|
+
If any check fails, stop and inform the user.
|
|
26
|
+
|
|
27
|
+
### 2. Analyze commits since last release
|
|
28
|
+
|
|
29
|
+
Run: `git log $(git describe --tags --abbrev=0)..HEAD --oneline`
|
|
30
|
+
|
|
31
|
+
Categorize each commit:
|
|
32
|
+
- **Added**: New features (commits starting with "Add")
|
|
33
|
+
- **Changed**: Changes to existing functionality
|
|
34
|
+
- **Fixed**: Bug fixes (commits starting with "Fix")
|
|
35
|
+
- **Removed**: Removed features
|
|
36
|
+
|
|
37
|
+
Ignore commits that are:
|
|
38
|
+
- Version bumps ("Bump version")
|
|
39
|
+
- Merge commits
|
|
40
|
+
- Gemfile.lock updates only
|
|
41
|
+
|
|
42
|
+
### 3. Determine version bump
|
|
43
|
+
|
|
44
|
+
Based on the commits, determine the version bump using semver:
|
|
45
|
+
|
|
46
|
+
- **MAJOR** (X.0.0): Breaking changes (look for "BREAKING", "breaking change", major API changes)
|
|
47
|
+
- **MINOR** (0.X.0): New features, new models, new API methods (most "Add" commits)
|
|
48
|
+
- **PATCH** (0.0.X): Bug fixes, documentation, minor tweaks
|
|
49
|
+
|
|
50
|
+
Read current version from `lib/rodoo/version.rb` and calculate the new version.
|
|
51
|
+
|
|
52
|
+
### 4. Update CHANGELOG.md
|
|
53
|
+
|
|
54
|
+
Read `CHANGELOG.md`. Update the `## [Unreleased]` section:
|
|
55
|
+
|
|
56
|
+
1. Replace `## [Unreleased]` with `## [Unreleased]` followed by a blank line and `## [NEW_VERSION] - YYYY-MM-DD`
|
|
57
|
+
2. Under the new version heading, add categorized entries:
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
## [Unreleased]
|
|
61
|
+
|
|
62
|
+
## [X.Y.Z] - 2026-01-22
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
- Description of new feature
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
- Description of change
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
- Description of fix
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Only include sections that have entries. Write concise, user-facing descriptions (not raw commit messages).
|
|
75
|
+
|
|
76
|
+
### 5. Update version.rb
|
|
77
|
+
|
|
78
|
+
Edit `lib/rodoo/version.rb` to set the new VERSION.
|
|
79
|
+
|
|
80
|
+
### 6. Update Gemfile.lock
|
|
81
|
+
|
|
82
|
+
Run: `bundle install`
|
|
83
|
+
|
|
84
|
+
### 7. Commit the release
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git add lib/rodoo/version.rb CHANGELOG.md Gemfile.lock
|
|
88
|
+
git commit -m "Bump version to X.Y.Z"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 8. Push develop branch
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git push origin develop
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 9. Merge to main
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git checkout main
|
|
101
|
+
git pull origin main
|
|
102
|
+
git merge develop
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 10. Push main branch
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git push origin main
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 11. Release to RubyGems
|
|
112
|
+
|
|
113
|
+
Run: `rake release`
|
|
114
|
+
|
|
115
|
+
This will:
|
|
116
|
+
- Build the gem
|
|
117
|
+
- Create and push the git tag
|
|
118
|
+
- Push to RubyGems
|
|
119
|
+
|
|
120
|
+
**Note**: If RubyGems requires authentication (one-time code), the user will need to enter it in the terminal.
|
|
121
|
+
|
|
122
|
+
### 12. Return to develop
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
git checkout develop
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 13. Summary
|
|
129
|
+
|
|
130
|
+
Report to the user:
|
|
131
|
+
- Previous version → New version
|
|
132
|
+
- Changelog entries added
|
|
133
|
+
- RubyGems URL: https://rubygems.org/gems/rodoo
|
data/CHANGELOG.md
CHANGED
data/lib/rodoo/model.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Rodoo
|
|
|
21
21
|
# contact.email = "draft@example.com"
|
|
22
22
|
# contact.save
|
|
23
23
|
#
|
|
24
|
-
class Model
|
|
24
|
+
class Model # rubocop:disable Metrics/ClassLength
|
|
25
25
|
# ============================================
|
|
26
26
|
# Class-level configuration and query methods
|
|
27
27
|
# ============================================
|
|
@@ -48,8 +48,13 @@ module Rodoo
|
|
|
48
48
|
# contact = Rodoo::Contact.find(42)
|
|
49
49
|
# contact.name # => "Acme Corp"
|
|
50
50
|
#
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
# @example With language
|
|
52
|
+
# contact = Rodoo::Contact.find(42, lang: "fr_FR")
|
|
53
|
+
#
|
|
54
|
+
def self.find(id, lang: nil)
|
|
55
|
+
params = { ids: [id] }
|
|
56
|
+
params[:context] = { lang: lang } if lang
|
|
57
|
+
result = execute("read", params)
|
|
53
58
|
raise NotFoundError, "#{model_name} with id=#{id} not found" if result.nil? || result.empty?
|
|
54
59
|
|
|
55
60
|
new(result.first)
|
|
@@ -75,13 +80,19 @@ module Rodoo
|
|
|
75
80
|
# @example Raw Odoo domain (array of arrays)
|
|
76
81
|
# Rodoo::Contact.where([["is_company", "=", true]], limit: 10)
|
|
77
82
|
#
|
|
78
|
-
|
|
83
|
+
# @example With language
|
|
84
|
+
# Rodoo::Contact.where(is_company: true, lang: "es_ES")
|
|
85
|
+
#
|
|
86
|
+
# rubocop:disable Metrics/ParameterLists
|
|
87
|
+
def self.where(conditions = nil, fields: nil, limit: nil, offset: nil, lang: nil, **attrs)
|
|
88
|
+
# rubocop:enable Metrics/ParameterLists
|
|
79
89
|
domain = DomainBuilder.build(conditions, attrs)
|
|
80
90
|
|
|
81
91
|
params = { domain: domain }
|
|
82
92
|
params[:fields] = fields if fields
|
|
83
93
|
params[:limit] = limit if limit
|
|
84
94
|
params[:offset] = offset if offset
|
|
95
|
+
params[:context] = { lang: lang } if lang
|
|
85
96
|
|
|
86
97
|
execute("search_read", params).map { |record| new(record) }
|
|
87
98
|
end
|
|
@@ -95,8 +106,11 @@ module Rodoo
|
|
|
95
106
|
# @example
|
|
96
107
|
# all_contacts = Rodoo::Contact.all(limit: 100)
|
|
97
108
|
#
|
|
98
|
-
|
|
99
|
-
|
|
109
|
+
# @example With language
|
|
110
|
+
# all_contacts = Rodoo::Contact.all(limit: 100, lang: "de_DE")
|
|
111
|
+
#
|
|
112
|
+
def self.all(fields: nil, limit: nil, lang: nil)
|
|
113
|
+
where([], fields: fields, limit: limit, lang: lang)
|
|
100
114
|
end
|
|
101
115
|
|
|
102
116
|
# Find a single record by attribute conditions
|
|
@@ -116,8 +130,11 @@ module Rodoo
|
|
|
116
130
|
# @example Find by raw domain
|
|
117
131
|
# contact = Rodoo::Contact.find_by([["name", "ilike", "%acme%"]])
|
|
118
132
|
#
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
# @example With language
|
|
134
|
+
# contact = Rodoo::Contact.find_by(name: "Acme", lang: "fr_FR")
|
|
135
|
+
#
|
|
136
|
+
def self.find_by(conditions = nil, lang: nil, **attrs)
|
|
137
|
+
where(conditions, limit: 1, lang: lang, **attrs).first
|
|
121
138
|
end
|
|
122
139
|
|
|
123
140
|
# Find a single record by attribute conditions, raising if not found
|
|
@@ -129,8 +146,11 @@ module Rodoo
|
|
|
129
146
|
# @example Find by email (raises if not found)
|
|
130
147
|
# contact = Rodoo::Contact.find_by!(email: "john@example.com")
|
|
131
148
|
#
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
# @example With language
|
|
150
|
+
# contact = Rodoo::Contact.find_by!(email: "john@example.com", lang: "it_IT")
|
|
151
|
+
#
|
|
152
|
+
def self.find_by!(conditions = nil, lang: nil, **attrs)
|
|
153
|
+
record = find_by(conditions, lang: lang, **attrs)
|
|
134
154
|
return record if record
|
|
135
155
|
|
|
136
156
|
raise NotFoundError, "#{model_name} matching #{conditions.inspect} #{attrs.inspect} not found"
|
|
@@ -145,9 +165,15 @@ module Rodoo
|
|
|
145
165
|
# contact = Rodoo::Contact.create(name: "New Contact", email: "new@example.com")
|
|
146
166
|
# contact.id # => 123
|
|
147
167
|
#
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
168
|
+
# @example With language
|
|
169
|
+
# contact = Rodoo::Contact.create({ name: "Nouveau Contact" }, lang: "fr_FR")
|
|
170
|
+
#
|
|
171
|
+
def self.create(attrs = nil, lang: nil, **kwargs)
|
|
172
|
+
actual_attrs = attrs || kwargs
|
|
173
|
+
params = { vals_list: [actual_attrs] }
|
|
174
|
+
params[:context] = { lang: lang } if lang
|
|
175
|
+
ids = execute("create", params)
|
|
176
|
+
find(ids.first, lang: lang)
|
|
151
177
|
end
|
|
152
178
|
|
|
153
179
|
# Execute an Odoo method via the JSON-2 API
|
|
@@ -36,25 +36,27 @@ module Rodoo
|
|
|
36
36
|
# Search for records, automatically scoped to the move_type
|
|
37
37
|
#
|
|
38
38
|
# @param conditions [Array, Hash, String, nil] Query conditions
|
|
39
|
-
# @param options [Hash] Additional options (fields, limit, offset)
|
|
39
|
+
# @param options [Hash] Additional options (fields, limit, offset, lang)
|
|
40
40
|
# @return [Array<AccountingEntry>] Array of matching records
|
|
41
41
|
def self.where(conditions = nil, **options)
|
|
42
|
-
domain = DomainBuilder.build(conditions, options.except(:fields, :limit, :offset))
|
|
42
|
+
domain = DomainBuilder.build(conditions, options.except(:fields, :limit, :offset, :lang))
|
|
43
43
|
domain = [["move_type", "=", default_move_type]] + domain if default_move_type
|
|
44
|
-
super(domain, **options.slice(:fields, :limit, :offset))
|
|
44
|
+
super(domain, **options.slice(:fields, :limit, :offset, :lang))
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# Create a new record, automatically setting the move_type
|
|
48
48
|
#
|
|
49
49
|
# @param attrs [Hash] Attributes for the new record
|
|
50
|
+
# @param lang [String, nil] Language code for translatable fields
|
|
50
51
|
# @return [AccountingEntry] The created record
|
|
51
|
-
def self.create(attrs)
|
|
52
|
+
def self.create(attrs = nil, lang: nil, **kwargs)
|
|
53
|
+
actual_attrs = attrs || kwargs
|
|
52
54
|
scoped_attrs = if default_move_type
|
|
53
|
-
{ move_type: default_move_type }.merge(
|
|
55
|
+
{ move_type: default_move_type }.merge(actual_attrs)
|
|
54
56
|
else
|
|
55
|
-
|
|
57
|
+
actual_attrs
|
|
56
58
|
end
|
|
57
|
-
super(scoped_attrs)
|
|
59
|
+
super(scoped_attrs, lang: lang)
|
|
58
60
|
end
|
|
59
61
|
|
|
60
62
|
# Attach a PDF file to this record
|
data/lib/rodoo/models/project.rb
CHANGED
|
@@ -10,7 +10,8 @@ module Rodoo
|
|
|
10
10
|
# project = Rodoo::Project.where([["is_company", "=", true]])
|
|
11
11
|
#
|
|
12
12
|
# @example Create a project
|
|
13
|
-
# project = Rodoo::Project.create(name: "my_project", account_id: analytic_account_id,
|
|
13
|
+
# project = Rodoo::Project.create(name: "my_project", account_id: analytic_account_id,
|
|
14
|
+
# allow_billable: true)
|
|
14
15
|
#
|
|
15
16
|
class Project < Model
|
|
16
17
|
model_name "project.project"
|
data/lib/rodoo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rodoo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rodrigo Serrano
|
|
@@ -31,6 +31,7 @@ executables: []
|
|
|
31
31
|
extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
|
33
33
|
files:
|
|
34
|
+
- ".claude/skills/release/SKILL.md"
|
|
34
35
|
- ".env.example"
|
|
35
36
|
- ".rubocop.yml"
|
|
36
37
|
- CHANGELOG.md
|