search_rails 1.1.2 → 2.0.0

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.
data/lib/search_rails.rb CHANGED
@@ -1,532 +1,15 @@
1
- require "search_rails/version"
1
+ # frozen_string_literal: true
2
2
 
3
- module SearchRails
4
- class SearchInstall
5
-
6
- def create_files
7
- require 'colorize'
8
- require "fileutils"
9
- root = Dir.pwd
10
- Dir.chdir(root + '/app')
11
- if File.exists?('search')
12
- puts 'Already Exists'.bold.green + ' /app/search'.bold
13
- else
14
- FileUtils::mkdir_p "search"
15
- puts "Created ".green.bold + '/app/search'.bold
16
- end
17
- Dir.chdir(root + '/app/search')
18
- if File.exists?('search_module.rb')
19
- puts 'Already Exists'.bold.green + ' /app/search/search_module.rb'.bold
20
- else
21
- File.new "search_module.rb", "w"
22
- puts "Created ".green.bold + '/app/search/search_module.rb'.bold
23
- end
24
- Dir.chdir(root + '/app/controllers')
25
- if File.exists?('searches_controller.rb')
26
- puts 'Already Exists'.bold.green + ' /app/controllers/searches_controller.rb'.bold
27
- else
28
- File.new "searches_controller.rb", "w"
29
- puts "Created ".green.bold + '/app/controllers/searches_controller.rb'.bold
30
- end
31
- Dir.chdir(root + '/app/models')
32
- if File.exists?('search.rb')
33
- puts 'Already Exists'.bold.green + ' /app/models/search.rb'.bold
34
- else
35
- File.new "search.rb", "w"
36
- puts 'Created '.green.bold + '/app/models/search.rb'.bold
37
- end
38
- Dir.chdir(root + '/db')
39
- if File.exists?('migrate')
40
- puts 'Already Exists'.bold.green + ' /db/migrate'.bold
41
- else
42
- FileUtils::mkdir_p "migrate"
43
- puts "Created ".green.bold + '/db/migrate'.bold
44
- end
45
- Dir.chdir(root)
46
- end
47
-
48
- def write_search_module(object, attributes)
49
- root = Dir.pwd
50
- require 'active_support/inflector'
51
- Dir.chdir(root + '/app/search')
52
- File.open("search_module.rb", "a") do |line|
53
- line.puts 'module SearchModule'
54
- line.puts ' def search'
55
- attri_one = attributes[0]
56
- attribute = attri_one.split(':')
57
- line.puts " @" + object.downcase.pluralize + " = " + object.capitalize.singularize + ".where('lower(" + attribute[0] + ") LIKE ?', '%' + @search.search.downcase + '%')"
58
- attributes = attributes.reject { |attri| attri == attributes[0] }
59
- attributes.each do |attri|
60
- attribute = attri.split(':')
61
- if attribute[1] == 'integer' || attribute[1] == 'decimal'
62
- line.puts " " + object.capitalize.singularize + ".where('cast(" + attribute[0] + " AS VARCHAR) LIKE ?', '%' + @search.search + '%').each { |" + attribute[0] + "| @" + object.downcase.pluralize + ".any? { |f| f.id == " + attribute[0] + ".id } ? true : @" + object.downcase.pluralize + " << " + attribute[0] + " }"
63
- elsif attribute[1] == 'boolean'
64
- line.puts " if @search.search.downcase == 'true' || @search.search.downcase == 'tru' || @search.search.downcase == 'tr' || @search.search.downcase == 't'"
65
- line.puts " " + object.capitalize.singularize + ".where(" + attribute[0] + ": true).each { |" + attribute[0] + "| @" + object.downcase.pluralize + ".any? { |f| f.id == " + attribute[0] + ".id } ? true : @" + object.downcase.pluralize + " << " + attribute[0] + " }"
66
- line.puts " else @search.search.downcase == 'false' || @search.search.downcase == 'fals' || @search.search.downcase == 'fal' || @search.search.downcase == 'fa' || @search.search.downcase == 'f'"
67
- line.puts " " + object.capitalize.singularize + ".where(" + attribute[0] + ": false).each { |" + attribute[0] + "| @" + object.downcase.pluralize + ".any? { |f| f.id == " + attribute[0] + ".id } ? true : @" + object.downcase.pluralize + " << " + attribute[0] + " }"
68
- line.puts " end"
69
- else
70
- line.puts " " + object.capitalize.singularize + ".where('lower(" + attribute[0] + ") LIKE ?', '%' + @search.search + '%').each { |" + attribute[0] + "| @" + object.downcase.pluralize + ".any? { |f| f.id == " + attribute[0] + ".id } ? true : @" + object.downcase.pluralize + " << " + attribute[0] + " }"
71
- end
72
- end
73
- line.puts ' end'
74
- line.puts ''
75
- line.puts ' def clear'
76
- line.puts ' @search = Search.find_by_search_id(1)'
77
- line.puts ' @search.search = nil'
78
- line.puts ' @search.save'
79
- line.puts ' redirect_to ' + object.pluralize.downcase + '_path'
80
- line.puts ' end'
81
- line.puts ''
82
- line.puts ' def check_for_search'
83
- line.puts ' if Search.find_by_search_id(1) == nil'
84
- line.puts ' @search = Search.new'
85
- line.puts ' @search.search = nil'
86
- line.puts ' @search.search_id = 1'
87
- line.puts ' @search.save'
88
- line.puts ' end'
89
- line.puts ' end'
90
- line.puts ''
91
- line.puts ' def update_search'
92
- line.puts ' respond_to do |format|'
93
- line.puts ' if @search.update(search_params)'
94
- line.puts ' format.html { redirect_to :back }'
95
- line.puts ' format.json { render :show, status: :ok, location: @search }'
96
- line.puts ' else'
97
- line.puts ' format.html { render :edit }'
98
- line.puts ' format.json { render json: @search.errors, status: :unprocessable_entity }'
99
- line.puts ' end'
100
- line.puts ' end'
101
- line.puts ' end'
102
-
103
- line.puts 'end'
104
- end
105
- Dir.chdir(root)
106
- end
107
-
108
- def write_search_controller
109
- root = Dir.pwd
110
- Dir.chdir(root + '/app/controllers')
111
- File.open("searches_controller.rb", "a") do |line|
112
- line.puts 'class SearchesController < ApplicationController'
113
- line.puts ' before_action :set_search, only: [:show, :edit, :update, :destroy]'
114
- line.puts ' before_action :include_search_module, only: [ :clear, :edit, :update ]'
115
- line.puts ''
116
- line.puts ' def clear'
117
- line.puts ' clear'
118
- line.puts ' end'
119
- line.puts ''
120
- line.puts ' def update'
121
- line.puts ' update_search'
122
- line.puts ' end'
123
- line.puts ''
124
- line.puts ' private'
125
- line.puts ''
126
- line.puts ' def set_search'
127
- line.puts ' @search = Search.find_by_search_id(1)'
128
- line.puts ' end'
129
- line.puts ''
130
- line.puts ' def include_search_module'
131
- line.puts " $LOAD_PATH.unshift(File.dirname('../app/search'))"
132
- line.puts ' extend SearchModule'
133
- line.puts ' end'
134
- line.puts ''
135
- line.puts ' def search_params'
136
- line.puts ' params.require(:search).permit(:search)'
137
- line.puts ' end'
138
- line.puts ''
139
- line.puts 'end'
140
- end
141
- Dir.chdir(root)
142
- end
143
-
144
- def write_migration
145
- require "fileutils"
146
- require 'colorize'
147
- root = Dir.pwd
148
- Dir.chdir(root + '/db/migrate')
149
- require 'date'
150
- @time = DateTime.now.strftime('%Y%m%d%H%M%S')
151
- if Dir[root + '/db/migrate/*_create_searches.rb'].count > 0
152
- file = Dir[root + '/db/migrate/*_create_searches.rb'].first
153
- puts 'Already Exists '.bold.green + file[38..100].bold
154
- else
155
- File.new @time + '_create_searches.rb', "w"
156
- puts "Created ".green.bold + '/db/migrate/'.bold + @time.bold + '_create_searches.rb'.bold
157
- File.open(@time + "_create_searches.rb", "a") do |line|
158
- line.puts 'class CreateSearches < ActiveRecord::Migration'
159
- line.puts ' def change'
160
- line.puts ' create_table :searches do |t|'
161
- line.puts ' t.string :search'
162
- line.puts ' t.integer :search_id'
163
- line.puts ' t.timestamps null: false'
164
- line.puts ' end'
165
- line.puts ' end'
166
- line.puts 'end'
167
- end
168
- end
169
- Dir.chdir(root)
170
- end
171
-
172
- def write_application_controller
173
- require "fileutils"
174
- root = Dir.pwd
175
- Dir.chdir(root + '/app/controllers')
176
- first_line = IO.readlines("application_controller.rb")[0]
177
- other_lines = IO.readlines("application_controller.rb")[1..1000000000]
178
- second_line = IO.readlines("application_controller.rb")[1]
179
-
180
- if second_line.chomp == ' before_action :check_for_search'
181
- puts 'Already Exists'.bold.green + ' /app/controllers/application_controller.rb'.bold
182
- else
183
- FileUtils::mkdir_p "migrate"
184
- puts "Updated ".green.bold + '/app/controllers/application_controller.rb'.bold
185
- File.open("application_controller.rb", "w") do |line|
186
- line.puts first_line
187
- line.puts ' before_action :check_for_search'
188
- line.puts ''
189
- line.puts ' def check_for_search'
190
- line.puts " $LOAD_PATH.unshift(File.dirname('../app/search'))"
191
- line.puts ' extend SearchModule'
192
- line.puts ' check_for_search'
193
- line.puts ' end'
194
- line.puts ''
195
- line.puts other_lines
196
- end
197
- end
198
- Dir.chdir(root)
199
- end
200
-
201
- def write_search_model
202
- require "fileutils"
203
- root = Dir.pwd
204
- Dir.chdir(root + '/app/models')
205
- File.open("search.rb", "w") do |line|
206
- line.puts 'class Search < ActiveRecord::Base'
207
- line.puts 'end'
208
- end
209
- Dir.chdir(root)
210
- end
211
-
212
- def update_routes
213
- require "fileutils"
214
- root = Dir.pwd
215
- Dir.chdir(root + '/config')
216
- first_line = IO.readlines("routes.rb")[0]
217
- other_lines = IO.readlines("routes.rb")[1..1000000000]
218
- second_line = IO.readlines("routes.rb")[1]
219
- if second_line.chomp == 'resources :searches do'
220
- puts 'Already Exists'.bold.green + ' /config/routes.rb'.bold
221
- else
222
- File.open('routes.rb', 'w') do |line|
223
- line.puts first_line
224
- line.puts 'resources :searches do'
225
- line.puts ' member do'
226
- line.puts " get 'clear'"
227
- line.puts ' end'
228
- line.puts 'end'
229
- line.puts other_lines
230
- end
231
- puts 'Updated '.bold.green + '/config/routes.rb'.bold
232
- end
233
- Dir.chdir(root)
234
- end
235
-
236
- def run
237
- require 'colorize'
238
- root = Dir.pwd
239
-
240
- puts "Syntax: 'install OBJECT ATTRIBUTE:TYPE'".bold.on_red
241
- command = gets.chomp
242
- command = command.split(" ")
243
- if command[0] == 'install'
244
- puts ''
245
- puts 'Creating Files...'.bold
246
- object = command[1]
247
- attributes = command[2..10000000]
248
- end
249
-
250
- SearchInstall.new.create_files
251
- SearchInstall.new.write_search_controller
252
- SearchInstall.new.write_search_model
253
- SearchInstall.new.write_search_module(object, attributes)
254
- SearchInstall.new.write_application_controller
255
- SearchInstall.new.write_migration
256
- SearchInstall.new.update_routes
257
-
258
- puts 'Done'.bold
259
- puts ''
260
-
261
-
262
- end
263
-
264
- end
265
-
266
-
267
- class SearchInstallDevise
268
-
269
- def create_files
270
- require "colorize"
271
- require "fileutils"
272
- root = Dir.pwd
273
- Dir.chdir(root + '/app')
274
- if File.exists?('search')
275
- puts 'Already Exists'.bold.green + ' /app/search'.bold
276
- else
277
- FileUtils::mkdir_p "search"
278
- puts "Created ".green.bold + '/app/search'.bold
279
- end
280
- Dir.chdir(root + '/app/search')
281
- if File.exists?('search_module.rb')
282
- puts 'Already Exists'.bold.green + ' /app/search/search_module.rb'.bold
283
- else
284
- File.new "search_module.rb", "w"
285
- puts "Created ".green.bold + '/app/search/search_module.rb'.bold
286
- end
287
- Dir.chdir(root + '/app/controllers')
288
- if File.exists?('searches_controller.rb')
289
- puts 'Already Exists'.bold.green + ' /app/controllers/searches_controller.rb'.bold
290
- else
291
- File.new "searches_controller.rb", "w"
292
- puts "Created ".green.bold + '/app/controllers/searches_controller.rb'.bold
293
- end
294
- Dir.chdir(root + '/app/models')
295
- if File.exists?('search.rb')
296
- puts 'Already Exists'.bold.green + ' /app/models/search.rb'.bold
297
- else
298
- File.new "search.rb", "w"
299
- puts 'Created '.green.bold + '/app/models/search.rb'.bold
300
- end
301
- Dir.chdir(root + '/db')
302
- if File.exists?('migrate')
303
- puts 'Already Exists'.bold.green + ' /db/migrate'.bold
304
- else
305
- FileUtils::mkdir_p "migrate"
306
- puts "Created ".green.bold + '/db/migrate'.bold
307
- end
308
- Dir.chdir(root)
309
- end
310
-
311
- def write_search_module(object, attributes)
312
- root = Dir.pwd
313
- require 'active_support/inflector'
314
- Dir.chdir(root + '/app/search')
315
- File.open("search_module.rb", "a") do |line|
316
- line.puts 'module SearchModule'
317
- line.puts ' def search'
318
- attri_one = attributes[0]
319
- attribute = attri_one.split(':')
320
- line.puts " @" + object.downcase.pluralize + " = " + object.capitalize.singularize + ".where('lower(" + attribute[0] + ") LIKE ?', '%' + @search.search.downcase + '%')"
321
- attributes = attributes.reject { |attri| attri == attributes[0] }
322
- attributes.each do |attri|
323
- attribute = attri.split(':')
324
- if attribute[1] == 'integer' || attribute[1] == 'decimal'
325
- line.puts " " + object.capitalize.singularize + ".where('cast(" + attribute[0] + " AS VARCHAR) LIKE ?', '%' + @search.search + '%').each { |" + attribute[0] + "| @" + object.downcase.pluralize + ".any? { |f| f.id == " + attribute[0] + ".id } ? true : @" + object.downcase.pluralize + " << " + attribute[0] + " }"
326
- elsif attribute[1] == 'boolean'
327
- line.puts " if @search.search.downcase == 'true' || @search.search.downcase == 'tru' || @search.search.downcase == 'tr' || @search.search.downcase == 't'"
328
- line.puts " " + object.capitalize.singularize + ".where(" + attribute[0] + ": true).each { |" + attribute[0] + "| @" + object.downcase.pluralize + ".any? { |f| f.id == " + attribute[0] + ".id } ? true : @" + object.downcase.pluralize + " << " + attribute[0] + " }"
329
- line.puts " else @search.search.downcase == 'false' || @search.search.downcase == 'fals' || @search.search.downcase == 'fal' || @search.search.downcase == 'fa' || @search.search.downcase == 'f'"
330
- line.puts " " + object.capitalize.singularize + ".where(" + attribute[0] + ": false).each { |" + attribute[0] + "| @" + object.downcase.pluralize + ".any? { |f| f.id == " + attribute[0] + ".id } ? true : @" + object.downcase.pluralize + " << " + attribute[0] + " }"
331
- line.puts " end"
332
- else
333
- line.puts " " + object.capitalize.singularize + ".where('lower(" + attribute[0] + ") LIKE ?', '%' + @search.search + '%').each { |" + attribute[0] + "| @" + object.downcase.pluralize + ".any? { |f| f.id == " + attribute[0] + ".id } ? true : @" + object.downcase.pluralize + " << " + attribute[0] + " }"
334
- end
335
- end
336
- line.puts ' end'
337
- line.puts ''
338
- line.puts ' def clear'
339
- line.puts ' @search = Search.find_by(user_id: current_user.id)'
340
- line.puts ' @search.search = nil'
341
- line.puts ' @search.save'
342
- line.puts ' redirect_to ' + object.pluralize.downcase + '_path'
343
- line.puts ' end'
344
- line.puts ''
345
- line.puts ' def check_for_search'
346
- line.puts ' if user_signed_in?'
347
- line.puts ' if Search.find_by(user_id: current_user.id) == nil'
348
- line.puts ' @search = Search.new'
349
- line.puts ' @search.search = nil'
350
- line.puts ' @search.user_id = current_user.id'
351
- line.puts ' @search.save'
352
- line.puts ' end'
353
- line.puts ' end'
354
- line.puts ' end'
355
- line.puts ''
356
- line.puts ' def update_search'
357
- line.puts ' respond_to do |format|'
358
- line.puts ' if @search.update(search_params)'
359
- line.puts ' format.html { redirect_to :back }'
360
- line.puts ' format.json { render :show, status: :ok, location: @search }'
361
- line.puts ' else'
362
- line.puts ' format.html { render :edit }'
363
- line.puts ' format.json { render json: @search.errors, status: :unprocessable_entity }'
364
- line.puts ' end'
365
- line.puts ' end'
366
- line.puts ' end'
367
-
368
- line.puts 'end'
369
- end
370
- Dir.chdir(root)
371
- end
372
-
373
- def write_search_controller
374
- root = Dir.pwd
375
- Dir.chdir(root + '/app/controllers')
376
- File.open("searches_controller.rb", "a") do |line|
377
- line.puts 'class SearchesController < ApplicationController'
378
- line.puts ' before_action :set_search, only: [:show, :edit, :update, :destroy]'
379
- line.puts ' before_action :include_search_module, only: [ :clear, :edit, :update ]'
380
- line.puts ''
381
- line.puts ' def clear'
382
- line.puts ' clear'
383
- line.puts ' end'
384
- line.puts ''
385
- line.puts ' def update'
386
- line.puts ' update_search'
387
- line.puts ' end'
388
- line.puts ''
389
- line.puts ' private'
390
- line.puts ''
391
- line.puts ' def set_search'
392
- line.puts ' @search = Search.find_by(user_id: current_user.id)'
393
- line.puts ' end'
394
- line.puts ''
395
- line.puts ' def include_search_module'
396
- line.puts " $LOAD_PATH.unshift(File.dirname('../app/search'))"
397
- line.puts ' extend SearchModule'
398
- line.puts ' end'
399
- line.puts ''
400
- line.puts ' def search_params'
401
- line.puts ' params.require(:search).permit(:search, :user_id)'
402
- line.puts ' end'
403
- line.puts ''
404
- line.puts 'end'
405
- end
406
- Dir.chdir(root)
407
- end
408
-
409
- def write_migration
410
- require "fileutils"
411
- require 'colorize'
412
- root = Dir.pwd
413
- Dir.chdir(root + '/db/migrate')
414
- require 'date'
415
- @time = DateTime.now.strftime('%Y%m%d%H%M%S')
416
- if Dir[root + '/db/migrate/*_create_searches.rb'].count > 0
417
- file = Dir[root + '/db/migrate/*_create_searches.rb'].first
418
- puts 'Already Exists '.bold.green + file[38..100].bold
419
- else
420
- File.new @time + '_create_searches.rb', "w"
421
- puts "Created ".green.bold + '/db/migrate/'.bold + @time.bold + '_create_searches.rb'.bold
422
- File.open(@time + "_create_searches.rb", "a") do |line|
423
- line.puts 'class CreateSearches < ActiveRecord::Migration'
424
- line.puts ' def change'
425
- line.puts ' create_table :searches do |t|'
426
- line.puts ' t.string :search'
427
- line.puts ' t.integer :user_id'
428
- line.puts ' t.timestamps null: false'
429
- line.puts ' end'
430
- line.puts ' end'
431
- line.puts 'end'
432
- end
433
- end
434
- Dir.chdir(root)
435
- end
436
-
437
- def write_application_controller
438
- require "fileutils"
439
- root = Dir.pwd
440
- Dir.chdir(root + '/app/controllers')
441
- first_line = IO.readlines("application_controller.rb")[0]
442
- other_lines = IO.readlines("application_controller.rb")[1..1000000000]
443
- second_line = IO.readlines("application_controller.rb")[1]
444
-
445
- if second_line.chomp == ' before_action :check_for_search'
446
- puts 'Already Exists'.bold.green + ' /app/controllers/application_controller.rb'.bold
447
- else
448
- FileUtils::mkdir_p "migrate"
449
- puts "Updated ".green.bold + '/app/controllers/application_controller.rb'.bold
450
- File.open("application_controller.rb", "w") do |line|
451
- line.puts first_line
452
- line.puts ' before_action :check_for_search'
453
- line.puts ''
454
- line.puts ' def check_for_search'
455
- line.puts " $LOAD_PATH.unshift(File.dirname('../app/search'))"
456
- line.puts ' extend SearchModule'
457
- line.puts ' check_for_search'
458
- line.puts ' end'
459
- line.puts ''
460
- line.puts other_lines
461
- end
462
- end
463
- Dir.chdir(root)
464
- end
465
-
466
- def write_search_model
467
- require "fileutils"
468
- root = Dir.pwd
469
- Dir.chdir(root + '/app/models')
470
- File.open("search.rb", "w") do |line|
471
- line.puts 'class Search < ActiveRecord::Base'
472
- line.puts 'end'
473
- end
474
- Dir.chdir(root)
475
- end
476
-
477
- def update_routes
478
- require "fileutils"
479
- root = Dir.pwd
480
- Dir.chdir(root + '/config')
481
- first_line = IO.readlines("routes.rb")[0]
482
- other_lines = IO.readlines("routes.rb")[1..1000000000]
483
- second_line = IO.readlines("routes.rb")[1]
484
- if second_line.chomp == 'resources :searches do'
485
- puts 'Already Exists'.bold.green + ' /config/routes.rb'.bold
486
- else
487
- File.open('routes.rb', 'w') do |line|
488
- line.puts first_line
489
- line.puts 'resources :searches do'
490
- line.puts ' member do'
491
- line.puts " get 'clear'"
492
- line.puts ' end'
493
- line.puts 'end'
494
- line.puts other_lines
495
- end
496
- puts 'Updated '.bold.green + '/config/routes.rb'.bold
497
- end
498
- Dir.chdir(root)
499
- end
500
-
501
- def run
502
- require 'colorize'
503
- root = Dir.pwd
504
-
505
- puts "Syntax: 'install OBJECT ATTRIBUTE:TYPE'".bold.on_red
506
- command = gets.chomp
507
- command = command.split(" ")
508
- if command[0] == 'install'
509
- puts ''
510
- puts 'Creating Files...'.bold
511
- object = command[1]
512
- attributes = command[2..10000000]
513
- end
514
-
515
- SearchInstallDevise.new.create_files
516
- SearchInstallDevise.new.write_search_controller
517
- SearchInstallDevise.new.write_search_model
518
- SearchInstallDevise.new.write_search_module(object, attributes)
519
- SearchInstallDevise.new.write_application_controller
520
- SearchInstallDevise.new.write_migration
521
- SearchInstallDevise.new.update_routes
522
-
523
- puts 'Done'.bold
524
- puts ''
525
-
526
-
527
- end
528
-
529
- end
3
+ require "active_support/all"
4
+ require "active_record"
5
+ require "query-ruby"
6
+ require "zeitwerk"
7
+ require "chronic"
530
8
 
