From 9dd539bb157e40e78791d83a89f4727d4b10115d Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Thu, 9 May 2013 17:05:59 +0500 Subject: remove unused variables --- minirake | 16 ++++++++-------- tasks/mrbgems.rake | 7 ++----- tasks/mrbgems_test.rake | 8 ++------ tasks/mruby_build_commands.rake | 9 ++------- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/minirake b/minirake index 40e0fe6bf..f41b9b587 100755 --- a/minirake +++ b/minirake @@ -101,7 +101,7 @@ module MiniRake puts "Execute #{name}" if $trace self.class.enhance_with_matching_rule(name) if @actions.empty? unless $dryrun - @actions.each { |act| result = act.call(self) } + @actions.each { |act| act.call(self) } end end @@ -160,14 +160,14 @@ module MiniRake lookup(task_name).enhance([deps].flatten, &block) end - # Define a rule for synthesizing tasks. + # Define a rule for synthesizing tasks. def create_rule(args, &block) pattern, deps = resolve_args(args) pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern RULES << [pattern, deps, block] end - + # Lookup a task. Return an existing task if found, otherwise # create a task of the current type. def lookup(task_name) @@ -181,7 +181,7 @@ module MiniRake # the enhanced task or nil of no rule was found. def enhance_with_matching_rule(task_name) RULES.each do |pattern, extensions, block| - if md = pattern.match(task_name) + if pattern.match(task_name) ext = extensions.first deps = extensions[1..-1] case ext @@ -201,8 +201,8 @@ module MiniRake end nil end - - private + + private # Resolve the arguments for a task/rule. def resolve_args(args) @@ -256,7 +256,7 @@ module MiniRake # demand. def directory(dir) path = [] - Sys.split_all(dir).each do |p| + Sys.split_all(dir).each do |p| path << p FileTask.define_task(File.join(path)) do |t| Sys.makedirs(t.name) @@ -415,7 +415,7 @@ class RakeApp fail "Unknown option: #{opt}" end end - + # Read and handle the command line options. def handle_options $verbose = false diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake index 43435cf0b..5f156c45a 100644 --- a/tasks/mrbgems.rake +++ b/tasks/mrbgems.rake @@ -1,12 +1,9 @@ MRuby.each_target do - current_dir = File.dirname(__FILE__).relative_path_from(Dir.pwd) - relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT) - if enable_gems? # set up all gems gems.each(&:setup) gems.check - + # loader all gems self.libmruby << objfile("#{build_dir}/mrbgems/gem_init") file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"] @@ -75,7 +72,7 @@ Additional Licenses Due to the reason that you choosed additional mruby packages (GEMS), please check the following additional licenses too: GEMS_LEGAL - + gems.map do |g| f.puts f.puts "GEM: #{g.name}" diff --git a/tasks/mrbgems_test.rake b/tasks/mrbgems_test.rake index b8d2d75d3..717f0d76b 100644 --- a/tasks/mrbgems_test.rake +++ b/tasks/mrbgems_test.rake @@ -1,8 +1,4 @@ MRuby.each_target do - current_dir = File.dirname(__FILE__).relative_path_from(Dir.pwd) - relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT) - current_build_dir = "#{build_dir}/#{relative_from_root}" - gems.each do |g| test_rbobj = g.test_rbireps.ext(exts.object) @@ -52,8 +48,8 @@ MRuby.each_target do f.puts %Q[ mrb_const_set(mrb2, mrb_obj_value(mrb2->object_class), mrb_intern(mrb2, "TEST_ARGS"), test_args_hash); ] end - f.puts %Q[ mrb_#{g.funcname}_gem_test(mrb2);] unless g.test_objs.empty? - + f.puts %Q[ mrb_#{g.funcname}_gem_test(mrb2);] unless g.test_objs.empty? + f.puts %Q[ mrb_load_irep(mrb2, gem_test_irep_#{g.funcname}_#{i});] f.puts %Q[ if (mrb2->exc) {] f.puts %Q[ mrb_p(mrb2, mrb_obj_value(mrb2->exc));] diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake index b968d07be..a47633c51 100644 --- a/tasks/mruby_build_commands.rake +++ b/tasks/mruby_build_commands.rake @@ -29,7 +29,7 @@ module MRuby sh build.filename(command) + ' ' + ( options % params ) end end - + class Command::Compiler < Command attr_accessor :flags, :include_paths, :defines, :source_exts attr_accessor :compile_options, :option_define, :option_include_path, :out_ext @@ -57,13 +57,9 @@ module MRuby end [flags, define_flags, include_path_flags, _flags].flatten.join(' ') end - + def run(outfile, infile, _defineds=[], _include_paths=[], _flags=[]) FileUtils.mkdir_p File.dirname(outfile) - define_flags = [defines, _defineds].flatten.map{ |d| option_define % d } - include_path_flags = [include_paths, _include_paths, File.dirname(infile)].flatten.map do |f| - option_include_path % filename(f) - end _pp "CC", infile.relative_path, outfile.relative_path if MRUBY_BUILD_HOST_IS_CYGWIN _run compile_options, { :flags => all_flags(_defineds, _include_paths, _flags), @@ -152,7 +148,6 @@ module MRuby def run(outfile, objfiles, _libraries=[], _library_paths=[], _flags=[], _flags_before_libraries=[], _flags_after_libraries=[]) FileUtils.mkdir_p File.dirname(outfile) library_flags = [libraries, _libraries].flatten.map { |d| option_library % d } - library_path_flags = [library_paths, _library_paths].flatten.map { |f| option_library_path % filename(f) } _pp "LD", outfile.relative_path if MRUBY_BUILD_HOST_IS_CYGWIN -- cgit v1.2.3