sylvia 0.2.6 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8783c3724ed736abf502fe3a02e41e2216e6ec3a961a4472a864b66f243a2a0c
4
- data.tar.gz: 1d9da5a2034b12694486606972a6443489787a0941b25408a350699aa394f681
3
+ metadata.gz: 839805c7b4e01b1edf6d11acd5d5f2c882aa9ab4a4211ca084382e80a15b6cc4
4
+ data.tar.gz: e63febac4acc8b9eb7fe2b89c5dc3acdc4f58e3dfae0eb29dbfd8189465fa5c2
5
5
  SHA512:
6
- metadata.gz: ae40c8d17067ff2f2d81c4562de5d1d6ecb31e72df2525ec3b03d2c494bc78a4ba8e714f62b6e8e340d6704e5636b960978da628461bd96a2e40bcd0cd3f8601
7
- data.tar.gz: a1e14069c41b86718fd70948358c6c0deebf7f0d154a1d7819ce3b1b5ea98a4ad95d9e75371662532affde136bbdc07478c0eaac73c2877c2428d1327b23e407
6
+ metadata.gz: 58a64920ab409558f22463b2007d2a6a47cdd176f932c6ac219abf42cd498b89ba79124745c293b5c270a78be2c36eba64b7d5e335c5eff80acf915132f62086
7
+ data.tar.gz: ac8d9ca5c62a4d40d0dd735e005776419ba5fc0f9ba7bde56ce17f97d135d9db8c1bcc3149c8900a8bec44b68ede97afb7fe0d216e8a2a8ca93118fd2e0b0aa0
data/.gitignore CHANGED
@@ -11,4 +11,5 @@ node_modules
11
11
  .rspec_status
12
12
  Gemfile.lock
13
13
  package-lock.json
14
- .rubocop_todo.yml
14
+ .rubocop_todo.yml
15
+ sylvia.rb
data/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
- inherit_from: .rubocop_todo.yml
1
+ require:
2
+ - rubocop-performance
2
3
 
3
4
  AllCops:
4
5
  Include:
@@ -10,6 +11,9 @@ AllCops:
10
11
  - "db/schema.rb"
11
12
  NewCops: enable
12
13
 
14
+ Performance:
15
+ Enabled: true
16
+
13
17
  Layout/LineLength:
14
18
  Max: 120
15
19
  Exclude:
@@ -56,3 +60,9 @@ Style/HashTransformKeys:
56
60
 
57
61
  Style/HashTransformValues:
58
62
  Enabled: false
63
+
64
+ Style/FrozenStringLiteralComment:
65
+ Enabled: false
66
+
67
+ Style/Documentation:
68
+ Enabled: false
data/Gemfile CHANGED
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in sylvia.gemspec
6
6
  gemspec
7
7
 
8
- gem "irb"
9
- gem "rake", "~> 13.0"
10
- gem "rspec", "~> 3.0"
11
- gem 'rubocop', '1.80.0'
8
+ gem 'irb'
9
+ gem 'rake', '~> 13.0'
10
+ gem 'rspec', '~> 3.0'
11
+ gem 'rubocop', '1.80.0'
12
+ gem 'rubocop-performance', '1.26.0', require: false
data/README.md CHANGED
@@ -15,10 +15,16 @@ gem install sylvia
15
15
 
16
16
  ## Usage
17
17
 
18
- ##### Setup Prettier for ruby
18
+ ##### Generate template jekyll (vite, stimulus, tailwind)
19
19
 
20
20
  ```
21
- sylvia prettier
21
+ sylvia jekyll name_app
22
+ ```
23
+
24
+ ##### Generate template Bot (Discord & Telegram)
25
+
26
+ ```
27
+ sylvia bot nname_app
22
28
  ```
23
29
 
24
30
  ##### Setup Rubocop
@@ -27,6 +33,18 @@ sylvia prettier
27
33
  sylvia rubocop
