Module: UsePacks
- Extended by:
- T::Sig
- Defined in:
- lib/use_packs/user_event_logger.rb,
lib/use_packs.rb,
lib/use_packs/cli.rb,
lib/use_packs/logging.rb,
lib/use_packs/private.rb,
lib/use_packs/configuration.rb,
lib/use_packs/rubocop_post_processor.rb,
lib/use_packs/private/interactive_cli.rb,
lib/use_packs/private/packwerk_wrapper.rb,
lib/use_packs/default_user_event_logger.rb,
lib/use_packs/private/file_move_operation.rb,
lib/use_packs/per_file_processor_interface.rb,
lib/use_packs/code_ownership_post_processor.rb,
lib/use_packs/private/pack_relationship_analyzer.rb,
lib/use_packs/private/interactive_cli/file_selector.rb,
lib/use_packs/private/interactive_cli/pack_selector.rb,
lib/use_packs/private/interactive_cli/team_selector.rb,
lib/use_packs/private/interactive_cli/use_cases/move.rb,
lib/use_packs/private/interactive_cli/use_cases/check.rb,
lib/use_packs/private/interactive_cli/use_cases/query.rb,
lib/use_packs/private/interactive_cli/use_cases/create.rb,
lib/use_packs/private/interactive_cli/use_cases/rename.rb,
lib/use_packs/private/interactive_cli/use_cases/update.rb,
lib/use_packs/private/interactive_cli/use_cases/get_info.rb,
lib/use_packs/private/interactive_cli/use_cases/validate.rb,
lib/use_packs/private/interactive_cli/use_cases/interface.rb,
lib/use_packs/private/interactive_cli/use_cases/visualize.rb,
lib/use_packs/private/interactive_cli/use_cases/make_public.rb,
lib/use_packs/private/interactive_cli/use_cases/add_dependency.rb,
lib/use_packs/private/interactive_cli/use_cases/move_to_parent.rb,
lib/use_packs/private/packwerk_wrapper/offenses_aggregator_formatter.rb,
lib/use_packs/private/interactive_cli/use_cases/lint_package_yml_files.rb,
lib/use_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
Constant Summary
collapse
- PERMITTED_PACK_LOCATIONS =
T.let(%w[
gems
components
packs
], T::Array[String])
Class Method Summary
collapse
-
.add_dependency!(pack_name:, dependency_name:) ⇒ Object
-
.bust_cache! ⇒ Object
-
.config ⇒ Object
-
.configure {|config| ... } ⇒ Object
-
.create_pack!(pack_name:, enforce_privacy: true, enforce_dependencies: nil, team: nil) ⇒ Object
-
.execute(argv, formatter = nil) ⇒ Object
-
.get_offenses_for_files(files) ⇒ Object
-
.get_offenses_for_files_by_package(files) ⇒ Object
-
.lint_package_todo_yml_files! ⇒ Object
-
.lint_package_yml_files!(packs) ⇒ Object
-
.list_top_dependency_violations(pack_name:, limit:) ⇒ Object
-
.list_top_privacy_violations(pack_name:, limit:) ⇒ Object
-
.make_public!(paths_relative_to_root: [], per_file_processors: []) ⇒ Object
-
.move_to_pack!(pack_name:, paths_relative_to_root: [], per_file_processors: []) ⇒ Object
-
.move_to_parent!(pack_name:, parent_name:, per_file_processors: []) ⇒ Object
-
.replace_in_file(file:, find:, replace_with:) ⇒ Object
-
.start_interactive_mode! ⇒ Object
Class Method Details
.add_dependency!(pack_name:, dependency_name:) ⇒ Object
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/use_packs.rb', line 121
def self.add_dependency!(
pack_name:,
dependency_name:
)
Logging.section('Adding a dependency') do
intro = UsePacks.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 = UsePacks.config.user_event_logger.after_add_dependency(pack_name)
Logging.print_bold_green(next_steps)
end
end
|
.bust_cache! ⇒ Object
219
220
221
|
# File 'lib/use_packs.rb', line 219
def self.bust_cache!
Private.bust_cache!
end
|
.config ⇒ Object
50
51
52
53
54
|
# File 'lib/use_packs/configuration.rb', line 50
def config
Private.load_client_configuration
@config = T.let(@config, T.nilable(Configuration))
@config ||= Configuration.new
end
|
57
58
59
|
# File 'lib/use_packs/configuration.rb', line 57
def configure(&blk)
yield(config)
end
|
.create_pack!(pack_name:, enforce_privacy: true, enforce_dependencies: nil, team: nil) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/use_packs.rb', line 46
def self.create_pack!(
pack_name:,
enforce_privacy: true,
enforce_dependencies: nil,
team: nil
)
Private.create_pack!(
pack_name: pack_name,
enforce_privacy: enforce_privacy,
enforce_dependencies: enforce_dependencies,
team: team
)
end
|
.execute(argv, formatter = nil) ⇒ Object
.get_offenses_for_files(files) ⇒ Object
.get_offenses_for_files_by_package(files) ⇒ Object
.lint_package_todo_yml_files! ⇒ Object
250
251
252
|
# File 'lib/use_packs.rb', line 250
def self.lint_package_todo_yml_files!
Private.lint_package_todo_yml_files!
end
|
.lint_package_yml_files!(packs) ⇒ Object
255
256
257
|
# File 'lib/use_packs.rb', line 255
def self.lint_package_yml_files!(packs)
Private.lint_package_yml_files!(packs)
end
|
.list_top_dependency_violations(pack_name:, limit:) ⇒ Object
.list_top_privacy_violations(pack_name:, limit:) ⇒ Object
.make_public!(paths_relative_to_root: [], per_file_processors: []) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/use_packs.rb', line 95
def self.make_public!(
paths_relative_to_root: [],
per_file_processors: []
)
Logging.section('Making files public') do
intro = UsePacks.config.user_event_logger.before_make_public
Logging.print_bold_green(intro)
end
Private.make_public!(
paths_relative_to_root: paths_relative_to_root,
per_file_processors: per_file_processors
)
Logging.section('Next steps') do
next_steps = UsePacks.config.user_event_logger.after_make_public
Logging.print_bold_green(next_steps)
end
end
|
.move_to_pack!(pack_name:, paths_relative_to_root: [], per_file_processors: []) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/use_packs.rb', line 67
def self.move_to_pack!(
pack_name:,
paths_relative_to_root: [],
per_file_processors: []
)
Logging.section('👋 Hi!') do
intro = UsePacks.config.user_event_logger.before_move_to_pack(pack_name)
Logging.print_bold_green(intro)
end
Private.move_to_pack!(
pack_name: pack_name,
paths_relative_to_root: paths_relative_to_root,
per_file_processors: per_file_processors
)
Logging.section('Next steps') do
next_steps = UsePacks.config.user_event_logger.after_move_to_pack(pack_name)
Logging.print_bold_green(next_steps)
end
end
|
.move_to_parent!(pack_name:, parent_name:, per_file_processors: []) ⇒ Object
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# File 'lib/use_packs.rb', line 148
def self.move_to_parent!(
pack_name:,
parent_name:,
per_file_processors: []
)
Logging.section('👋 Hi!') do
intro = UsePacks.config.user_event_logger.before_move_to_parent(pack_name)
Logging.print_bold_green(intro)
end
Private.move_to_parent!(
pack_name: pack_name,
parent_name: parent_name,
per_file_processors: per_file_processors
)
Logging.section('Next steps') do
next_steps = UsePacks.config.user_event_logger.after_move_to_parent(pack_name)
Logging.print_bold_green(next_steps)
end
end
|
.replace_in_file(file:, find:, replace_with:) ⇒ Object
210
211
212
213
214
215
216
|
# File 'lib/use_packs.rb', line 210
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
34
35
36
|
# File 'lib/use_packs.rb', line 34
def self.start_interactive_mode!
Private::InteractiveCli.start!
end
|