-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #812 from Golmote/prism-roboconf
Add support for Roboconf
- Loading branch information
Showing
11 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Prism.languages.roboconf = { | ||
'comment': /#.*/, | ||
'keyword': { | ||
'pattern': /(^|\s)(?:(?:facet|instance of)(?=[ \t]+[\w-]+[ \t]*\{)|(?:external|import)\b)/, | ||
lookbehind: true | ||
}, | ||
'component': { | ||
pattern: /[\w-]+(?=[ \t]*\{)/, | ||
alias: 'variable' | ||
}, | ||
'property': /[\w.-]+(?=[ \t]*:)/, | ||
'value': { | ||
pattern: /(=[ \t]*)[^,;]+/, | ||
lookbehind: true, | ||
alias: 'attr-value' | ||
}, | ||
'optional': { | ||
pattern: /\(optional\)/, | ||
alias: 'builtin' | ||
}, | ||
'wildcard': { | ||
pattern: /(\.)\*/, | ||
lookbehind: true, | ||
alias: 'operator' | ||
}, | ||
'punctuation': /[{},.;:=]/ | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<h1>Roboconf</h1> | ||
<p>To use this language, use the class "language-roboconf".</p> | ||
|
||
<h2>Full example</h2> | ||
<pre><code>ApacheServer { | ||
# Apache instances will be deployed by Roboconf's Puppet extension | ||
installer: puppet; | ||
|
||
# Web applications could be deployed over this Apache server | ||
children: My-Dash-Board, Marketing-Suite; | ||
|
||
# Properties exported by this component. | ||
# 'port' should have a default value, or we will have to set it when we create an instance. | ||
exports: port = 19099; | ||
|
||
# 'ip' is a special variable. It will be updated at runtime by a Roboconf agent. | ||
exports: ip; | ||
|
||
# Other components properties that this server needs to have so that it can start. | ||
imports: LB.port (optional), LB.ip (optional); | ||
|
||
# Here, the Apache may also be notified about components instances of type LB. | ||
# The imports are marked as optional. It means that if there is no LB instance, an | ||
# Apache instance will be able to start anyway. | ||
# | ||
# If the import was not optional, e.g. | ||
# | ||
# imports: LB.port, LB.ip; | ||
# or even | ||
# imports: LB.port (optional), LB.ip; | ||
# | ||
# ... then an Apache instance would need at least one LB instance somewhere. | ||
|
||
# Imports may also reference variables from other applications | ||
imports: external Lamp.lb-ip; | ||
} | ||
|
||
facet LoadBalanced { | ||
exports: ip, port; # Define we export two variables. | ||
} | ||
|
||
instance of VM { | ||
|
||
# This will create 5 VM instances, called VM 1, VM 2, VM3, VM 4 and VM 5. | ||
name: VM ; # Yes, there is a space at the end... :) | ||
count: 5; | ||
|
||
# On every VM instance, we will deploy... | ||
instance of Tomcat { | ||
name: Tomcat; | ||
} | ||
}</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Foobar | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "#"], | ||
["comment", "# Foobar"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ApacheServer {} | ||
lb--apache-mod-jk--puppet {} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["component", "ApacheServer"], ["punctuation", "{"], ["punctuation", "}"], | ||
["component", "lb--apache-mod-jk--puppet"], ["punctuation", "{"], ["punctuation", "}"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for component names. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
facet Foo {} | ||
instance of Bar {} | ||
external | ||
import | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "facet"], | ||
["component", "Foo"], ["punctuation", "{"], ["punctuation", "}"], | ||
["keyword", "instance of"], | ||
["component", "Bar"], ["punctuation", "{"], ["punctuation", "}"], | ||
["keyword", "external"], | ||
["keyword", "import"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for keywords. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(optional) | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["optional", "(optional)"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for optional flag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
extends : | ||
imports: | ||
installer: | ||
data.ec2.elastic.ip: | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["property", "extends"], ["punctuation", ":"], | ||
["property", "imports"], ["punctuation", ":"], | ||
["property", "installer"], ["punctuation", ":"], | ||
["property", "data.ec2.elastic.ip"], ["punctuation", ":"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for properties. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
port = 8080; | ||
MySQL.port = 3307, My-Client-Database.port = 3308; | ||
my-own-variable = something; | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
"port ", ["punctuation", "="], | ||
["value", "8080"], ["punctuation", ";"], | ||
"\r\nMySQL", ["punctuation", "."], "port ", ["punctuation", "="], | ||
["value", "3307"], ["punctuation", ","], | ||
" My-Client-Database", ["punctuation", "."], "port ", ["punctuation", "="], | ||
["value", "3308"], ["punctuation", ";"], | ||
"\r\nmy-own-variable ", ["punctuation", "="], | ||
["value", "something"], ["punctuation", ";"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for default values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
load-balance-able.* | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
"load-balance-able", ["punctuation", "."], | ||
["wildcard", "*"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for wildcards. |