You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by to...@apache.org on 2015/03/18 21:43:10 UTC

svn commit: r1667614 - in /sling/trunk/contrib/sling-s3: Makefile scripts/download_dependencies.rb

Author: tomekr
Date: Wed Mar 18 20:43:10 2015
New Revision: 1667614

URL: http://svn.apache.org/r1667614
Log:
Added install-deps goal

Added:
    sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb   (with props)
Modified:
    sling/trunk/contrib/sling-s3/Makefile

Modified: sling/trunk/contrib/sling-s3/Makefile
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/sling-s3/Makefile?rev=1667614&r1=1667613&r2=1667614&view=diff
==============================================================================
--- sling/trunk/contrib/sling-s3/Makefile (original)
+++ sling/trunk/contrib/sling-s3/Makefile Wed Mar 18 20:43:10 2015
@@ -41,5 +41,8 @@ update-bundles:
 	rm crank.d/*-sling-startlevel-*.txt
 	$(BUNDLES)
 
+install-deps:
+	./scripts/download_dependencies.rb *.d/*
+
 clean:
 	rm -rf target sling

Added: sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb?rev=1667614&view=auto
==============================================================================
--- sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb (added)
+++ sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb Wed Mar 18 20:43:10 2015
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+
+DEP_PLUGIN = 'org.apache.maven.plugins:maven-dependency-plugin:2.10:get'
+SNAPSHOT_REPO = 'https://repository.apache.org/content/repositories/snapshots'
+LOCAL_REPO = '~/.m2/repository'
+
+def download groupId, artifactId, version
+  puts "#{groupId}:#{artifactId}:#{version}"
+  local = "#{LOCAL_REPO}/#{groupId.gsub('.', '/')}/#{artifactId}/#{version}"
+  if File.exists?(File.expand_path(local))
+    puts "(/) Already installed"
+    return
+  end
+  result = `mvn #{DEP_PLUGIN}\
+            -DremoteRepositories=#{SNAPSHOT_REPO}\
+            -Dartifact=#{groupId}:#{artifactId}:#{version}`
+  if result.include? 'BUILD SUCCESS'
+    puts "(/) Downloaded"
+  else
+    puts "(X) Error\n#{result}"
+  end
+end
+
+defaults = Hash.new
+
+ARGV.each do |f|
+  File.open(f).each_line do |l|
+    defaults.each { |k, v| l[k] &&= v }
+    if l =~ /^bundle mvn:([^\/]+)\/([^\/]+)\/(.+)$/
+      download($1, $2, $3)
+    elsif l =~ /^defaults ([^ ]+) ([^ ]+)$/
+      defaults["${#{$1}}"] = $2
+    end
+  end
+end

Propchange: sling/trunk/contrib/sling-s3/scripts/download_dependencies.rb
------------------------------------------------------------------------------
    svn:executable = *