Class: Packs::CLI
Constant Summary collapse
- POSIBLE_TYPES =
T.let(%w[dependency privacy layer], T::Array[String])
Instance Method Summary collapse
- #add_dependency(from_pack, to_pack) ⇒ Object
- #check(*paths) ⇒ Object
- #create(pack_name) ⇒ Object
- #get_info(*pack_names) ⇒ Object
- #lint_package_todo_yml_files ⇒ Object
- #lint_package_yml_files(*pack_names) ⇒ Object
- #list_top_violations(type, pack_name = nil) ⇒ Object
- #make_public(*paths) ⇒ Object
- #move(pack_name, *paths) ⇒ Object
- #move_to_folder(pack_name, destination) ⇒ Object
- #move_to_parent(child_pack_name, parent_pack_name) ⇒ Object
- #rename ⇒ Object
- #update ⇒ Object
- #validate ⇒ Object
Instance Method Details
#add_dependency(from_pack, to_pack) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/packs/cli.rb', line 34 def add_dependency(from_pack, to_pack) Packs.add_dependency!( pack_name: from_pack, dependency_name: to_pack ) exit_successfully end |
#check(*paths) ⇒ Object
121 122 123 |
# File 'lib/packs/cli.rb', line 121 def check(*paths) Private.exit_with(Packs.check(paths)) end |
#create(pack_name) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/packs/cli.rb', line 14 def create(pack_name) Packs.create_pack!( pack_name: pack_name, enforce_dependencies: [:enforce_dependencies], enforce_privacy: [:enforce_privacy], enforce_layers: [:enforce_layers] ) exit_successfully end |
#get_info(*pack_names) ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/packs/cli.rb', line 136 def get_info(*pack_names) selected_types = [:types].to_s.downcase.split(',') invalid_types = selected_types - POSIBLE_TYPES raise StandardError, "Invalid type(s): #{invalid_types.join(', ')}. Possible types are: #{POSIBLE_TYPES.join(', ')}" unless invalid_types.empty? Private.get_info( packs: parse_pack_names(pack_names), format: [:format].to_sym, types: selected_types.map(&:to_sym), include_date: [:include_date] ) exit_successfully end |
#lint_package_todo_yml_files ⇒ Object
103 104 105 |
# File 'lib/packs/cli.rb', line 103 def lint_package_todo_yml_files Packs.lint_package_todo_yml_files! end |
#lint_package_yml_files(*pack_names) ⇒ Object
109 110 111 |
# File 'lib/packs/cli.rb', line 109 def lint_package_yml_files(*pack_names) Packs.lint_package_yml_files!(parse_pack_names(pack_names)) end |
#list_top_violations(type, pack_name = nil) ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/packs/cli.rb', line 62 def list_top_violations(type, pack_name = nil) raise StandardError, "Invalid type #{type}. Possible types are: #{POSIBLE_TYPES.join(', ')}" unless POSIBLE_TYPES.include?(type) Packs.list_top_violations( type: type, pack_name: pack_name, limit: [:limit] ) exit_successfully end |
#make_public(*paths) ⇒ Object
80 81 82 83 |
# File 'lib/packs/cli.rb', line 80 def make_public(*paths) Packs.make_public!(paths_relative_to_root: paths) exit_successfully end |
#move(pack_name, *paths) ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/packs/cli.rb', line 93 def move(pack_name, *paths) Packs.move_to_pack!( pack_name: pack_name, paths_relative_to_root: paths ) exit_successfully end |
#move_to_folder(pack_name, destination) ⇒ Object
169 170 171 172 173 174 175 |
# File 'lib/packs/cli.rb', line 169 def move_to_folder(pack_name, destination) Packs.move_to_folder!( pack_name: pack_name, destination: destination ) exit_successfully end |
#move_to_parent(child_pack_name, parent_pack_name) ⇒ Object
159 160 161 162 163 164 165 |
# File 'lib/packs/cli.rb', line 159 def move_to_parent(child_pack_name, parent_pack_name) Packs.move_to_parent!( parent_name: parent_pack_name, pack_name: child_pack_name ) exit_successfully end |
#rename ⇒ Object
152 153 154 155 |
# File 'lib/packs/cli.rb', line 152 def rename puts Private.rename_pack exit_successfully end |