-
-
Save havenwood/a69b8f6a079711d16ec6a98d9acf7887 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
require 'fileutils' | |
require 'open-uri' | |
require 'rexml/document' | |
JAR_DIR = 'jars' | |
LAMBDA_JAVA_URL = 'http://central.maven.org/maven2/com/amazonaws/aws-lambda-java-core' | |
FileUtils.mkdir_p JAR_DIR | |
def save_jar jar_url | |
IO.copy_stream open(jar_url), File.join(JAR_DIR, File.basename(jar_url)) | |
end | |
## | |
# Fetch the latest jruby-complete.jar: | |
html = open 'http://jruby.org/download', &:read | |
save_jar html[/[^']*.jar/] | |
## | |
# Fetch the latest aws-lambda-java-core.jar: | |
xml = open "#{LAMBDA_JAVA_URL}/maven-metadata.xml", &:read | |
rexml = REXML::Document.new xml | |
version = rexml.elements['metadata/versioning/latest'].text | |
save_jar "#{LAMBDA_JAVA_URL}/#{version}/aws-lambda-java-core-#{version}.jar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment