mensa 0.7.0 → 0.7.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/.shipkit.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +12 -8
- data/docs/columns.png +0 -0
- data/docs/export.png +0 -0
- data/docs/filters1.png +0 -0
- data/docs/filters2.png +0 -0
- data/docs/table.png +0 -0
- data/lib/mensa/verifier/result.rb +4 -2
- data/lib/mensa/verifier.rb +9 -4
- data/lib/mensa/version.rb +1 -1
- data/lib/tasks/mensa.rake +7 -4
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ca5c6f3fab08895527058f4cbb70a55608297da85a234c2476d120be6de13882
|
|
4
|
+
data.tar.gz: f09da64e3c8dfaaf1917e1097845171aa29fab13c18285d3802278d5a7d8bfc9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f9ff2a45fd5d5784a31ee7e96d45b683bc16aecb53947eb6a942f5764d175fcbbc16303103ad3c46f71a571da8c5a8b5e8af9fa82000fdd8bbd025694108263
|
|
7
|
+
data.tar.gz: 9948a29ea8daee96c71466b33d3e63e4a7dd20496247edf36740c779cf2b2743fbfdedf92f03a391abe5d43544aa32f25825b340b6fb8a8f471bb66432107dda
|
data/.shipkit.yml
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
---
|
|
2
|
-
previous_version: 0.
|
|
2
|
+
previous_version: 0.7.1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
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, and the classes in `app/tables` that were skipped as they aren't Mensa
|
|
8
|
+
tables.
|
|
9
|
+
|
|
3
10
|
## 0.7.0
|
|
4
11
|
|
|
5
12
|
- Filters only offer the operators that work for the column's type in SQL,
|
data/Gemfile.lock
CHANGED
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
|

|
|
7
|
-

|
|
8
|
+

|
|
8
9
|

|
|
9
10
|

|
|
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
|
|
452
|
-
exit non-zero when a check failed.
|
|
453
|
-
|
|
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 skipped, and only reported as such with `-v`.
|
|
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
|
-
|
|
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
|
-
|
|
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?}"
|
data/lib/mensa/verifier.rb
CHANGED
|
@@ -94,19 +94,24 @@ 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
|
-
|
|
97
|
+
# The reports list failures and warnings, +verbose+ (or VERBOSE=1) lists
|
|
98
|
+
# every check and the classes skipped as they aren't Mensa tables.
|
|
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
|
|
105
|
+
verify(klass, **options).each do |result|
|
|
106
|
+
io.puts(result.to_s(verbose: verbose), "") if verbose || result.mensa_table?
|
|
107
|
+
end
|
|
103
108
|
end
|
|
104
109
|
|
|
105
110
|
by_table = results.select(&:mensa_table?).group_by(&:table_class)
|
|
106
111
|
others = results.reject(&:mensa_table?)
|
|
107
|
-
if results.size > 1
|
|
112
|
+
if by_table.size > 1 || (verbose && results.size > 1)
|
|
108
113
|
passed = by_table.count { |_table, table_results| table_results.all?(&:success?) }
|
|
109
|
-
io.puts ["#{passed}/#{by_table.size} tables passed", ("#{others.size} skipped, not a Mensa::Base subclass" if others.any?)].compact.join(", ")
|
|
114
|
+
io.puts ["#{passed}/#{by_table.size} tables passed", ("#{others.size} skipped, not a Mensa::Base subclass" if verbose && others.any?)].compact.join(", ")
|
|
110
115
|
end
|
|
111
116
|
results.all?(&:success?)
|
|
112
117
|
end
|
data/lib/mensa/version.rb
CHANGED
data/lib/tasks/mensa.rake
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
namespace :mensa do
|
|
2
|
-
|
|
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.
|
|
4
|
+
version: 0.7.2
|
|
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
|