项目作者: pumlhorse

项目描述 :
VS Code extension for Pumlhorse
高级语言: TypeScript
项目地址: git://github.com/pumlhorse/pumlhorse-vscode.git
创建时间: 2017-02-11T19:12:36Z
项目社区:https://github.com/pumlhorse/pumlhorse-vscode

开源协议:MIT License

下载


Pumlhorse Visual Studio Code extension

Pumlhorse is a scripting language with a simple, highly readable syntax. It can be used for automated testing, workflows, scripting utilities, and much more. More information is available on the Pumlhorse site.

Commands

Access the Command Palette by pressing the beaker icon in the lower left or by using the shortcut ctrl+alt+p p. This menu lets you:

  • Run the current file (ctrl+alt+p c)
  • Run all files in the workspace (ctrl+alt+p a)
  • Run a profile (ctrl+alt+p o)
  • Set the current profile

Running Scripts

When you run a script, the output will show in the Pumlhorse console.

In addition to the Command Palette, you can run a single file with the “play” button on the top right of the file editor.

You can also right-click a file or folder and choose “Run in Pumlhorse”

Running Profiles

Profiles allow you to run complex configurations in one go. For instance, you may have a set of scripts you want to run
all at the same time. You can create a profile that includes those scripts.

Another common situation is using context files to extract environmental variables from the script. This allows you to have a single script that can be run in multiple
environments. In this case, you can create a profile that uses those context files.

Sample Scripts

Try these scripts to get a feel for what Pumlhorse can do.

Print the latest version of Pumlhorse

  1. name: Find the latest version of Pumlhorse
  2. steps:
  3. - response = http.get:
  4. url: https://api.github.com/repos/pumlhorse/pumlhorse/contents/package.json
  5. headers:
  6. Accept: application/vnd.github.v3+json
  7. - http.isOk: $response # Ensure we got back a 200
  8. - decoded = convertFromBase64: $response.json.content
  9. - packageData = fromJson: $decoded
  10. - log: Current version of Pumlhorse is $packageData.version
  11. functions:
  12. convertFromBase64:
  13. - input
  14. - return new Buffer(input, 'base64').toString('utf-8')

Print OS information

  1. name: Print OS information
  2. steps:
  3. # Log OS information using the Node 'os' module
  4. - osMod = import: os
  5. - log: HOSTNAME: $osMod.hostname()
  6. - log: RUNNING
  7. - log: OPERATING SYSTEM: $osMod.type() $osMod.arch()
  8. - log: CPU CORES: $osMod.cpus().length
  9. - log: TOTAL MEMORY: ${ osMod.totalmem() / 1000000 } MB

Check whether it’s the weekend

  1. name: Check if it's the weekend
  2. functions:
  3. getTodaysDate:
  4. - return new Date().getDay()
  5. steps:
  6. - dayOfWeek = getTodaysDate
  7. - if:
  8. value: ${ dayOfWeek == 5 }
  9. is true:
  10. - log: Congratulations, today is Friday!
  11. is false:
  12. - if:
  13. value: ${ dayOfWeek == 6 || dayOfWeek == 0}
  14. is true:
  15. - log: Congratulations, it's the weekend!
  16. is false:
  17. - log: Sorry, it's still not the weekend...

Feedback

I am very interested in any feedback on this extension or Pumlhorse in general. Please feel free to submit an issue on Github.