test/test_helper.rb in ruboto-0.10.2 vs test/test_helper.rb in ruboto-0.11.0.rc.0

- old
+ new

@@ -18,11 +18,11 @@ ENV['GEM_PATH'] = GEM_PATH ENV['PATH'] = "#{GEM_PATH}/bin:#{ENV['PATH']}" Gem.paths = GEM_PATH Gem.refresh `gem query -i -n bundler` - system 'gem install bundler -v "!=1.3.1" --no-ri --no-rdoc' unless $? == 0 + system 'gem install bundler --no-ri --no-rdoc' unless $? == 0 `bundle check` system 'bundle --system' unless $? == 0 lib_path = File.expand_path('lib', File.dirname(File.dirname(__FILE__))) $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path) require 'ruboto' @@ -109,11 +109,11 @@ puts "RUBOTO_PLATFORM: #{RUBOTO_PLATFORM}" install_jruby_jars_gem unless RUBOTO_PLATFORM == 'CURRENT' if RUBOTO_PLATFORM == 'CURRENT' - JRUBY_JARS_VERSION = Gem::Version.new('1.7.1') + JRUBY_JARS_VERSION = Gem::Version.new('1.7.3') else # FIXME(uwe): Simplify when we stop supporting rubygems < 1.8.0 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0') gem_spec = Gem::Specification.find_by_path 'jruby-jars' else @@ -162,12 +162,14 @@ end def generate_app(options = {}) example = options.delete(:example) || false update = options.delete(:update) || false + # FIXME(uwe): Remove exclusion feature excluded_stdlibs = options.delete(:excluded_stdlibs) - standalone = options.delete(:standalone) || !!excluded_stdlibs || ENV['RUBOTO_PLATFORM'] == 'STANDALONE' + included_stdlibs = options.delete(:included_stdlibs) + standalone = options.delete(:standalone) || !!included_stdlibs || !!excluded_stdlibs || ENV['RUBOTO_PLATFORM'] == 'STANDALONE' bundle = options.delete(:bundle) raise "Unknown options: #{options.inspect}" unless options.empty? Dir.mkdir TMP_DIR unless File.exists? TMP_DIR FileUtils.rm_rf APP_DIR if File.exists? APP_DIR @@ -175,10 +177,11 @@ template_dir << "_example_#{example}" if example template_dir << "_bundle_#{[*bundle].join('_')}" if bundle template_dir << '_updated' if update template_dir << '_standalone' if standalone template_dir << "_without_#{excluded_stdlibs.map { |ed| ed.gsub(/[.\/]/, '_') }.join('_')}" if excluded_stdlibs + template_dir << "_with_#{included_stdlibs.map { |ed| ed.gsub(/[.\/]/, '_') }.join('_')}" if included_stdlibs if File.exists?(template_dir) puts "Copying app from template #{template_dir}" FileUtils.cp_r template_dir, APP_DIR, :preserve => true else install_jruby_jars_gem @@ -208,10 +211,11 @@ raise "gen app failed with return code #$?" end Dir.chdir APP_DIR do write_gemfile(bundle) if bundle if standalone + include_stdlibs(included_stdlibs) if included_stdlibs exclude_stdlibs(excluded_stdlibs) if excluded_stdlibs system "#{RUBOTO_CMD} gen jruby" raise "update jruby failed with return code #$?" if $? != 0 end end @@ -273,19 +277,24 @@ FileUtils.rm_rf 'tmp/RubotoCore' fail 'Error (un)installing RubotoCore' end end + def include_stdlibs(included_stdlibs) + puts "Adding ruboto.yml: #{included_stdlibs.join(' ')}" + File.open('ruboto.yml', 'w') { |f| f << YAML.dump({:included_stdlibs => included_stdlibs}) } + end + def exclude_stdlibs(excluded_stdlibs) puts "Adding ruboto.yml: #{excluded_stdlibs.join(' ')}" File.open('ruboto.yml', 'w') { |f| f << YAML.dump({:excluded_stdlibs => excluded_stdlibs}) } end def write_gemfile(bundle) gems = [*bundle] puts "Adding Gemfile.apk: #{gems.join(' ')}" File.open('Gemfile.apk', 'w') do |f| - f << "source :rubygems\n\n" + f << "source 'https://rubygems.org/'\n\n" gems.each{|g| f << "gem '#{g}'\n"} end end end