Module: Mrbgem

Includes:
Enumerable
Defined in:
lib/mgem.rb

Constant Summary collapse

MGEM_VERSION =
'0.3.0'
MGEM_HOME =
ENV['MGEM_HOME']
MGEM_DIR =
'.mgem'
GEMS_ACTIVE =
'GEMS_ACTIVE.lst'
GEMS_LIST =
'mgem-list'
GEMS_REPO =
'https://github.com/mruby/mgem-list.git'
TOOLCHAINS =
{
  'gcc' => {:desc => 'GNU Compiler Collection', :id => 'gcc'},
  'clang' => {:desc => 'LLVM C Compiler', :id => 'clang'},
  'vc' => {:desc => 'Visual C++', :id => 'visualcpp'},
  'wrt' => {:desc => 'OpenWRT Build environment', :id => 'openwrt'},
  'ndk' => {:desc => 'Android NDK', :id => 'android'}
}

Instance Method Summary collapse

Instance Method Details

#initialize_mgem_list(config = {}) ⇒ Object


35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/mgem.rb', line 35

def initialize_mgem_list(config = {})
  unless File.exists? config[:mgem_list]
    puts "Loading fresh GEM list..."
    cmd = %Q(git clone "#{GEMS_REPO}" "#{config[:mgem_list]}")
    `#{cmd}`
    puts "done!"
  end

  unless File.exists? config[:mgem_active]
    FileUtils.touch config[:mgem_active]
  end
end

#load_gemsObject


24
25
26
27
28
29
30
31
32
33
# File 'lib/mgem.rb', line 24

def load_gems
  config = {}
  config[:mgem_dir] = [ENV["MGEM_HOME"], MGEM_DIR].join File::SEPARATOR
  config[:mgem_active] = [config[:mgem_dir], GEMS_ACTIVE].join File::SEPARATOR
  config[:mgem_list] = [config[:mgem_dir], GEMS_LIST].join File::SEPARATOR

  initialize_mgem_list(config)

  MrbgemList.new(config)
end