File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1158,7 +1158,7 @@ def run_collection(args, options)
11581158 stderr . puts "#{ lock_path } should exist to clean"
11591159 return 1
11601160 end
1161- Collection ::Cleaner . new ( lockfile_path : lock_path )
1161+ Collection ::Cleaner . new ( lockfile_path : lock_path ) . clean
11621162 when 'help' , 'hel' , 'he' , 'h'
11631163 stdout . puts opts . help
11641164 else
Original file line number Diff line number Diff line change @@ -1734,6 +1734,42 @@ def test_collection_install__set_pathname__manifest
17341734 end
17351735 end
17361736
1737+ def test_collection_clean
1738+ Dir . mktmpdir do |dir |
1739+ dir = Pathname ( dir )
1740+
1741+ config_path = dir + RBS ::Collection ::Config ::PATH
1742+ config_path . write ( "" )
1743+
1744+ RBS ::Collection ::Config . to_lockfile_path ( config_path ) . write ( <<~YAML )
1745+ path: .gem_rbs_collection
1746+ gems:
1747+ - name: ast
1748+ version: "2.4"
1749+ source:
1750+ type: git
1751+ name: ruby/gem_rbs_collection
1752+ remote: https://github.com/ruby/gem_rbs_collection.git
1753+ revision: b4d3b346d9657543099a35a1fd20347e75b8c523
1754+ repo_dir: gems
1755+ YAML
1756+
1757+ collection_dir = dir + ".gem_rbs_collection"
1758+ ( collection_dir + "ast/2.4" ) . mkpath
1759+ ( collection_dir + "ast/2.4/ast.rbs" ) . write ( "class Ast end" )
1760+ ( collection_dir + "ast/2.3" ) . mkpath
1761+ ( collection_dir + "rainbow/3.0" ) . mkpath
1762+
1763+ with_cli do |cli |
1764+ assert_cli_success cli . run ( [ "--collection" , config_path . to_s , "collection" , "clean" ] )
1765+ end
1766+
1767+ assert_predicate ( collection_dir + "ast/2.4/ast.rbs" , :file? )
1768+ refute_predicate ( collection_dir + "ast/2.3" , :exist? )
1769+ refute_predicate ( collection_dir + "rainbow/3.0" , :exist? )
1770+ end
1771+ end
1772+
17371773 def test_subtract
17381774 Dir . mktmpdir do |dir |
17391775 dir = Pathname ( dir )
You can’t perform that action at this time.
0 commit comments