trix-genius 0.0.5 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d25f1567cc5fa06b21e7409fe6b262be50b9cbd175b80b36aec273a74576fb7e
4
- data.tar.gz: ae1fea00b204489a22feebf04c28f2f2db1f7cabb9050134d09bf289ac06a72a
3
+ metadata.gz: 0f1396b57c17915295c7058c05f85e6fb1eade9b1a3c95e2115caf358c16dd94
4
+ data.tar.gz: 712e73bec4165be575c43e7675a6c3585977fe7922d98637517a4af15b817d3f
5
5
  SHA512:
6
- metadata.gz: b6d6e93d8205fa99030b61575a643c19329173627185add96303ee7d66cc2400dd96eb601281e88da2c36a3f7e9a149fbf6995bf571398f8578d4ddc120268ca
7
- data.tar.gz: a04585743449e0c0705d1287b5e2acb3895c5f99d043751dc2eda82720bdc066bb735826d22283f762ec5a20266abd192008dfb15631cb6077f6769c377e552e
6
+ metadata.gz: 2f49520247f14d7bc5abdd5c2808a849dc846f5ed2c5efd73ef083679cfeebd7b29000db6092329f25d90231ffa2c7b3cc8d07ab734f5c559913afb4bcd5bbb5
7
+ data.tar.gz: 2ffe0b3643eeb810fb9daa7e86ac8a8c4d345090cc39ad9fc3d1dceb1be56d3378066d5c2287278052db19b21523a292ab1fefab4cce4483292293d048d9d0d4
@@ -6,30 +6,50 @@ module TrixGenius
6
6
  source_root File.expand_path("templates", __dir__)
7
7
 
8
8
  def create_initializer
9
- initializer "trix_genius", <<~RUBY
9
+ initializer "trix_genius.rb", <<~RUBY
10
10
  TrixGenius.configure do |config|
11
11
  config.deepseek_api_key=ENV['DEEPSEEK_API_KEY']
12
12
  end
13
13
  RUBY
14
14
  end
15
15
 
16
- def update_applications_js
17
- # app/javascript/application.js
16
+ def add_import_to_application_js
17
+ js_application_path = "app/javascript/application.js"
18
+ application_lines = ["import \"controllers\"", "import \"trix\"", "import \"@rails/actiontext\""]
18
19
 
19
- # import "controllers"
20
- # import "trix"
21
- # import "@rails/actiontext"
20
+ if File.exists?(js_application_path)
21
+ application_file = File.read(js_application_path)
22
+ update_file application_lines, application_file
23
+ else
24
+ say_status("error", "Could not find #{js_application_path}", :red)
25
+ end
22
26
 
23
27
 
24
- # app/javascript/controllers/application.js
25
- # import TrixController from "controllers/trix-controller"
26
- # application.register("trix", TrixController)
28
+ js_application_controller_path ="app/javascript/controllers/application.js"
29
+ application_controller_lines = ["import TrixController from \"controllers/trix-controller"\", "application.register(\"trix\", TrixController)"]
30
+
31
+ if File.exists?(js_application_controller_path)
32
+ application_controller_file = File.read(js_application_controller_path)
33
+ update_file application_controller_lines, application_controller_file
34
+ else
35
+ say_status("error", "Could not find #{js_application_path}", :red)
36
+ end
27
37
  end
28
38
 
29
39
  def create_stimulus_controller
30
40
  copy_file "trix_genius_controller.js", "app/javascript/controllers/trix_genius_controller.js"
31
41
  end
32
42
 
43
+ def update_file lines, file_content
44
+ lines.each do |line|
45
+ unless application_file.include?(line)
46
+ append_to_file js_application_path, "\n#{line}\n"
47
+ else
48
+ say_status("skipped", "Import already present in application.js", :yellow)
49
+ end
50
+ end
51
+ end
52
+
33
53
  end
34
54
  end
35
55
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trix-genius
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giménez Silva Germán Alberto https://rubystacknews.com/
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-01 00:00:00.000000000 Z
10
+ date: 2025-04-07 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -16,6 +16,9 @@ dependencies:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
18
  version: '6.0'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '9.0'
19
22
  type: :runtime
20
23
  prerelease: false
21
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -23,32 +26,35 @@ dependencies:
23
26
  - - ">="
24
27
  - !ruby/object:Gem::Version
25
28
  version: '6.0'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '9.0'
26
32
  - !ruby/object:Gem::Dependency
27
33
  name: stimulus-rails
28
34
  requirement: !ruby/object:Gem::Requirement
29
35
  requirements:
30
- - - ">="
36
+ - - "~>"
31
37
  - !ruby/object:Gem::Version
32
- version: 1.3.4
38
+ version: '1.3'
33
39
  type: :runtime
34
40
  prerelease: false
35
41
  version_requirements: !ruby/object:Gem::Requirement
36
42
  requirements:
37
- - - ">="
43
+ - - "~>"
38
44
  - !ruby/object:Gem::Version
39
- version: 1.3.4
45
+ version: '1.3'
40
46
  - !ruby/object:Gem::Dependency
41
47
  name: actiontext
42
48
  requirement: !ruby/object:Gem::Requirement
43
49
  requirements:
44
- - - ">="
50
+ - - "~>"
45
51
  - !ruby/object:Gem::Version
46
52
  version: '8.0'
47
53
  type: :runtime
48
54
  prerelease: false
49
55
  version_requirements: !ruby/object:Gem::Requirement
50
56
  requirements:
51
- - - ">="
57
+ - - "~>"
52
58
  - !ruby/object:Gem::Version
53
59
  version: '8.0'
54
60
  description: Trix-Genius adds AI-powered buttons and other custom controls to Trix
@@ -73,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
79
  requirements:
74
80
  - - ">="
75
81
  - !ruby/object:Gem::Version
76
- version: '0'
82
+ version: '3.0'
77
83
  required_rubygems_version: !ruby/object:Gem::Requirement
78
84
  requirements:
79
85
  - - ">="