Merge branch 'fix_install_fe_bug' into 'develop'
Fix frontend install mix task bug See merge request pleroma/pleroma!2942
This commit is contained in:
		
						commit
						1d743ca829
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		|  | @ -69,7 +69,7 @@ def run(["install", frontend | args]) do | ||||||
| 
 | 
 | ||||||
|     fe_label = "#{frontend} (#{ref})" |     fe_label = "#{frontend} (#{ref})" | ||||||
| 
 | 
 | ||||||
|     tmp_dir = Path.join(dest, "tmp") |     tmp_dir = Path.join([instance_static_dir, "frontends", "tmp"]) | ||||||
| 
 | 
 | ||||||
|     with {_, :ok} <- |     with {_, :ok} <- | ||||||
|            {:download_or_unzip, download_or_unzip(frontend_info, tmp_dir, options[:file])}, |            {:download_or_unzip, download_or_unzip(frontend_info, tmp_dir, options[:file])}, | ||||||
|  | @ -135,6 +135,7 @@ defp download_build(frontend_info, dest) do | ||||||
| 
 | 
 | ||||||
|   defp install_frontend(frontend_info, source, dest) do |   defp install_frontend(frontend_info, source, dest) do | ||||||
|     from = frontend_info["build_dir"] || "dist" |     from = frontend_info["build_dir"] || "dist" | ||||||
|  |     File.rm_rf!(dest) | ||||||
|     File.mkdir_p!(dest) |     File.mkdir_p!(dest) | ||||||
|     File.cp_r!(Path.join([source, from]), dest) |     File.cp_r!(Path.join([source, from]), dest) | ||||||
|     :ok |     :ok | ||||||
|  |  | ||||||
|  | @ -48,11 +48,18 @@ test "it also works given a file" do | ||||||
|       } |       } | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|  |     folder = Path.join([@dir, "frontends", "pleroma", "fantasy"]) | ||||||
|  |     previously_existing = Path.join([folder, "temp"]) | ||||||
|  |     File.mkdir_p!(folder) | ||||||
|  |     File.write!(previously_existing, "yey") | ||||||
|  |     assert File.exists?(previously_existing) | ||||||
|  | 
 | ||||||
|     capture_io(fn -> |     capture_io(fn -> | ||||||
|       Frontend.run(["install", "pleroma", "--file", "test/fixtures/tesla_mock/frontend.zip"]) |       Frontend.run(["install", "pleroma", "--file", "test/fixtures/tesla_mock/frontend.zip"]) | ||||||
|     end) |     end) | ||||||
| 
 | 
 | ||||||
|     assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"])) |     assert File.exists?(Path.join([folder, "test.txt"])) | ||||||
|  |     refute File.exists?(previously_existing) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   test "it downloads and unzips unknown frontends" do |   test "it downloads and unzips unknown frontends" do | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 lain
						lain