28
34
  ```
29
35
 
36
+ ##### Setup Rubocop for Rails project
37
+
38
+ ```
39
+ sylvia rubocop-rails
40
+ ```
41
+
42
+ ##### Setup Prettier for ruby
43
+
44
+ ```
45
+ sylvia prettier
46
+ ```
47
+
30
48
  ##### Setup and Configuration AI LLM
31
49
 
32
50
  ```
data/lib/sylvia/bot.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'fileutils'
2
+
3
+ module Sylvia
4
+ class Bot
5
+ def self.new_project(target = 'bot-app')
6
+ repo = 'https://github.com/spellbooks/ruby-discord-telegram-bot-boilerplate'
7
+
8
+ if git_installed?
9
+ puts '➡️ Git found, cloning repo...'
10
+ system("git clone #{repo} #{target}")
11
+ else
12
+ puts '⚠️ Git not found, using fallback template...'
13
+ copy_fallback_template(target)
14
+ end
15
+
16
+ puts "✅ Bot project created successfully in folder: #{target}"
17
+ end
18
+
19
+ private
20
+
21
+ def self.git_installed?
22
+ system('git --version > /dev/null 2>&1')
23
+ end
24
+
25
+ def self.copy_fallback_template(target)
26
+ source = File.expand_path('../../templates/bot', __dir__)
27
+ FileUtils.cp_r("#{source}/.", target)
28
+ end
29
+ end
30
+ end
data/lib/sylvia/cli.rb CHANGED
@@ -1,8 +1,11 @@
1
- require "json"
2
- require_relative "version"
3
- require_relative "llm"
4
- require_relative "prettier"
5
- require_relative "rubocop"
1
+ require 'json'
2
+ require_relative 'version'
3
+ require_relative 'llm'
4
+ require_relative 'prettier'
5
+ require_relative 'rubocop'
6
+ require_relative 'rubocop-rails'
7
+ require_relative 'jekyll'
8
+ require_relative 'bot'
6
9
 
7
10
  module Sylvia
8
11
  class CLI
@@ -10,26 +13,40 @@ module Sylvia
10
13
  command = args.shift
11
14
 
12
15
  case command
13
- when "llm"
16
+ when 'llm'
14
17
  LLM.setup
15
- when "ai"
18
+ when 'ai'
16
19
  LLM.run
17
- when "prettier"
20
+ when 'prettier'
18
21
  Prettier.setup
19
- when "rubocop"
22
+ when 'rubocop'
20
23
  RuboCop.setup
21
- when "rubocop-todo"
24
+ when 'rubocop-todo'
22
25
  RuboCop.generate_todo
23
- when "-v", "--version"
26
+ when 'rubocop-rails'
27
+ RuboCopRails.setup
28
+ when 'rubocop-rails-todo'
29
+ RuboCopRails.generate_todo
30
+ when 'jekyll'
31
+ target = args.shift || 'jekyll-app'
32
+ Jekyll.new_project(target)
33
+ when 'bot'
34
+ target = args.shift || 'bot-app'
35
+ Bot.new_project(target)
36
+ when '-v', '--version'
24
37
  puts "Sylvia version #{Sylvia::VERSION}"
25
38
  else
26
- puts "Usage:"
27
- puts " sylvia llm # Create setup file llm"
28
- puts " sylvia ai # Run llm"
29
- puts " sylvia prettier # Setup Prettier for Ruby"
30
- puts " sylvia rubocop # Create .rubocop.yml config file"
31
- puts " sylvia rubocop-todo # Generate .rubocop_todo.yml automatically"
32
- puts " sylvia -v, --version # Show Sylvia version"
39
+ puts 'Usage:'
40
+ puts ' sylvia llm # Create setup file llm'
41
+ puts ' sylvia ai # Run llm'
42
+ puts ' sylvia prettier # Setup Prettier for Ruby'
43
+ puts ' sylvia rubocop # Create .rubocop.yml config file'
44
+ puts ' sylvia rubocop-todo # Generate .rubocop_todo.yml automatically'
45
+ puts ' sylvia rubocop-rails # Create .rubocop.yml config file for Rails'
46
+ puts ' sylvia rubocop-rails-todo # Generate .rubocop_todo.yml automatically'
47
+ puts ' sylvia jekyll [name-app] # Create Jekyll boilerplate project'
48
+ puts ' sylvia bot [name-app] # Create Discord & Telegram bot boilerplate project'
49
+ puts ' sylvia -v, --version # Show Sylvia version'
33
50
  end
34
51
  end
35
52
  end
@@ -0,0 +1,31 @@
1
+ # lib/sylvia/jekyll.rb
2
+ require 'fileutils'
3
+
4
+ module Sylvia
5
+ class Jekyll
6
+ def self.new_project(target = 'jekyll-app')
7
+ repo = 'https://github.com/spellbooks/jekyll-boilerplate'
8
+
9
+ if git_installed?
10
+ puts 'Git found, cloning repo...'
11
+ system("git clone #{repo} #{target}")
12
+ else
13
+ puts 'Git not found, using fallback template...'
14
+ copy_fallback_template(target)
15
+ end
16
+
17
+ puts "Project created successfully in folder: #{target}"
18
+ end
19
+
20
+ private
21
+
22
+ def self.git_installed?
23
+ system('git --version > /dev/null 2>&1')
24
+ end
25
+
26
+ def self.copy_fallback_template(target)
27
+ source = File.expand_path('../../templates/jekyll', __dir__)
28
+ FileUtils.cp_r("#{source}/.", target)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,254 @@
1
+ module Sylvia
2
+ class RuboCopRails
3
+ CONFIG_FILE = '.rubocop.yml'
4
+ TODO_FILE = '.rubocop_todo.yml'
5
+ GEMFILE = 'Gemfile'
6
+
7
+ def self.setup
8
+ setup_config
9
+ setup_gems
10
+ rescue StandardError => e
11
+ warn "Error during RuboCop setup: #{e.message}"
12
+ warn e.backtrace.first
13
+ exit(1)
14
+ end
15
+
16
+ def self.generate_todo
17
+ if File.exist?(TODO_FILE)
18
+ puts "#{TODO_FILE} already exists. Skipping generation."
19
+ return
20
+ end
21
+
22
+ puts 'Generating RuboCop TODO...'
23
+ success = system('bundle exec rubocop --auto-gen-config --no-exclude-limit')
24
+
25
+ if success
26
+ puts "RuboCop TODO generated (see #{TODO_FILE})"
27
+ else
28
+ warn 'Failed to generate RuboCop TODO. Check if rubocop is installed.'
29
+ end
30
+ rescue StandardError => e
31
+ warn "Error while generating TODO: #{e.message}"
32
+ exit(1)
33
+ end
34
+
35
+ def self.setup_config
36
+ if File.exist?(CONFIG_FILE)
37
+ puts "#{CONFIG_FILE} already exists. Skipping."
38
+ return
39
+ end
40
+
41
+ config_content = <<~YAML
42
+ require:
43
+ - rubocop-rails
44
+ - rubocop-performance
45
+ - rubocop-rspec
46
+
47
+ inherit_mode:
48
+ merge:
49
+ - Exclude
50
+
51
+ AllCops:
52
+ TargetRubyVersion: 3.3
53
+ TargetRailsVersion: 8.0
54
+ NewCops: enable
55
+ SuggestExtensions: false
56
+ DisplayCopNames: true
57
+ Exclude:
58
+ - "db/schema.rb"
59
+ - "db/migrate/**/*"
60
+ - "bin/**/*"
61
+ - "vendor/**/*"
62
+ - "node_modules/**/*"
63
+ - "tmp/**/*"
64
+ - "config/puma.rb"
65
+ - "config/environments/**/*"
66
+
67
+ # =========================================
68
+ # Layout
69
+ # =========================================
70
+
71
+ Layout/LineLength:
72
+ Max: 120
73
+ Exclude:
74
+ - "spec/**/*"
75
+ - "test/**/*"
76
+ - "config/routes.rb"
77
+
78
+ Layout/HeredocIndentation:
79
+ Enabled: true
80
+
81
+ # =========================================
82
+ # Metrics
83
+ # =========================================
84
+
85
+ Metrics/BlockLength:
86
+ Exclude:
87
+ - "spec/**/*"
88
+ - "test/**/*"
89
+ - "config/routes.rb"
90
+ - "db/migrate/**/*"
91
+
92
+ Metrics/ClassLength:
93
+ Max: 175
94
+
95
+ Metrics/MethodLength:
96
+ Max: 25
97
+
98
+ Metrics/ParameterLists:
99
+ Max: 6
100
+
101
+ Metrics/AbcSize:
102
+ Max: 30
103
+
104
+ Metrics/CyclomaticComplexity:
105
+ Max: 8
106
+
107
+ Metrics/PerceivedComplexity:
108
+ Max: 8
109
+
110
+ # =========================================
111
+ # Style Rules
112
+ # =========================================
113
+
114
+ Style/FrozenStringLiteralComment:
115
+ Enabled: false
116
+
117
+ Style/Documentation:
118
+ Enabled: false
119
+
120
+ Style/StringLiterals:
121
+ EnforcedStyle: single_quotes
122
+
123
+ Style/SymbolArray:
124
+ EnforcedStyle: brackets
125
+
126
+ Style/TrailingCommaInArrayLiteral:
127
+ EnforcedStyleForMultiline: comma
128
+
129
+ Style/TrailingCommaInHashLiteral:
130
+ EnforcedStyleForMultiline: comma
131
+
132
+ Style/HashEachMethods:
133
+ Enabled: true
134
+
135
+ Style/HashTransformKeys:
136
+ Enabled: true
137
+
138
+ Style/HashTransformValues:
139
+ Enabled: true
140
+
141
+ # =========================================
142
+ # Rails Rules
143
+ # =========================================
144
+
145
+ Rails:
146
+ Enabled: true
147
+
148
+ Rails/FindBy:
149
+ Enabled: true
150
+ Rails/SaveBang:
151
+ Enabled: true
152
+ Rails/TimeZone:
153
+ EnforcedStyle: strict
154
+ Rails/Date:
155
+ Enabled: true
156
+ Rails/PluralizationGrammar:
157
+ Enabled: true
158
+ Rails/SkipsModelValidations:
159
+ Enabled: true
160
+ Rails/OutputSafety:
161
+ Enabled: true
162
+ Rails/HttpPositionalArguments:
163
+ Enabled: true
164
+ Rails/NegateInclude:
165
+ Enabled: true
166
+ Rails/WhereEquals:
167
+ Enabled: true
168
+ Rails/CompactBlank:
169
+ Enabled: true
170
+ Rails/Pluck:
171
+ Enabled: false
172
+
173
+ # =========================================
174
+ # Performance Rules
175
+ # =========================================
176
+
177
+ Performance/Count:
178
+ Enabled: true
179
+ Performance/Detect:
180
+ Enabled: true
181
+ Performance/RedundantSortBlock:
182
+ Enabled: true
183
+ Performance/ReverseEach:
184
+ Enabled: true
185
+ Performance/Sum:
186
+ Enabled: true
187
+ Performance/TimesMap:
188
+ Enabled: true
189
+
190
+ # =========================================
191
+ # RSpec Rules
192
+ # =========================================
193
+
194
+ RSpec:
195
+ Enabled: true
196
+ AllCops:
197
+ Exclude:
198
+ - "db/**/*"
199
+ - "config/**/*"
200
+ ExampleLength:
201
+ Max: 10
202
+ EmptyExampleGroup:
203
+ Enabled: false
204
+ MultipleExpectations:
205
+ Max: 10
206
+ YAML
207
+
208
+ File.write(CONFIG_FILE, config_content)
209
+ puts "Created #{CONFIG_FILE}"
210
+ rescue Errno::EACCES
211
+ warn "Permission denied while creating #{CONFIG_FILE}"
212
+ exit(1)
213
+ end
214
+
215
+ def self.setup_gems
216
+ unless File.exist?(GEMFILE)
217
+ puts 'No Gemfile found. Please create one and add these gems manually:'
218
+ puts " gem 'rubocop', '1.80.0', require: false"
219
+ puts " gem 'rubocop-performance', '1.26.0', require: false"
220
+ return
221
+ end
222
+
223
+ content = File.read(GEMFILE)
224
+ gems_to_add = {
225
+ 'rubocop' => '1.80.0',
226
+ 'rubocop-performance' => '1.26.0',
227
+ 'rubocop-rails' => '2.33.4',
228
+ 'rubocop-rspec' => '3.7.0'
229
+ }
230
+
231
+ gems_to_add.each do |name, version|
232
+ if content.match?(/gem ['"]#{name}['"]/)
233
+ puts "Gemfile already contains #{name}"
234
+ else
235
+ File.open(GEMFILE, 'a') do |f|
236
+ f.puts %(\ngem "#{name}", "#{version}", require: false)
237
+ end
238
+ puts "Added gem '#{name}' (version #{version}) to Gemfile"
239
+ end
240
+ end
241
+
242
+ puts 'Installing specified gems...'
243
+ success = system('bundle install')
244
+
245
+ warn 'bundle install failed. Please run it manually.' unless success
246
+ rescue Errno::EACCES
247
+ warn 'Permission denied while modifying Gemfile.'
248
+ exit(1)
249
+ rescue StandardError => e
250
+ warn "Error while setting up gems: #{e.message}"
251
+ exit(1)
252
+ end
253
+ end
254
+ end
@@ -1,100 +1,156 @@
1
1
  module Sylvia
2
2
  class RuboCop
3
3
  CONFIG_FILE = '.rubocop.yml'
4
+ TODO_FILE = '.rubocop_todo.yml'
5
+ GEMFILE = 'Gemfile'
4
6
 
5
7
  def self.setup
8
+ setup_config
9
+ setup_gems
10
+ rescue StandardError => e
11
+ warn "Error during RuboCop setup: #{e.message}"
12
+ warn e.backtrace.first
13
+ exit(1)
14
+ end
15
+
16
+ def self.generate_todo
17
+ if File.exist?(TODO_FILE)
18
+ puts "#{TODO_FILE} already exists. Skipping generation."
19
+ return
20
+ end
21
+
22
+ puts 'Generating RuboCop TODO...'
23
+ success = system('bundle exec rubocop --auto-gen-config --no-exclude-limit')
24
+
25
+ if success
26
+ puts "RuboCop TODO generated (see #{TODO_FILE})"
27
+ else
28
+ warn 'Failed to generate RuboCop TODO. Check if rubocop is installed.'
29
+ end
30
+ rescue StandardError => e
31
+ warn "Error while generating TODO: #{e.message}"
32
+ exit(1)
33
+ end
34
+
35
+ def self.setup_config
6
36
  if File.exist?(CONFIG_FILE)
7
37
  puts "#{CONFIG_FILE} already exists. Skipping."
8
- else
9
- config_content = <<~YAML
10
- AllCops:
11
- Include:
12
- - "**/*.rb"
13
- - "**/*.rake"
14
- - "."
15
- Exclude:
16
- - "vendor/**/*"
17
- - "db/schema.rb"
18
- NewCops: enable
38
+ return
39
+ end
40
+
41
+ config_content = <<~YAML
42
+ require:
43
+ - rubocop-performance
19
44
 
20
- Layout/LineLength:
21
- Max: 120
22
- Exclude:
23
- - "spec/**/*"
45
+ AllCops:
46
+ Include:
47
+ - "**/*.rb"
48
+ - "**/*.rake"
49
+ - "."
50
+ Exclude:
51
+ - "vendor/**/*"
52
+ - "db/schema.rb"
53
+ NewCops: enable
24
54
 
25
- Style/BlockDelimiters:
26
- Exclude:
27
- - "spec/**/*"
55
+ Performance:
56
+ Enabled: true
28
57
 
29
- Lint/AmbiguousBlockAssociation:
30
- Exclude:
31
- - "spec/**/*"
58
+ Layout/LineLength:
59
+ Max: 120
60
+ Exclude:
61
+ - "spec/**/*"
32
62
 
33
- Metrics/BlockLength:
34
- Exclude:
35
- - "spec/**/*"
63
+ Style/BlockDelimiters:
64
+ Exclude:
65
+ - "spec/**/*"
36
66
 
37
- Layout/HeredocIndentation:
38
- Enabled: false
67
+ Lint/AmbiguousBlockAssociation:
68
+ Exclude:
69
+ - "spec/**/*"
39
70
 
40
- Metrics/ClassLength:
41
- Max: 175
71
+ Metrics/BlockLength:
72
+ Exclude:
73
+ - "spec/**/*"
42
74
 
43
- Metrics/MethodLength:
44
- Max: 25
75
+ Layout/HeredocIndentation:
76
+ Enabled: false
45
77
 
46
- Metrics/ParameterLists:
47
- Max: 20
78
+ Metrics/ClassLength:
79
+ Max: 175
48
80
 
49
- Metrics/AbcSize:
50
- Enabled: false
81
+ Metrics/MethodLength:
82
+ Max: 25
51
83
 
52
- Metrics/PerceivedComplexity:
53
- Enabled: false
84
+ Metrics/ParameterLists:
85
+ Max: 20
54
86
 
55
- Metrics/CyclomaticComplexity:
56
- Enabled: false
87
+ Metrics/AbcSize:
88
+ Enabled: false
57
89
 
58
- Style/HashEachMethods:
59
- Enabled: true
90
+ Metrics/PerceivedComplexity:
91
+ Enabled: false
60
92
 
61
- Style/HashTransformKeys:
62
- Enabled: false
93
+ Metrics/CyclomaticComplexity:
94
+ Enabled: false
63
95
 
64
- Style/HashTransformValues:
65
- Enabled: false
66
- YAML
96
+ Style/HashEachMethods:
97
+ Enabled: true
67
98
 
68
- File.write(CONFIG_FILE, config_content)
69
- puts "Created #{CONFIG_FILE}"
99
+ Style/HashTransformKeys:
100
+ Enabled: false
101
+
102
+ Style/HashTransformValues:
103
+ Enabled: false
104
+
105
+ Style/FrozenStringLiteralComment:
106
+ Enabled: false
107
+
108
+ Style/Documentation:
109
+ Enabled: false
110
+ YAML
111
+
112
+ File.write(CONFIG_FILE, config_content)
113
+ puts "Created #{CONFIG_FILE}"
114
+ rescue Errno::EACCES
115
+ warn "Permission denied while creating #{CONFIG_FILE}"
116
+ exit(1)
117
+ end
118
+
119
+ def self.setup_gems
120
+ unless File.exist?(GEMFILE)
121
+ puts 'No Gemfile found. Please create one and add these gems manually:'
122
+ puts " gem 'rubocop', '1.80.0', require: false"
123
+ puts " gem 'rubocop-performance', '1.26.0', require: false"
124
+ return
70
125
  end
71
126
 
72
- gemfile = 'Gemfile'
73
- if File.exist?(gemfile)
74
- content = File.read(gemfile)
75
- if content.include?('gem "rubocop"')
76
- puts 'Gemfile already contains rubocop'
127
+ content = File.read(GEMFILE)
128
+ gems_to_add = {
129
+ 'rubocop' => '1.80.0',
130
+ 'rubocop-performance' => '1.26.0'
131
+ }
132
+
133
+ gems_to_add.each do |name, version|
134
+ if content.match?(/gem ['"]#{name}['"]/)
135
+ puts "Gemfile already contains #{name}"
77
136
  else
78
- File.open(gemfile, 'a') { |f| f.puts "\ngem \"rubocop\", require: false" }
79
- puts "Added gem 'rubocop' to Gemfile"
80
- system('bundle install')
137
+ File.open(GEMFILE, 'a') do |f|
138
+ f.puts %(\ngem "#{name}", "#{version}", require: false)
139
+ end
140
+ puts "Added gem '#{name}' (version #{version}) to Gemfile"
81
141
  end
82
- else
83
- puts "No Gemfile found. Please create one and add gem 'rubocop'."
84
142
  end
85
- end
86
143
 
87
- def self.generate_todo
88
- todo_file = '.rubocop_todo.yml'
144
+ puts 'Installing specified gems...'
145
+ success = system('bundle install')
89
146
 
90
- if File.exist?(todo_file)
91
- puts "#{todo_file} already exists. Skipping generation."
92
- return
93
- end
94
-
95
- puts 'Generating RuboCop TODO...'
96
- system('rubocop --auto-gen-config --no-exclude-limit')
97
- puts "RuboCop TODO generated (see #{todo_file})"
147
+ warn 'bundle install failed. Please run it manually.' unless success
148
+ rescue Errno::EACCES
149
+ warn 'Permission denied while modifying Gemfile.'
150
+ exit(1)
151
+ rescue StandardError => e
152
+ warn "Error while setting up gems: #{e.message}"
153
+ exit(1)
98
154
  end
99
155
  end
100
156
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sylvia
4
- VERSION = "0.2.6"
4
+ VERSION = '0.4.2'
5
5
  end
data/sylvia.gemspec CHANGED
@@ -1,33 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/sylvia/version"
3
+ require_relative 'lib/sylvia/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "sylvia"
6
+ spec.name = 'sylvia'
7
7
  spec.version = Sylvia::VERSION
8
- spec.authors = ["whdzera"]
9
- spec.email = ["whdzera@gmail.com"]
8
+ spec.authors = ['whdzera']
9
+ spec.email = ['whdzera@gmail.com']
10
10
 
11
11
  spec.summary =
12
- "A command-line tool for generating and managing Ruby projects."
12
+ 'A command-line tool for generating and managing Ruby projects.'
13
13
  spec.description =
14
- "Sylvia is a command-line tool that helps you create and manage Ruby projects with ease."
15
- spec.homepage = "https://github.com/whdzera/sylvia"
16
- spec.license = "MIT"
17
- spec.required_ruby_version = ">= 3.1.0"
14
+ 'Sylvia is a command-line tool that helps you create and manage Ruby projects with ease.'
15
+ spec.homepage = 'https://github.com/whdzera/sylvia'
16
+ spec.license = 'MIT'
17
+ spec.required_ruby_version = '>= 3.1.0'
18
18
 
19
- spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = "https://github.com/whdzera/sylvia"
21
- spec.metadata["changelog_uri"] = "https://github.com/whdzera/sylvia"
19
+ spec.metadata['homepage_uri'] = spec.homepage
20
+ spec.metadata['source_code_uri'] = 'https://github.com/whdzera/sylvia'
21
+ spec.metadata['changelog_uri'] = 'https://github.com/whdzera/sylvia'
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
22
23
 
23
24
  gemspec = File.basename(__FILE__)
24
25
  spec.files = `git ls-files -z`.split("\x0")
25
- spec.bindir = "bin"
26
+ spec.bindir = 'bin'
26
27
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
27
- spec.require_paths = ["lib"]
28
+ spec.require_paths = ['lib']
28
29
 
29
- spec.add_dependency "ruby_llm"
30
- spec.add_dependency "dotenv"
31
- spec.add_dependency "tty-markdown"
32
- spec.add_development_dependency "syntax_tree"
30
+ spec.add_dependency 'dotenv'
31
+ spec.add_dependency 'ruby_llm'
32
+ spec.add_dependency 'tty-markdown'
33
+ spec.add_development_dependency 'syntax_tree'
33
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sylvia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - whdzera
@@ -10,7 +10,7 @@ cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: ruby_llm
13
+ name: dotenv
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
@@ -24,7 +24,7 @@ dependencies:
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0'
26
26
  - !ruby/object:Gem::Dependency
27
- name: dotenv
27
+ name: ruby_llm
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
@@ -74,7 +74,6 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - ".github/workflows/main.yml"
78
77
  - ".gitignore"
79
78
  - ".rspec"
80
79
  - ".rubocop.yml"
@@ -86,16 +85,17 @@ files:
86
85
  - Rakefile
87
86
  - bin/sylvia
88
87
  - lib/sylvia.rb
88
+ - lib/sylvia/bot.rb
89
89
  - lib/sylvia/cli.rb
90
+ - lib/sylvia/jekyll.rb
90
91
  - lib/sylvia/llm.rb
91
92
  - lib/sylvia/prettier.rb
93
+ - lib/sylvia/rubocop-rails.rb
92
94
  - lib/sylvia/rubocop.rb
93
95
  - lib/sylvia/version.rb
94
- - sig/sylvia.rbs
95
96
  - spec/spec_helper.rb
96
97
  - spec/sylvia_spec.rb
97
98
  - sylvia.gemspec
98
- - sylvia.rb
99
99
  homepage: https://github.com/whdzera/sylvia
100
100
  licenses:
101
101
  - MIT
@@ -103,6 +103,7 @@ metadata:
103
103
  homepage_uri: https://github.com/whdzera/sylvia
104
104
  source_code_uri: https://github.com/whdzera/sylvia
105
105
  changelog_uri: https://github.com/whdzera/sylvia
106
+ rubygems_mfa_required: 'true'
106
107
  rdoc_options: []
107
108
  require_paths:
108
109
  - lib
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.7.1
121
+ rubygems_version: 3.6.7
121
122
  specification_version: 4
122
123
  summary: A command-line tool for generating and managing Ruby projects.
123
124
  test_files: []
@@ -1,27 +0,0 @@
1
- name: Ruby
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
-
8
- pull_request:
9
-
10
- jobs:
11
- build:
12
- runs-on: ubuntu-latest
13
- name: Ruby ${{ matrix.ruby }}
14
- strategy:
15
- matrix:
16
- ruby:
17
- - '3.3.0'
18
-
19
- steps:
20
- - uses: actions/checkout@v4
21
- - name: Set up Ruby
22
- uses: ruby/setup-ruby@v1
23
- with:
24
- ruby-version: ${{ matrix.ruby }}
25
- bundler-cache: true
26
- - name: Run the default task
27
- run: bundle exec rake
data/sig/sylvia.rbs DELETED
@@ -1,4 +0,0 @@
1
- module Sylvia
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end
data/sylvia.rb DELETED
@@ -1,24 +0,0 @@
1
- require 'ruby_llm'
2
- require 'tty-markdown'
3
-
4
- api_key = 'xxx'
5
- model_ai = 'gemini-2.0-flash'
6
-
7
- RubyLLM.configure do |config|
8
- config.gemini_api_key = api_key
9
- end
10
-
11
- chat = RubyLLM.chat(model: model_ai)
12
-
13
- response = chat.ask <<~PROMPT, with: ["assets/example.rb", "assets/example2.rb"]
14
- Please review the following Ruby code and suggest improvements:
15
-
16
- 1. Use descriptive variable names.
17
- 2. Follow Ruby style conventions.
18
- 3. Optimize loops and iterators.
19
- 4. Avoid unnecessary complexity.
20
- PROMPT
21
-
22
- markdown = response.content.to_s
23
-
24
- puts TTY::Markdown.parse(markdown)