Module: Packs
- Extended by:
- T::Sig
- Defined in:
- lib/packs/user_event_logger.rb,
lib/packs.rb,
lib/packs/cli.rb,
lib/packs/logging.rb,
lib/packs/private.rb,
lib/packs/configuration.rb,
lib/packs/rubocop_post_processor.rb,
lib/packs/private/interactive_cli.rb,
lib/packs/default_user_event_logger.rb,
lib/packs/private/file_move_operation.rb,
lib/packs/per_file_processor_interface.rb,
lib/packs/code_ownership_post_processor.rb,
lib/packs/update_references_post_processor.rb,
lib/packs/private/pack_relationship_analyzer.rb,
lib/packs/private/interactive_cli/file_selector.rb,
lib/packs/private/interactive_cli/pack_selector.rb,
lib/packs/private/interactive_cli/team_selector.rb,
lib/packs/private/interactive_cli/use_cases/move.rb,
lib/packs/private/interactive_cli/use_cases/check.rb,
lib/packs/private/interactive_cli/use_cases/query.rb,
lib/packs/private/interactive_cli/use_cases/create.rb,
lib/packs/private/interactive_cli/use_cases/rename.rb,
lib/packs/private/interactive_cli/use_cases/update.rb,
lib/packs/private/interactive_cli/use_cases/get_info.rb,
lib/packs/private/interactive_cli/use_cases/validate.rb,
lib/packs/private/interactive_cli/use_cases/interface.rb,
lib/packs/private/interactive_cli/use_cases/move_pack.rb,
lib/packs/private/interactive_cli/use_cases/make_public.rb,
lib/packs/private/interactive_cli/pack_directory_selector.rb,
lib/packs/private/interactive_cli/use_cases/add_dependency.rb,
lib/packs/private/packwerk_wrapper/offenses_aggregator_formatter.rb,
lib/packs/private/interactive_cli/use_cases/lint_package_yml_files.rb,
lib/packs/private/interactive_cli/use_cases/lint_package_todo_yml_files.rb
Overview
Defined Under Namespace
Modules: Logging, PerFileProcessorInterface, UserEventLogger
Classes: CLI, CodeOwnershipPostProcessor, Configuration, DefaultUserEventLogger, RubocopPostProcessor, UpdateReferencesPostProcessor
Class Method Summary
collapse
-
.add_dependency!(pack_name:, dependency_name:) ⇒ Object
-
.bust_cache! ⇒ Object
-
.check(files) ⇒ Object
-
.config ⇒ Object
-
.configure {|config| ... } ⇒ Object
-
.create_pack!(pack_name:, enforce_privacy: true, enforce_layers: true, enforce_dependencies: nil, team: nil) ⇒ Object
-
.lint_package_todo_yml_files! ⇒ Object
-
.lint_package_yml_files!(packs) ⇒ Object
-
.list_top_violations(type:, pack_name:, limit:) ⇒ Object
-
.make_public!(paths_relative_to_root: [], per_file_processors: [Packs::RubocopPostProcessor.new, Packs::CodeOwnershipPostProcessor.new]) ⇒ Object
-
.move_to_folder!(pack_name:, destination:, per_file_processors: [Packs::RubocopPostProcessor.new, Packs::CodeOwnershipPostProcessor.new]) ⇒ Object
-
.move_to_pack!(pack_name:, paths_relative_to_root: [], per_file_processors: [Packs::RubocopPostProcessor.new, Packs::CodeOwnershipPostProcessor.new]) ⇒ Object
-
.move_to_parent!(pack_name:, parent_name:, per_file_processors: [Packs::RubocopPostProcessor.new, Packs::CodeOwnershipPostProcessor.new]) ⇒ Object
-
.replace_in_file(file:, find:, replace_with:) ⇒ Object
-
.start_interactive_mode! ⇒ Object
-
.update ⇒ Object
-
.validate ⇒ Object
Class Method Details
.add_dependency!(pack_name:, dependency_name:) ⇒ Object
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# File 'lib/packs.rb', line 146
def self.add_dependency!(
pack_name:,
dependency_name:
)
Logging.section('Adding a dependency') do
intro = Packs.config.user_event_logger.before_add_dependency(pack_name)
Logging.print_bold_green(intro)
end
Private.add_dependency!(
pack_name: pack_name,
dependency_name: dependency_name
)
Logging.section('Next steps') do
next_steps = Packs.config.user_event_logger.after_add_dependency(pack_name)
Logging.print_bold_green(next_steps)
end
end
|
.bust_cache! ⇒ Object
261
262
263
264
|
# File 'lib/packs.rb', line 261
def self.bust_cache!
Private.bust_cache!
Specification.bust_cache!
end
|
.check(files) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/packs.rb', line 52
def self.check(files)
if Packs.config.use_pks
Private.system_with("bin/pks check #{files.join(' ')}")
else
Private.system_with("bin/packwerk check #{files.join(' ')}")
end
end
|
.config ⇒ Object
54
55
56
57
58
|
# File 'lib/packs/configuration.rb', line 54
def config
Private.load_client_configuration
@config = T.let(@config, T.nilable(Configuration))
@config ||= Configuration.new
end
|
61
62
63
|
# File 'lib/packs/configuration.rb', line 61
def configure(&blk)
yield(config)
end
|
.create_pack!(pack_name:, enforce_privacy: true, enforce_layers: true, enforce_dependencies: nil, team: nil) ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/packs.rb', line 69
def self.create_pack!(
pack_name:,
enforce_privacy: true,
enforce_layers: true,
enforce_dependencies: nil,
team: nil
)
Private.create_pack!(
pack_name: pack_name,
enforce_privacy: enforce_privacy,
enforce_dependencies: enforce_dependencies,
enforce_layers: enforce_layers,
team: team
)
end
|
.lint_package_todo_yml_files! ⇒ Object
267
268
269
|
# File 'lib/packs.rb', line 267
def self.lint_package_todo_yml_files!
Private.lint_package_todo_yml_files!
end
|
.lint_package_yml_files!(packs) ⇒ Object
272
273
274
|
# File 'lib/packs.rb', line 272
def self.lint_package_yml_files!(packs)
Private.lint_package_yml_files!(packs)
end
|
.list_top_violations(type:, pack_name:, limit:) ⇒ Object
233
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/packs.rb', line 233
def self.list_top_violations(
type:,
pack_name:,
limit:
)
Private::PackRelationshipAnalyzer.list_top_violations(
type,
pack_name,
limit
)
end
|
.make_public!(paths_relative_to_root: [], per_file_processors: [Packs::RubocopPostProcessor.new, Packs::CodeOwnershipPostProcessor.new]) ⇒ Object
.move_to_folder!(pack_name:, destination:, per_file_processors: [Packs::RubocopPostProcessor.new, Packs::CodeOwnershipPostProcessor.new]) ⇒ Object
.move_to_pack!(pack_name:, paths_relative_to_root: [], per_file_processors: [Packs::RubocopPostProcessor.new, Packs::CodeOwnershipPostProcessor.new]) ⇒ Object
.move_to_parent!(pack_name:, parent_name:, per_file_processors: [Packs::RubocopPostProcessor.new, Packs::CodeOwnershipPostProcessor.new]) ⇒ Object
.replace_in_file(file:, find:, replace_with:) ⇒ Object
252
253
254
255
256
257
258
|
# File 'lib/packs.rb', line 252
def self.replace_in_file(file:, find:, replace_with:)
Private.replace_in_file(
file: file,
find: find,
replace_with: replace_with
)
end
|
.start_interactive_mode! ⇒ Object
29
30
31
|
# File 'lib/packs.rb', line 29
def self.start_interactive_mode!
Private::InteractiveCli.start!
end
|
.update ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/packs.rb', line 34
def self.update
if Packs.config.use_pks
Private.system_with('bin/pks update')
else
Private.system_with('bin/packwerk update-todo')
end
end
|
.validate ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/packs.rb', line 43
def self.validate
if Packs.config.use_pks
Private.system_with('bin/pks validate')
else
Private.system_with('bin/packwerk validate')
end
end
|