Skip to content

Commit

Permalink
add use_pks (#159)
Browse files Browse the repository at this point in the history
* add use_pks and use it in update

* check and validate

* bump version

* remove white space
  • Loading branch information
tstannard authored Jun 12, 2024
1 parent 913b4bb commit 8f8ded1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GIT
PATH
remote: .
specs:
packs (0.0.43)
packs (0.0.44)
bigdecimal
code_ownership (>= 1.33.0)
packs-specification
Expand Down
18 changes: 15 additions & 3 deletions lib/packs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,29 @@ def self.start_interactive_mode!

sig { returns(T::Boolean) }
def self.update
Private.system_with('bin/packwerk update-todo')
if Packs.config.use_pks
Private.system_with('bin/pks update')
else
Private.system_with('bin/packwerk update-todo')
end
end

sig { returns(T::Boolean) }
def self.validate
Private.system_with('bin/packwerk validate')
if Packs.config.use_pks
Private.system_with('bin/pks validate')
else
Private.system_with('bin/packwerk validate')
end
end

sig { params(files: T::Array[String]).returns(T::Boolean) }
def self.check(files)
Private.system_with("bin/packwerk check #{files.join(' ')}")
if Packs.config.use_pks
Private.system_with("bin/pks check #{files.join(' ')}")
else
Private.system_with("bin/packwerk check #{files.join(' ')}")
end
end

sig do
Expand Down
4 changes: 4 additions & 0 deletions lib/packs/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class Configuration
sig { returns(UserEventLogger) }
attr_accessor :user_event_logger

sig { returns(T::Boolean) }
attr_accessor :use_pks

OnPackageTodoLintFailure = T.type_alias do
T.proc.params(output: String).void
end
Expand All @@ -25,6 +28,7 @@ def initialize
@enforce_dependencies = T.let(default_enforce_dependencies, T::Boolean)
@user_event_logger = T.let(DefaultUserEventLogger.new, UserEventLogger)
@on_package_todo_lint_failure = T.let(->(output) {}, OnPackageTodoLintFailure)
@use_pks = T.let(false, T::Boolean)
end

sig { returns(T::Boolean) }
Expand Down
2 changes: 1 addition & 1 deletion packs.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'packs'
spec.version = '0.0.43'
spec.version = '0.0.44'
spec.authors = ['Gusto Engineers']
spec.email = ['[email protected]']

Expand Down

0 comments on commit 8f8ded1

Please sign in to comment.