glib-web 7.0.0.beta1 → 7.0.1.beta1
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/app/controllers/concerns/glib/auth/policy.rb +5 -1
- data/app/controllers/concerns/glib/auth/token_authenticatable.rb +37 -0
- data/app/controllers/glib/api_controller.rb +52 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +133 -4
- data/app/jobs/glib/purge_unattached_job.rb +32 -0
- data/app/models/concerns/glib/snapshot_v2.rb +485 -0
- data/app/models/glib/model.rb +40 -0
- data/app/models/glib/plain_model.rb +23 -0
- data/app/models/snapshot_blob_reference.rb +20 -0
- data/app/views/json_ui/garage/test_page/_header.json.jbuilder +1 -0
- data/app/views/json_ui/garage/test_page/dialog.json.jbuilder +21 -0
- data/app/views/json_ui/garage/test_page/fields_change_trigger.json.jbuilder +128 -0
- data/app/views/json_ui/garage/test_page/fields_sign.json.jbuilder +49 -1
- data/lib/generators/glib/snapshot_v2_generator.rb +54 -0
- data/lib/generators/templates/snapshot_v2/add_snapshot_v2_columns.rb +18 -0
- data/lib/generators/templates/snapshot_v2/create_snapshot_blob_references.rb +10 -0
- data/lib/glib/engine.rb +32 -0
- data/lib/glib/purge_unattached/config.rb +38 -0
- data/lib/glib/test/full_suite_rubocop.rb +87 -0
- data/lib/glib/test/rubocop_guards.rb +42 -0
- data/lib/glib/test_helpers.rb +9 -6
- data/lib/glib-web.rb +4 -2
- metadata +29 -2
- data/lib/glib/test/changed_files_rubocop.rb +0 -55
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'English'
|
|
4
|
-
require 'shellwords'
|
|
5
|
-
|
|
6
|
-
module Glib
|
|
7
|
-
module Test
|
|
8
|
-
# Fast RuboCop guard for the subset-run workflow.
|
|
9
|
-
#
|
|
10
|
-
# Lives in glib-web's test helper so any project that includes
|
|
11
|
-
# `Glib::TestHelpers` into `ActiveSupport::TestCase` picks it up. Minitest
|
|
12
|
-
# runs all loaded test classes on every invocation, so this fires on every
|
|
13
|
-
# `rails test` — but it lints ONLY the files you have changed in the
|
|
14
|
-
# working tree (unstaged + staged + untracked). That keeps it fast and
|
|
15
|
-
# fails the run the moment an edited file has an offense.
|
|
16
|
-
#
|
|
17
|
-
# Skip with `SKIP_CHANGED_RUBOCOP=1` during tight debug loops. Auto-skips
|
|
18
|
-
# on CI because gem caches put thousands of vendored `.rb` files into the
|
|
19
|
-
# working tree (the "working-tree diff == your edits" premise breaks).
|
|
20
|
-
class ChangedFilesRubocop < ::ActiveSupport::TestCase
|
|
21
|
-
# Extensions RuboCop targets by default (see its AllCops/Include). We
|
|
22
|
-
# rely on `--force-exclusion` to honour the project's AllCops/Exclude.
|
|
23
|
-
RUBOCOP_EXTENSIONS = %w[.rb .rake .jbuilder .gemspec].freeze
|
|
24
|
-
|
|
25
|
-
def test_changed_files_are_rubocop_clean
|
|
26
|
-
skip 'opted out via SKIP_CHANGED_RUBOCOP' if ENV['SKIP_CHANGED_RUBOCOP'] == '1'
|
|
27
|
-
skip 'CI lints every file separately; this guard is for local working-tree edits' if ENV['CI']
|
|
28
|
-
|
|
29
|
-
files = changed_ruby_files
|
|
30
|
-
# IMPORTANT: never call rubocop with zero paths — it would lint the whole repo.
|
|
31
|
-
skip 'no changed Ruby files in the working tree' if files.empty?
|
|
32
|
-
|
|
33
|
-
output = `bundle exec rubocop --force-exclusion --format simple #{files.shelljoin} 2>&1`
|
|
34
|
-
|
|
35
|
-
assert(
|
|
36
|
-
$CHILD_STATUS.success?,
|
|
37
|
-
'RuboCop offenses in files you changed (fix them with `rubocop -a`):' \
|
|
38
|
-
"\n\n#{output}"
|
|
39
|
-
)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
private
|
|
43
|
-
def changed_ruby_files
|
|
44
|
-
# `git status --porcelain` covers unstaged, staged, and untracked in
|
|
45
|
-
# one spawn. Each line is `XY PATH` (or `XY ORIG -> PATH` for
|
|
46
|
-
# renames); PATH starts at index 3. Deleted files are dropped by the
|
|
47
|
-
# File.file? check below (no on-disk entry to lint).
|
|
48
|
-
`git status --porcelain`
|
|
49
|
-
.split("\n")
|
|
50
|
-
.filter_map { |line| line[3..]&.split(' -> ')&.last }
|
|
51
|
-
.select { |path| RUBOCOP_EXTENSIONS.include?(File.extname(path)) && File.file?(path) }
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|