feat: Add clean mix task
This commit is contained in:
		
							parent
							
								
									1f9246e8db
								
							
						
					
					
						commit
						78f677b98b
					
				
					 2 changed files with 21 additions and 0 deletions
				
			
		
							
								
								
									
										7
									
								
								lib/mix/tasks/pre_dot_hn/clean.ex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								lib/mix/tasks/pre_dot_hn/clean.ex
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| defmodule Mix.Tasks.PreDotHn.Clean do | ||||
|   use Mix.Task | ||||
| 
 | ||||
|   def run(_args) do | ||||
|     PreDotHn.clean() | ||||
|   end | ||||
| end | ||||
|  | @ -36,6 +36,20 @@ defmodule PreDotHn do | |||
| 
 | ||||
|   def validate(other), do: {:ok, other} | ||||
| 
 | ||||
|   def clean() do | ||||
|     "priv/static/**" | ||||
|     |> Path.wildcard() | ||||
|     |> Enum.each(fn path -> | ||||
|       if File.dir?(path) do | ||||
|         if !File.exists?(Path.join(path, ".keep")) do | ||||
|           File.exists?(path) && File.rm_rf!(path) | ||||
|         end | ||||
|       else | ||||
|         File.exists?(path) && File.rm!(path) | ||||
|       end | ||||
|     end) | ||||
|   end | ||||
| 
 | ||||
|   def run() do | ||||
|     posts = | ||||
|       "site/**/*.md" | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Robert Prehn
						Robert Prehn