moirai 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +15 -6
  3. data/CHANGELOG.md +21 -0
  4. data/Gemfile +12 -1
  5. data/README.md +63 -27
  6. data/app/assets/config/moirai_manifest.js +0 -1
  7. data/app/assets/javascripts/moirai_translation_controller.js +41 -0
  8. data/app/assets/stylesheets/moirai/application.css +2 -0
  9. data/app/assets/stylesheets/translation_files.css +22 -0
  10. data/app/controllers/moirai/translation_files_controller.rb +66 -18
  11. data/app/controllers/moirai/translations_controller.rb +7 -0
  12. data/app/models/moirai/change.rb +15 -0
  13. data/app/models/moirai/key_finder.rb +55 -0
  14. data/app/models/moirai/translation.rb +9 -5
  15. data/app/models/moirai/translation_dumper.rb +40 -13
  16. data/app/views/layouts/moirai/application.html.erb +28 -1
  17. data/app/views/moirai/translation_files/_form.html.erb +3 -3
  18. data/app/views/moirai/translation_files/index.html.erb +1 -1
  19. data/app/views/moirai/translation_files/show.html.erb +11 -5
  20. data/app/views/moirai/translations/index.html.erb +7 -0
  21. data/bin/check +3 -1
  22. data/config/routes.rb +2 -1
  23. data/lib/generators/moirai/install_generator.rb +27 -2
  24. data/lib/generators/moirai/migration_generator.rb +5 -1
  25. data/lib/generators/moirai/templates/make_moirai_translations_file_path_not_required.rb.erb +5 -0
  26. data/lib/i18n/backend/moirai.rb +1 -53
  27. data/lib/i18n/extensions/i18n.rb +13 -0
  28. data/lib/moirai/engine.rb +8 -6
  29. data/lib/moirai/pull_request_creator.rb +42 -33
  30. data/lib/moirai/version.rb +1 -1
  31. data/lib/moirai.rb +2 -1
  32. data/moirai.gemspec +3 -6
  33. metadata +12 -77
  34. data/app/assets/javascripts/moirai/application.js +0 -2
  35. data/app/assets/javascripts/moirai/controllers/moirai_translation_controller.js +0 -27
  36. data/app/assets/javascripts/moirai/stimulus/init.js +0 -5
  37. /data/lib/generators/moirai/templates/{migration.rb.erb → create_moirai_translations.rb.erb} +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moirai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Rodi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2024-10-23 00:00:00.000000000 Z
13
+ date: 2024-11-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -26,76 +26,6 @@ dependencies:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '6.1'
29
- - !ruby/object:Gem::Dependency
30
- name: octokit
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: '4.0'
36
- type: :development
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: '4.0'
43
- - !ruby/object:Gem::Dependency
44
- name: capybara
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '0'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: '0'
57
- - !ruby/object:Gem::Dependency
58
- name: selenium-webdriver
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: '0'
64
- type: :development
65
- prerelease: false
66
- version_requirements: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: '0'
71
- - !ruby/object:Gem::Dependency
72
- name: rails
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: 7.2.0
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - "~>"
83
- - !ruby/object:Gem::Version
84
- version: 7.2.0
85
- - !ruby/object:Gem::Dependency
86
- name: dotenv
87
- requirement: !ruby/object:Gem::Requirement
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: '0'
92
- type: :development
93
- prerelease: false
94
- version_requirements: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- version: '0'
99
29
  description: |-
100
30
  This gem allows you to manage translation strings in real time,
101
31
  viewing the live changes in the browser, with the changes then converted to a PR opened on the repository.
@@ -117,17 +47,19 @@ files:
117
47
  - Rakefile
118
48
  - app/assets/config/moirai_manifest.js
119
49
  - app/assets/images/moirai/.keep
120
- - app/assets/javascripts/moirai/application.js
121
- - app/assets/javascripts/moirai/controllers/moirai_translation_controller.js
122
- - app/assets/javascripts/moirai/stimulus/init.js
50
+ - app/assets/javascripts/moirai_translation_controller.js
123
51
  - app/assets/stylesheets/moirai/application.css
52
+ - app/assets/stylesheets/translation_files.css
124
53
  - app/controllers/concerns/.keep
125
54
  - app/controllers/moirai/application_controller.rb
126
55
  - app/controllers/moirai/translation_files_controller.rb
56
+ - app/controllers/moirai/translations_controller.rb
127
57
  - app/helpers/moirai/application_helper.rb
128
58
  - app/jobs/moirai/application_job.rb
129
59
  - app/models/concerns/.keep
130
60
  - app/models/moirai/application_record.rb
61
+ - app/models/moirai/change.rb
62
+ - app/models/moirai/key_finder.rb
131
63
  - app/models/moirai/translation.rb
132
64
  - app/models/moirai/translation_dumper.rb
133
65
  - app/models/moirai/translation_file_handler.rb
@@ -135,6 +67,7 @@ files:
135
67
  - app/views/moirai/translation_files/_form.html.erb
136
68
  - app/views/moirai/translation_files/index.html.erb
137
69
  - app/views/moirai/translation_files/show.html.erb
70
+ - app/views/moirai/translations/index.html.erb
138
71
  - bin/check
139
72
  - bin/console
140
73
  - bin/fastcheck
@@ -143,8 +76,10 @@ files:
143
76
  - config/routes.rb
144
77
  - lib/generators/moirai/install_generator.rb
145
78
  - lib/generators/moirai/migration_generator.rb
146
- - lib/generators/moirai/templates/migration.rb.erb
79
+ - lib/generators/moirai/templates/create_moirai_translations.rb.erb
80
+ - lib/generators/moirai/templates/make_moirai_translations_file_path_not_required.rb.erb
147
81
  - lib/i18n/backend/moirai.rb
82
+ - lib/i18n/extensions/i18n.rb
148
83
  - lib/moirai.rb
149
84
  - lib/moirai/engine.rb
150
85
  - lib/moirai/pull_request_creator.rb
@@ -174,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
109
  - !ruby/object:Gem::Version
175
110
  version: '0'
176
111
  requirements: []
177
- rubygems_version: 3.4.20
112
+ rubygems_version: 3.5.22
178
113
  signing_key:
179
114
  specification_version: 4
180
115
  summary: Manage translation strings in real time
@@ -1,2 +0,0 @@
1
- //= require ./stimulus/init
2
- //= require ./controllers/moirai_translation_controller
@@ -1,27 +0,0 @@
1
- Stimulus.register(
2
- "moirai-translation",
3
- class extends Controller {
4
- click(event) {
5
- event.preventDefault()
6
- }
7
-
8
- submit(event) {
9
- const {filePath, key} = event.target.dataset
10
-
11
- const csrfToken = document.querySelector('meta[name="csrf-token"]').content
12
-
13
- const formObject = new FormData()
14
- formObject.append('translation[key]', key)
15
- formObject.append('translation[file_path]', filePath)
16
- formObject.append('translation[value]', event.target.innerText)
17
-
18
- fetch(`/moirai/translation_files`, {
19
- method: 'POST',
20
- headers: {
21
- 'X-CSRF-Token': csrfToken
22
- },
23
- body: formObject
24
- })
25
- }
26
- }
27
- );
@@ -1,5 +0,0 @@
1
- import {
2
- Application,
3
- Controller,
4
- } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js";
5
- window.Stimulus = Application.start();