lib/packwerk/cli.rb in packwerk-1.4.0 vs lib/packwerk/cli.rb in packwerk-2.0.0

- old
+ new

@@ -51,12 +51,10 @@ generate_configs when "check" output_result(parse_run(args).check) when "detect-stale-violations" output_result(parse_run(args).detect_stale_violations) - when "update" - update(args) when "update-deprecations" output_result(parse_run(args).update_deprecations) when "validate" validate(args) when nil, "help" @@ -86,18 +84,17 @@ generate_configs end def generate_configs configuration_file = Packwerk::Generators::ConfigurationFile.generate( - load_paths: Packwerk::ApplicationLoadPaths.extract_relevant_paths(@configuration.root_path, @environment), root: @configuration.root_path, out: @out ) - inflections_file = Packwerk::Generators::InflectionsFile.generate(root: @configuration.root_path, out: @out) + root_package = Packwerk::Generators::RootPackage.generate(root: @configuration.root_path, out: @out) - success = configuration_file && inflections_file && root_package + success = configuration_file && root_package result = if success <<~EOS 🎉 Packwerk is ready to be used. You can start defining packages and run `bin/packwerk check`. @@ -113,15 +110,10 @@ @out.puts(result) success end - def update(paths) - warn("`packwerk update` is deprecated in favor of `packwerk update-deprecations`.") - output_result(parse_run(paths).update_deprecations) - end - def output_result(result) @out.puts @out.puts(result.message) result.status end @@ -137,20 +129,23 @@ files end def validate(_paths) @progress_formatter.started_validation do - checker = Packwerk::ApplicationValidator.new( - config_file_path: @configuration.config_path, - configuration: @configuration, - environment: @environment, - ) result = checker.check_all list_validation_errors(result) return result.ok? end + end + + def checker + Packwerk::ApplicationValidator.new( + config_file_path: @configuration.config_path, + configuration: @configuration, + environment: @environment, + ) end def list_validation_errors(result) @out.puts if result.ok?