mensa 0.7.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 064c836f400dd147fc8fde3fb1f38a49f7bd447c44e6d7493c055cd6dede6b19
4
- data.tar.gz: b6fdbbdce0951fb43fdfd8f574cf6888ebe1c9f4e369752f4a497de85ca8b8f4
3
+ metadata.gz: c9016fbd279d8168641f18891986045e07f26b124842610e22728268d3f7557e
4
+ data.tar.gz: 9ca2ab7decb8b7a5d901821a3d129c94ae3a43f20bd981c1d7cb1d0ab68cb402
5
5
  SHA512:
6
- metadata.gz: f96aca8ee7039304c3292456e0be10722faba2eecac2ba41030f632317998bbf0d1e4d3f649f5a46d675a4d06268dae07d216e536b80294c4990c805160df0b3
7
- data.tar.gz: f629a69b4a6177d8aedc58f931fa00d328af953dca50cfd80c282989c40fd2434e2e655b5c1f55611568f893d016b5467b16c2925e8fff293b977be9f53d36fc
6
+ metadata.gz: dbcd2b404c1da8e152ac4ad555a3a95093a0a33bafb3f809f9f099c2b21b21028667b2dae708ffae57dcd9d0e9db2fd539de2baea1110e0628d536b01d9aab49
7
+ data.tar.gz: 49e1a2b30f5efd72d913d22981aad389116d3935dedd4245ffebbc87637222a1f3bca58850bbbd094461b59b29bce9400e9a94867608195d96fc2ecf4773313b
data/.shipkit.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- previous_version: 0.6.19
2
+ previous_version: 0.7.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ - The verifier's report only lists failures and warnings. `-v`/`--verbose` (or
6
+ `VERBOSE=1`) on the rake tasks, or `result.to_s(verbose: true)`, lists every
7
+ check.
8
+
3
9
  ## 0.7.0
4
10
 
5
11
  - Filters only offer the operators that work for the column's type in SQL,
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mensa (0.6.19)
4
+ mensa (0.7.0)
5
5
  csv
6
6
  importmap-rails
7
7
  pagy (>= 43)
data/README.md CHANGED
@@ -4,7 +4,8 @@ Fast and awesome tables, with pagination, sorting, filtering, batch processing,
4
4
  Due to search, it only works with postgresql at the moment.
5
5
 
6
6
  ![table](./docs/table.png)
7
- ![filters](./docs/filters.png)
7
+ ![filters](./docs/filters1.png)
8
+ ![filters value](./docs/filters2.png)
8
9
  ![columns](./docs/columns.png)
9
10
  ![export](./docs/export.png)
10
11
 
@@ -448,9 +449,16 @@ bin/rails "mensa:verify[inventories]" # or InventoriesTable
448
449
  bin/rails mensa:verify_all # every table in app/tables
449
450
  ```
450
451
 
451
- The tasks print a report (✓ passed, ✗ failed with the error and SQL, - skipped) and
452
- exit non-zero when a check failed. Classes and modules that don't descend from
453
- `Mensa::Base` (e.g. helpers in `app/tables`) are reported as skipped.
452
+ The tasks print a report of the failures (✗, with the error and SQL) and warnings (!)
453
+ and exit non-zero when a check failed. Add `-v`/`--verbose` (or `VERBOSE=1`) to list
454
+ every check (✓ passed, - skipped):
455
+
456
+ ```sh
457
+ bin/rails "mensa:verify[inventories]" -v
458
+ ```
459
+
460
+ Classes and modules that don't descend from `Mensa::Base` (e.g. helpers in
461
+ `app/tables`) are reported as skipped.
454
462
 
455
463
  #### From tests
456
464
 
@@ -504,11 +512,7 @@ end
504
512
 
505
513
  ## Contributing
506
514
 
507
- ```
508
515
  Contribution directions go here.
509
516
 
510
-
511
-
512
517
  ## License
