lib/jbundler/config.rb in jbundler-0.5.3 vs lib/jbundler/config.rb in jbundler-0.5.4

- old
+ new

@@ -1,7 +1,7 @@ # -# Copyright (C) 2013 Kristian Meier +# Copyright (C) 2013 Christian Meier # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of @@ -23,27 +23,31 @@ module JBundler # allow yaml config in $HOME/.jbundlerrc and $PWD/.jbundlerrc class Config - attr_accessor :verbose, :local_repository, :jarfile, :gemfile, :skip, :settings, :offline, :work_dir + attr_accessor :verbose, :local_repository, :jarfile, :gemfile, :skip, :settings, :offline, :work_dir, :vendor_dir def initialize file = '.jbundlerrc' homefile = File.join(ENV['HOME'], file) home_config = YAML.load_file(homefile) if File.exists?(homefile) pwd_config = YAML.load_file(file) if File.exists?(file) + File.expand_path( file ) @config = (home_config || {}).merge(pwd_config || {}) end if defined? JRUBY_VERSION def jbundler_env(key) - @config[key.downcase.sub(/^j?bundle_/, '').sub(/[.]/, '_')] || java.lang.System.getProperty(key.downcase.gsub(/_/, '.')) || ENV[key.upcase.gsub(/[.]/, '_')] + java.lang.System.getProperty(key.downcase.gsub(/_/, '.')) || + ENV[key.upcase.gsub(/[.]/, '_')] || + @config[key.downcase.sub(/^j?bundle_/, '').sub(/[.]/, '_')] end else def jbundler_env(key) - @config[key.downcase.sub(/^j?bundler/, '').sub(/[.]/, '_')] || ENV[key.upcase.gsub(/[.]/, '_')] + ENV[key.upcase.gsub(/[.]/, '_')] || + @config[key.downcase.sub(/^j?bundler/, '').sub(/[.]/, '_')] end end private :jbundler_env def skip @@ -77,11 +81,11 @@ def gemfile_lock "#{gemfile}.lock" end def classpath_file - '.jbundler/classpath.rb' + jbundler_env('JBUNDLE_CLASSPATH_FILE') || '.jbundler/classpath.rb' end def local_repository # use maven default local repo as default @local_maven_repository ||= jbundler_env('JBUNDLE_LOCAL_REPOSITORY') @@ -114,9 +118,13 @@ @rubygems_mirror end def work_dir @work_dir ||= jbundler_env('JBUNDLE_WORK_DIR') || 'target' + end + + def vendor_dir + @vendor_dir ||= jbundler_env('JBUNDLE_VENDOR_DIR') || File.join( 'vendor', 'jars' ) end end end