From b17edd64a7e6a16b1e9065da459ad8ff771221c3 Mon Sep 17 00:00:00 2001 From: Ruy Asan Date: Wed, 9 Jul 2014 14:23:03 -0700 Subject: [PATCH 1/8] Add better expression support ... covers expressions inside argument defaults, also introduces some explicit knowledge of grouping literals --- Syntaxes/Puppet.tmLanguage | 325 ++++++++++++++----------------------- 1 file changed, 125 insertions(+), 200 deletions(-) diff --git a/Syntaxes/Puppet.tmLanguage b/Syntaxes/Puppet.tmLanguage index c1ffa67..072c468 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,148 @@ 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 - - - - nested_brackets - - begin - \[ - captures - - 1 - - name - punctuation.section.scope.puppet + #arrays - - 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 + #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 From 3797770c53392d2202819b5b18a0d46b9e49a857 Mon Sep 17 00:00:00 2001 From: Ruy Asan Date: Wed, 9 Jul 2014 14:30:30 -0700 Subject: [PATCH 2/8] woops - forgot to deal with comments in hash-likes --- Syntaxes/Puppet.tmLanguage | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Syntaxes/Puppet.tmLanguage b/Syntaxes/Puppet.tmLanguage index 072c468..0418356 100755 --- a/Syntaxes/Puppet.tmLanguage +++ b/Syntaxes/Puppet.tmLanguage @@ -425,6 +425,10 @@ meta.structure.hash.puppetbracket-exp patterns + + include + #line_comment + include #expression From 65c0e5d53821d85844bd5c56d772a210d60f7a58 Mon Sep 17 00:00:00 2001 From: Sean Keery Date: Tue, 10 Jun 2014 22:08:51 -0600 Subject: [PATCH 3/8] Added windows platform build cmd Added windows platform build cmd per http://docs.sublimetext.info/en/latest/reference/build_systems.html --- Puppet.sublime-build | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Puppet.sublime-build b/Puppet.sublime-build index 2ca9bdc..b5a1f38 100755 --- a/Puppet.sublime-build +++ b/Puppet.sublime-build @@ -2,5 +2,10 @@ "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": ["C:\\ruby193\\bin\\puppet.bat", "parser", "validate", "--color=false", "$file" ], + + "path": "C:\\ruby193\\bin;$PATH" + } +} From 1eb47fb1b4f7fa06a9f5be64cb5523491cc3e007 Mon Sep 17 00:00:00 2001 From: Sean Keery Date: Tue, 10 Jun 2014 22:23:43 -0600 Subject: [PATCH 4/8] Removed opinionated path Ruby should be in your path, I shouldn't specify my version. --- Puppet.sublime-build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Puppet.sublime-build b/Puppet.sublime-build index b5a1f38..9d1729e 100755 --- a/Puppet.sublime-build +++ b/Puppet.sublime-build @@ -4,8 +4,7 @@ "selector": "source.pp", "path": "/opt/local/bin:$PATH", "windows": - { "cmd": ["C:\\ruby193\\bin\\puppet.bat", "parser", "validate", "--color=false", "$file" ], - - "path": "C:\\ruby193\\bin;$PATH" + { + "cmd": ["puppet.bat", "parser", "validate", "--color=false", "$file" ] } } From 30b920037b3c5dbd71be792863b063746e487246 Mon Sep 17 00:00:00 2001 From: Peter Souter Date: Mon, 1 Sep 2014 12:02:40 +0100 Subject: [PATCH 5/8] Updated Readme Borrowed a bunch from https://github.com/stopdropandrew/SublimeLinter-puppet/ README --- README.md | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 81df72e..26db987 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,47 @@ 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 +Please use [Package Control][pc] to install this plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here. + +To install via Package Control, do the following: + +1. Within Sublime Text, bring up the [Command Palette][cmd] and type `install`. Among the commands you should see `Package Control: Install Package`. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins. + +1. When the plugin list appears, type `puppet`. Among the entries you should see `SublimePuppet`. If that entry is not highlighted, use the keyboard or mouse to select it. + +### 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: + ``` + [sudo] 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 From d03527f25b284563872cdf7586de9b83584af712 Mon Sep 17 00:00:00 2001 From: Sean Keery Date: Tue, 10 Jun 2014 22:46:14 -0600 Subject: [PATCH 6/8] Create Authors --- Authors | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Authors 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 From e4e3b862472ca77c8e98d04911451a7da53131be Mon Sep 17 00:00:00 2001 From: Sean Keery Date: Tue, 10 Jun 2014 22:52:44 -0600 Subject: [PATCH 7/8] linked puppet url --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 26db987..245ce01 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ SublimePuppet ============= -Puppet (puppetlabs.com) highlighting, snippets and completion for Sublime Text 2 & 3. - -Now with windows parsing support. +[Puppet](puppetlabs.com) highlighting, snippets and completion for Sublime Text 2 & 3. Now with windows parsing support. ### Plugin installation Please use [Package Control][pc] to install this plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here. From 90db5636b34843e7edbf5f4b7d0f7a2a6b208b53 Mon Sep 17 00:00:00 2001 From: Peter Souter Date: Mon, 1 Sep 2014 12:01:10 +0100 Subject: [PATCH 8/8] Update README Closes #4 #5 --- README.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 245ce01..ff05b63 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,38 @@ SublimePuppet -============= +================================== [Puppet](puppetlabs.com) highlighting, snippets and completion for Sublime Text 2 & 3. Now with windows parsing support. ### Plugin installation -Please use [Package Control][pc] to install this plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here. -To install via Package Control, do the following: +#### Package Manager -1. Within Sublime Text, bring up the [Command Palette][cmd] and type `install`. Among the commands you should see `Package Control: Install Package`. If that command is not highlighted, use the keyboard or mouse to select it. There will be a pause of a few seconds while Package Control fetches the list of available plugins. +First, install the Package Control plugin, instructions here: http://wbond.net/sublime_packages/package_control. -1. When the plugin list appears, type `puppet`. Among the entries you should see `SublimePuppet`. If that entry is not highlighted, use the keyboard or mouse to select it. +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: @@ -19,7 +41,7 @@ Before using this plugin, you must ensure that `puppet` is installed on your sys 1. Install `puppet` by typing the following in a terminal: ``` - [sudo] gem install puppet + 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.