Use for both jets.gemspec and rake rdoc task
778174
def options
      exclude = %w[
        docs
        spec
        vendor
        core.rb
        .js
        templates
        commands
        internal
        support
        Dockerfile
        Dockerfile.base
        Gemfile
        Gemfile.lock
        Guardfile
        LICENSE
        Procfile
        Rakefile
        bin
      ]
      exclude = exclude.map { |word| ['-x', word] }.flatten
      ["-m", "README.md", "--markup", "tomdoc"] + exclude
    end
602155
def task_execution
      begin
        require 'rake'

        Rails.application.load_tasks
        ::Rake::Task[params[:task]].execute
      rescue StandardError => e
        flash[:alert] = e.message
      else
        flash[:notice] = "Task: #{params[:task]} has completed"
      end

      redirect_to root_path
    end
701599
def load_from(gemspec_path, pattern)
      Gem.refresh
      spec = Gem::Specification.load(gemspec_path)
      dependencies = spec.runtime_dependencies.concat(spec.development_dependencies)
      dependencies.each do |gem|
        gem_name = gem.name[pattern]
        next if gem_name.to_s.empty?
        register(gem_name, Plugin.new(gem_name, gem))
      end
      self
    end
117588
def setup_rake_dependencies(task, multitask = nil)
      dependencies.reverse_each do |d|
        begin
          bb = ALL_BUILDING_BLOCKS[d]
          raise "Error: tried to add the dependencies of \"#{d}\" to \"#{@name}\" but such a building block could not be found!" unless bb

          if multitask and bb.pre_step
            multitask.prerequisites.unshift(bb.get_task_name)
          else
            task.prerequisites.unshift(bb.get_task_name)
          end
        rescue ExitHelperException
          raise
        rescue Exception => e
          Printer.printError e.message
          ExitHelper.exit(1)
        end
      end

      task
    end
808985
def rake(file = nil, options = {})
      if file.nil?
        perform_set_operation :rake, options
      else
        file = File.expand_path(file)
        chdir(File.dirname(file)) do
          perform_set_operation(:rake, options.merge(:rakefile => file))
        end
      end
    end
183709
def define # :nodoc:

      actual_name = Hash === name ? name.keys.first : name
      unless ::Rake.application.last_comment
        desc "Run JShint"
      end
      task name do
        unless js_file_list.empty?
          result = Jshintrb::report(js_file_list, @options, @globals, STDERR)
          if result.size > 0
            abort("JSHint check failed") if fail_on_error
          end
        end
      end

      self
    end
1363909
def have_rakefile # :nodoc:
      @rakefiles.each do |fn|
        if File.exist?(fn)
          others = FileList.glob(fn, File::FNM_CASEFOLD)
          return others.size == 1 ? others.first : fn
        elsif fn == ""
          return fn
        end
      end
      return nil
    end
816417
def define
      super
      task :package => [:gem]
      desc "Build the gem file #{gem_file}"
      task :gem => ["#{package_dir}/#{gem_file}"]
      file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do
        when_writing("Creating GEM") {
          Gem::Builder.new(gem_spec).build
          verbose(true) {
            mv gem_file, "#{package_dir}/#{gem_file}"
          }
        }
      end
    end
963380
def convert_to_rake()
      object_multitask = prepare_tasks_for_objects()
      archiver = @tcs[:ARCHIVER]

      res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do
        cmd = calc_command_line
        aname = calc_archive_name
        Dir.chdir(@project_dir) do
          FileUtils.rm(aname) if File.exists?(aname)
#          cmd.map! {|c| c.include?(' ') ? "\"#{c}\"" : c }
          rd, wr = IO.pipe
          cmd << {
            :err => wr,
            :out => wr
          }
          sp = spawn(*cmd)
          cmd.pop

          consoleOutput = ProcessHelper.readOutput(sp, rd, wr)

          process_result(cmd, consoleOutput, @tcs[:ARCHIVER][:ERROR_PARSER], "Creating #{aname}")

          check_config_file()
        end
      end
      res.tags = tags
      enhance_with_additional_files(res)
      add_output_dir_dependency(get_task_name, res, true)

      add_grouping_tasks(get_task_name)

      setup_rake_dependencies(res, object_multitask)
      return res
    end
