Sha256: 81f203cd0303d98406a7344270e440a70a19da46f2ad8db32897e8e107424963
Contents?: true
Size: 1.43 KB
Versions: 60
Compression:
Stored size: 1.43 KB
Contents
require 'commands/meta/command' require 'json' module Nutella # This class describes a template command which can be either install or template # It is mostly a commodity class for code reuse. class TemplateCommand < Command def run (args=nil) console.error 'Running generic TemplateCommand!!! WAT?' end # Validates a template in a certain folder # @param [String] dir the directory where the template is stored def validate_template( dir ) # Parse and validate the template's nutella.json file begin template_nutella_file_json = JSON.parse(IO.read("#{dir}/nutella.json")) rescue return false end return false unless validate_nutella_file_json template_nutella_file_json # If template is a bot, perform the appropriate checks if template_nutella_file_json['type']=='bot' # Is there a mandatory 'startup' script and is it executable return false unless File.executable? "#{dir}/startup" end # If template is an interface, perform the appropriate checks if template_nutella_file_json['type']=='interface' # Is there the mandatory index.html file return false unless File.exist? "#{dir}/index.html" end true end def validate_nutella_file_json( json ) !json['name'].nil? && !json['version'].nil? && !json['type'].nil? && (json['type']=='bot' || json['type']=='interface') end end end
Version data entries
60 entries across 60 versions & 1 rubygems