felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r771422 - in /felix/sandbox/gertv/scripts: ./ rename.rb
Date Mon, 04 May 2009 20:08:05 GMT
Author: gertv
Date: Mon May  4 20:08:04 2009
New Revision: 771422

URL: http://svn.apache.org/viewvc?rev=771422&view=rev
Log:
Keeping a copy of the rename script for Apache Felix Karaf around

Added:
    felix/sandbox/gertv/scripts/
    felix/sandbox/gertv/scripts/rename.rb   (with props)

Added: felix/sandbox/gertv/scripts/rename.rb
URL: http://svn.apache.org/viewvc/felix/sandbox/gertv/scripts/rename.rb?rev=771422&view=auto
==============================================================================
--- felix/sandbox/gertv/scripts/rename.rb (added)
+++ felix/sandbox/gertv/scripts/rename.rb Mon May  4 20:08:04 2009
@@ -0,0 +1,59 @@
+#!/usr/bin/ruby
+
+require 'ftools'
+
+SOURCES = ["main/java", "main/resources", "main/filtered-resources", "main/descriptors",
"main/distribution", "test/java", "test/resources"]
+
+def handlePom(pom)
+  puts "- Changing pom file"
+  filter(pom)
+end
+
+def handleSource(src)
+  puts "- Handing sources"
+  dirs = SOURCES.select { |dir| File.directory?("#{src}/#{dir}") }
+  dirs.each { |dir| handleSourceDir("#{src}/#{dir}") }
+end
+
+def handleSourceDir(src)
+  if File.directory?("#{src}/org/apache/servicemix/kernel")
+    File.makedirs "#{src}/org/apache/felix"
+    system "svn add #{src}/org/apache/felix"
+    system "svn move #{src}/org/apache/servicemix/kernel #{src}/org/apache/felix/karaf"
+  end
+
+  filterSources(src)
+end
+
+def filterSources(src)
+  Dir.foreach(src) do |file|
+    next if file =~ /^\./
+    if File.directory?("#{src}/#{file}") then
+      filterSources("#{src}/#{file}")
+    else
+      filter("#{src}/#{file}")
+    end
+  end
+end
+
+def filter(file)
+  puts "   #{file}"
+  File.move(file, file + ".orig", false)
+  File.open(file, "w") do |new|
+    IO.foreach(file + ".orig") do |line|
+      new.puts line.gsub(/org\.apache\.servicemix\.kernel/, "org.apache.felix.karaf").gsub(/Apache
ServiceMix Kernel/, "Apache Felix Karaf").gsub(/org\/apache\/servicemix\/kernel/, "org/apache/felix/karaf").gsub(/apache-servicemix-kernel/,
"apache-felix-karaf")
+    end
+  end
+end
+
+def walk(dir)
+  puts "In #{dir}"
+  Dir.foreach(dir) do |path|
+    handlePom("#{dir}/pom.xml") if path =~ /^pom\.xml$/
+    handleSource("#{dir}/src") if path =~ /src/
+    next if path =~ /^\./ or File.file?("#{dir}/#{path}") or path =~ /target/ or path =~
/src/
+    walk("#{dir}/#{path}") if File.directory?("#{dir}/#{path}")
+  end
+end
+
+walk(".")

Propchange: felix/sandbox/gertv/scripts/rename.rb
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message