puppet.js (5569B)
1 /* 2 Language: Puppet 3 Author: Jose Molina Colmenero <gaudy41@gmail.com> 4 Website: https://puppet.com/docs 5 Category: config 6 */ 7 8 function puppet(hljs) { 9 10 var PUPPET_KEYWORDS = { 11 keyword: 12 /* language keywords */ 13 'and case default else elsif false if in import enherits node or true undef unless main settings $string ', 14 literal: 15 /* metaparameters */ 16 'alias audit before loglevel noop require subscribe tag ' + 17 /* normal attributes */ 18 'owner ensure group mode name|0 changes context force incl lens load_path onlyif provider returns root show_diff type_check ' + 19 'en_address ip_address realname command environment hour monute month monthday special target weekday '+ 20 'creates cwd ogoutput refresh refreshonly tries try_sleep umask backup checksum content ctime force ignore ' + 21 'links mtime purge recurse recurselimit replace selinux_ignore_defaults selrange selrole seltype seluser source ' + 22 'souirce_permissions sourceselect validate_cmd validate_replacement allowdupe attribute_membership auth_membership forcelocal gid '+ 23 'ia_load_module members system host_aliases ip allowed_trunk_vlans description device_url duplex encapsulation etherchannel ' + 24 'native_vlan speed principals allow_root auth_class auth_type authenticate_user k_of_n mechanisms rule session_owner shared options ' + 25 'device fstype enable hasrestart directory present absent link atboot blockdevice device dump pass remounts poller_tag use ' + 26 'message withpath adminfile allow_virtual allowcdrom category configfiles flavor install_options instance package_settings platform ' + 27 'responsefile status uninstall_options vendor unless_system_user unless_uid binary control flags hasstatus manifest pattern restart running ' + 28 'start stop allowdupe auths expiry gid groups home iterations key_membership keys managehome membership password password_max_age ' + 29 'password_min_age profile_membership profiles project purge_ssh_keys role_membership roles salt shell uid baseurl cost descr enabled ' + 30 'enablegroups exclude failovermethod gpgcheck gpgkey http_caching include includepkgs keepalive metadata_expire metalink mirrorlist ' + 31 'priority protect proxy proxy_password proxy_username repo_gpgcheck s3_enabled skip_if_unavailable sslcacert sslclientcert sslclientkey ' + 32 'sslverify mounted', 33 built_in: 34 /* core facts */ 35 'architecture augeasversion blockdevices boardmanufacturer boardproductname boardserialnumber cfkey dhcp_servers ' + 36 'domain ec2_ ec2_userdata facterversion filesystems ldom fqdn gid hardwareisa hardwaremodel hostname id|0 interfaces '+ 37 'ipaddress ipaddress_ ipaddress6 ipaddress6_ iphostnumber is_virtual kernel kernelmajversion kernelrelease kernelversion ' + 38 'kernelrelease kernelversion lsbdistcodename lsbdistdescription lsbdistid lsbdistrelease lsbmajdistrelease lsbminordistrelease ' + 39 'lsbrelease macaddress macaddress_ macosx_buildversion macosx_productname macosx_productversion macosx_productverson_major ' + 40 'macosx_productversion_minor manufacturer memoryfree memorysize netmask metmask_ network_ operatingsystem operatingsystemmajrelease '+ 41 'operatingsystemrelease osfamily partitions path physicalprocessorcount processor processorcount productname ps puppetversion '+ 42 'rubysitedir rubyversion selinux selinux_config_mode selinux_config_policy selinux_current_mode selinux_current_mode selinux_enforced '+ 43 'selinux_policyversion serialnumber sp_ sshdsakey sshecdsakey sshrsakey swapencrypted swapfree swapsize timezone type uniqueid uptime '+ 44 'uptime_days uptime_hours uptime_seconds uuid virtual vlans xendomains zfs_version zonenae zones zpool_version' 45 }; 46 47 var COMMENT = hljs.COMMENT('#', '$'); 48 49 var IDENT_RE = '([A-Za-z_]|::)(\\w|::)*'; 50 51 var TITLE = hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}); 52 53 var VARIABLE = {className: 'variable', begin: '\\$' + IDENT_RE}; 54 55 var STRING = { 56 className: 'string', 57 contains: [hljs.BACKSLASH_ESCAPE, VARIABLE], 58 variants: [ 59 {begin: /'/, end: /'/}, 60 {begin: /"/, end: /"/} 61 ] 62 }; 63 64 return { 65 name: 'Puppet', 66 aliases: ['pp'], 67 contains: [ 68 COMMENT, 69 VARIABLE, 70 STRING, 71 { 72 beginKeywords: 'class', end: '\\{|;', 73 illegal: /=/, 74 contains: [TITLE, COMMENT] 75 }, 76 { 77 beginKeywords: 'define', end: /\{/, 78 contains: [ 79 { 80 className: 'section', begin: hljs.IDENT_RE, endsParent: true 81 } 82 ] 83 }, 84 { 85 begin: hljs.IDENT_RE + '\\s+\\{', returnBegin: true, 86 end: /\S/, 87 contains: [ 88 { 89 className: 'keyword', 90 begin: hljs.IDENT_RE 91 }, 92 { 93 begin: /\{/, end: /\}/, 94 keywords: PUPPET_KEYWORDS, 95 relevance: 0, 96 contains: [ 97 STRING, 98 COMMENT, 99 { 100 begin:'[a-zA-Z_]+\\s*=>', 101 returnBegin: true, end: '=>', 102 contains: [ 103 { 104 className: 'attr', 105 begin: hljs.IDENT_RE, 106 } 107 ] 108 }, 109 { 110 className: 'number', 111 begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b', 112 relevance: 0 113 }, 114 VARIABLE 115 ] 116 } 117 ], 118 relevance: 0 119 } 120 ] 121 } 122 } 123 124 module.exports = puppet;