Class: UsePackwerk::CLI

Inherits:
Thor
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/use_packwerk/cli.rb

Instance Method Summary collapse

Instance Method Details

#add_dependency(from_pack, to_pack) ⇒ Object



25
26
27
28
29
30
# File 'lib/use_packwerk/cli.rb', line 25

def add_dependency(from_pack, to_pack)
  UsePackwerk.add_dependency!(
    pack_name: from_pack,
    dependency_name: to_pack
  )
end

#check(*paths) ⇒ Object



101
102
103
# File 'lib/use_packwerk/cli.rb', line 101

def check(*paths)
  system("bin/packwerk check #{paths.join(' ')}")
end

#create(pack_name) ⇒ Object



11
12
13
# File 'lib/use_packwerk/cli.rb', line 11

def create(pack_name)
  UsePackwerk.create_pack!(pack_name: pack_name)
end

#lint_deprecated_references_yml_filesObject



83
84
85
# File 'lib/use_packwerk/cli.rb', line 83

def lint_deprecated_references_yml_files
  UsePackwerk.lint_deprecated_references_yml_files!
end

#lint_package_yml_files(*pack_names) ⇒ Object



89
90
91
# File 'lib/use_packwerk/cli.rb', line 89

def lint_package_yml_files(*pack_names)
  UsePackwerk.lint_package_yml_files!(parse_pack_names(pack_names))
end

#list_top_dependency_violations(pack_name) ⇒ Object



35
36
37
38
39
40
# File 'lib/use_packwerk/cli.rb', line 35

def list_top_dependency_violations(pack_name)
  UsePackwerk.list_top_dependency_violations(
    pack_name: pack_name,
    limit: options[:limit]
  )
end

#list_top_privacy_violations(pack_name) ⇒ Object



45
46
47
48
49
50
# File 'lib/use_packwerk/cli.rb', line 45

def list_top_privacy_violations(pack_name)
  UsePackwerk.list_top_privacy_violations(
    pack_name: pack_name,
    limit: options[:limit]
  )
end

#make_public(*paths) ⇒ Object



54
55
56
57
58
59
# File 'lib/use_packwerk/cli.rb', line 54

def make_public(*paths)
  UsePackwerk.make_public!(
    paths_relative_to_root: paths,
    per_file_processors: [UsePackwerk::RubocopPostProcessor.new, UsePackwerk::CodeOwnershipPostProcessor.new]
  )
end

#move(pack_name, *paths) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/use_packwerk/cli.rb', line 63

def move(pack_name, *paths)
  UsePackwerk.move_to_pack!(
    pack_name: pack_name,
    paths_relative_to_root: paths,
    per_file_processors: [UsePackwerk::RubocopPostProcessor.new, UsePackwerk::CodeOwnershipPostProcessor.new]
  )
end

#move_to_parent(parent_name, pack_name) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/use_packwerk/cli.rb', line 73

def move_to_parent(parent_name, pack_name)
  UsePackwerk.move_to_parent!(
    parent_name: parent_name,
    pack_name: pack_name,
    per_file_processors: [UsePackwerk::RubocopPostProcessor.new, UsePackwerk::CodeOwnershipPostProcessor.new]
  )
end

#regenerate_rubocop_todo(*pack_names) ⇒ Object



113
114
115
# File 'lib/use_packwerk/cli.rb', line 113

def regenerate_rubocop_todo(*pack_names)
  RuboCop::Packs.regenerate_todo(packs: parse_pack_names(pack_names))
end

#update(*paths) ⇒ Object



107
108
109
# File 'lib/use_packwerk/cli.rb', line 107

def update(*paths)
  system("bin/packwerk update-deprecations #{paths.join(' ')}")
end

#validateObject



95
96
97
# File 'lib/use_packwerk/cli.rb', line 95

def validate
  system('bin/packwerk validate')
end