whoosh 1.2.0 → 1.2.1
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/lib/whoosh/cli/main.rb +58 -0
- data/lib/whoosh/cli/project_generator.rb +34 -0
- data/lib/whoosh/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f647a91b22fcee8322c6af7bf0ab0ac0108aa3113e2d4db89a3f187bb6a1caa3
|
|
4
|
+
data.tar.gz: e46c07b2f4fbaf1233bb52a321ff161952989313adbbfebdb5b7bf1c08675f08
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ca2dbc63ab481d5d61260cfbfca37768a9498fa74fe90d68f039884f05ca2a79f0fa08da07fdca04ba175e95ab0997d5cc00acf0e8b2bbceef5ca576f8fef91
|
|
7
|
+
data.tar.gz: b0361d6a812b80e093125f7be7d5681977ab615b6ebccacbe87753352223e6058e0076dd2eace8e3092a60a57e3387b9ebe0baed4b2f623befeb8f1c38d9435e
|
data/lib/whoosh/cli/main.rb
CHANGED
|
@@ -224,6 +224,64 @@ module Whoosh
|
|
|
224
224
|
end
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
desc "ci", "Run full CI pipeline (lint + security + tests)"
|
|
228
|
+
def ci
|
|
229
|
+
puts "=> Whoosh CI Pipeline"
|
|
230
|
+
puts "=" * 50
|
|
231
|
+
puts ""
|
|
232
|
+
|
|
233
|
+
steps = []
|
|
234
|
+
|
|
235
|
+
# Step 1: Rubocop (lint)
|
|
236
|
+
if system("bundle exec rubocop --version > /dev/null 2>&1")
|
|
237
|
+
steps << { name: "Rubocop (lint)", cmd: "bundle exec rubocop --format simple" }
|
|
238
|
+
else
|
|
239
|
+
puts " [skip] Rubocop not installed (add rubocop to Gemfile)"
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Step 2: Brakeman (security)
|
|
243
|
+
if system("bundle exec brakeman --version > /dev/null 2>&1")
|
|
244
|
+
steps << { name: "Brakeman (security)", cmd: "bundle exec brakeman -q --no-pager" }
|
|
245
|
+
else
|
|
246
|
+
puts " [skip] Brakeman not installed (add brakeman to Gemfile)"
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Step 3: RSpec (tests)
|
|
250
|
+
if system("bundle exec rspec --version > /dev/null 2>&1")
|
|
251
|
+
steps << { name: "RSpec (tests)", cmd: "bundle exec rspec --format progress" }
|
|
252
|
+
else
|
|
253
|
+
puts " [skip] RSpec not installed"
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Step 4: Gem build check
|
|
257
|
+
gemspec = Dir.glob("*.gemspec").first
|
|
258
|
+
if gemspec
|
|
259
|
+
steps << { name: "Gem build", cmd: "gem build #{gemspec} --quiet" }
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
failed = []
|
|
263
|
+
steps.each_with_index do |step, i|
|
|
264
|
+
puts "--- [#{i + 1}/#{steps.length}] #{step[:name]} ---"
|
|
265
|
+
success = system(step[:cmd])
|
|
266
|
+
if success
|
|
267
|
+
puts " ✓ #{step[:name]} passed"
|
|
268
|
+
else
|
|
269
|
+
puts " ✗ #{step[:name]} FAILED"
|
|
270
|
+
failed << step[:name]
|
|
271
|
+
end
|
|
272
|
+
puts ""
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
puts "=" * 50
|
|
276
|
+
if failed.empty?
|
|
277
|
+
puts "=> All checks passed! ✓"
|
|
278
|
+
exit 0
|
|
279
|
+
else
|
|
280
|
+
puts "=> FAILED: #{failed.join(', ')}"
|
|
281
|
+
exit 1
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
227
285
|
desc "new NAME", "Create a new Whoosh project"
|
|
228
286
|
option :minimal, type: :boolean, default: false
|
|
229
287
|
option :full, type: :boolean, default: false
|
|
@@ -31,6 +31,7 @@ module Whoosh
|
|
|
31
31
|
write(dir, ".rspec", rspec_config)
|
|
32
32
|
write(dir, "Dockerfile", dockerfile)
|
|
33
33
|
write(dir, ".dockerignore", dockerignore)
|
|
34
|
+
write(dir, ".rubocop.yml", rubocop_config)
|
|
34
35
|
write(dir, "README.md", readme(name))
|
|
35
36
|
|
|
36
37
|
# Create empty SQLite DB directory
|
|
@@ -55,6 +56,8 @@ module Whoosh
|
|
|
55
56
|
puts " http://localhost:9292/docs # Swagger UI"
|
|
56
57
|
puts " http://localhost:9292/metrics # Prometheus metrics"
|
|
57
58
|
puts ""
|
|
59
|
+
puts " whoosh ci # run lint + security + tests"
|
|
60
|
+
puts ""
|
|
58
61
|
end
|
|
59
62
|
|
|
60
63
|
class << self
|
|
@@ -145,6 +148,8 @@ module Whoosh
|
|
|
145
148
|
group :development, :test do
|
|
146
149
|
gem "rspec"
|
|
147
150
|
gem "rack-test"
|
|
151
|
+
gem "rubocop", require: false
|
|
152
|
+
gem "brakeman", require: false
|
|
148
153
|
end
|
|
149
154
|
GEM
|
|
150
155
|
|
|
@@ -349,6 +354,35 @@ module Whoosh
|
|
|
349
354
|
DOCKERFILE
|
|
350
355
|
end
|
|
351
356
|
|
|
357
|
+
def rubocop_config
|
|
358
|
+
<<~YAML
|
|
359
|
+
AllCops:
|
|
360
|
+
TargetRubyVersion: 3.4
|
|
361
|
+
NewCops: enable
|
|
362
|
+
SuggestExtensions: false
|
|
363
|
+
Exclude:
|
|
364
|
+
- db/migrations/**/*
|
|
365
|
+
- vendor/**/*
|
|
366
|
+
|
|
367
|
+
Style/FrozenStringLiteralComment:
|
|
368
|
+
Enabled: true
|
|
369
|
+
|
|
370
|
+
Style/StringLiterals:
|
|
371
|
+
EnforcedStyle: double_quotes
|
|
372
|
+
|
|
373
|
+
Layout/LineLength:
|
|
374
|
+
Max: 120
|
|
375
|
+
|
|
376
|
+
Metrics/MethodLength:
|
|
377
|
+
Max: 25
|
|
378
|
+
|
|
379
|
+
Metrics/BlockLength:
|
|
380
|
+
Exclude:
|
|
381
|
+
- spec/**/*
|
|
382
|
+
- test/**/*
|
|
383
|
+
YAML
|
|
384
|
+
end
|
|
385
|
+
|
|
352
386
|
def dockerignore
|
|
353
387
|
<<~IGNORE
|
|
354
388
|
.git
|
data/lib/whoosh/version.rb
CHANGED