Module: Merb::RakeHelper

Extended by:
GemManagement
Defined in:
lib/merb-core/tasks/merb_rake_helper.rb

Class Method Summary collapse

Methods included from GemManagement

ensure_bin_wrapper_for, install_gem, install_gem_from_cache, install_gem_from_src, uninstall_gem, which

Methods included from ColorfulMessages

#error, #success, #warning

Class Method Details

.install(name, options = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/merb-core/tasks/merb_rake_helper.rb', line 8

def self.install(name, options = {})
  defaults = { :cache => false }
  defaults[:install_dir] = ENV['GEM_DIR'] if ENV['GEM_DIR']
  opts = defaults.merge(options)
  install_gem_from_src(Dir.pwd, opts)
  ensure_wrapper(opts[:install_dir] || Gem.default_dir, name)
end

.install_package(pkg, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/merb-core/tasks/merb_rake_helper.rb', line 16

def self.install_package(pkg, options = {})
  defaults = { :cache => false }
  defaults[:install_dir] = ENV['GEM_DIR'] if ENV['GEM_DIR']
  opts = defaults.merge(options)
  install_gem(pkg, opts)
  name = File.basename(pkg, '.gem')[/^(.*?)-([\d\.]+)$/, 1]
  ensure_wrapper(opts[:install_dir] || Gem.default_dir, name)
end

.sudoObject



31
32
33
34
# File 'lib/merb-core/tasks/merb_rake_helper.rb', line 31

def self.sudo
  ENV['MERB_SUDO'] ||= "sudo"
  sudo = windows? ? "" : ENV['MERB_SUDO']
end

.uninstall(name, options = {}) ⇒ Object



25
26
27
28
29
# File 'lib/merb-core/tasks/merb_rake_helper.rb', line 25

def self.uninstall(name, options = {})
  defaults = { :ignore => true, :executables => true }
  defaults[:install_dir] = ENV['GEM_DIR'] if ENV['GEM_DIR']
  uninstall_gem(name, defaults.merge(options))
end

.windows?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/merb-core/tasks/merb_rake_helper.rb', line 36

def self.windows?
  (PLATFORM =~ /win32|cygwin/) rescue nil
end