513
518
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
514
- ```
data/docs/columns.png CHANGED
Binary file
data/docs/export.png CHANGED
Binary file
data/docs/filters1.png ADDED
Binary file
data/docs/filters2.png ADDED
Binary file
data/docs/table.png CHANGED
Binary file
@@ -92,12 +92,14 @@ module Mensa
92
92
  [table_class.name || table_class.to_s, ("(#{label})" if label)].compact.join(" ")
93
93
  end
94
94
 
95
- def to_s
95
+ # Lists the failures and warnings, +verbose+ lists every check
96
+ def to_s(verbose: false)
96
97
  return "#{title}\n - skipped: #{checks.first&.message}" unless mensa_table?
97
98
 
98
99
  lines = [title]
100
+ shown = verbose ? checks : checks.select { |check| check.failed? || check.warning? }
99
101
 
100
- checks.group_by(&:section).each do |section, section_checks|
102
+ shown.group_by(&:section).each do |section, section_checks|
101
103
  lines << " #{SECTIONS.fetch(section, section.to_s.humanize)}"
102
104
  section_checks.each do |check|
103
105
  lines << " #{SYMBOLS[check.status]} #{check.label}#{" (skipped: #{check.message})" if check.skipped?}"
@@ -94,12 +94,15 @@ module Mensa
94
94
  # their reports to +io+ and returns true when all of them passed.
95
95
  # Context comes from USER_ID, ACCOUNT_ID and PARAMS (JSON) in +env+, and
96
96
  # STRICT=1 makes warnings fail, used by the mensa:verify rake tasks.
97
- def run(tables = nil, env: ENV, io: $stdout)
97
+ # The reports list failures and warnings, +verbose+ (or VERBOSE=1) lists
98
+ # every check.
99
+ def run(tables = nil, env: ENV, io: $stdout, verbose: false)
98
100
  classes = tables.present? ? Array(tables).map { |table| resolve_table_class(table) } : table_classes
99
101
  options = options_from_env(env)
102
+ verbose ||= %w[1 true yes].include?(env["VERBOSE"].to_s.downcase)
100
103
 
101
104
  results = classes.flat_map do |klass|
102
- verify(klass, **options).each { |result| io.puts(result, "") }
105
+ verify(klass, **options).each { |result| io.puts(result.to_s(verbose: verbose), "") }
103
106
  end
104
107
 
105
108
  by_table = results.select(&:mensa_table?).group_by(&:table_class)
data/lib/mensa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mensa
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
data/lib/tasks/mensa.rake CHANGED
@@ -1,13 +1,16 @@
1
1
  namespace :mensa do
2
- desc "Verify a Mensa table against the database, e.g. mensa:verify[users] (context: USER_ID=, ACCOUNT_ID=, PARAMS='{...}', STRICT=1 fails on warnings)"
2
+ # -v/--verbose sets Rake.verbose to true, it's a default object otherwise
3
+ verbose = -> { Rake.verbose == true }
4
+
5
+ desc "Verify a Mensa table against the database, e.g. mensa:verify[users] (context: USER_ID=, ACCOUNT_ID=, PARAMS='{...}', STRICT=1 fails on warnings, -v or VERBOSE=1 lists every check)"
3
6
  task :verify, [:table] => :environment do |_task, args|
4
7
  abort "Usage: bin/rails \"mensa:verify[table_name]\"" if args[:table].blank?
5
8
 
6
- exit(1) unless Mensa::Verifier.run(args[:table])
9
+ exit(1) unless Mensa::Verifier.run(args[:table], verbose: verbose.call)
7
10
  end
8
11
 
9
- desc "Verify all Mensa tables in app/tables against the database (context: USER_ID=, ACCOUNT_ID=, PARAMS='{...}', STRICT=1 fails on warnings)"
12
+ desc "Verify all Mensa tables in app/tables against the database (context: USER_ID=, ACCOUNT_ID=, PARAMS='{...}', STRICT=1 fails on warnings, -v or VERBOSE=1 lists every check)"
10
13
  task verify_all: :environment do
11
- exit(1) unless Mensa::Verifier.run
14
+ exit(1) unless Mensa::Verifier.run(verbose: verbose.call)
12
15
  end
13
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mensa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt
@@ -314,6 +314,8 @@ files:
314
314
  - docs/columns.png
315
315
  - docs/export.png
316
316
  - docs/filters.png
317
+ - docs/filters1.png
318
+ - docs/filters2.png
317
319
  - docs/table.png
318
320
  - lib/generators/mensa/install_generator.rb
319
321
  - lib/generators/mensa/table_generator.rb