Builds a new Rack::Builder with the middleware and the app
13405
def build
      @builder = Rack::Builder.new

      @middlewares.each do |middleware|
        if middleware[0] == :map
          @builder.map(middleware[1], &middleware[2])
        else
          @builder.use(*middleware[0], &middleware[1])
        end
      end

      @builder.run(@app)
    end
752062
def _build_app(args, extra_args):
    

    if not args.remote:
        # LOCAL BUILD

        try:
            output = build_and_upload_locally(
                args.src_dir,
                args.mode,
                overwrite=args.overwrite,
                archive=args.archive,
                publish=args.publish,
                destination_override=args.destination,
                version_override=args.version_override,
                bill_to_override=args.bill_to,
                use_temp_build_project=args.use_temp_build_project,
                do_parallel_build=args.parallel_build,
                do_version_autonumbering=args.version_autonumbering,
                do_try_update=args.update,
                dx_toolkit_autodep=args.dx_toolkit_autodep,
                do_check_syntax=args.check_syntax,
                ensure_upload=args.ensure_upload,
                force_symlinks=args.force_symlinks,
                dry_run=args.dry_run,
                confirm=args.confirm,
                return_object_dump=args.json,
                region=args.region,
                **extra_args
                )

            if output is not None and args.run is None:
                print(json.dumps(output))
        except dxpy.app_builder.AppBuilderException as e:
            # AppBuilderException represents errors during app or applet building
            # that could reasonably have been anticipated by the user.
            print("Error: %s" % (e.args,), file=sys.stderr)
            sys.exit(3)
        except dxpy.exceptions.DXAPIError as e:
            print("Error: %s" % (e,), file=sys.stderr)
            sys.exit(3)

        if args.dry_run:
            return None

        return output['id']

    else:
        # REMOTE BUILD

        try:
            app_json = _parse_app_spec(args.src_dir)
            _check_suggestions(app_json, publish=args.publish)
            _verify_app_source_dir(args.src_dir, args.mode)
            if args.mode == "app" and not args.dry_run:
                dxpy.executable_builder.verify_developer_rights('app-' + app_json['name'])
        except dxpy.app_builder.AppBuilderException as e:
            print("Error: %s" % (e.args,), file=sys.stderr)
            sys.exit(3)

        # The following flags might be useful in conjunction with
        # --remote. To enable these, we need to learn how to pass these
        # options through to the interior call of dx_build_app(let).
        if args.dry_run:
            parser.error('--remote cannot be combined with --dry-run')
        if args.overwrite:
            parser.error('--remote cannot be combined with --overwrite/-f')
        if args.archive:
            parser.error('--remote cannot be combined with --archive/-a')

        # The following flags are probably not useful in conjunction
        # with --remote.
        if args.json:
            parser.error('--remote cannot be combined with --json')
        if not args.use_temp_build_project:
            parser.error('--remote cannot be combined with --no-temp-build-project')

        if isinstance(args.region, list) and len(args.region) > 1:
            parser.error('--region can only be specified once for remote builds')
        region = args.region[0] if args.region is not None else None

        more_kwargs = {}
        if args.version_override:
            more_kwargs['version_override'] = args.version_override
        if args.bill_to:
            more_kwargs['bill_to_override'] = args.bill_to
        if not args.version_autonumbering:
            more_kwargs['do_version_autonumbering'] = False
        if not args.update:
            more_kwargs['do_try_update'] = False
        if not args.parallel_build:
            more_kwargs['do_parallel_build'] = False
        if not args.check_syntax:
            more_kwargs['do_check_syntax'] = False

        return _build_app_remote(args.mode, args.src_dir, destination_override=args.destination,
                                 publish=args.publish, dx_toolkit_autodep=args.dx_toolkit_autodep,
                                 region=region, watch=args.watch, **more_kwargs)
91834
def build(name, options={})
      @builds[name] = build = Build.new(options)
      with_scope(build) { yield }
    end
864825
def instantiate_builder
      klass = TinyCI::Builders.const_get(@config[:builder][:class])
      klass.new(@config[:builder][:config].merge(target: export_path), logger: @logger)
    end
164407
def make_middleware(app=None, *args, **kw):
    
    app = iWSGIMiddleware(app, *args, **kw)
    return app
1067272
def application
      return @app if @app
      
      @stack.use Rack::HtmlValidator if self.options[:validate]
      @stack.run Rack::HtmlMockup.new(self.project)
      
      @app = @stack
    end
1322377
def call_builder_init(cls, kb_app, sphinx_app: Sphinx):
        

        # Find and commit docs project plugins
        conf_dir = sphinx_app.confdir
        plugins_dir = sphinx_app.config.kaybee_settings.plugins_dir
        full_plugins_dir = os.path.join(conf_dir, plugins_dir)

        if os.path.exists(full_plugins_dir):
            sys.path.insert(0, conf_dir)
            plugin_package = importlib.import_module(plugins_dir)
            importscan.scan(plugin_package)
        else:
            logger.info(f'## Kaybee: No plugin dir at {plugins_dir}')

        dectate.commit(kb_app)
        for callback in cls.get_callbacks(kb_app, SphinxEvent.BI):
            callback(kb_app, sphinx_app)
177651
def apply_middleware(*middlewares):
    
    def inner(create_store_):
        def create_wrapper(reducer, enhancer=None):
            store = create_store_(reducer, enhancer)
            dispatch = store['dispatch']
            middleware_api = {
                'get_state': store['get_state'],
                'dispatch': lambda action: dispatch(action),
            }
            chain = [mw(middleware_api) for mw in middlewares]
            dispatch = compose(*chain)(store['dispatch'])

            return extend(store, {'dispatch': dispatch})
        return create_wrapper
    return inner
414177
def stack(options={}, &block)
      @stack ||= begin
        if block_given?
          Faraday::RackBuilder.new(&block)
        else
          Faraday::RackBuilder.new(&default_middleware(options))
        end
      end
    end
335336
def create(self, **kwargs):
        
        resource = self.resource.create(kwargs)
        if 'admin_token' in kwargs:
            resource.context.authorize('Gem-Application',
                                       api_token=resource.api_token,
                                       admin_token=kwargs['admin_token'])
        app = self.wrap(resource)
        return self.add(app)
962827
def call(env)
      @request = Rack::Request.new(env)
      xml_response = @xmlrpc_handler.process(request_body)
      [200, {'Content-Type' => 'text/xml'}, [xml_response]]
    end
912607
def buildpacks_for_app
      raise "#{source_dir} does not exist" unless File.directory?(source_dir)
      @buildpacks_for_app ||= begin
        mode, buildpacks = distribution.buildpacks
        case mode
        when :custom
          buildpacks.find_all do |buildpack|
            buildpack.setup(config.edge, config.home)
            buildpack.detect(source_dir)
          end
        else
          [buildpacks.find do |buildpack|
            buildpack.setup(config.edge, config.home)
            buildpack.detect(source_dir)
          end].compact
        end
      end
    end
1044297
function () {
		var start = Date.now();
		gutil.log('Building APP bundle');
		appBundler.bundle()
			.on('error', gutil.log)
			.pipe(source('main.js'))
			.pipe(gulpif(!isDevelopment, streamify(uglify())))
			.pipe(gulp.dest(configs.folders[options.environment]))
			.pipe(notify(function () {
				gutil.log('APP bundle built in ' + (Date.now() - start) + 'ms');
			}))
			.pipe(connect.reload());
	}
512727
def add_middleware(self, middleware):
        """"""
        if self.middleware is None:
            self._middleware = []
        self.middleware.append(middleware)
677679
def build(associations, base_klass)
      associations.map do |name, right|
        if name.is_a? Join
          reflection = find_reflection base_klass, name.name
          reflection.check_validity!
          reflection.check_eager_loadable!

          klass = if reflection.polymorphic?
            name.klass || base_klass
          else
            reflection.klass
          end
          JoinAssociation.new(reflection, build(right, klass), alias_tracker, name.klass, name.type)
        else
          reflection = find_reflection base_klass, name
          reflection.check_validity!
          reflection.check_eager_loadable!

          if reflection.polymorphic?
            raise ActiveRecord::EagerLoadPolymorphicError.new(reflection)
          end
          JoinAssociation.new(reflection, build(right, reflection.klass), alias_tracker)
        end
      end
    end
1029272
def make_middleware(app=None, *args, **kw):
    
    app = RaptorizeMiddleware(app, *args, **kw)
    return app
343117
function build() {
    const p = pending = new Emitter()
    buffer = bundler.toString()

    if (p !== pending) return
    pending.emit('ready', null, pending = false)
  }