Title: [587] trunk/rails-integration/plugins/goldspike-snapshot/lib: replacing log instead of puts
Revision
587
Author
fausto
Date
2007-05-14 16:25:15 -0400 (Mon, 14 May 2007)

Log Message

replacing log instead of puts

Modified Paths


Diff

Modified: trunk/rails-integration/plugins/goldspike-snapshot/lib/packer.rb (586 => 587)


--- trunk/rails-integration/plugins/goldspike-snapshot/lib/packer.rb	2007-05-14 20:23:00 UTC (rev 586)
+++ trunk/rails-integration/plugins/goldspike-snapshot/lib/packer.rb	2007-05-14 20:25:15 UTC (rev 587)
@@ -66,13 +66,18 @@
     end
     
     def add_java_libraries
+      WLog.info("Packing needed Java libraries ...")
       staging = config.staging
       lib = File.join(staging, 'WEB-INF', 'lib')
+      WLog.debug("assembling files in " + lib + " directory")
       File.makedirs(lib)
+      WLog.debug("need to assemble #{config.java_libraries.size} libraries")
       for library in config.java_libraries.values
+        WLog.debug("library to assemble " + library.name )
         target = File.join(lib, library.file)
+        WLog.debug("should install to " + target)
         unless File.exists?(target)
-          WLog.info "  Adding Java library #{library}"
+          WLog.info "  adding Java library #{library}"
           library.install(config, target)
         end
       end
@@ -87,6 +92,7 @@
     
     def add_ruby_libraries
       # add the gems
+      WLog.info("Packing needed Ruby gems ...")
       gem_home = File.join(config.staging, 'WEB-INF', 'gems')
       File.makedirs(gem_home)
       File.makedirs(File.join(gem_home, 'gems'))
@@ -106,7 +112,7 @@
 
       unless File.exists?(gem_target)
         # package up the gem
-        puts "  Adding Ruby gem #{gem.name} version #{gem.version}"
+        WLog.info "  adding Ruby gem #{gem.name} version #{gem.version}"
         # copy the specification
         install(gem.loaded_from, File.join(target_gem_home, 'specifications'), 0644)
         # copy the files
@@ -151,7 +157,7 @@
     
     def add_webapp
       staging = config.staging
-      puts '  Adding web application'
+      WLog.info 'Packing web application ...'
       File.makedirs(staging)
       webapp_files = Rake::FileList.new(File.join('.', '**', '*'))
       webapp_files.exclude(staging)

Modified: trunk/rails-integration/plugins/goldspike-snapshot/lib/util.rb (586 => 587)


--- trunk/rails-integration/plugins/goldspike-snapshot/lib/util.rb	2007-05-14 20:23:00 UTC (rev 586)
+++ trunk/rails-integration/plugins/goldspike-snapshot/lib/util.rb	2007-05-14 20:25:15 UTC (rev 587)
@@ -12,8 +12,9 @@
   
   class WLog
     @@logger_inst = Logger.new(STDOUT)
+    #@@logger_inst.level = Logger::Severity::DEBUG
     @@logger_inst.level = Logger::Severity::INFO
-  
+    
     def self.level=(level_req) 
       @@logger_inst.level = level_req
     end

Modified: trunk/rails-integration/plugins/goldspike-snapshot/lib/war_config.rb (586 => 587)


--- trunk/rails-integration/plugins/goldspike-snapshot/lib/war_config.rb	2007-05-14 20:23:00 UTC (rev 586)
+++ trunk/rails-integration/plugins/goldspike-snapshot/lib/war_config.rb	2007-05-14 20:25:15 UTC (rev 587)
@@ -61,7 +61,7 @@
 
     def initialize
 
-      WLog.debug("initializing configuration")
+      WLog.debug("initializing configuration ...")
       # default internal locations
       @staging = RAILS_ROOT
       @excludes = []
@@ -88,11 +88,11 @@
 
       @java_libraries = {}
       # default java libraries
-      add_java_library(maven_library('org.jruby', 'jruby-complete', '0.9.9'))
-      add_java_library(maven_library('org.jruby.extras', 'goldspike', '1.2'))
-      add_java_library(maven_library('javax.activation', 'activation', '1.1'))
-      add_java_library(maven_library('commons-pool', 'commons-pool', '1.3'))
-      add_java_library(maven_library('bouncycastle', 'bcprov-jdk14', '124'))
+      add_library(maven_library('org.jruby', 'jruby-complete', '0.9.9'))
+      add_library(maven_library('org.jruby.extras', 'goldspike', '1.2'))
+      add_library(maven_library('javax.activation', 'activation', '1.1'))
+      add_library(maven_library('commons-pool', 'commons-pool', '1.3'))
+      add_library(maven_library('bouncycastle', 'bcprov-jdk14', '124'))
 
       # default gems
       @gem_libraries = {}
@@ -127,6 +127,7 @@
       end
 
       # load user configuration
+      WLog.debug("loading user configuration ...")
       load_user_configuration
     end # initialize
     
@@ -154,29 +155,29 @@
           War::Configuration::DSL.evaluate(user_config, self)
         rescue => e
           puts e.backtrace.join("\n")
-          puts "Error reading user configuration (#{e.message}), using defaults"
+                WLog.error("Error reading user configuration (#{e.message}), using defaults")
         end
       end
     end
 
     def java_library(name, version)