9
+ loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
10
+ loader.ignore("#{__dir__}/search_rails.rb")
11
+ loader.setup
531
12
 
13
+ class Object
14
+ alias is_an? is_a?
532
15
  end
data/package-lock.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "code-ruby",
3
+ "lockfileVersion": 3,
4
+ "requires": true,
5
+ "packages": {
6
+ "": {
7
+ "license": "MIT",
8
+ "engines": {
9
+ "node": "23.11.0",
10
+ "npm": "11.2.0"
11
+ }
12
+ }
13
+ }
14
+ }
data/package.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "license": "MIT",
3
+ "engines": {
4
+ "node": "23.11.0",
5
+ "npm": "11.2.0"
6
+ }
7
+ }
data/search_rails.gemspec CHANGED
@@ -1,29 +1,23 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'search_rails/version'
1
+ # frozen_string_literal: true
5
2
 
6
- Gem::Specification.new do |spec|
7
- spec.name = "search_rails"
8
- spec.version = SearchRails::VERSION
9
- spec.authors = ["micahnico22"]
10
- spec.email = ["micahnicodemus22@gmail.com"]
3
+ Gem::Specification.new do |s|
4
+ s.name = "search_rails"
5
+ s.version = File.read("VERSION").strip
6
+ s.summary = "a powerful search for rails"
7
+ s.description = s.summary
8
+ s.authors = ["Dorian Marié"]
9
+ s.email = "dorian@dorianmarie.com"
10
+ s.files = `git ls-files`.lines.map(&:strip)
11
+ s.require_paths = ["lib"]
12
+ s.homepage = "https://github.com/dorianmariecom/search_rails"
13
+ s.license = "MIT"
11
14
 
12
- spec.summary = "A Simple Search Gem"
13
- spec.description = "A Simple Search Gem For Searching In Rails Projects."
14
- spec.homepage = "https://github.com/micahnico/search_rails"
15
- spec.license = "MIT"
15
+ s.add_dependency "rails"
16
+ s.add_dependency "query-ruby"
17
+ s.add_dependency "zeitwerk"
18
+ s.add_dependency "chronic"
16
19
 
20
+ s.metadata["rubygems_mfa_required"] = "true"
17
21
 
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
20
- end
21
- spec.bindir = "bin"
22
- spec.executables = ["search:install", "search:install:devise"]
23
- spec.require_paths = ["lib"]
24
-
25
- spec.add_development_dependency "bundler", "~> 1.13"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "rspec", "~> 3.0"
28
- spec.add_development_dependency "colorize"
22
+ s.required_ruby_version = ">= 3.0"
29
23
  end