Class: JBundler::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/jbundler/config.rb

Overview

allow yaml config in $HOME/.jbundlerrc and $PWD/.jbundlerrc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



30
31
32
33
34
35
36
37
# File 'lib/jbundler/config.rb', line 30

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

Instance Attribute Details

#gemfileObject

Returns the value of attribute gemfile.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def gemfile
  @gemfile
end

#jarfileObject

Returns the value of attribute jarfile.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def jarfile
  @jarfile
end

#local_repositoryObject

Returns the value of attribute local_repository.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def local_repository
  @local_repository
end

#offlineObject

Returns the value of attribute offline.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def offline
  @offline
end

#settingsObject

Returns the value of attribute settings.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def settings
  @settings
end

#skipObject

Returns the value of attribute skip.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def skip
  @skip
end

#vendor_dirObject

Returns the value of attribute vendor_dir.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def vendor_dir
  @vendor_dir
end

#verboseObject

Returns the value of attribute verbose.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def verbose
  @verbose
end

#work_dirObject

Returns the value of attribute work_dir.



28
29
30
# File 'lib/jbundler/config.rb', line 28

def work_dir
  @work_dir
end

Instance Method Details

#classpath_fileObject



85
86
87
# File 'lib/jbundler/config.rb', line 85

def classpath_file
  jbundler_env('JBUNDLE_CLASSPATH_FILE') || '.jbundler/classpath.rb'
end

#gemfile_lockObject



81
82
83
# File 'lib/jbundler/config.rb', line 81

def gemfile_lock
  "#{gemfile}.lock"
end

#jarfile_lockObject



73
74
75
# File 'lib/jbundler/config.rb', line 73

def jarfile_lock
  "#{jarfile}.lock"
end

#mirrorObject



107
108
109
110
111
112
# File 'lib/jbundler/config.rb', line 107

def mirror
  @mirror ||= jbundler_env('JBUNDLE_MIRROR')
  # nice to have no leading slash
  @mirror = @mirror.sub( /\/$/, '' ) if @mirror
  @mirror
end

#proxyObject



103
104
105
# File 'lib/jbundler/config.rb', line 103

def proxy
  @proxy ||= jbundler_env('JBUNDLE_PROXY')
end

#rubygems_mirrorObject



114
115
116
117
118
119
# File 'lib/jbundler/config.rb', line 114

def rubygems_mirror
  @rubygems_mirror ||= jbundler_env('BUNDLE_RUBYGEMS_MIRROR')
  # here a leading slash is needed !!
 @rubygems_mirror =  @rubygems_mirror.sub( /([^\/])$/ , "\\1/" ) if @rubygems_mirror
  @rubygems_mirror
end