Class: Gem::Micro::Config
- Inherits:
-
Object
- Object
- Gem::Micro::Config
- Extended by:
- Utils
- Defined in:
- lib/microgem/config.rb
Class Attribute Summary collapse
-
.force ⇒ Object
writeonly
Sets the attribute force.
-
.log_level ⇒ Object
Returns the current log level, which is
:infoor:debug. -
.simple_downloader ⇒ Object
writeonly
Sets the attribute simple_downloader.
-
.simple_unpacker ⇒ Object
writeonly
Sets the attribute simple_unpacker.
Class Method Summary collapse
-
.bin_dir ⇒ Object
Returns the full path to the bin directory.
-
.cache_path ⇒ Object
Returns the full path to the directory where the gems are cached.
-
.force? ⇒ Boolean
Returns whether or not actions should be forced.
-
.gem_home ⇒ Object
Returns the full path to the Gem home directory.
-
.gems_path ⇒ Object
Returns the full path to the directory where the installed gems are.
-
.merge!(options) ⇒ Object
Merges the values from the
optionshash. -
.simple_downloader? ⇒ Boolean
Returns whether or not to use
curlinstead of Net::HTTP. -
.simple_unpacker? ⇒ Boolean
Returns whether or not to use the external
xinflateinstead of Zlib::Inflate.inflate. -
.sources ⇒ Object
Returns an array of source hosts from which to fetch gems.
-
.specifications_path ⇒ Object
Returns the full path to the directory where the installed gem specs are.
Methods included from Utils
config, ensure_dir, log, replace, tmpdir
Class Attribute Details
.force=(value) ⇒ Object (writeonly)
Sets the attribute force
56 57 58 |
# File 'lib/microgem/config.rb', line 56 def force=(value) @force = value end |
.log_level ⇒ Object
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
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
56 57 58 |
# File 'lib/microgem/config.rb', line 56 def simple_unpacker=(value) @simple_unpacker = value end |
Class Method Details
.bin_dir ⇒ Object
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.("../../../tmp/bin", __FILE__)) end end |
.cache_path ⇒ Object
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.
64 65 66 |
# File 'lib/microgem/config.rb', line 64 def force? @force ||= false end |
.gem_home ⇒ Object
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.("../../Gems/#{version}", sitelibdir) else File.("../../../tmp/gem_home", __FILE__) end) end |
.gems_path ⇒ Object
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!() .each { |k,v| send("#{k}=", v) } end |
.simple_downloader? ⇒ Boolean
Returns whether or not to use curl instead of Net::HTTP.
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.
75 76 77 |
# File 'lib/microgem/config.rb', line 75 def simple_unpacker? @simple_unpacker ||= false end |
.sources ⇒ Object
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_path ⇒ Object
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 |