Skip to content

Instantly share code, notes, and snippets.

@OsQu
Created November 19, 2014 08:05
Show Gist options
  • Save OsQu/2a9193a08d2393b6f60c to your computer and use it in GitHub Desktop.
Save OsQu/2a9193a08d2393b6f60c to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'JSON'
if File.exists?("package.json")
package_json = JSON.load(File.read("package.json"))
engines = package_json["engines"]
node_version = if !engines.nil? && engines.has_key?("node")
engines["node"]
else
nil
end
puts node_version
else
puts "default"
end
@OsQu
Copy link
Author

OsQu commented Nov 19, 2014

Add it to PATH and give executable rights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment