trix-genius 0.0.3 → 0.0.5a

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: 382310515db26045a23e50410cbbd5a4912e4c144bc8876509c8bbf9164e05db
4
- data.tar.gz: 5f1e5ced035a6d1f4a052f6bf05f5c542f0976fbff71f06ba31546a3d34297a0
3
+ metadata.gz: 135cb33725790904d8681630bc1170d7c100a9941d1dcc105d4c6356e8ec2aa5
4
+ data.tar.gz: 0ea0098cdce2770ecb74cc0119ffc0f2631c263f70348aed41457287d20012fe
5
5
  SHA512:
6
- metadata.gz: 78e4e46692b89e8f616fd2cef72b41e4c7e37236e1df962c3067823b9bf684d54d3cf334a07355566a31c3355e2f9f52220ca693c6ea0af6cfbfa14a3ff56b77
7
- data.tar.gz: 0b33448da2f66a800b7f1cf8befeab949a793497406f533dee30511292b6caa7fd7d622fc302f70e1ec20d9fe3cf1ab534456f4b68f9267787ac84cc85c2da10
6
+ metadata.gz: eb2a7e7127fab2f11f11728e9568656074bcef188ab9d755f7bf92716e820b4de83b2a9968cac18c2d0ddfa4f1a70ba50a576b98c061c3f2466debe3bcadb7a1
7
+ data.tar.gz: d1857789b062ddd3c98701bea4e7b31b6e4f8d5695076853abcd26bc52425cef7928e88945a1de8ac0726783622b9e25df519a659d5f114736ad501617f99e72
@@ -6,7 +6,7 @@ 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
@@ -14,22 +14,42 @@ module TrixGenius
14
14
  end
15
15
 
16
16
  def update_applications_js
17
- # app/javascript/application.js
18
-
19
- # import "controllers"
20
- # import "trix"
21
- # import "@rails/actiontext"
22
-
23
-
24
- # app/javascript/controllers/application.js
25
- # import TrixController from "controllers/trix-controller"
26
- # application.register("trix", TrixController)
17
+ js_application_path = "app/javascript/application.js"
18
+ application_lines = ["import \"controllers\"", "import \"trix\"", "import \"@rails/actiontext\""]
19
+
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
26
+
27
+
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,56 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trix-genius
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5a
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
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
18
  version: '6.0'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '6.0'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: stimulus-rails
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: 4.3.4
32
+ version: '1.3'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 4.3.4
39
+ version: '1.3'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: actiontext
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '7.0'
46
+ version: '8.0'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '7.0'
53
+ version: '8.0'
54
54
  description: Trix-Genius adds AI-powered buttons and other custom controls to Trix
55
55
  editor using Stimulus.
56
56
  email: ggerman@gmail.com
@@ -73,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: '3.0'
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - ">="