diff --git a/Authors b/Authors new file mode 100644 index 0000000..cf9a2bf --- /dev/null +++ b/Authors @@ -0,0 +1,2 @@ +Russell Cloak +Sean Keery diff --git a/Puppet.sublime-build b/Puppet.sublime-build index 2ca9bdc..9d1729e 100755 --- a/Puppet.sublime-build +++ b/Puppet.sublime-build @@ -2,5 +2,9 @@ "cmd": [ "puppet", "parser", "validate", "--color=false", "--confdir=/tmp", "--vardir=/tmp", "$file" ], "working_dir": "${project_path:${folder:${file_path}}}", "selector": "source.pp", - "path": "/opt/local/bin:$PATH" -} \ No newline at end of file + "path": "/opt/local/bin:$PATH", + "windows": + { + "cmd": ["puppet.bat", "parser", "validate", "--color=false", "$file" ] + } +} diff --git a/README.md b/README.md index 81df72e..ff05b63 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,67 @@ SublimePuppet -============= +================================== -Puppet (puppetlabs.com) highlighting, snippets and completion for Sublime Text 2 \ No newline at end of file +[Puppet](puppetlabs.com) highlighting, snippets and completion for Sublime Text 2 & 3. Now with windows parsing support. + +### Plugin installation + +#### Package Manager + +First, install the Package Control plugin, instructions here: http://wbond.net/sublime_packages/package_control. + +Once you install Package Control, restart ST2 and bring up the Command Palette (`Command+Shift+P` on OS X, `Control+Shift+P` on Linux/Windows). Select "Package Control: Install Package", wait while Package Control fetches the latest package list, then select SublimeLinter when the list appears. The advantage of using this method is that Package Control will automatically keep SublimePuppet up to date with the latest version. + +#### Manual + +**With Git:** Clone the repository in your Sublime Text "Packages" directory: + + git clone https://github.com/SublimeLinter/SublimeLinter.git + + +The "Packages" directory is located at: + +* OS X: + + ~/Library/Application Support/Sublime Text 2/Packages/ + +* Linux: + + ~/.config/sublime-text-2/Packages/ + +* Windows: + + %APPDATA%/Sublime Text 2/Packages/ + +**Without Git:** Download the latest source from [here](https://github.com/russCloak/SublimePuppet/archive/master.zip) and copy the `SublimePuppet` folder to your Sublime Text "Packages" directory. + +### Puppet installation +Before using this plugin, you must ensure that `puppet` is installed on your system. To install `puppet`, do the following: + +1. Install [Ruby](http://ruby-lang.org). + +1. Install `puppet` by typing the following in a terminal: + ``` + gem install puppet + ``` + +1. If you are using `rvm` or `rbenv`, ensure that they are loaded in your shell’s correct startup file. See [here](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#shell-startup-files) for more information. + +## Contributing +If you would like to contribute enhancements or fixes, please do the following: + +1. Fork the plugin repository. +1. Hack on a separate topic branch created from the latest `master`. +1. Commit and push the topic branch. +1. Make a pull request. +1. Be patient. ;-) + +Please note that modifications should follow these coding guidelines: + +- Indent is 4 spaces. +- Code should pass flake8 and pep257 linters. +- Vertical whitespace helps readability, don’t be afraid to use it. +- Please use descriptive variable names, no abbreviations unless they are very well known. + +[pc]: https://sublime.wbond.net/installation +[locating-executables]: http://sublimelinter.readthedocs.org/en/latest/usage.html#how-linter-executables-are-located +[cmd]: http://docs.sublimetext.info/en/sublime-text-3/extensibility/command_palette.html diff --git a/Syntaxes/Puppet.tmLanguage b/Syntaxes/Puppet.tmLanguage index c1ffa67..0418356 100755 --- a/Syntaxes/Puppet.tmLanguage +++ b/Syntaxes/Puppet.tmLanguage @@ -157,14 +157,14 @@ end - (?=,|\)) + , name meta.function.argument.default.puppet patterns include - #parameter-default-types + #expression @@ -203,11 +203,7 @@ include - #strings - - - include - #variable + #expression begin @@ -246,15 +242,57 @@ repository + arrays + + patterns + + + begin + \[ + end + \] + name + meta.structure.array.puppet + patterns + + + include + #expression + + + + + + bracket-exp + + patterns + + + begin + \( + end + \) + name + meta.group.braces.round + patterns + + + include + #expression + + + + + constants patterns match - (?i)\b(false|true|running|present|absent|file|directory)\b + (?i)\b(false|true|running|undef|present|absent|file|directory)\b name - constant.language.php + constant.language.puppet @@ -301,261 +339,152 @@ name constant.character.escape.puppet - line_comment - - patterns - - - captures - - 1 - - name - comment.line.number-sign.puppet - - 2 - - name - punctuation.definition.comment.puppet - - - match - ^((#).*$\n?) - name - meta.comment.full-line.puppet - - - captures - - 1 - - name - punctuation.definition.comment.puppet - - - match - (#).*$\n? - name - comment.line.number-sign.puppet - - - - nested_braces + expression - begin - \{ - captures - - 1 - - name - punctuation.section.scope.puppet - - - end - \} patterns include - #escaped_char - - - include - #nested_braces - - - - nested_braces_interpolated - - begin - \{ - captures - - 1 - - name - punctuation.section.scope.puppet + #constants - - end - \} - patterns - include - #escaped_char + #strings include - #variable + #numbers include - #nested_braces_interpolated + #arrays - - - nested_brackets - - begin - \[ - captures - - 1 - - name - punctuation.section.scope.puppet - - - end - \] - patterns - include - #escaped_char + #hashes include - #nested_brackets - - - - nested_brackets_interpolated - - begin - \[ - captures - - 1 - - name - punctuation.section.scope.puppet + #variable - - end - \] - patterns - include - #escaped_char + #function-call include - #variable + #resource-reference include - #nested_brackets_interpolated + #bracket-exp - nested_parens + function-call - begin - \( - captures - - 1 - - name - punctuation.section.scope.puppet - - - end - \) patterns - include - #escaped_char - - - include - #nested_parens + begin + ([a-z][a-z0-9_]*)\( + beginCaptures + + 1 + + name + meta.function-call.function-name.puppet + + + contentName + meta.function-call.arguments.puppet + end + \) + name + meta.function-call.puppet + patterns + + + include + #expression + + - nested_parens_interpolated + hashes - begin - \( - captures - - 1 - - name - punctuation.section.scope.puppet - - - end - \) patterns - include - #escaped_char - - - include - #variable - - - include - #nested_parens_interpolated + begin + \{ + end + \} + name + meta.structure.hash.puppetbracket-exp + patterns + + + include + #line_comment + + + include + #expression + + - parameter-default-types + line_comment patterns - include - #strings - - - match - = - name - keyword.operator.assignment.php - - - begin - (\[) - beginCaptures + captures 1 name - punctuation.definition.array.begin.puppet + comment.line.number-sign.puppet - - end - \] - endCaptures - - 0 + 2 name - punctuation.definition.array.end.puppet + punctuation.definition.comment.puppet + match + ^((#).*$\n?) name - meta.array.php - patterns - + meta.comment.full-line.puppet + + + captures + + 1 - include - #parameter-default-types + name + punctuation.definition.comment.puppet - + + match + (#).*$\n? + name + comment.line.number-sign.puppet + + + numbers + + patterns + - include - #constants + match + -?\d+(?:\.\d+)? + name + constant.numeric.puppet