mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #1228 from bovi/mrbgems-core-gem
Implementation of :core parameter for conf.gem
This commit is contained in:
+16
-16
@@ -1,49 +1,49 @@
|
||||
MRuby::GemBox.new do |conf|
|
||||
# Use standard Kernel#sprintf method
|
||||
conf.gem "#{root}/mrbgems/mruby-sprintf"
|
||||
conf.gem :core => "mruby-sprintf"
|
||||
|
||||
# Use standard print/puts/p
|
||||
conf.gem "#{root}/mrbgems/mruby-print"
|
||||
conf.gem :core => "mruby-print"
|
||||
|
||||
# Use standard Math module
|
||||
conf.gem "#{root}/mrbgems/mruby-math"
|
||||
conf.gem :core => "mruby-math"
|
||||
|
||||
# Use standard Time class
|
||||
conf.gem "#{root}/mrbgems/mruby-time"
|
||||
conf.gem :core => "mruby-time"
|
||||
|
||||
# Use standard Struct class
|
||||
conf.gem "#{root}/mrbgems/mruby-struct"
|
||||
conf.gem :core => "mruby-struct"
|
||||
|
||||
# Use extensional Enumerable module
|
||||
conf.gem "#{root}/mrbgems/mruby-enum-ext"
|
||||
conf.gem :core => "mruby-enum-ext"
|
||||
|
||||
# Use extensional String class
|
||||
conf.gem "#{root}/mrbgems/mruby-string-ext"
|
||||
conf.gem :core => "mruby-string-ext"
|
||||
|
||||
# Use extensional Numeric class
|
||||
conf.gem "#{root}/mrbgems/mruby-numeric-ext"
|
||||
conf.gem :core => "mruby-numeric-ext"
|
||||
|
||||
# Use extensional Array class
|
||||
conf.gem "#{root}/mrbgems/mruby-array-ext"
|
||||
conf.gem :core => "mruby-array-ext"
|
||||
|
||||
# Use extensional Hash class
|
||||
conf.gem "#{root}/mrbgems/mruby-hash-ext"
|
||||
conf.gem :core => "mruby-hash-ext"
|
||||
|
||||
# Use extensional Range class
|
||||
conf.gem "#{root}/mrbgems/mruby-range-ext"
|
||||
conf.gem :core => "mruby-range-ext"
|
||||
|
||||
# Use extensional Proc class
|
||||
conf.gem "#{root}/mrbgems/mruby-proc-ext"
|
||||
conf.gem :core => "mruby-proc-ext"
|
||||
|
||||
# Use extensional Symbol class
|
||||
conf.gem "#{root}/mrbgems/mruby-symbol-ext"
|
||||
conf.gem :core => "mruby-symbol-ext"
|
||||
|
||||
# Use Random class
|
||||
conf.gem "#{root}/mrbgems/mruby-random"
|
||||
conf.gem :core => "mruby-random"
|
||||
|
||||
# Generate mirb command
|
||||
conf.gem "#{root}/mrbgems/mruby-bin-mirb"
|
||||
conf.gem :core => "mruby-bin-mirb"
|
||||
|
||||
# Generate mruby command
|
||||
conf.gem "#{root}/mrbgems/mruby-bin-mruby"
|
||||
conf.gem :core => "mruby-bin-mruby"
|
||||
end
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
MRuby::GemBox.new do |conf|
|
||||
conf.gem "#{root}/mrbgems/mruby-sprintf"
|
||||
conf.gem "#{root}/mrbgems/mruby-print"
|
||||
conf.gem :core => "mruby-sprintf"
|
||||
conf.gem :core => "mruby-print"
|
||||
|
||||
Dir.glob("#{root}/mrbgems/mruby-*") do |x|
|
||||
conf.gem x unless x =~ /\/mruby-(print|sprintf)$/
|
||||
g = File.basename(x)
|
||||
conf.gem :core => g unless g =~ /^mruby-(print|sprintf)$/
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ module MRuby
|
||||
def gem(gemdir, &block)
|
||||
caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1]))
|
||||
if gemdir.is_a?(Hash)
|
||||
gemdir = load_external_gem(gemdir)
|
||||
gemdir = load_special_path_gem(gemdir)
|
||||
else
|
||||
gemdir = File.expand_path(gemdir, caller_dir)
|
||||
end
|
||||
@@ -28,14 +28,16 @@ module MRuby
|
||||
Gem.current
|
||||
end
|
||||
|
||||
def load_external_gem(params)
|
||||
def load_special_path_gem(params)
|
||||
if params[:github]
|
||||
params[:git] = "https://github.com/#{params[:github]}.git"
|
||||
elsif params[:bitbucket]
|
||||
params[:git] = "https://bitbucket.org/#{params[:bitbucket]}.git"
|
||||
end
|
||||
|
||||
if params[:git]
|
||||
if params[:core]
|
||||
gemdir = "#{root}/mrbgems/#{params[:core]}"
|
||||
elsif params[:git]
|
||||
url = params[:git]
|
||||
gemdir = "build/mrbgems/#{url.match(/([-_\w]+)(\.[-_\w]+|)$/).to_a[1]}"
|
||||
return gemdir if File.exists?(gemdir)
|
||||
@@ -45,11 +47,11 @@ module MRuby
|
||||
|
||||
FileUtils.mkdir_p "build/mrbgems"
|
||||
git.run_clone gemdir, url, options
|
||||
|
||||
gemdir
|
||||
else
|
||||
fail "unknown gem option #{params}"
|
||||
end
|
||||
|
||||
gemdir
|
||||
end
|
||||
|
||||
def enable_gems?
|
||||
|
||||
Reference in New Issue
Block a user