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
# 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)
  @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

#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



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

def classpath_file
  '.jbundler/classpath.rb'
end

#gemfile_lockObject



77
78
79
# File 'lib/jbundler/config.rb', line 77

def gemfile_lock
  "#{gemfile}.lock"
end

#jarfile_lockObject



69
70
71
# File 'lib/jbundler/config.rb', line 69

def jarfile_lock
  "#{jarfile}.lock"
end

#mirrorObject



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

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

#proxyObject



99
100
101
# File 'lib/jbundler/config.rb', line 99

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

#rubygems_mirrorObject



110
111
112
113
114
115
# File 'lib/jbundler/config.rb', line 110

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