Class: Gem::Micro::Config

Inherits:
Object
  • Object
show all
Extended by:
Utils
Defined in:
lib/microgem/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Utils

config, ensure_dir, log, replace, tmpdir

Class Attribute Details

.force=(value) ⇒ Object (writeonly)

Sets the attribute force

Parameters:

  • value

    the value to set the attribute force to.



56
57
58
# File 'lib/microgem/config.rb', line 56

def force=(value)
  @force = value
end

.log_levelObject

Returns the current log level, which is :info or :debug.



59
60
61
# File 'lib/microgem/config.rb', line 59

def log_level
  @log_level ||= :info
end

.simple_downloader=(value) ⇒ Object (writeonly)

Sets the attribute simple_downloader

Parameters:

  • value

    the value to set the attribute simple_downloader to.



56
57
58
# File 'lib/microgem/config.rb', line 56

def simple_downloader=(value)
  @simple_downloader = value
end

.simple_unpacker=(value) ⇒ Object (writeonly)

Sets the attribute simple_unpacker

Parameters:

  • value

    the value to set the attribute simple_unpacker to.



56
57
58
# File 'lib/microgem/config.rb', line 56

def simple_unpacker=(value)
  @simple_unpacker = value
end

Class Method Details

.bin_dirObject

Returns the full path to the bin directory.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/microgem/config.rb', line 21

def bin_dir
  @bin_dir ||= if ENV['PRODUCTION']
    if macruby?
      '/usr/local/bin'
    elsif osx_default_ruby?
      '/usr/bin'
    else
      ::Config::CONFIG['bindir']
    end
  else
    ensure_dir(File.expand_path("../../../tmp/bin", __FILE__))
  end
end

.cache_pathObject

Returns the full path to the directory where the gems are cached.



47
48
49
# File 'lib/microgem/config.rb', line 47

def cache_path
  @cache_path ||= ensure_dir(File.join(gem_home, 'cache'))
end

.force?Boolean

Returns whether or not actions should be forced.

Returns:

  • (Boolean)


64
65
66
# File 'lib/microgem/config.rb', line 64

def force?
  @force ||= false
end

.gem_homeObject

Returns the full path to the Gem home directory.



10
11
12
13
14
15
16
17
18
# File 'lib/microgem/config.rb', line 10

def gem_home
  @gem_home ||= ensure_dir(if ENV['PRODUCTION']
    sitelibdir = ::Config::CONFIG['sitelibdir']
    version = ::Config::CONFIG['ruby_version']
    File.expand_path("../../Gems/#{version}", sitelibdir)
  else
    File.expand_path("../../../tmp/gem_home", __FILE__)
  end)
end

.gems_pathObject

Returns the full path to the directory where the installed gems are.



36
37
38
# File 'lib/microgem/config.rb', line 36

def gems_path
  @gems_path ||= ensure_dir(File.join(gem_home, 'gems'))
end

.merge!(options) ⇒ Object

Merges the values from the options hash.



80
81
82
# File 'lib/microgem/config.rb', line 80

def merge!(options)
  options.each { |k,v| send("#{k}=", v) }
end

.simple_downloader?Boolean

Returns whether or not to use curl instead of Net::HTTP.

Returns:

  • (Boolean)


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

def simple_downloader?
  @simple_downloader ||= false
end

.simple_unpacker?Boolean

Returns whether or not to use the external xinflate instead of Zlib::Inflate.inflate.

Returns:

  • (Boolean)


75
76
77
# File 'lib/microgem/config.rb', line 75

def simple_unpacker?
  @simple_unpacker ||= false
end

.sourcesObject

Returns an array of source hosts from which to fetch gems.



52
53
54
# File 'lib/microgem/config.rb', line 52

def sources
  %w{ gems.rubyforge.org gems.github.com }
end

.specifications_pathObject

Returns the full path to the directory where the installed gem specs are.



42
43
44
# File 'lib/microgem/config.rb', line 42

def specifications_path
  @specifications_path ||= ensure_dir(File.join(gem_home, 'specifications'))
end