Class: UsePacks::CLI

Inherits:
Thor
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/use_packs/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_packs/cli.rb', line 25

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

#check(*paths) ⇒ Object



116
117
118
# File 'lib/use_packs/cli.rb', line 116

def check(*paths)
  UsePacks.execute(['check', *paths])
end

#create(pack_name) ⇒ Object



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

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

#get_info(*pack_names) ⇒ Object



128
129
130
# File 'lib/use_packs/cli.rb', line 128

def get_info(*pack_names)
  Private.get_info(packs: parse_pack_names(pack_names))
end

#lint_package_todo_yml_filesObject



98
99
100
# File 'lib/use_packs/cli.rb', line 98

def lint_package_todo_yml_files
  UsePacks.lint_package_todo_yml_files!
end

#lint_package_yml_files(*pack_names) ⇒ Object



104
105
106
# File 'lib/use_packs/cli.rb', line 104

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

#list_top_dependency_violations(pack_name) ⇒ Object



42
43
44
45
46
47
# File 'lib/use_packs/cli.rb', line 42

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

#list_top_privacy_violations(pack_name) ⇒ Object



59
60
61
62
63
64
# File 'lib/use_packs/cli.rb', line 59

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

#make_public(*paths) ⇒ Object



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

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

#move(pack_name, *paths) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/use_packs/cli.rb', line 88

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

#move_to_parent(child_pack_name, parent_pack_name) ⇒ Object



146
147
148
149
150
151
152
# File 'lib/use_packs/cli.rb', line 146

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

#renameObject



140
141
142
# File 'lib/use_packs/cli.rb', line 140

def rename
  puts Private.rename_pack
end

#updateObject



122
123
124
# File 'lib/use_packs/cli.rb', line 122

def update
  system('bin/packwerk update-todo')
end

#validateObject



110
111
112
# File 'lib/use_packs/cli.rb', line 110

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

#visualize(*pack_names) ⇒ Object



134
135
136
# File 'lib/use_packs/cli.rb', line 134

def visualize(*pack_names)
  Private.visualize(packs: parse_pack_names(pack_names))
end