1189721
def setup
      self.class.load_yard

      if File.exist?(@doc_dir)
        raise Gem::FilePermissionError, @doc_dir unless File.writable?(@doc_dir)
      else
        FileUtils.mkdir_p @doc_dir
      end
    end
992516
def rake_require(file_name, paths=$LOAD_PATH, loaded=$")
      fn = file_name + ".rake"
      return false if loaded.include?(fn)
      paths.each do |path|
        full_path = File.join(path, fn)
        if File.exist?(full_path)
          Rake.load_rakefile(full_path)
          loaded << fn
          return true
        end
      end
      fail LoadError, "Can't find #{file_name}"
    end
878466
def run(args = ARGV)
      opts.parse!(args)

      if !analyze_gemfile? && args.empty?
        puts opts.parser
        exit 1
      end

      print_requires(options, args)
    end
288957
def gemspec_filename(gem_version = nil)
      gem_version ||= version.to_s
      n = [name, gem_version]
      n.push(@platform) if @platform != 'ruby'
      "#{n.join('-')}.gemspec.rz"
    end
843414
def execute_tasks(tasks,template_path)
      
      if File.exists?(File.expand_path(File.join(template_path,'tasks.rb')))
        load File.expand_path(File.join(template_path,'tasks.rb'))
      end
       
      tasks.each{
        |task|
        
        puts 'Running Task: ' + task
        
        task = replace_tags(task);
        
        options = task.split(', ')
        action = options.slice!(0)
        
        if(Tasks.respond_to?(action))
          Tasks.send action, options.join(', ')
        else
          send action, options.join(', ')
        end
        
      }
                  
    end
332764
function runTool(platform, args_, done) {
  var args = optimist.argv;
  var allzones = args['allzones'];

  var inputFile = args['_'][0];
  if (!inputFile) {
    console.log('usage: dump.js [--allzones] file.wtf-trace');
    done(1);
    return;
  }
  console.log('Dumping ' + inputFile + '...');
  console.log('');

  wtf.db.load(inputFile, function(db) {
    if (db instanceof Error) {
      console.log('ERROR: unable to open ' + inputFile, db, db.stack);
      done(1);
    } else {
      done(dumpDatabase(db, allzones));
    }
  });
}
723203
function(args, done) {
  debug('checking required files with args', args);
  var dir = path.resolve(args['<directory>']);

  var tasks = [
    'README*',
    'LICENSE',
    '.travis.yml',
    '.gitignore'
  ].map(function requireFileExists(pattern) {
    return function(cb) {
      glob(pattern, {
        cwd: dir
      }, function(err, files) {
        debug('resolved %s for `%s`', files, pattern);
        if (err) {
          return cb(err);
        }
        if (files.length === 0) {
          return done(new Error('missing required file matching ' + pattern));
        }
        if (files.length > 1) {
          return done(new Error('more than one file matched ' + pattern));
        }

        fs.exists(files[0], function(exists) {
          if (!exists) {
            return done(new Error('missing required file matching ' + files[0]));
          }
          return cb(null, files[0]);
        });
      });
    };
  });
  async.parallel(tasks, done);
}
774897
def load_tasks
      return if @loaded

      # By convention, the '*_helper.rb' files are helpers and need to be loaded first. Load
      # them into the Thor::Sandbox namespace
      Dir.glob( File.join(File.dirname(__FILE__), '**', '*.rb')  ).each do |task|
        if task.match(/_helper\.rb$/)
          #logger.debug "load_thorfile helper: #{task}"
          ::Thor::Util.load_thorfile task
        end
      end

      # Now load the thor files
      Dir.glob( File.join(File.dirname(__FILE__), '**', '*.rb')  ).each do |task|
        unless task.match(/_helper\.rb$/)
          #logger.debug "load_thorfile: #{task}"
          ::Thor::Util.load_thorfile task
        end
      end

      # load user tasks
      if user_tasks_folder
        Dir.glob( File.join([user_tasks_folder, '**', '*.{rb,thor}'])  ).each { |task| ::Thor::Util.load_thorfile task if task.match(/_helper\.rb$/) }
        Dir.glob( File.join([user_tasks_folder, '**', '*.{rb,thor}'])  ).each { |task| ::Thor::Util.load_thorfile task unless task.match(/_helper\.rb$/) }
      end

      @loaded = true
    end