kolla 0.0.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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/bin/kolla +4 -0
  3. data/lib/kolla/parser.rb +21 -0
  4. data/lib/kolla.rb +20 -0
  5. metadata +42 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 132a825d42a4bea791e2e5e689d6d06ae3defd3d452ecf41220d9079e63ec475
4
+ data.tar.gz: 8db516431150f3b81246d8042f4a8d7fe3a7cf0ede830d2374589a48ba1224af
5
+ SHA512:
6
+ metadata.gz: 431e7bbeb1c5fcb61a13c3ef9007c19b7dafaede6228c5391ba102146f58adc00c867a7c26897887daee25cfe85e3568c2f8509f479ca9b936f0c360b5d9b189
7
+ data.tar.gz: d6159da48b3f8e3e2ae794666313ac3a0e20d2e1609b70591fee854cca244bd858e095343f18435a6fbffb2677abffa5788e510978cdfabe71ea1df382b1d90c
data/bin/kolla ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'kolla'
4
+ ARGV[0].nil? ? Kolla.run : Kolla.run(ARGV[0])
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kolla
4
+ class Parser
5
+ def initialize(file_path)
6
+ @file_path = file_path
7
+ end
8
+
9
+ def process
10
+ content = File.read(file_path)
11
+ matches = content.scan(/create_table\s+"(\w+)"/)
12
+ matches.map(&:first).reject { |table| table.start_with?('action_', 'active_') }
13
+ rescue Errno::ENOENT
14
+ raise "Schema file_path not found at #{file_path}"
15
+ end
16
+
17
+ private
18
+
19
+ attr_reader :file_path
20
+ end
21
+ end
data/lib/kolla.rb ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Kolla parses a file and reports matching results.
4
+ module Kolla
5
+ DEFAULT_FILE = 'db/schema.rb'
6
+
7
+ def self.run(file_path = DEFAULT_FILE)
8
+ absolute_path = File.expand_path(file_path)
9
+
10
+ unless File.exist?(absolute_path)
11
+ puts "File #{file_path} not found"
12
+ return
13
+ end
14
+
15
+ parser = Parser.new(absolute_path)
16
+ puts parser.process
17
+ end
18
+ end
19
+
20
+ require 'kolla/parser'
metadata ADDED
@@ -0,0 +1,42 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kolla
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Antony Sastre
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-02-03 00:00:00.000000000 Z
11
+ dependencies: []
12
+ email: antony.sastre@gmail.com
13
+ executables:
14
+ - kolla
15
+ extensions: []
16
+ extra_rdoc_files: []
17
+ files:
18
+ - bin/kolla
19
+ - lib/kolla.rb
20
+ - lib/kolla/parser.rb
21
+ homepage: https://rubygems.org/gems/kolla
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.6.3
40
+ specification_version: 4
41
+ summary: Simple CLI utility tool to parse domain specific files and return reports.
42
+ test_files: []