
    MBj
                        d Z ddlmZ ddlZddlZddlZddlZddlmZ  ee	      j                         j                  d   Zedz  Zh dZdd	hZdd
ZddZedk(  r e e             y)z
Create an Apache deployment zip for My Daneshyar.

The package includes Laravel source, vendor if present, built frontend assets,
and public files. It excludes node_modules, git data, logs, caches, local
archives, and .env by default.
    )annotationsN)Path   build>	   .git.idea.vscodestorage/logsstorage/framework/cachestorage/framework/viewsstorage/framework/sessionsr   node_modules.envz	.DS_Storec                    | j                  t              j                         }| j                  }|r|dk(  ry|t        v ryt
        D ]  }||k(  s|j                  |dz         s y |j                  d      ryy)Nr   FT/.zip)relative_toROOTas_posixnameEXCLUDED_FILESEXCLUDED_DIRS
startswithendswith)pathinclude_envrelativer   excludeds        scripts/package_for_apache.pyshould_excluder    )   s}    %..0H99Dx6)~! x8#6#6x#~#F      c                    t        j                  d      } | j                  ddd       | j                  ddd	
       | j                         }t        j                  d       t        j                  d      }|j                  xs d| d}t        |z  }t        dz  dz  t        dz  dz  dz  t        dz  t        dz  g}|D cg c]  }|j                         r| }}|r,t        d       |D ]  }t        d|         t        d       yt        j                  |dt        j                        5 }t        j                  d      D ]b  }||k(  st!        ||j"                        r|j%                         r0|j'                  ||j)                  t              j+                                d 	 d d d        t        d|        t        d       yc c}w # 1 sw Y   (xY w) Nz(Package Daneshyar for Apache deployment.)descriptionz--include-env
store_truez-Include .env in the package. Not recommended.)actionhelpz--name zCustom output zip filename.)defaultr&   T)exist_okz%Y%m%d-%H%M%Szdaneshyar-apache-r   publicz	index.phpr   zmanifest.jsonartisanzcomposer.jsonz*ERROR: Project is not ready for packaging.z	Missing: z=Run the Laravel scaffold and build first, then package again.r   w)compression*zPackage created: zLRemember: Apache DocumentRoot must point to the package's public/ directory.r   )argparseArgumentParseradd_argument
parse_args	BUILD_DIRmkdirtimestrftimer   r   existsprintzipfileZipFileZIP_DEFLATEDrglobr    r   is_dirwriter   r   )	parserargs	timestampoutput_nameoutput_pathrequiredr   missingarchives	            r   mainrG   =   s   $$1[\F
Crs
"3PQDOOTO"o.I))B!29+TBKk)K 	x+%x'!O3y	H !)>t>G>:; 	&DIdV$%	&MN	cw7K7K	L CPWJJsO 	CD{"nT4;K;K&L{{}MM$ 0 0 6 ? ? AB	CC 
k]
+,	
XY% ?C Cs   GG6A;GG"__main__)r   r   r   boolreturnrI   )rJ   int)__doc__
__future__r   r/   osr5   r9   pathlibr   __file__resolveparentsr   r3   r   r   r    rG   __name__
SystemExit r!   r   <module>rV      s    #  	    H~''*7N	
 (#L z
TV
 r!   