-      WLog.debug("defining java library : " + name + " " + version)
+      WLog.debug("add java library : " + name + " " + version)
       # check local sources first, then the list
       JavaLibrary.new(name, version, self)
     end
 
     def maven_library(group, name, version)
-      WLog.debug("defining maven library : " + group + " " + name + " " + version)
+      WLog.debug("add maven library : " + group + " " + name + " " + version)
       #locations = maven_locations(group, name, version)
       MavenLibrary.new(group, name, version, self)
     end
 
-    def add_java_library(lib)
-      @java_libraries[lib.artifact] = lib
+    def add_library(lib)
+      @java_libraries[lib.name] = lib
     end
 
     def add_jetty_library(lib)
-      @jetty_libraries[lib.artifact] = lib
+      @jetty_libraries[lib.name] = lib
     end
 
     def add_gem(name, match_version=nil)
@@ -202,76 +203,76 @@
 
       # method hook for name property
       def war_file(*val)
-        puts "Warning: property 'name' takes only one argument" if val.size > 1
+        WLog.warn "property 'war_file' takes only one argument" if val.size > 1
         @result.war_file = val[0]
       end
       
       def exclude_files(*val)
-        puts "Warning: property 'exclude_files' takes only one argument" if val.size > 1
+        WLog.warn "property 'exclude_files' takes only one argument" if val.size > 1
         @result.exclude_files(val[0])
       end
 
       def servlet(*val)
-        puts "Warning: property 'servlet' takes only one argument" if val.size > 1
+        WLog.warn "property 'servlet' takes only one argument" if val.size > 1
         @result.servlet = val[0]
       end
 
       def compile_ruby(*val)
-        puts "Warning: property 'compile_ruby' takes only one argument" if val.size > 1
+        WLog.warn "property 'compile_ruby' takes only one argument" if val.size > 1
         unless is_either_true_or_false?(val[0])
-          puts "Warning: property 'compile_ruby' must be either true or false"
+          WLog.warn "property 'compile_ruby' must be either true or false"
           return
         end
         @result.compile_ruby = val[0]
       end
 
       def add_gem_dependencies(*val)
-        puts "Warning: property 'add_gem_dependencies' takes only one argument" if val.size > 1
+        WLog.warn "property 'add_gem_dependencies' takes only one argument" if val.size > 1
         unless is_either_true_or_false?(val[0])
-          puts "Warning: property 'add_gem_dependencies' must be either true or false"
+          WLog.warn "property 'add_gem_dependencies' must be either true or false"
           return
         end
         @result.add_gem_dependencies = val[0]
       end
 
       def keep_source(*val)
-        puts "Warning: property 'keep_source' takes only one argument" if val.size > 1
+        WLog.warn "property 'keep_source' takes only one argument" if val.size > 1
         unless is_either_true_or_false?(val[0])
-          puts "Warning: property 'keep_source' must be either true or false"
+          WLog.warn "property 'keep_source' must be either true or false"
           return
         end
         @result.keep_source = val[0]
       end
       
       def add_gem(*val)
-        puts "Warning: add_gem takes at most two arguments" if val.size > 2
+        WLog.warn "add_gem takes at most two arguments" if val.size > 2
         @result.add_gem(val[0], val[1])
       end
 
       def datasource_jndi(*val)
-        puts "Warning: property 'datasource_jndi' takes only one argument" if val.size > 1
+        WLog.warn "property 'datasource_jndi' takes only one argument" if val.size > 1
         unless is_either_true_or_false?(val[0])
-          puts "Warning: property 'datasource_jndi' must be either true or false"
+          WLog.warn "property 'datasource_jndi' must be either true or false"
           return
         end
         @result.datasource_jndi = val[0]
       end
 
       def datasource_jndi_name(*val)
-        puts "Warning: datasource_jndi_name takes at most one argument" if val.size > 1
+        WLog.warn "datasource_jndi_name takes at most one argument" if val.size > 1
         @result.datasource_jndi_name = val[0]
       end
 
       # method hook for library property
       def include_library(name, properties)
         if properties == nil or properties[:version] == nil or properties[:locations] == nil
-          puts "Warning: in library #{name}, 'version' and 'locations' specifications are mandatory"
+          WLog.warn "in include_library #{name}, 'version' and 'locations' specifications are mandatory"
           return
         end
         begin
           @result.add_java_library(@result.java_library(name, properties[:version], properties[:locations]))
         rescue
-          puts "Warning: couldn't load library #{name}, check library definition in the config file"
+          WLog.warn "couldn't load library #{name}, check library definition in the config file"
         end
       end
 
@@ -280,7 +281,7 @@
         begin
           @result.add_java_library(@result.maven_library(group, name, version))
         rescue
-          puts "Warning: couldn't load maven library #{name}, check library definition in the config file"
+          WLog.warn "couldn't load maven library #{name}, check library definition in the config file"
         end
       end
 
@@ -288,7 +289,7 @@
       # is met in the dsl. By now, just ignore it and print a warning
       # message
       def method_missing(name, *args)
-        puts "Warning: property '#{name}' in config file not defined"
+        WLog.warn "property '#{name}' in config file not defined, ignoring it ..."
       end
 
       # main parsing method. pass the file name for the dsl and the configuration
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to