| 
									
										
										
										
											2012-09-09 13:19:53 -07:00
										 |  |  | class Metafiles | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize | 
					
						
							| 
									
										
										
										
											2012-11-11 10:55:08 -08:00
										 |  |  |     @exts = %w[.md .html .rtf .txt] | 
					
						
							|  |  |  |     @metafiles = %w[
 | 
					
						
							|  |  |  |       about authors changelog changes copying copyright history license | 
					
						
							|  |  |  |       licence news notes notice readme todo] | 
					
						
							| 
									
										
										
										
											2012-09-09 13:19:53 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def + other | 
					
						
							|  |  |  |     @metafiles + other | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def should_copy? file | 
					
						
							|  |  |  |     include? file | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def should_list? file | 
					
						
							|  |  |  |     return false if %w[.DS_Store INSTALL_RECEIPT.json].include? file | 
					
						
							|  |  |  |     not include? file | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-07 00:49:56 -05:00
										 |  |  |   private | 
					
						
							| 
									
										
										
										
											2012-09-09 13:19:53 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def include? p | 
					
						
							|  |  |  |     p = p.to_s # Might be a pathname | 
					
						
							|  |  |  |     p = p.downcase | 
					
						
							|  |  |  |     path = Pathname.new(p) | 
					
						
							|  |  |  |     if @exts.include? path.extname | 
					
						
							|  |  |  |       p = path.basename(path.extname) | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |       p = path.basename | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |     p = p.to_s | 
					
						
							|  |  |  |     return @metafiles.include? p | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | end |