Created
November 19, 2014 08:05
-
-
Save OsQu/2a9193a08d2393b6f60c to your computer and use it in GitHub Desktop.
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add it to PATH and give executable rights.