sylvia 0.3.2 → 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 +4 -4
- data/.rubocop.yml +11 -1
- data/Gemfile +6 -5
- data/README.md +15 -3
- data/lib/sylvia/cli.rb +33 -27
- data/lib/sylvia/rubocop-rails.rb +254 -0
- data/lib/sylvia/rubocop.rb +124 -68
- data/lib/sylvia/version.rb +1 -1
- metadata +3 -3
- data/.github/workflows/main.yml +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 839805c7b4e01b1edf6d11acd5d5f2c882aa9ab4a4211ca084382e80a15b6cc4
|
|
4
|
+
data.tar.gz: e63febac4acc8b9eb7fe2b89c5dc3acdc4f58e3dfae0eb29dbfd8189465fa5c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58a64920ab409558f22463b2007d2a6a47cdd176f932c6ac219abf42cd498b89ba79124745c293b5c270a78be2c36eba64b7d5e335c5eff80acf915132f62086
|
|
7
|
+
data.tar.gz: ac8d9ca5c62a4d40d0dd735e005776419ba5fc0f9ba7bde56ce17f97d135d9db8c1bcc3149c8900a8bec44b68ede97afb7fe0d216e8a2a8ca93118fd2e0b0aa0
|
data/.rubocop.yml
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
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
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
5
|
# Specify your gem's dependencies in sylvia.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem
|
|
9
|
-
gem
|
|
10
|
-
gem
|
|
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
|
@@ -18,13 +18,13 @@ gem install sylvia
|
|
|
18
18
|
##### Generate template jekyll (vite, stimulus, tailwind)
|
|
19
19
|
|
|
20
20
|
```
|
|
21
|
-
sylvia jekyll
|
|
21
|
+
sylvia jekyll name_app
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
#####
|
|
24
|
+
##### Generate template Bot (Discord & Telegram)
|
|
25
25
|
|
|
26
26
|
```
|
|
27
|
-
sylvia
|
|
27
|
+
sylvia bot nname_app
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
##### Setup Rubocop
|
|
@@ -33,6 +33,18 @@ sylvia prettier
|
|
|
33
33
|
sylvia rubocop
|
|
34
34
|
```
|
|
35
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
|
+
|
|
36
48
|
##### Setup and Configuration AI LLM
|
|
37
49
|
|
|
38
50
|
```
|
data/lib/sylvia/cli.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
5
|
-
require_relative
|
|
6
|
-
require_relative
|
|
7
|
-
require_relative
|
|
8
|
-
require_relative
|
|
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'
|
|
9
9
|
|
|
10
10
|
module Sylvia
|
|
11
11
|
class CLI
|
|
@@ -13,34 +13,40 @@ module Sylvia
|
|
|
13
13
|
command = args.shift
|
|
14
14
|
|
|
15
15
|
case command
|
|
16
|
-
when
|
|
16
|
+
when 'llm'
|
|
17
17
|
LLM.setup
|
|
18
|
-
when
|
|
18
|
+
when 'ai'
|
|
19
19
|
LLM.run
|
|
20
|
-
when
|
|
20
|
+
when 'prettier'
|
|
21
21
|
Prettier.setup
|
|
22
|
-
when
|
|
22
|
+
when 'rubocop'
|
|
23
23
|
RuboCop.setup
|
|
24
|
-
when
|
|
24
|
+
when 'rubocop-todo'
|
|
25
25
|
RuboCop.generate_todo
|
|
26
|
-
when
|
|
27
|
-
|
|
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'
|
|
28
32
|
Jekyll.new_project(target)
|
|
29
|
-
when
|
|
30
|
-
target = args.shift ||
|
|
33
|
+
when 'bot'
|
|
34
|
+
target = args.shift || 'bot-app'
|
|
31
35
|
Bot.new_project(target)
|
|
32
|
-
when
|
|
36
|
+
when '-v', '--version'
|
|
33
37
|
puts "Sylvia version #{Sylvia::VERSION}"
|
|
34
38
|
else
|
|
35
|
-
puts
|
|
36
|
-
puts
|
|
37
|
-
puts
|
|
38
|
-
puts
|
|
39
|
-
puts
|
|
40
|
-
puts
|
|
41
|
-
puts
|
|
42
|
-
puts
|
|
43
|
-
puts
|
|
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'
|
|
44
50
|
end
|
|
45
51
|
end
|
|
46
52
|
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
|
data/lib/sylvia/rubocop.rb
CHANGED
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
45
|
+
AllCops:
|
|
46
|
+
Include:
|
|
47
|
+
- "**/*.rb"
|
|
48
|
+
- "**/*.rake"
|
|
49
|
+
- "."
|
|
50
|
+
Exclude:
|
|
51
|
+
- "vendor/**/*"
|
|
52
|
+
- "db/schema.rb"
|
|
53
|
+
NewCops: enable
|
|
24
54
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- "spec/**/*"
|
|
55
|
+
Performance:
|
|
56
|
+
Enabled: true
|
|
28
57
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
58
|
+
Layout/LineLength:
|
|
59
|
+
Max: 120
|
|
60
|
+
Exclude:
|
|
61
|
+
- "spec/**/*"
|
|
32
62
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
63
|
+
Style/BlockDelimiters:
|
|
64
|
+
Exclude:
|
|
65
|
+
- "spec/**/*"
|
|
36
66
|
|
|
37
|
-
|
|
38
|
-
|
|
67
|
+
Lint/AmbiguousBlockAssociation:
|
|
68
|
+
Exclude:
|
|
69
|
+
- "spec/**/*"
|
|
39
70
|
|
|
40
|
-
|
|
41
|
-
|
|
71
|
+
Metrics/BlockLength:
|
|
72
|
+
Exclude:
|
|
73
|
+
- "spec/**/*"
|
|
42
74
|
|
|
43
|
-
|
|
44
|
-
|
|
75
|
+
Layout/HeredocIndentation:
|
|
76
|
+
Enabled: false
|
|
45
77
|
|
|
46
|
-
|
|
47
|
-
|
|
78
|
+
Metrics/ClassLength:
|
|
79
|
+
Max: 175
|
|
48
80
|
|
|
49
|
-
|
|
50
|
-
|
|
81
|
+
Metrics/MethodLength:
|
|
82
|
+
Max: 25
|
|
51
83
|
|
|
52
|
-
|
|
53
|
-
|
|
84
|
+
Metrics/ParameterLists:
|
|
85
|
+
Max: 20
|
|
54
86
|
|
|
55
|
-
|
|
56
|
-
|
|
87
|
+
Metrics/AbcSize:
|
|
88
|
+
Enabled: false
|
|
57
89
|
|
|
58
|
-
|
|
59
|
-
|
|
90
|
+
Metrics/PerceivedComplexity:
|
|
91
|
+
Enabled: false
|
|
60
92
|
|
|
61
|
-
|
|
62
|
-
|
|
93
|
+
Metrics/CyclomaticComplexity:
|
|
94
|
+
Enabled: false
|
|
63
95
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
YAML
|
|
96
|
+
Style/HashEachMethods:
|
|
97
|
+
Enabled: true
|
|
67
98
|
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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(
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
88
|
-
|
|
144
|
+
puts 'Installing specified gems...'
|
|
145
|
+
success = system('bundle install')
|
|
89
146
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
data/lib/sylvia/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- whdzera
|
|
@@ -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"
|
|
@@ -91,6 +90,7 @@ files:
|
|
|
91
90
|
- lib/sylvia/jekyll.rb
|
|
92
91
|
- lib/sylvia/llm.rb
|
|
93
92
|
- lib/sylvia/prettier.rb
|
|
93
|
+
- lib/sylvia/rubocop-rails.rb
|
|
94
94
|
- lib/sylvia/rubocop.rb
|
|
95
95
|
- lib/sylvia/version.rb
|
|
96
96
|
- spec/spec_helper.rb
|
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
119
|
version: '0'
|
|
120
120
|
requirements: []
|
|
121
|
-
rubygems_version: 3.7
|
|
121
|
+
rubygems_version: 3.6.7
|
|
122
122
|
specification_version: 4
|
|
123
123
|
summary: A command-line tool for generating and managing Ruby projects.
|
|
124
124
|
test_files: []
|
data/.github/workflows/main.yml
DELETED
|
@@ -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
|