| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | require "commands/bootstrap_templates" | 
					
						
							| 
									
										
										
										
											2015-07-16 12:54:16 +03:00
										 |  |  | require "db/validators/base" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | module Validators | 
					
						
							| 
									
										
										
										
											2015-07-16 12:54:16 +03:00
										 |  |  |   module Image | 
					
						
							|  |  |  |     class BootstrapTemplate < Base | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-16 12:54:16 +03:00
										 |  |  |       include BootstrapTemplatesCommands | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-16 12:54:16 +03:00
										 |  |  |       def valid? | 
					
						
							|  |  |  |         if @model.bootstrap_template | 
					
						
							|  |  |  |           templates = get_templates | 
					
						
							|  |  |  |           templates.include?(@model.bootstrap_template) | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |           true | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-16 12:54:16 +03:00
										 |  |  |       def message | 
					
						
							|  |  |  |         "Invalid bootstrap template '#{@model.bootstrap_template}' for image '#{@model.id}'" | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |