diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-04-27 07:23:55 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-04-27 07:23:55 -0700 |
| commit | fad94ba5006d3ef9423fb684eeeb0639adb94ec3 (patch) | |
| tree | b2f4db3dd1cbe463edb3fbcafdbc1248d87a5888 | |
| parent | 495f66b9f17a36f9e85b370d9d51d5d8809b3ae8 (diff) | |
| parent | 3875140afe6c83868d4469fd170d831bef71a310 (diff) | |
| download | mruby-fad94ba5006d3ef9423fb684eeeb0639adb94ec3.tar.gz mruby-fad94ba5006d3ef9423fb684eeeb0639adb94ec3.zip | |
Merge pull request #1218 from bovi/gembox
GemBox
| -rw-r--r-- | build_config.rb | 57 | ||||
| -rw-r--r-- | mrbgems/default.gembox | 49 | ||||
| -rw-r--r-- | mrbgems/full-core.gembox | 8 | ||||
| -rw-r--r-- | tasks/mrbgem_spec.rake | 7 | ||||
| -rw-r--r-- | tasks/mruby_build_gem.rake | 7 | ||||
| -rw-r--r-- | travis_config.rb | 8 |
6 files changed, 75 insertions, 61 deletions
diff --git a/build_config.rb b/build_config.rb index 31d20d4fa..a6502ac86 100644 --- a/build_config.rb +++ b/build_config.rb @@ -11,61 +11,8 @@ MRuby::Build.new do |conf| # conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master' # conf.gem :git => '[email protected]:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v' - # Use standard Kernel#sprintf method - conf.gem "#{root}/mrbgems/mruby-sprintf" - - # Use standard print/puts/p - conf.gem "#{root}/mrbgems/mruby-print" - - # Use standard Math module - conf.gem "#{root}/mrbgems/mruby-math" - - # Use standard Time class - conf.gem "#{root}/mrbgems/mruby-time" - - # Use standard Struct class - conf.gem "#{root}/mrbgems/mruby-struct" - - # Use extensional Enumerable module - conf.gem "#{root}/mrbgems/mruby-enum-ext" - - # Use extensional String class - conf.gem "#{root}/mrbgems/mruby-string-ext" - - # Use extensional Numeric class - conf.gem "#{root}/mrbgems/mruby-numeric-ext" - - # Use extensional Array class - conf.gem "#{root}/mrbgems/mruby-array-ext" - - # Use extensional Hash class - conf.gem "#{root}/mrbgems/mruby-hash-ext" - - # Use extensional Range class - conf.gem "#{root}/mrbgems/mruby-range-ext" - - # Use extensional Proc class - conf.gem "#{root}/mrbgems/mruby-proc-ext" - - # Use extensional Symbol class - conf.gem "#{root}/mrbgems/mruby-symbol-ext" - - # Use Random class - conf.gem "#{root}/mrbgems/mruby-random" - - # No use eval method - # conf.gem "#{root}/mrbgems/mruby-eval" - - - # Generate binaries - # conf.bins = %w(mrbc) - - # Generate mirb command - conf.gem "#{root}/mrbgems/mruby-bin-mirb" - - # Generate mruby command - conf.gem "#{root}/mrbgems/mruby-bin-mruby" - + # include the default GEMs + conf.gembox 'default' # C compiler settings # conf.cc do |cc| diff --git a/mrbgems/default.gembox b/mrbgems/default.gembox new file mode 100644 index 000000000..7e81abd34 --- /dev/null +++ b/mrbgems/default.gembox @@ -0,0 +1,49 @@ +MRuby::GemBox.new do |conf| + # Use standard Kernel#sprintf method + conf.gem "#{root}/mrbgems/mruby-sprintf" + + # Use standard print/puts/p + conf.gem "#{root}/mrbgems/mruby-print" + + # Use standard Math module + conf.gem "#{root}/mrbgems/mruby-math" + + # Use standard Time class + conf.gem "#{root}/mrbgems/mruby-time" + + # Use standard Struct class + conf.gem "#{root}/mrbgems/mruby-struct" + + # Use extensional Enumerable module + conf.gem "#{root}/mrbgems/mruby-enum-ext" + + # Use extensional String class + conf.gem "#{root}/mrbgems/mruby-string-ext" + + # Use extensional Numeric class + conf.gem "#{root}/mrbgems/mruby-numeric-ext" + + # Use extensional Array class + conf.gem "#{root}/mrbgems/mruby-array-ext" + + # Use extensional Hash class + conf.gem "#{root}/mrbgems/mruby-hash-ext" + + # Use extensional Range class + conf.gem "#{root}/mrbgems/mruby-range-ext" + + # Use extensional Proc class + conf.gem "#{root}/mrbgems/mruby-proc-ext" + + # Use extensional Symbol class + conf.gem "#{root}/mrbgems/mruby-symbol-ext" + + # Use Random class + conf.gem "#{root}/mrbgems/mruby-random" + + # Generate mirb command + conf.gem "#{root}/mrbgems/mruby-bin-mirb" + + # Generate mruby command + conf.gem "#{root}/mrbgems/mruby-bin-mruby" +end diff --git a/mrbgems/full-core.gembox b/mrbgems/full-core.gembox new file mode 100644 index 000000000..b9f19e452 --- /dev/null +++ b/mrbgems/full-core.gembox @@ -0,0 +1,8 @@ +MRuby::GemBox.new do |conf| + conf.gem "#{root}/mrbgems/mruby-sprintf" + conf.gem "#{root}/mrbgems/mruby-print" + + Dir.glob("#{root}/mrbgems/mruby-*") do |x| + conf.gem x unless x =~ /\/mruby-(print|sprintf)$/ + end +end diff --git a/tasks/mrbgem_spec.rake b/tasks/mrbgem_spec.rake index 564836630..eedc6480f 100644 --- a/tasks/mrbgem_spec.rake +++ b/tasks/mrbgem_spec.rake @@ -158,4 +158,11 @@ module MRuby end # Specification end # Gem + + GemBox = BasicObject.new + class << GemBox + def new(&block); block.call(self); end + def config=(obj); @config = obj; end + def gem(gemdir, &block); @config.gem(gemdir, &block); end + end # GemBox end # MRuby diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake index 358df1612..10e9b9692 100644 --- a/tasks/mruby_build_gem.rake +++ b/tasks/mruby_build_gem.rake @@ -1,5 +1,12 @@ module MRuby module LoadGems + def gembox(gemboxfile) + gembox = File.absolute_path("#{gemboxfile}.gembox", "#{MRUBY_ROOT}/mrbgems") + fail "Can't find gembox '#{gembox}'" unless File.exists?(gembox) + GemBox.config = self + instance_eval File.read(gembox) + end + def gem(gemdir, &block) caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1])) if gemdir.is_a?(Hash) diff --git a/travis_config.rb b/travis_config.rb index 0ba2c38f1..040b1a255 100644 --- a/travis_config.rb +++ b/travis_config.rb @@ -1,10 +1,6 @@ MRuby::Build.new do |conf| toolchain :gcc - conf.gem "#{root}/mrbgems/mruby-sprintf" - conf.gem "#{root}/mrbgems/mruby-print" - - Dir.glob("#{root}/mrbgems/mruby-*") do |x| - conf.gem x unless x =~ /\/mruby-(print|sprintf)$/ - end + # include all core GEMs + conf.gembox 'full-core' end |
