content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
simplify the alias_attribute example [ci skip]
7e26f7f0f7e3c230c333e1b265727a9b8cf7c91f
<ide><path>activemodel/lib/active_model/attribute_methods.rb <ide> def attribute_method_affix(*affixes) <ide> <ide> # Allows you to make aliases for attributes. <ide> # <del> # For example: <del> # <ide> # class Person <del> # <del> # include ActiveModel::AttributeMethods <ide> # attr_accessor :name <del> # attribute_method_prefix 'clear_' <del> # <del> # define_attribute_methods [:name] <del> # <del> # private <del> # <del> # def clear_attribute(attr) <del> # send("#{attr}=", nil) <del> # end <del> # end <del> # <del> # class Person <del> # attr_accessor :nickname <del> # <ide> # alias_attribute :nickname, :name <ide> # end <ide> # <ide> # person = Person.new <ide> # person.nickname = "Bob" <ide> # person.nickname # => "Bob" <del> # person.clear_nickname <del> # person.nickname # => nil <add> # person.name # => "Bob" <ide> def alias_attribute(new_name, old_name) <ide> attribute_method_matchers.each do |matcher| <ide> matcher_new = matcher.method_name(new_name).to_s
1
Javascript
Javascript
use shorter promise.resolve for empty blocks
d1efe5b5fc07b789c20536514f79aaf21a87b1bd
<ide><path>lib/dependencies/DepBlockHelpers.js <ide> DepBlockHelpers.getDepBlockPromise = (depBlock, outputOptions, requestShortener, <ide> return `Promise.all${name}(${pathChunkCheck ? Template.toComment(shortChunkName) : ""}[${chunks.map(requireChunkId).join(", ")}])`; <ide> } <ide> } <del> return "new Promise(function(resolve) { resolve(); })"; <add> return "Promise.resolve()"; <ide> };
1
Ruby
Ruby
use homebrew_repository for freshness check
c947dbc58028f6c8efe40e9b3206c04e62fe73e5
<ide><path>Library/Homebrew/cmd/doctor.rb <ide> def check_for_bad_python_symlink <ide> end <ide> <ide> def check_for_outdated_homebrew <del> HOMEBREW_PREFIX.cd do <add> HOMEBREW_REPOSITORY.cd do <ide> timestamp = if File.directory? ".git" <ide> `git log -1 --format="%ct" HEAD`.to_i <ide> else <del> (HOMEBREW_PREFIX/"Library").mtime.to_i <add> (HOMEBREW_REPOSITORY/"Library").mtime.to_i <ide> end <ide> <ide> if Time.now.to_i - timestamp > 60 * 60 * 24 then <<-EOS.undent
1
Text
Text
update object example in using objects for lookups
9b95c2d95e35dd71872244c9ea33cdb0b6d8ee61
<ide><path>curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md <ide> dashedName: using-objects-for-lookups <ide> <ide> Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to lookup values rather than a `switch` statement or an `if/else` chain. This is most useful when you know that your input data is limited to a certain range. <ide> <del>Here is an example of a simple reverse alphabet lookup: <add>Here is an example of an article object: <ide> <ide> ```js <del>const alpha = { <del> 1:"Z", <del> 2:"Y", <del> 3:"X", <del> 4:"W", <del> ... <del> 24:"C", <del> 25:"B", <del> 26:"A" <add>const article = { <add> "title": "How to create objects in JavaScript", <add> "link": "https://www.freecodecamp.org/news/a-complete-guide-to-creating-objects-in-javascript-b0e2450655e8/", <add> "author": "Kaashan Hussain", <add> "language": "JavaScript", <add> "tags": "TECHNOLOGY", <add> "createdAt": "NOVEMBER 28, 2018" <ide> }; <ide> <del>const thirdLetter = alpha[2]; <del>const lastLetter = alpha[24]; <add>const articleAuthor = article[author]; <add>const articleLink = article[link]; <ide> <del>const value = 2; <del>const valueLookup = alpha[value]; <add>const value = "title"; <add>const valueLookup = article[value]; <ide> ``` <ide> <del>`thirdLetter` is the string `Y`, `lastLetter` is the string `C`, and `valueLookup` is the string `Y`. <add>`articleAuthor` is the string `Kaashan Hussain`, `articleLink` is the string `https://www.freecodecamp.org/news/a-complete-guide-to-creating-objects-in-javascript-b0e2450655e8/`, and `valueLookup` is the string `How to create objects in JavaScript`. <ide> <ide> # --instructions-- <ide>
1
Javascript
Javascript
fix typo in test options
72dc37581c13362ee7bee60610cf42ae9e0fad4d
<ide><path>test/specs/controller.bar.tests.js <ide> describe('Chart.controllers.bar', function() { <ide> }, <ide> options: { <ide> elements: { <del> bars: { <add> bar: { <ide> backgroundColor: 'rgb(255, 0, 0)', <ide> borderColor: 'rgb(0, 0, 255)', <ide> borderWidth: 2,
1
PHP
PHP
fix incomplete test
afa0329330f7eb8884024cd30daf6cf6b50bd37f
<ide><path>lib/Cake/Test/Case/Utility/Set2Test.php <ide> public function testFormat() { <ide> * @return void <ide> */ <ide> public function testFormatNullValues() { <del> $this->markTestIncomplete('Not done yet'); <del> <ide> $data = array( <del> array('Person' => array('first_name' => 'Nate', 'last_name' => 'Abele', 'city' => 'Boston', 'state' => 'MA', 'something' => '42')), <del> array('Person' => array('first_name' => 'Larry', 'last_name' => 'Masters', 'city' => 'Boondock', 'state' => 'TN', 'something' => null)), <del> array('Person' => array('first_name' => 'Garrett', 'last_name' => 'Woodworth', 'city' => 'Venice Beach', 'state' => 'CA', 'something' => null))); <del> <del> $result = Set2::format($data, '%s', array('{n}.Person.something')); <add> array('Person' => array( <add> 'first_name' => 'Nate', 'last_name' => 'Abele', 'city' => 'Boston', 'state' => 'MA', 'something' => '42' <add> )), <add> array('Person' => array( <add> 'first_name' => 'Larry', 'last_name' => 'Masters', 'city' => 'Boondock', 'state' => 'TN', 'something' => null <add> )), <add> array('Person' => array( <add> 'first_name' => 'Garrett', 'last_name' => 'Woodworth', 'city' => 'Venice Beach', 'state' => 'CA', 'something' => null <add> )) <add> ); <add> <add> $result = Set2::format($data, array('{n}.Person.something'), '%s'); <ide> $expected = array('42', '', ''); <ide> $this->assertEquals($expected, $result); <ide> <del> $result = Set2::format($data, '{0}, {1}', array('{n}.Person.city', '{n}.Person.something')); <add> $result = Set2::format($data, array('{n}.Person.city', '{n}.Person.something'), '%s, %s'); <ide> $expected = array('Boston, 42', 'Boondock, ', 'Venice Beach, '); <ide> $this->assertEquals($expected, $result); <ide> }
1
Go
Go
add (hidden) flags to set containerd namespaces
24ad2f486d92681080a8e257760b047f8de2c71c
<ide><path>cmd/dockerd/config.go <ide> package main <ide> import ( <ide> "runtime" <ide> <add> "github.com/docker/docker/daemon" <ide> "github.com/docker/docker/daemon/config" <ide> "github.com/docker/docker/opts" <add> "github.com/docker/docker/plugin/executor/containerd" <ide> "github.com/docker/docker/registry" <ide> "github.com/spf13/pflag" <ide> ) <ide> func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error { <ide> <ide> conf.MaxConcurrentDownloads = &maxConcurrentDownloads <ide> conf.MaxConcurrentUploads = &maxConcurrentUploads <del> return nil <add> <add> flags.StringVar(&conf.ContainerdNamespace, "containerd-namespace", daemon.ContainersNamespace, "Containerd namespace to use") <add> if err := flags.MarkHidden("containerd-namespace"); err != nil { <add> return err <add> } <add> flags.StringVar(&conf.ContainerdPluginNamespace, "containerd-plugins-namespace", containerd.PluginNamespace, "Containerd namespace to use for plugins") <add> return flags.MarkHidden("containerd-plugins-namespace") <ide> } <ide> <ide> func installRegistryServiceFlags(options *registry.ServiceOptions, flags *pflag.FlagSet) { <ide><path>daemon/config/config.go <ide> type CommonConfig struct { <ide> Features map[string]bool `json:"features,omitempty"` <ide> <ide> Builder BuilderConfig `json:"builder,omitempty"` <add> <add> ContainerdNamespace string `json:"containerd-namespace,omitempty"` <add> ContainerdPluginNamespace string `json:"containerd-plugin-namespace,omitempty"` <ide> } <ide> <ide> // IsValueSet returns true if a configuration value <ide><path>daemon/daemon.go <ide> func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S <ide> grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(defaults.DefaultMaxSendMsgSize)), <ide> } <ide> if config.ContainerdAddr != "" { <del> d.containerdCli, err = containerd.New(config.ContainerdAddr, containerd.WithDefaultNamespace(ContainersNamespace), containerd.WithDialOpts(gopts), containerd.WithTimeout(60*time.Second)) <add> d.containerdCli, err = containerd.New(config.ContainerdAddr, containerd.WithDefaultNamespace(config.ContainerdNamespace), containerd.WithDialOpts(gopts), containerd.WithTimeout(60*time.Second)) <ide> if err != nil { <ide> return nil, errors.Wrapf(err, "failed to dial %q", config.ContainerdAddr) <ide> } <ide> func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S <ide> // Windows is not currently using containerd, keep the <ide> // client as nil <ide> if config.ContainerdAddr != "" { <del> pluginCli, err = containerd.New(config.ContainerdAddr, containerd.WithDefaultNamespace(pluginexec.PluginNamespace), containerd.WithDialOpts(gopts), containerd.WithTimeout(60*time.Second)) <add> pluginCli, err = containerd.New(config.ContainerdAddr, containerd.WithDefaultNamespace(config.ContainerdPluginNamespace), containerd.WithDialOpts(gopts), containerd.WithTimeout(60*time.Second)) <ide> if err != nil { <ide> return nil, errors.Wrapf(err, "failed to dial %q", config.ContainerdAddr) <ide> } <ide> } <ide> <del> return pluginexec.New(ctx, getPluginExecRoot(config.Root), pluginCli, m) <add> return pluginexec.New(ctx, getPluginExecRoot(config.Root), pluginCli, config.ContainerdPluginNamespace, m) <ide> } <ide> <ide> // Plugin system initialization should happen before restore. Do not change order. <ide> func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S <ide> <ide> go d.execCommandGC() <ide> <del> d.containerd, err = libcontainerd.NewClient(ctx, d.containerdCli, filepath.Join(config.ExecRoot, "containerd"), ContainersNamespace, d) <add> d.containerd, err = libcontainerd.NewClient(ctx, d.containerdCli, filepath.Join(config.ExecRoot, "containerd"), config.ContainerdNamespace, d) <ide> if err != nil { <ide> return nil, err <ide> } <ide><path>daemon/daemon_unix.go <ide> func (daemon *Daemon) initRuntimes(runtimes map[string]types.Runtime) (err error <ide> <ide> // verifyDaemonSettings performs validation of daemon config struct <ide> func verifyDaemonSettings(conf *config.Config) error { <add> if conf.ContainerdNamespace == conf.ContainerdPluginNamespace { <add> return errors.New("containers namespace and plugins namespace cannot be the same") <add> } <ide> // Check for mutually incompatible config options <ide> if conf.BridgeConfig.Iface != "" && conf.BridgeConfig.IP != "" { <ide> return fmt.Errorf("You specified -b & --bip, mutually exclusive options. Please specify only one") <ide><path>integration-cli/docker_cli_daemon_test.go <ide> import ( <ide> <ide> "github.com/cloudflare/cfssl/helpers" <ide> "github.com/docker/docker/api/types" <del> moby_daemon "github.com/docker/docker/daemon" <ide> "github.com/docker/docker/integration-cli/checker" <ide> "github.com/docker/docker/integration-cli/cli" <ide> "github.com/docker/docker/integration-cli/cli/build" <ide> func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *chec <ide> <ide> // kill the container <ide> icmd.RunCommand(ctrBinary, "--address", containerdSocket, <del> "--namespace", moby_daemon.ContainersNamespace, "tasks", "kill", id).Assert(c, icmd.Success) <add> "--namespace", d.ContainersNamespace(), "tasks", "kill", id).Assert(c, icmd.Success) <ide> <ide> // restart daemon. <ide> d.Restart(c) <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *check <ide> <ide> // kill the container <ide> icmd.RunCommand(ctrBinary, "--address", containerdSocket, <del> "--namespace", moby_daemon.ContainersNamespace, "tasks", "kill", cid).Assert(t, icmd.Success) <add> "--namespace", s.d.ContainersNamespace(), "tasks", "kill", cid).Assert(t, icmd.Success) <ide> <ide> // Give time to containerd to process the command if we don't <ide> // the exit event might be received after we do the inspect <ide> func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che <ide> result := icmd.RunCommand( <ide> ctrBinary, <ide> "--address", containerdSocket, <del> "--namespace", moby_daemon.ContainersNamespace, <add> "--namespace", s.d.ContainersNamespace(), <ide> "tasks", "resume", cid) <ide> result.Assert(t, icmd.Success) <ide> <ide><path>internal/test/daemon/daemon.go <ide> func New(t testingT, ops ...func(*Daemon)) *Daemon { <ide> return d <ide> } <ide> <add>// ContainersNamespace returns the containerd namespace used for containers. <add>func (d *Daemon) ContainersNamespace() string { <add> return d.id <add>} <add> <ide> // RootDir returns the root directory of the daemon. <ide> func (d *Daemon) RootDir() string { <ide> return d.Root <ide> func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error { <ide> if err != nil { <ide> return errors.Wrapf(err, "[%s] could not find docker binary in $PATH", d.id) <ide> } <add> <ide> args := append(d.GlobalFlags, <ide> "--containerd", containerdSocket, <ide> "--data-root", d.Root, <ide> "--exec-root", d.execRoot, <ide> "--pidfile", fmt.Sprintf("%s/docker.pid", d.Folder), <ide> fmt.Sprintf("--userland-proxy=%t", d.userlandProxy), <add> "--containerd-namespace", d.id, <add> "--containerd-plugins-namespace", d.id+"p", <ide> ) <ide> if d.defaultCgroupNamespaceMode != "" { <ide> args = append(args, []string{"--default-cgroupns-mode", d.defaultCgroupNamespaceMode}...) <ide><path>plugin/executor/containerd/containerd.go <ide> type ExitHandler interface { <ide> } <ide> <ide> // New creates a new containerd plugin executor <del>func New(ctx context.Context, rootDir string, cli *containerd.Client, exitHandler ExitHandler) (*Executor, error) { <add>func New(ctx context.Context, rootDir string, cli *containerd.Client, ns string, exitHandler ExitHandler) (*Executor, error) { <ide> e := &Executor{ <ide> rootDir: rootDir, <ide> exitHandler: exitHandler, <ide> } <ide> <del> client, err := libcontainerd.NewClient(ctx, cli, rootDir, PluginNamespace, e) <add> client, err := libcontainerd.NewClient(ctx, cli, rootDir, ns, e) <ide> if err != nil { <ide> return nil, errors.Wrap(err, "error creating containerd exec client") <ide> }
7
Ruby
Ruby
remove needless require
5ce59f456f4c77b93df69d617f9f20a62546b13e
<ide><path>activejob/lib/active_job/exceptions.rb <del>require 'active_job/arguments' <del> <ide> module ActiveJob <ide> # Provides behavior for retrying and discarding jobs on exceptions. <ide> module Exceptions
1
Javascript
Javascript
remove unneeded condition
3429991d8b43474cab58f067658b5ce81ace58f8
<ide><path>lib/assert.js <ide> assert.notStrictEqual = function notStrictEqual(actual, expected, message) { <ide> }; <ide> <ide> function expectedException(actual, expected) { <del> if (!actual || !expected) { <add> // actual is guaranteed to be an Error object, but we need to check expected. <add> if (!expected) { <ide> return false; <ide> } <ide>
1
Java
Java
introduce default constructor in tomcathttpserver
d9e3b8b9a5526b5ca31b5a974c684f808adffb6b
<ide><path>spring-web/src/test/java/org/springframework/http/server/reactive/AbstractHttpHandlerIntegrationTests.java <ide> <ide> package org.springframework.http.server.reactive; <ide> <del>import java.io.File; <ide> import java.lang.annotation.ElementType; <ide> import java.lang.annotation.Retention; <ide> import java.lang.annotation.RetentionPolicy; <ide> public static Flux<Long> testInterval(Duration period, int count) { <ide> } <ide> <ide> static Stream<HttpServer> httpServers() { <del> File base = new File(System.getProperty("java.io.tmpdir")); <ide> return Stream.of( <ide> new JettyHttpServer(), <ide> new ReactorHttpServer(), <del> new TomcatHttpServer(base.getAbsolutePath()), <add> new TomcatHttpServer(), <ide> new UndertowHttpServer() <ide> ); <ide> } <ide><path>spring-web/src/test/java/org/springframework/http/server/reactive/bootstrap/TomcatHttpServer.java <ide> /* <del> * Copyright 2002-2017 the original author or authors. <add> * Copyright 2002-2019 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> public class TomcatHttpServer extends AbstractHttpServer { <ide> private Tomcat tomcatServer; <ide> <ide> <add> /** <add> * Create a new Tomcat HTTP server using the {@code java.io.tmpdir} JVM <add> * system property as the {@code baseDir}. <add> * @since 5.2 <add> */ <add> public TomcatHttpServer() { <add> this(new File(System.getProperty("java.io.tmpdir")).getAbsolutePath()); <add> } <add> <ide> public TomcatHttpServer(String baseDir) { <ide> this(baseDir, null); <ide> } <ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ContextPathIntegrationTests.java <ide> */ <ide> package org.springframework.web.reactive.result.method.annotation; <ide> <del>import java.io.File; <ide> <ide> import org.junit.jupiter.api.Test; <ide> <ide> public void servletPathMapping() throws Exception { <ide> context.register(WebAppConfig.class); <ide> context.refresh(); <ide> <del> File base = new File(System.getProperty("java.io.tmpdir")); <del> TomcatHttpServer server = new TomcatHttpServer(base.getAbsolutePath()); <add> TomcatHttpServer server = new TomcatHttpServer(); <ide> server.setContextPath("/app"); <ide> server.setServletMapping("/api/*"); <ide> <ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java <ide> <ide> package org.springframework.web.reactive.result.method.annotation; <ide> <del>import java.io.File; <ide> import java.lang.annotation.ElementType; <ide> import java.lang.annotation.Retention; <ide> import java.lang.annotation.RetentionPolicy; <ide> class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests { <ide> } <ide> <ide> static Object[][] arguments() { <del> File base = new File(System.getProperty("java.io.tmpdir")); <ide> return new Object[][] { <ide> {new JettyHttpServer(), new ReactorClientHttpConnector()}, <ide> {new JettyHttpServer(), new JettyClientHttpConnector()}, <ide> {new ReactorHttpServer(), new ReactorClientHttpConnector()}, <ide> {new ReactorHttpServer(), new JettyClientHttpConnector()}, <del> {new TomcatHttpServer(base.getAbsolutePath()), new ReactorClientHttpConnector()}, <del> {new TomcatHttpServer(base.getAbsolutePath()), new JettyClientHttpConnector()}, <add> {new TomcatHttpServer(), new ReactorClientHttpConnector()}, <add> {new TomcatHttpServer(), new JettyClientHttpConnector()}, <ide> {new UndertowHttpServer(), new ReactorClientHttpConnector()}, <ide> {new UndertowHttpServer(), new JettyClientHttpConnector()} <ide> };
4
Ruby
Ruby
add test for method `#attributes`
ac623b8511d064419a1ae32d36d1c95c28aba01c
<ide><path>activerecord/test/cases/base_test.rb <ide> def test_attributes_on_dummy_time_with_invalid_time <ide> assert_nil topic.bonus_time <ide> end <ide> <add> def test_attributes <add> category = Category.new(name: "Ruby") <add> <add> expected_attributes = category.attribute_names.map do |attribute_name| <add> [attribute_name, category.public_send(attribute_name)] <add> end.to_h <add> <add> assert_instance_of Hash, category.attributes <add> assert_equal expected_attributes, category.attributes <add> end <add> <ide> def test_boolean <ide> b_nil = Boolean.create("value" => nil) <ide> nil_id = b_nil.id
1
Ruby
Ruby
use user path
f11ddb9aab4a6ebfa6a4be8888cca6b6908944aa
<ide><path>Library/Homebrew/cmd/log.rb <ide> def log_args <ide> def log <ide> log_args.parse <ide> <add> # As this command is simplifying user run commands then let's just use a <add> # user path, too. <add> ENV["PATH"] = ENV["HOMEBREW_PATH"] <add> <ide> if ARGV.named.empty? <ide> git_log HOMEBREW_REPOSITORY <ide> else
1
Javascript
Javascript
add rotation (optional) to three.ellipsecurve
26e3f30e387fa5f8d512e45e7865cb82561637f2
<ide><path>src/extras/curves/EllipseCurve.js <ide> * Ellipse curve <ide> **************************************************************/ <ide> <del>THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) { <add>THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { <ide> <ide> this.aX = aX; <ide> this.aY = aY; <ide> THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle <ide> this.aEndAngle = aEndAngle; <ide> <ide> this.aClockwise = aClockwise; <add> <add> this.aRotation = aRotation || 0; <ide> <ide> }; <ide> <ide> THREE.EllipseCurve.prototype.getPoint = function ( t ) { <ide> <ide> } <ide> <del> var vector = new THREE.Vector2(); <add> var x = this.aX + this.xRadius * Math.cos( angle ); <add> var y = this.aY + this.yRadius * Math.sin( angle ); <add> <add> if ( this.aRotation ) { <add> <add> var cos = Math.cos( this.aRotation ); <add> var sin = Math.sin( this.aRotation ); <ide> <del> vector.x = this.aX + this.xRadius * Math.cos( angle ); <del> vector.y = this.aY + this.yRadius * Math.sin( angle ); <add> // Rotate the point about the center of the ellipse. <add> x = ( x - this.aX ) * cos - ( y - this.aY ) * sin + this.aX; <add> y = ( x - this.aX ) * sin + ( y - this.aY ) * cos + this.aY; <add> <add> } <ide> <del> return vector; <add> return new THREE.Vector2( x, y ); <ide> <ide> };
1
Text
Text
fix guide about command_line [ci skip]
66b92ab81e0734131b968eb62346850f39a6b4fe
<ide><path>guides/source/command_line.md <ide> Please choose a generator below. <ide> <ide> Rails: <ide> assets <add> channel <ide> controller <ide> generator <ide> ... <ide> $ bin/rails generate scaffold HighScore game:string score:integer <ide> invoke jbuilder <ide> create app/views/high_scores/index.json.jbuilder <ide> create app/views/high_scores/show.json.jbuilder <add> invoke test_unit <add> create test/system/high_scores_test.rb <ide> invoke assets <ide> invoke coffee <ide> create app/assets/javascripts/high_scores.coffee
1
Ruby
Ruby
fix comment about session
a91c7b4006f32ba425ca6d88b43fc5078819dd7d
<ide><path>actionpack/lib/action_dispatch/request/session.rb <ide> <ide> module ActionDispatch <ide> class Request < Rack::Request <del> # SessionHash is responsible to lazily load the session from store. <add> # Session is responsible for lazily loading the session from store. <ide> class Session # :nodoc: <ide> ENV_SESSION_KEY = Rack::Session::Abstract::ENV_SESSION_KEY # :nodoc: <ide> ENV_SESSION_OPTIONS_KEY = Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY # :nodoc:
1
Ruby
Ruby
add xcode 7.2
6b42a0c1f535676a63cba4e09ebc8e1c618eaf41
<ide><path>Library/Homebrew/os/mac.rb <ide> def preferred_arch <ide> "7.0.1" => { :clang => "7.0", :clang_build => 700 }, <ide> "7.1" => { :clang => "7.0", :clang_build => 700 }, <ide> "7.1.1" => { :clang => "7.0", :clang_build => 700 }, <add> "7.2" => { :clang => "7.0", :clang_build => 700 }, <ide> } <ide> <ide> def compilers_standard?
1
Javascript
Javascript
reset branch to dev
450e71cba34aa0524e67341548dc7635cdf3fc7f
<ide><path>editor/js/Editor.js <ide> var Editor = function () { <ide> this.loader = new Loader( this ); <ide> <ide> this.camera = this.DEFAULT_CAMERA.clone(); <del> this.sceneCameras = []; <ide> <ide> this.scene = new THREE.Scene(); <ide> this.scene.name = 'Scene'; <ide><path>editor/js/Sidebar.Object.js <ide> Sidebar.Object = function ( editor ) { <ide> <ide> var signals = editor.signals; <ide> <del> var sceneCameras = editor.sceneCameras; <del> <ide> var container = new UI.Panel(); <ide> container.setBorderTop( '0' ); <ide> container.setPaddingTop( '20px' ); <ide> Sidebar.Object = function ( editor ) { <ide> <ide> container.add( objectUserDataRow ); <ide> <del> // view from camera <del> var cameraViewRow = new UI.Row().setDisplay( editor.selected !== null && editor.selected.isCamera ? 'block' : 'none' ); <del> container.add( cameraViewRow ); <del> <del> cameraViewRow.add( new UI.Text( strings.getKey( 'sidebar/object/view' ) ).setWidth( '90px' ) ); <del> <del> var cameraViewCheckbox = new UI.Checkbox( false ).onChange( update ).onClick( function () { <del> <del> var object = editor.selected; <del> if ( object.isCamera !== true ) return; <del> <del> if ( sceneCameras.indexOf( object ) === - 1 ) { <del> <del> if ( sceneCameras.length === 4 ) { <del> <del> alert( "Only 4 scene cameras can be shown at once." ); <del> cameraViewCheckbox.setValue( false ); <del> return; <del> <del> } <del> <del> sceneCameras.push( object ); <del> cameraViewCheckbox.setValue( true ); <del> <del> } else { <del> <del> sceneCameras.splice( sceneCameras.indexOf( object ), 1 ); <del> cameraViewCheckbox.setValue( false ); <del> <del> } <del> <del> signals.sceneGraphChanged.dispatch(); <del> <del> } ); <del> cameraViewRow.add( cameraViewCheckbox ); <ide> <ide> // <ide> <ide> Sidebar.Object = function ( editor ) { <ide> 'intensity': objectIntensityRow, <ide> 'color': objectColorRow, <ide> 'groundColor': objectGroundColorRow, <del> 'distance': objectDistanceRow, <del> 'angle': objectAngleRow, <del> 'penumbra': objectPenumbraRow, <del> 'decay': objectDecayRow, <del> 'castShadow': objectShadowRow, <del> 'receiveShadow': objectReceiveShadow, <add> 'distance' : objectDistanceRow, <add> 'angle' : objectAngleRow, <add> 'penumbra' : objectPenumbraRow, <add> 'decay' : objectDecayRow, <add> 'castShadow' : objectShadowRow, <add> 'receiveShadow' : objectReceiveShadow, <ide> 'shadow': objectShadowRadius <ide> }; <ide> <ide> Sidebar.Object = function ( editor ) { <ide> <ide> } <ide> <del> if ( object.isCamera === true ) { <del> <del> cameraViewRow.setDisplay( 'block' ); <del> cameraViewCheckbox.setValue( sceneCameras.indexOf( object ) !== - 1 ); <del> <del> } else { <del> <del> cameraViewRow.setDisplay( 'none' ); <del> <del> } <del> <ide> objectVisible.setValue( object.visible ); <ide> objectFrustumCulled.setValue( object.frustumCulled ); <ide> objectRenderOrder.setValue( object.renderOrder ); <ide><path>editor/js/Sidebar.Settings.Viewport.js <ide> Sidebar.Settings.Viewport = function ( editor ) { <ide> <ide> var signals = editor.signals; <ide> var strings = editor.strings; <del> var config = editor.config; <ide> <ide> var container = new UI.Div(); <ide> container.add( new UI.Break() ); <ide> <ide> container.add( new UI.Text( strings.getKey( 'sidebar/settings/viewport/grid' ) ).setWidth( '90px' ) ); <ide> <ide> var show = new UI.THREE.Boolean( true ).onChange( update ); <del> container.add( show, new UI.Break() ); <del> <del> container.add( new UI.Text( strings.getKey( 'sidebar/settings/viewport/view' ) ).setWidth( '90px' ) ); <del> <del> var sceneViewOptions = new UI.Select().setOptions( { <del> left: 'left', <del> right: 'right', <del> top: 'top', <del> bottom: 'bottom' <del> } ); <del> <del> if ( config.getKey( 'sceneCameraView' ) !== undefined ) { <del> <del> sceneViewOptions.setValue( config.getKey( 'sceneCameraView' ) ); <del> <del> } else { <del> <del> sceneViewOptions.setValue( 'left' ); <del> <del> } <del> <del> sceneViewOptions.onChange( function () { <del> <del> config.setKey( 'sceneCameraView', sceneViewOptions.getValue() ); <del> signals.sceneGraphChanged.dispatch(); <del> <del> } ); <del> container.add( sceneViewOptions ); <add> container.add( show ); <ide> <ide> /* <ide> var snapSize = new UI.Number( 25 ).setWidth( '40px' ).onChange( update ); <ide><path>editor/js/Storage.js <ide> var Storage = function () { <ide> <ide> var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; <ide> <del> if ( indexedDB === undefined ) { <add> if ( indexedDB === undefined ) { <ide> <ide> console.warn( 'Storage: IndexedDB not available.' ); <ide> return { init: function () {}, get: function () {}, set: function () {}, clear: function () {} }; <ide><path>editor/js/Strings.js <ide> var Strings = function ( config ) { <ide> 'sidebar/object/frustumcull': 'Frustum Cull', <ide> 'sidebar/object/renderorder': 'Render Order', <ide> 'sidebar/object/userdata': 'User data', <del> 'sidebar/object/view': 'Show View', <ide> <ide> 'sidebar/geometry/type': 'Type', <ide> 'sidebar/geometry/new': 'New', <ide> var Strings = function ( config ) { <ide> 'sidebar/settings/shortcuts/focus': 'Focus', <ide> <ide> 'sidebar/settings/viewport/grid': 'Grid', <del> 'sidebar/settings/viewport/view': 'Cameras', <ide> <ide> 'sidebar/history/history': 'HISTORY', <ide> 'sidebar/history/persistent': 'persistent', <ide><path>editor/js/Viewport.js <ide> var Viewport = function ( editor ) { <ide> <ide> var signals = editor.signals; <del> var config = editor.config; <del> <del> var sceneCameras = editor.sceneCameras; <ide> <ide> var container = new UI.Panel(); <ide> container.setId( 'viewport' ); <ide> var Viewport = function ( editor ) { <ide> <ide> renderer.autoClear = false; <ide> renderer.autoUpdateScene = false; <del> renderer.setScissorTest( true ); <ide> renderer.setPixelRatio( window.devicePixelRatio ); <ide> renderer.setSize( container.dom.offsetWidth, container.dom.offsetHeight ); <ide> <ide> var Viewport = function ( editor ) { <ide> requestAnimationFrame( animate ); <ide> <ide> // <del> var viewport = new THREE.Vector4(); <ide> <ide> function render() { <ide> <ide> sceneHelpers.updateMatrixWorld(); <ide> scene.updateMatrixWorld(); <ide> <del> var width = container.dom.offsetWidth; <del> var height = container.dom.offsetHeight; <del> <del> viewport.set( 0, 0, width, height ); <del> renderScene( camera, viewport, true ); <del> <del> switch ( config.getKey( 'sceneCameraView' ) ) { <del> <del> case 'left': <del> for ( var i = 0; i < sceneCameras.length; ++ i ) { <del> <del> viewport.set( 0, height * 0.25 * i, width * 0.25, height * 0.25 ); <del> renderScene( sceneCameras[ i ], viewport ); <del> <del> } <del> break; <del> case 'right': <del> for ( var i = 0; i < sceneCameras.length; ++ i ) { <del> <del> viewport.set( width * 0.75, height * 0.25 * i, width * 0.25, height * 0.25 ); <del> renderScene( sceneCameras[ i ], viewport ); <del> <del> } <del> break; <del> case 'bottom': <del> for ( var i = 0; i < sceneCameras.length; ++ i ) { <del> <del> viewport.set( width * 0.25 * i, 0, width * 0.25, height * 0.25 ); <del> renderScene( sceneCameras[ i ], viewport ); <del> <del> } <del> break; <del> case 'top': <del> for ( var i = 0; i < sceneCameras.length; ++ i ) { <del> <del> viewport.set( width * 0.25 * i, height * 0.75, width * 0.25, height * 0.25 ); <del> renderScene( sceneCameras[ i ], viewport ); <del> <del> } <del> break; <del> default: <del> console.error( "Unknown scene view type: " + config.getKey( "sceneCameraView" ) ); <del> break; <del> <del> } <del> <del> } <del> <del> function renderScene( cam, viewport, showHelpers ) { <del> <del> renderer.setViewport( viewport ); <del> renderer.setScissor( viewport ); <del> renderer.render( scene, cam ); <add> renderer.render( scene, camera ); <ide> <del> if ( showHelpers === true && renderer instanceof THREE.RaytracingRenderer === false ) { <add> if ( renderer instanceof THREE.RaytracingRenderer === false ) { <ide> <del> renderer.render( sceneHelpers, cam ); <add> renderer.render( sceneHelpers, camera ); <ide> <ide> } <ide>
6
Ruby
Ruby
add support for calling nested direct routes
35afd2c53b4a49a6b4495b167eef233428123b4a
<ide><path>actionpack/lib/action_dispatch/routing/polymorphic_routes.rb <ide> module Routing <ide> # <ide> # Example usage: <ide> # <del> # edit_polymorphic_path(@post) # => "/posts/1/edit" <add> # edit_polymorphic_path(@post) # => "/posts/1/edit" <ide> # polymorphic_path(@post, format: :pdf) # => "/posts/1.pdf" <ide> # <ide> # == Usage with mounted engines <ide> def polymorphic_url(record_or_hash_or_array, options = {}) <ide> end <ide> <ide> if mapping = polymorphic_mapping(record_or_hash_or_array) <del> return mapping.call(self, [record_or_hash_or_array, options]) <add> return mapping.call(self, [record_or_hash_or_array, options], false) <ide> end <ide> <ide> opts = options.dup <ide> def polymorphic_path(record_or_hash_or_array, options = {}) <ide> end <ide> <ide> if mapping = polymorphic_mapping(record_or_hash_or_array) <del> return mapping.call(self, [record_or_hash_or_array, options], only_path: true) <add> return mapping.call(self, [record_or_hash_or_array, options], true) <ide> end <ide> <ide> opts = options.dup <ide> def handle_model(record) <ide> <ide> def handle_model_call(target, record) <ide> if mapping = polymorphic_mapping(target, record) <del> mapping.call(target, [record], only_path: suffix == "path") <add> mapping.call(target, [record], suffix == "path") <ide> else <ide> method, args = handle_model(record) <ide> target.send(method, *args) <ide><path>actionpack/lib/action_dispatch/routing/route_set.rb <ide> def add_url_helper(name, defaults, &block) <ide> <ide> @path_helpers_module.module_eval do <ide> define_method(:"#{name}_path") do |*args| <del> helper.call(self, args, only_path: true) <add> helper.call(self, args, true) <ide> end <ide> end <ide> <ide> @url_helpers_module.module_eval do <ide> define_method(:"#{name}_url") do |*args| <del> helper.call(self, args) <add> helper.call(self, args, false) <ide> end <ide> end <ide> end <ide> def url_for(options) <ide> @_proxy.url_for(options) <ide> end <ide> <add> def route_for(name, *args) <add> @_proxy.route_for(name, *args) <add> end <add> <ide> def optimize_routes_generation? <ide> @_proxy.optimize_routes_generation? <ide> end <ide> def initialize(name, defaults, &block) <ide> @block = block <ide> end <ide> <del> def call(t, args, outer_options = {}) <add> def call(t, args, only_path = false) <ide> options = args.extract_options! <del> url_options = eval_block(t, args, options) <del> <del> case url_options <del> when String <del> t.url_for(url_options) <del> when Hash <del> t.url_for(url_options.merge(outer_options)) <del> when ActionController::Parameters <del> if url_options.permitted? <del> t.url_for(url_options.to_h.merge(outer_options)) <del> else <del> raise ArgumentError, "Generating a URL from non sanitized request parameters is insecure!" <del> end <del> when Array <del> opts = url_options.extract_options! <del> t.url_for(url_options.push(opts.merge(outer_options))) <add> url = t.url_for(eval_block(t, args, options)) <add> <add> if only_path <add> "/" + url.partition(%r{(?<!/)/(?!/)}).last <ide> else <del> t.url_for([url_options, outer_options]) <add> url <ide> end <ide> end <ide> <ide><path>actionpack/lib/action_dispatch/routing/url_for.rb <ide> def url_for(options = nil) <ide> end <ide> end <ide> <add> def route_for(name, *args) # :nodoc: <add> public_send(:"#{name}_url", *args) <add> end <add> <ide> protected <ide> <ide> def optimize_routes_generation? <ide><path>actionpack/test/dispatch/routing/custom_url_helpers_test.rb <ide> class TestCustomUrlHelpers < ActionDispatch::IntegrationTest <ide> class Linkable <ide> attr_reader :id <ide> <add> def self.name <add> super.demodulize <add> end <add> <ide> def initialize(id) <ide> @id = id <ide> end <ide> <ide> def linkable_type <del> self.class.name.demodulize.underscore <add> self.class.name.underscore <ide> end <ide> end <ide> <ide> class Category < Linkable; end <ide> class Collection < Linkable; end <ide> class Product < Linkable; end <add> class Manufacturer < Linkable; end <ide> <ide> class Model <ide> extend ActiveModel::Naming <ide> class ProductPage < Page; end <ide> get "/media/:id", to: "media#show", as: :media <ide> get "/pages/:id", to: "pages#show", as: :page <ide> <del> resources :categories, :collections, :products <add> resources :categories, :collections, :products, :manufacturers <ide> <ide> namespace :admin do <ide> get "/dashboard", to: "dashboard#index" <ide> class ProductPage < Page; end <ide> direct("string") { "http://www.rubyonrails.org" } <ide> direct(:helper) { basket_url } <ide> direct(:linkable) { |linkable| [:"#{linkable.linkable_type}", { id: linkable.id }] } <add> direct(:nested) { |linkable| route_for(:linkable, linkable) } <ide> direct(:params) { |params| params } <ide> direct(:symbol) { :basket } <ide> direct(:hash) { { controller: "basket", action: "show" } } <ide> class ProductPage < Page; end <ide> <ide> resolve("Article") { |article| [:post, { id: article.id }] } <ide> resolve("Basket") { |basket| [:basket] } <add> resolve("Manufacturer") { |manufacturer| route_for(:linkable, manufacturer) } <ide> resolve("User", anchor: "details") { |user, options| [:profile, options] } <ide> resolve("Video") { |video| [:media, { id: video.id }] } <ide> resolve(%w[Page CategoryPage ProductPage]) { |page| [:page, { id: page.id }] } <ide> def setup <ide> @category = Category.new("1") <ide> @collection = Collection.new("2") <ide> @product = Product.new("3") <add> @manufacturer = Manufacturer.new("apple") <ide> @basket = Basket.new <ide> @user = User.new <ide> @video = Video.new("4") <ide> def params <ide> end <ide> <ide> def test_direct_paths <del> assert_equal "http://www.rubyonrails.org", website_path <del> assert_equal "http://www.rubyonrails.org", Routes.url_helpers.website_path <add> assert_equal "/", website_path <add> assert_equal "/", Routes.url_helpers.website_path <ide> <del> assert_equal "http://www.rubyonrails.org", string_path <del> assert_equal "http://www.rubyonrails.org", Routes.url_helpers.string_path <add> assert_equal "/", string_path <add> assert_equal "/", Routes.url_helpers.string_path <ide> <del> assert_equal "http://www.example.com/basket", helper_url <del> assert_equal "http://www.example.com/basket", Routes.url_helpers.helper_url <add> assert_equal "/basket", helper_path <add> assert_equal "/basket", Routes.url_helpers.helper_path <ide> <ide> assert_equal "/categories/1", linkable_path(@category) <ide> assert_equal "/categories/1", Routes.url_helpers.linkable_path(@category) <ide> def test_direct_paths <ide> assert_equal "/products/3", linkable_path(@product) <ide> assert_equal "/products/3", Routes.url_helpers.linkable_path(@product) <ide> <add> assert_equal "/categories/1", nested_path(@category) <add> assert_equal "/categories/1", Routes.url_helpers.nested_path(@category) <add> <ide> assert_equal "/", params_path(@safe_params) <ide> assert_equal "/", Routes.url_helpers.params_path(@safe_params) <ide> assert_raises(ArgumentError) { params_path(@unsafe_params) } <ide> def test_direct_urls <ide> assert_equal "http://www.example.com/products/3", linkable_url(@product) <ide> assert_equal "http://www.example.com/products/3", Routes.url_helpers.linkable_url(@product) <ide> <add> assert_equal "http://www.example.com/categories/1", nested_url(@category) <add> assert_equal "http://www.example.com/categories/1", Routes.url_helpers.nested_url(@category) <add> <ide> assert_equal "http://www.example.com/", params_url(@safe_params) <ide> assert_equal "http://www.example.com/", Routes.url_helpers.params_url(@safe_params) <ide> assert_raises(ArgumentError) { params_url(@unsafe_params) } <ide> def test_resolve_paths <ide> assert_equal "/pages/8", polymorphic_path(@product_page) <ide> assert_equal "/pages/8", Routes.url_helpers.polymorphic_path(@product_page) <ide> assert_equal "/pages/8", ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.path.handle_model_call(self, @product_page) <add> <add> assert_equal "/manufacturers/apple", polymorphic_path(@manufacturer) <add> assert_equal "/manufacturers/apple", Routes.url_helpers.polymorphic_path(@manufacturer) <ide> end <ide> <ide> def test_resolve_urls <ide> def test_resolve_urls <ide> assert_equal "http://www.example.com/pages/8", polymorphic_url(@product_page) <ide> assert_equal "http://www.example.com/pages/8", Routes.url_helpers.polymorphic_url(@product_page) <ide> assert_equal "http://www.example.com/pages/8", ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder.url.handle_model_call(self, @product_page) <add> <add> assert_equal "http://www.example.com/manufacturers/apple", polymorphic_url(@manufacturer) <add> assert_equal "http://www.example.com/manufacturers/apple", Routes.url_helpers.polymorphic_url(@manufacturer) <ide> end <ide> <ide> def test_defining_direct_inside_a_scope_raises_runtime_error
4
Go
Go
add headers when using exec
f86db80b5ff3250a98482b4dc9ff69effbbf2390
<ide><path>api/server/router/container/exec.go <ide> func (s *containerRouter) postContainerExecStart(ctx context.Context, w http.Res <ide> defer httputils.CloseStreams(inStream, outStream) <ide> <ide> if _, ok := r.Header["Upgrade"]; ok { <del> fmt.Fprintf(outStream, "HTTP/1.1 101 UPGRADED\r\nContent-Type: application/vnd.docker.raw-stream\r\nConnection: Upgrade\r\nUpgrade: tcp\r\n\r\n") <add> fmt.Fprint(outStream, "HTTP/1.1 101 UPGRADED\r\nContent-Type: application/vnd.docker.raw-stream\r\nConnection: Upgrade\r\nUpgrade: tcp\r\n") <ide> } else { <del> fmt.Fprintf(outStream, "HTTP/1.1 200 OK\r\nContent-Type: application/vnd.docker.raw-stream\r\n\r\n") <add> fmt.Fprint(outStream, "HTTP/1.1 200 OK\r\nContent-Type: application/vnd.docker.raw-stream\r\n") <ide> } <ide> <add> // copy headers that were removed as part of hijack <add> if err := w.Header().WriteSubset(outStream, nil); err != nil { <add> return err <add> } <add> fmt.Fprint(outStream, "\r\n") <add> <ide> stdin = inStream <ide> stdout = outStream <ide> if !execStartCheck.Tty { <ide><path>integration-cli/docker_api_exec_test.go <ide> func (s *DockerSuite) TestExecAPIStart(c *check.C) { <ide> startExec(c, id, http.StatusOK) <ide> } <ide> <add>func (s *DockerSuite) TestExecAPIStartEnsureHeaders(c *check.C) { <add> testRequires(c, DaemonIsLinux) <add> dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top") <add> <add> id := createExec(c, "test") <add> resp, _, err := sockRequestRaw("POST", fmt.Sprintf("/exec/%s/start", id), strings.NewReader(`{"Detach": true}`), "application/json") <add> c.Assert(err, checker.IsNil) <add> c.Assert(resp.Header.Get("Server"), checker.Not(checker.Equals), "") <add>} <add> <ide> func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *check.C) { <ide> testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later <ide> runSleepingContainer(c, "-d", "--name", "test")
2
Python
Python
add input layer to the docs
a2e26b12e2c12eaa1d15debfe697e1354c54b6ed
<ide><path>docs/autogen.py <ide> layers.Activation, <ide> layers.Dropout, <ide> layers.Flatten, <add> layers.Input, <ide> layers.Reshape, <ide> layers.Permute, <ide> layers.RepeatVector,
1
PHP
PHP
remove unused vars
2781f6494338c232301359bd027fbf4c95a50998
<ide><path>src/ORM/ResultSet.php <ide> public function __construct($query, $statement) <ide> $repository = $query->repository(); <ide> $this->_query = $query; <ide> $this->_statement = $statement; <del> $this->_driver = $driver = $this->_query->connection()->driver(); <add> $this->_driver = $this->_query->connection()->driver(); <ide> $this->_defaultTable = $this->_query->repository(); <ide> $this->_calculateAssociationMap(); <ide> $this->_hydrate = $this->_query->hydrate(); <ide> public function rewind() <ide> */ <ide> public function valid() <ide> { <del> $valid = true; <ide> if ($this->_useBuffering) { <ide> $valid = $this->_index < $this->_count; <ide> if ($valid && $this->_results[$this->_index] !== null) { <ide><path>src/Shell/Task/AssetsTask.php <ide> protected function _list($name = null) <ide> protected function _process($plugins, $copy = false) <ide> { <ide> foreach ($plugins as $plugin => $config) { <del> $path = Plugin::path($plugin) . 'webroot'; <del> <ide> $this->out(); <ide> $this->out('For plugin: ' . $plugin); <ide> $this->hr();
2
Javascript
Javascript
handle inextensible `dataset.data` array
ef507e11bd6936a0a60cbd66822aa6aef23df828
<ide><path>src/core/core.datasetController.js <ide> helpers.extend(DatasetController.prototype, { <ide> unlistenArrayEvents(me._data, me); <ide> } <ide> <del> listenArrayEvents(data, me); <add> if (data && Object.isExtensible(data)) { <add> listenArrayEvents(data, me); <add> } <ide> me._data = data; <ide> } <ide> <ide><path>test/specs/core.datasetController.tests.js <ide> describe('Chart.DatasetController', function() { <ide> }); <ide> }); <ide> <add> describe('inextensible data', function() { <add> it('should handle a frozen data object', function() { <add> function createChart() { <add> var data = Object.freeze([0, 1, 2, 3, 4, 5]); <add> expect(Object.isExtensible(data)).toBeFalsy(); <add> <add> var chart = acquireChart({ <add> type: 'line', <add> data: { <add> datasets: [{ <add> data: data <add> }] <add> } <add> }); <add> <add> var dataset = chart.data.datasets[0]; <add> dataset.data = Object.freeze([5, 4, 3, 2, 1, 0]); <add> expect(Object.isExtensible(dataset.data)).toBeFalsy(); <add> chart.update(); <add> <add> // Tests that the unlisten path also works for frozen objects <add> chart.destroy(); <add> } <add> <add> expect(createChart).not.toThrow(); <add> }); <add> <add> it('should handle a sealed data object', function() { <add> function createChart() { <add> var data = Object.seal([0, 1, 2, 3, 4, 5]); <add> expect(Object.isExtensible(data)).toBeFalsy(); <add> <add> var chart = acquireChart({ <add> type: 'line', <add> data: { <add> datasets: [{ <add> data: data <add> }] <add> } <add> }); <add> <add> var dataset = chart.data.datasets[0]; <add> dataset.data = Object.seal([5, 4, 3, 2, 1, 0]); <add> expect(Object.isExtensible(dataset.data)).toBeFalsy(); <add> chart.update(); <add> <add> // Tests that the unlisten path also works for frozen objects <add> chart.destroy(); <add> } <add> <add> expect(createChart).not.toThrow(); <add> }); <add> <add> it('should handle an unextendable data object', function() { <add> function createChart() { <add> var data = Object.preventExtensions([0, 1, 2, 3, 4, 5]); <add> expect(Object.isExtensible(data)).toBeFalsy(); <add> <add> var chart = acquireChart({ <add> type: 'line', <add> data: { <add> datasets: [{ <add> data: data <add> }] <add> } <add> }); <add> <add> var dataset = chart.data.datasets[0]; <add> dataset.data = Object.preventExtensions([5, 4, 3, 2, 1, 0]); <add> expect(Object.isExtensible(dataset.data)).toBeFalsy(); <add> chart.update(); <add> <add> // Tests that the unlisten path also works for frozen objects <add> chart.destroy(); <add> } <add> <add> expect(createChart).not.toThrow(); <add> }); <add> }); <add> <ide> it('should synchronize metadata when data are inserted or removed', function() { <ide> var data = [0, 1, 2, 3, 4, 5]; <ide> var chart = acquireChart({
2
Javascript
Javascript
display values in assertionerrors
745463a0b72c77cecff60cfda175f6185745799a
<ide><path>test/parallel/test-module-relative-lookup.js <ide> const _module = require('module'); // avoid collision with global.module <ide> const lookupResults = _module._resolveLookupPaths('./lodash'); <ide> let paths = lookupResults[1]; <ide> <del>assert.strictEqual(paths[0], '.', <del> 'Current directory gets highest priority for local modules'); <add>// Current directory gets highest priority for local modules <add>assert.strictEqual(paths[0], '.'); <ide> <ide> paths = _module._resolveLookupPaths('./lodash', null, true); <ide> <del>assert.strictEqual(paths && paths[0], '.', <del> 'Current directory gets highest priority for local modules'); <add>// Current directory gets highest priority for local modules <add>assert.strictEqual(paths && paths[0], '.');
1
Ruby
Ruby
remove public/ files for api apps
985d8b25623dfd11972fa6966d0e47695c347084
<ide><path>railties/lib/rails/generators/rails/app/app_generator.rb <ide> def delete_application_layout_file_if_api_option <ide> end <ide> end <ide> <add> def delete_public_files_if_api_option <add> if options[:api] <add> remove_file 'public/404.html' <add> remove_file 'public/422.html' <add> remove_file 'public/500.html' <add> remove_file 'public/apple-touch-icon-precomposed.png' <add> remove_file 'public/apple-touch-icon.png' <add> remove_file 'public/favicon.ico' <add> end <add> end <add> <ide> def delete_js_folder_skipping_javascript <ide> if options[:skip_javascript] <ide> remove_dir 'app/assets/javascripts' <ide><path>railties/test/generators/api_app_generator_test.rb <ide> def skipped_files <ide> lib/assets <ide> vendor/assets <ide> test/helpers <del> tmp/cache/assets) <add> tmp/cache/assets <add> public/404.html <add> public/422.html <add> public/500.html <add> public/apple-touch-icon-precomposed.png <add> public/apple-touch-icon.png <add> public/favicon.ico) <ide> end <ide> end
2
Javascript
Javascript
remove feature flagging import
c021a5ae2a6a60245ce45d680c5b1e0d79efc097
<ide><path>packages/ember-htmlbars/lib/env.js <ide> import _Ember from 'ember-metal'; <del>import isEnabled from 'ember-metal/features'; <ide> import environment from 'ember-metal/environment'; <ide> <ide> import { hooks } from 'htmlbars-runtime'; <ide><path>packages/ember-htmlbars/lib/helpers/each-in.js <ide> @submodule ember-templates <ide> */ <ide> <del>import isEnabled from 'ember-metal/features'; <ide> import shouldDisplay from 'ember-views/streams/should_display'; <ide> <ide> /** <ide><path>packages/ember-htmlbars/lib/keywords/get.js <ide> */ <ide> <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import Stream from 'ember-metal/streams/stream'; <ide> import KeyStream from 'ember-metal/streams/key-stream'; <ide> import { isStream } from 'ember-metal/streams/utils'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/boolean_test.js <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import run from 'ember-metal/run_loop'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/class_test.js <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import run from 'ember-metal/run_loop'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/data_test.js <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import run from 'ember-metal/run_loop'; <ide> import EmberObject from 'ember-runtime/system/object'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/href_test.js <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import run from 'ember-metal/run_loop'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/property_test.js <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import run from 'ember-metal/run_loop'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js <ide> /* jshint scripturl:true */ <ide> <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide> import { SafeString } from 'ember-htmlbars/utils/string'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/style_test.js <ide> /* globals EmberDev */ <ide> <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide> import { SafeString } from 'ember-htmlbars/utils/string'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/svg_test.js <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import run from 'ember-metal/run_loop'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide><path>packages/ember-htmlbars/tests/attr_nodes/value_test.js <del>import isEnabled from 'ember-metal/features'; <ide> import EmberView from 'ember-views/views/view'; <ide> import run from 'ember-metal/run_loop'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide><path>packages/ember-htmlbars/tests/helpers/component_test.js <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import { set } from 'ember-metal/property_set'; <ide> import { get } from 'ember-metal/property_get'; <ide> import run from 'ember-metal/run_loop'; <ide><path>packages/ember-htmlbars/tests/helpers/each_in_test.js <del>import isEnabled from 'ember-metal/features'; <ide> import Component from 'ember-views/views/component'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide> import run from 'ember-metal/run_loop'; <ide><path>packages/ember-htmlbars/tests/helpers/get_test.js <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import run from 'ember-metal/run_loop'; <ide> import { Registry } from 'ember-runtime/system/container'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide><path>packages/ember-htmlbars/tests/helpers/if_unless_test.js <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import run from 'ember-metal/run_loop'; <ide> import Namespace from 'ember-runtime/system/namespace'; <ide> import { Registry } from 'ember-runtime/system/container'; <ide><path>packages/ember-htmlbars/tests/integration/helper-lookup-test.js <del>import isEnabled from 'ember-metal/features'; <ide> import Registry from 'container/registry'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide> import ComponentLookup from 'ember-views/component_lookup'; <ide><path>packages/ember-htmlbars/tests/system/discover-known-helpers-test.js <del>import isEnabled from 'ember-metal/features'; <ide> import Registry from 'container/registry'; <ide> import Helper from 'ember-htmlbars/helper'; <ide> import { runDestroy } from 'ember-runtime/tests/utils'; <ide><path>packages/ember-routing-htmlbars/lib/keywords/action.js <ide> @submodule ember-templates <ide> */ <ide> <del>import isEnabled from 'ember-metal/features'; <ide> import { keyword } from 'htmlbars-runtime/hooks'; <ide> import closureAction from 'ember-routing-htmlbars/keywords/closure-action'; <ide> <ide><path>packages/ember-routing-htmlbars/lib/keywords/element-action.js <ide> import Ember from 'ember-metal/core'; // assert <del>import isEnabled from 'ember-metal/features'; <ide> import { uuid } from 'ember-metal/utils'; <ide> import run from 'ember-metal/run_loop'; <ide> import { readUnwrappedModel } from 'ember-views/streams/utils'; <ide><path>packages/ember-routing-htmlbars/tests/helpers/closure_action_test.js <del>import isEnabled from 'ember-metal/features'; <ide> import run from 'ember-metal/run_loop'; <ide> import compile from 'ember-template-compiler/system/compile'; <ide> import EmberComponent from 'ember-views/views/component'; <ide><path>packages/ember-routing-htmlbars/tests/helpers/element_action_test.js <ide> import Ember from 'ember-metal/core'; // A, FEATURES, assert <del>import isEnabled from 'ember-metal/features'; <ide> import { set } from 'ember-metal/property_set'; <ide> import run from 'ember-metal/run_loop'; <ide> import EventDispatcher from 'ember-views/system/event_dispatcher'; <ide><path>packages/ember-routing-views/lib/views/link.js <ide> */ <ide> <ide> import Ember from 'ember-metal/core'; // FEATURES, Logger, assert <del>import isEnabled from 'ember-metal/features'; <ide> <ide> import { get } from 'ember-metal/property_get'; <ide> import { set } from 'ember-metal/property_set'; <ide><path>packages/ember-routing/lib/system/dsl.js <ide> import Ember from 'ember-metal/core'; // FEATURES, assert <del>import isEnabled from 'ember-metal/features'; <ide> <ide> /** <ide> @module ember <ide><path>packages/ember-routing/lib/system/router.js <ide> import Ember from 'ember-metal/core'; // FEATURES, Logger, assert <del>import isEnabled from 'ember-metal/features'; <ide> import EmberError from 'ember-metal/error'; <ide> import { get } from 'ember-metal/property_get'; <ide> import { set } from 'ember-metal/property_set'; <ide><path>packages/ember-routing/tests/system/dsl_test.js <ide> /* globals EmberDev */ <del>import isEnabled from 'ember-metal/features'; <ide> import EmberRouter from 'ember-routing/system/router'; <ide> import { HANDLERS } from 'ember-debug/handlers'; <ide> import { <ide> QUnit.test('should add loading and error routes if _isRouterMapResult is true', <ide> ok(router.router.recognizer.names['blork_error'], 'error route was added'); <ide> }); <ide> <del> QUnit.test('should not add loading and error routes if _isRouterMapResult is false', function() { <add>QUnit.test('should not add loading and error routes if _isRouterMapResult is false', function() { <ide> Router.map(function() { <ide> this.route('blork'); <ide> }); <ide><path>packages/ember/tests/global-api-test.js <ide> /*globals Ember */ <ide> import 'ember'; <del>import isEnabled from 'ember-metal/features'; <ide> <ide> QUnit.module('Global API Tests'); <ide> <ide><path>packages/ember/tests/helpers/helper_registration_test.js <ide> import 'ember'; <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import helpers from 'ember-htmlbars/helpers'; <ide> import { compile } from 'ember-template-compiler'; <ide> import Helper, { helper } from 'ember-htmlbars/helper'; <ide><path>packages/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js <ide> import 'ember'; <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import { compile } from 'ember-template-compiler'; <ide> <ide> var Router, App, router, registry, container; <ide> var set = Ember.set; <ide> <ide> var aboutDefer, otherDefer; <ide> <del>function basicEagerURLUpdateTest(setTagName) { <del> expect(6); <del> <del> if (setTagName) { <del> Ember.TEMPLATES.application = compile('{{outlet}}{{link-to \'Index\' \'index\' id=\'index-link\'}}{{link-to \'About\' \'about\' id=\'about-link\' tagName=\'span\'}}'); <del> } <del> <del> bootApplication(); <del> equal(updateCount, 0); <del> Ember.run(Ember.$('#about-link'), 'click'); <del> <del> // URL should be eagerly updated now <del> equal(updateCount, 1); <del> equal(router.get('location.path'), '/about'); <del> <del> // Resolve the promise. <del> Ember.run(aboutDefer, 'resolve'); <del> equal(router.get('location.path'), '/about'); <del> <del> // Shouldn't have called update url again. <del> equal(updateCount, 1); <del> equal(router.get('location.path'), '/about'); <del>} <del> <ide> function bootApplication() { <ide> router = container.lookup('router:main'); <ide> Ember.run(App, 'advanceReadiness'); <ide><path>packages/ember/tests/routing/substates_test.js <ide> import 'ember'; <ide> import Ember from 'ember-metal/core'; <del>import isEnabled from 'ember-metal/features'; <ide> import { compile } from 'ember-template-compiler'; <ide> import EmberView from 'ember-views/views/view'; <ide>
30
Text
Text
update reply template for invalid prs
40c831bbcd5e52fd192ef2c8cdeabbd70d388d06
<ide><path>docs/moderator-handbook.md <ide> Thanks again! 😊 <ide> ```markdown <ide> Hey @username <ide> <del>You have not added any content, We will be closing this PR and marking it as `invalid`. 😓️ <add>Thank you for opening this pull request. <ide> <del>Feel free to open another PR though! 👍 <add>This is a standard message notifying you that we've reviewed your pull request and have decided not to merge it. We would welcome future pull requests from you. <add> <add>Thank you and happy coding. <ide> ```
1
Text
Text
replace the deprecated -d with docker daemon
b08c6b17685d4af40e9705ca0efddbdffdf2657e
<ide><path>docs/articles/configuring.md <ide> or `systemd` to manage the `docker` daemon's start and stop. <ide> <ide> ### Running the docker daemon directly <ide> <del>The `docker` daemon can be run directly using the `-d` option. By default it listens on <add>The `docker` daemon can be run directly using the `docker daemon` command. By default it listens on <ide> the Unix socket `unix:///var/run/docker.sock` <ide> <ide> $ docker daemon
1
Javascript
Javascript
redirect error to the correct url
fc08fa0c0e2116a493b85c8226760829a4ded0f0
<ide><path>packages/next/export/worker.js <ide> export default async function({ <ide> return results <ide> } catch (error) { <ide> console.error( <del> `\nError occurred prerendering page "${path}". Read more: https://err.sh/next.js/prerender-error:\n` + <add> `\nError occurred prerendering page "${path}". Read more: https://err.sh/next.js/prerender-error\n` + <ide> error <ide> ) <ide> return { ...results, error: true }
1
Python
Python
fix wrong flag name docstring
70982107b10a24386edb2bb5d636c71ba744c895
<ide><path>numpy/add_newdocs.py <ide> copies those elements indicated by this mask. <ide> * 'writemasked' indicates that only elements where the chosen <ide> 'arraymask' operand is True will be written to. <del> * "overlap_allow_same" can be used to mark operands that are <add> * "overlap_assume_elementwise" can be used to mark operands that are <ide> accessed only in the iterator order, to allow less conservative <ide> copying when "copy_if_overlap" is present. <ide> op_dtypes : dtype or tuple of dtype(s), optional
1
Ruby
Ruby
fix variable name
367de3523ae7ae1146b092dbaca3720df9e336c2
<ide><path>Library/Homebrew/dev-cmd/pr-automerge.rb <ide> def pr_automerge <ide> query = "is:pr is:open repo:#{tap.full_name}" <ide> query += Homebrew.args.ignore_failures? ? " -status:pending" : " status:success" <ide> query += " review:approved" unless Homebrew.args.without_approval? <del> query += " label:\"#{with_label}\"" if Homebrew.args.with_label <add> query += " label:\"#{args.with_label}\"" if Homebrew.args.with_label <ide> without_labels&.each { |label| query += " -label:\"#{label}\"" } <ide> odebug "Searching: #{query}" <ide>
1
Javascript
Javascript
update description about removeclippedsubviews
8080583f528b048f5b2a9fa86580e1055611ce38
<ide><path>Libraries/CustomComponents/ListView/ListView.js <ide> var ListView = React.createClass({ <ide> */ <ide> onChangeVisibleRows: React.PropTypes.func, <ide> /** <del> * An experimental performance optimization for improving scroll perf of <add> * A performance optimization for improving scroll perf of <ide> * large lists, used in conjunction with overflow: 'hidden' on the row <del> * containers. Use at your own risk. <add> * containers. This is enabled by default. <ide> */ <ide> removeClippedSubviews: React.PropTypes.bool, <ide> },
1
Javascript
Javascript
use mapdispatchtoprops to bind actions efficiently
def86ae9af3b85259d167913b7eb81e677c5cb05
<ide><path>examples/todomvc/containers/App.js <ide> import * as TodoActions from '../actions/todos'; <ide> <ide> class App extends Component { <ide> render() { <del> const { todos, dispatch } = this.props; <del> const actions = bindActionCreators(TodoActions, dispatch); <del> <add> const { todos, actions } = this.props; <ide> return ( <ide> <div> <ide> <Header addTodo={actions.addTodo} /> <ide> class App extends Component { <ide> <ide> App.propTypes = { <ide> todos: PropTypes.array.isRequired, <del> dispatch: PropTypes.func.isRequired <add> actions: PropTypes.object.isRequired <ide> }; <ide> <ide> function mapStateToProps(state) { <ide> function mapStateToProps(state) { <ide> }; <ide> } <ide> <del>export default connect(mapStateToProps)(App); <add>function mapDispatchToProps(dispatch) { <add> return { <add> actions: bindActionCreators(TodoActions, dispatch) <add> }; <add>} <add> <add>export default connect( <add> mapStateToProps, <add> mapDispatchToProps <add>)(App);
1
Go
Go
use syscall consts, check for errors,
45262c4cb057e78ba98d02b5e0121ed402779c7f
<ide><path>api/client/cli.go <ide> func NewDockerCli(in io.ReadCloser, out, err io.Writer, keyFile string, proto, a <ide> scheme = "https" <ide> } <ide> if in != nil { <del> inFd, isTerminalIn = term.GetHandleInfo(in) <add> inFd, isTerminalIn = term.GetFdInfo(in) <ide> } <ide> <ide> if out != nil { <del> outFd, isTerminalOut = term.GetHandleInfo(out) <add> outFd, isTerminalOut = term.GetFdInfo(out) <ide> } <ide> <ide> if err == nil { <ide><path>pkg/term/term.go <ide> func StdStreams() (stdOut io.Writer, stdErr io.Writer, stdIn io.ReadCloser) { <ide> return os.Stdout, os.Stderr, os.Stdin <ide> } <ide> <del>func GetHandleInfo(in interface{}) (uintptr, bool) { <add>func GetFdInfo(in interface{}) (uintptr, bool) { <ide> var inFd uintptr <ide> var isTerminalIn bool <ide> if file, ok := in.(*os.File); ok { <ide><path>pkg/term/term_windows.go <ide> func MakeRaw(fd uintptr) (*State, error) { <ide> return state, nil <ide> } <ide> <del>// GetHandleInfo returns file descriptor and bool indicating whether the file is a terminal <del>func GetHandleInfo(in interface{}) (uintptr, bool) { <add>// GetFdInfo returns file descriptor and bool indicating whether the file is a terminal <add>func GetFdInfo(in interface{}) (uintptr, bool) { <ide> return winconsole.GetHandleInfo(in) <ide> } <ide> <ide><path>pkg/term/winconsole/console_windows.go <ide> const ( <ide> <ide> ANSI_MAX_CMD_LENGTH = 256 <ide> <del> // https://msdn.microsoft.com/en-us/library/windows/desktop/ms683231(v=vs.85).aspx <del> STD_INPUT_HANDLE = -10 <del> STD_OUTPUT_HANDLE = -11 <del> STD_ERROR_HANDLE = -12 <del> <ide> MAX_INPUT_BUFFER = 1024 <ide> DEFAULT_WIDTH = 80 <ide> DEFAULT_HEIGHT = 24 <ide> func StdStreams() (stdOut io.Writer, stdErr io.Writer, stdIn io.ReadCloser) { <ide> } <ide> <ide> // Save current screen buffer info <del> handle, _ := syscall.GetStdHandle(STD_OUTPUT_HANDLE) <add> handle, err := syscall.GetStdHandle(syscall.STD_OUTPUT_HANDLE) <add> if nil != err { <add> panic("This should never happen as it is predefined handle.") <add> } <ide> screenBufferInfo, err := GetConsoleScreenBufferInfo(uintptr(handle)) <ide> if err == nil { <ide> handler.screenBufferInfo = screenBufferInfo <ide> func StdStreams() (stdOut io.Writer, stdErr io.Writer, stdIn io.ReadCloser) { <ide> wrappedWriter: os.Stdout, <ide> emulator: handler, <ide> command: make([]byte, 0, ANSI_MAX_CMD_LENGTH), <add> fd: uintptr(handle), <ide> } <ide> } else { <ide> stdOut = os.Stdout <ide> <ide> } <ide> if IsTerminal(os.Stderr.Fd()) { <add> handle, err := syscall.GetStdHandle(syscall.STD_ERROR_HANDLE) <add> if nil != err { <add> panic("This should never happen as it is predefined handle.") <add> } <ide> stdErr = &terminalWriter{ <ide> wrappedWriter: os.Stderr, <ide> emulator: handler, <ide> command: make([]byte, 0, ANSI_MAX_CMD_LENGTH), <add> fd: uintptr(handle), <ide> } <ide> } else { <ide> stdErr = os.Stderr <del> <ide> } <ide> if IsTerminal(os.Stdin.Fd()) { <add> handle, err := syscall.GetStdHandle(syscall.STD_INPUT_HANDLE) <add> if nil != err { <add> panic("This should never happen as it is predefined handle.") <add> } <ide> stdIn = &terminalReader{ <ide> wrappedReader: os.Stdin, <ide> emulator: handler, <ide> command: make([]byte, 0, ANSI_MAX_CMD_LENGTH), <add> fd: uintptr(handle), <ide> } <ide> } else { <ide> stdIn = os.Stdin <ide> func getWindowsTextAttributeForAnsiValue(originalFlag WORD, defaultValue WORD, a <ide> } <ide> <ide> // HandleOutputCommand interpretes the Ansi commands and then makes appropriate Win32 calls <del>func (term *WindowsTerminal) HandleOutputCommand(command []byte) (n int, err error) { <add>func (term *WindowsTerminal) HandleOutputCommand(fd uintptr, command []byte) (n int, err error) { <ide> // console settings changes need to happen in atomic way <ide> term.outMutex.Lock() <ide> defer term.outMutex.Unlock() <ide> func (term *WindowsTerminal) HandleOutputCommand(command []byte) (n int, err err <ide> parsedCommand := parseAnsiCommand(command) <ide> <ide> // use appropriate handle <del> handle, _ := syscall.GetStdHandle(STD_OUTPUT_HANDLE) <add> handle := syscall.Handle(fd) <ide> <ide> switch parsedCommand.Command { <ide> case "m": <ide> func (term *WindowsTerminal) HandleOutputCommand(command []byte) (n int, err err <ide> } <ide> <ide> // WriteChars writes the bytes to given writer. <del>func (term *WindowsTerminal) WriteChars(w io.Writer, p []byte) (n int, err error) { <add>func (term *WindowsTerminal) WriteChars(fd uintptr, w io.Writer, p []byte) (n int, err error) { <ide> return w.Write(p) <ide> } <ide> <ide> func mapKeystokeToTerminalString(keyEvent *KEY_EVENT_RECORD, escapeSequence []by <ide> <ide> // getAvailableInputEvents polls the console for availble events <ide> // The function does not return until at least one input record has been read. <del>func getAvailableInputEvents() (inputEvents []INPUT_RECORD, err error) { <del> handle, _ := syscall.GetStdHandle(STD_INPUT_HANDLE) <add>func getAvailableInputEvents(fd uintptr) (inputEvents []INPUT_RECORD, err error) { <add> handle := syscall.Handle(fd) <ide> if nil != err { <ide> return nil, err <ide> } <ide> func getTranslatedKeyCodes(inputEvents []INPUT_RECORD, escapeSequence []byte) st <ide> } <ide> <ide> // ReadChars reads the characters from the given reader <del>func (term *WindowsTerminal) ReadChars(w io.Reader, p []byte) (n int, err error) { <add>func (term *WindowsTerminal) ReadChars(fd uintptr, w io.Reader, p []byte) (n int, err error) { <ide> n = 0 <ide> for n < len(p) { <ide> select { <ide> func (term *WindowsTerminal) ReadChars(w io.Reader, p []byte) (n int, err error) <ide> if n > 0 { <ide> return n, nil <ide> } <del> inputEvents, _ := getAvailableInputEvents() <add> inputEvents, _ := getAvailableInputEvents(fd) <ide> if inputEvents != nil { <ide> if len(inputEvents) == 0 && nil != err { <ide> return n, err <ide> func (term *WindowsTerminal) ReadChars(w io.Reader, p []byte) (n int, err error) <ide> } <ide> <ide> // HandleInputSequence interprets the input sequence command <del>func (term *WindowsTerminal) HandleInputSequence(command []byte) (n int, err error) { <add>func (term *WindowsTerminal) HandleInputSequence(fd uintptr, command []byte) (n int, err error) { <ide> return 0, nil <ide> } <ide> <ide><path>pkg/term/winconsole/term_emulator.go <ide> const ( <ide> <ide> // Interface that implements terminal handling <ide> type terminalEmulator interface { <del> HandleOutputCommand(command []byte) (n int, err error) <del> HandleInputSequence(command []byte) (n int, err error) <del> WriteChars(w io.Writer, p []byte) (n int, err error) <del> ReadChars(w io.Reader, p []byte) (n int, err error) <add> HandleOutputCommand(fd uintptr, command []byte) (n int, err error) <add> HandleInputSequence(fd uintptr, command []byte) (n int, err error) <add> WriteChars(fd uintptr, w io.Writer, p []byte) (n int, err error) <add> ReadChars(fd uintptr, w io.Reader, p []byte) (n int, err error) <ide> } <ide> <ide> type terminalWriter struct { <ide> wrappedWriter io.Writer <ide> emulator terminalEmulator <ide> command []byte <ide> inSequence bool <add> fd uintptr <ide> } <ide> <ide> type terminalReader struct { <ide> wrappedReader io.ReadCloser <ide> emulator terminalEmulator <ide> command []byte <ide> inSequence bool <add> fd uintptr <ide> } <ide> <ide> // http://manpages.ubuntu.com/manpages/intrepid/man4/console_codes.4.html <ide> func (tw *terminalWriter) Write(p []byte) (n int, err error) { <ide> if !isXtermOscSequence(tw.command, p[current]) { <ide> // found the last command character. <ide> // Now we have a complete command. <del> nchar, err := tw.emulator.HandleOutputCommand(tw.command) <add> nchar, err := tw.emulator.HandleOutputCommand(tw.fd, tw.command) <ide> totalWritten += nchar <ide> if err != nil { <ide> return totalWritten, err <ide> func (tw *terminalWriter) Write(p []byte) (n int, err error) { <ide> tw.inSequence = true <ide> // indicates end of "normal sequence", write whatever you have so far <ide> if len(p[start:current]) > 0 { <del> nw, err := tw.emulator.WriteChars(tw.wrappedWriter, p[start:current]) <add> nw, err := tw.emulator.WriteChars(tw.fd, tw.wrappedWriter, p[start:current]) <ide> totalWritten += nw <ide> if err != nil { <ide> return totalWritten, err <ide> func (tw *terminalWriter) Write(p []byte) (n int, err error) { <ide> if !tw.inSequence { <ide> // assumption is that we can't be inside sequence and therefore command should be empty <ide> if len(p[start:]) > 0 { <del> nw, err := tw.emulator.WriteChars(tw.wrappedWriter, p[start:]) <add> nw, err := tw.emulator.WriteChars(tw.fd, tw.wrappedWriter, p[start:]) <ide> totalWritten += nw <ide> if err != nil { <ide> return totalWritten, err <ide> func (tr *terminalReader) Read(p []byte) (n int, err error) { <ide> if nil == tr.emulator { <ide> return tr.readFromWrappedReader(p) <ide> } <del> return tr.emulator.ReadChars(tr.wrappedReader, p) <add> return tr.emulator.ReadChars(tr.fd, tr.wrappedReader, p) <ide> } <ide> <ide> // Close the underlying stream <ide><path>pkg/term/winconsole/term_emulator_test.go <ide> func (mt *mockTerminal) record(operation int, data []byte) { <ide> mt.OutputCommandSequence = append(mt.OutputCommandSequence, op) <ide> } <ide> <del>func (mt *mockTerminal) HandleOutputCommand(command []byte) (n int, err error) { <add>func (mt *mockTerminal) HandleOutputCommand(fd uintptr, command []byte) (n int, err error) { <ide> mt.record(COMMAND_OPERATION, command) <ide> return len(command), nil <ide> } <ide> <del>func (mt *mockTerminal) HandleInputSequence(command []byte) (n int, err error) { <add>func (mt *mockTerminal) HandleInputSequence(fd uintptr, command []byte) (n int, err error) { <ide> return 0, nil <ide> } <ide> <del>func (mt *mockTerminal) WriteChars(w io.Writer, p []byte) (n int, err error) { <add>func (mt *mockTerminal) WriteChars(fd uintptr, w io.Writer, p []byte) (n int, err error) { <ide> mt.record(WRITE_OPERATION, p) <ide> return len(p), nil <ide> } <ide> <del>func (mt *mockTerminal) ReadChars(w io.Reader, p []byte) (n int, err error) { <add>func (mt *mockTerminal) ReadChars(fd uintptr, w io.Reader, p []byte) (n int, err error) { <ide> return len(p), nil <ide> } <ide>
6
Text
Text
remove dead link
8d291e91e68ce942ed4a2232cc81405b8b432b08
<ide><path>docs/community/videos.md <ide> Facebook engineers [Bill Fisher](https://twitter.com/fisherwebdev) and [Jing Che <ide> <ide> <iframe width="100%" height="366" src="https://www.youtube-nocookie.com/embed/i__969noyAM" frameborder="0" allowfullscreen></iframe> <ide> <del>### Server-Side Rendering of Isomorphic Apps at SoundCloud <del> <del>Walk-through by [Andres Suarez](https://github.com/zertosh) on how [SoundCloud](https://developers.soundcloud.com/blog/) is using React and Flux for server-side rendering. <del> <del><iframe src="https://player.vimeo.com/video/108488724" width="100%" height="365" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> <del> <ide> > [Slides and sample code](https://github.com/zertosh/ssr-demo-kit) <ide> <ide> ### CodeWinds Podcast
1
PHP
PHP
add console events
b26a9faacc933f5c56dd1b72cc5e443627317aa4
<ide><path>src/Illuminate/Console/Application.php <ide> use Symfony\Component\Console\Input\ArrayInput; <ide> use Symfony\Component\Console\Input\InputOption; <ide> use Symfony\Component\Process\PhpExecutableFinder; <add>use Symfony\Component\Console\Input\InputInterface; <ide> use Symfony\Component\Console\Output\BufferedOutput; <add>use Symfony\Component\Console\Output\OutputInterface; <ide> use Symfony\Component\Console\Application as SymfonyApplication; <ide> use Symfony\Component\Console\Command\Command as SymfonyCommand; <ide> use Illuminate\Contracts\Console\Application as ApplicationContract; <ide> class Application extends SymfonyApplication implements ApplicationContract <ide> */ <ide> protected static $bootstrappers = []; <ide> <add> /** <add> * The Event Dispatcher. <add> * <add> * @var \Illuminate\Contracts\Events\Dispatcher <add> */ <add> protected $events; <add> <ide> /** <ide> * Create a new Artisan console application. <ide> * <ide> public function __construct(Container $laravel, Dispatcher $events, $version) <ide> parent::__construct('Laravel Framework', $version); <ide> <ide> $this->laravel = $laravel; <add> $this->events = $events; <ide> $this->setAutoExit(false); <ide> $this->setCatchExceptions(false); <ide> <del> $events->dispatch(new Events\ArtisanStarting($this)); <add> $this->events->dispatch(new Events\ArtisanStarting($this)); <ide> <ide> $this->bootstrap(); <ide> } <ide> <add> /** <add> * {@inheritdoc} <add> */ <add> public function run(InputInterface $input = null, OutputInterface $output = null) <add> { <add> $commandName = $this->getCommandName($input); <add> <add> $this->events->fire( <add> new Events\CommandStarting($commandName, $input) <add> ); <add> <add> $exitCode = parent::run($input, $output); <add> <add> $this->events->fire( <add> new Events\CommandTerminating($commandName, $input, $exitCode) <add> ); <add> <add> return $exitCode; <add> } <add> <ide> /** <ide> * Determine the proper PHP executable. <ide> * <ide><path>src/Illuminate/Console/Events/CommandStarting.php <add><?php <add> <add>namespace Illuminate\Console\Events; <add> <add>use Symfony\Component\Console\Input\InputInterface; <add> <add>class CommandStarting <add>{ <add> /** <add> * The command name. <add> * <add> * @var string <add> */ <add> public $command; <add> <add> /** <add> * The console input. <add> * <add> * @var string <add> */ <add> public $input; <add> <add> /** <add> * Create a new event instance. <add> * <add> * @param string $command <add> * @param \Symfony\Component\Console\Input\InputInterface $input <add> * @return void <add> */ <add> public function __construct($command, InputInterface $input) <add> { <add> $this->command = $command; <add> $this->input = $input; <add> } <add>} <ide><path>src/Illuminate/Console/Events/CommandTerminating.php <add><?php <add> <add>namespace Illuminate\Console\Events; <add> <add>use Symfony\Component\Console\Input\InputInterface; <add> <add>class CommandTerminating <add>{ <add> /** <add> * The command name. <add> * <add> * @var string <add> */ <add> public $command; <add> <add> /** <add> * The console input. <add> * <add> * @var string <add> */ <add> public $input; <add> <add> /** <add> * The command exit code. <add> * <add> * @var int <add> */ <add> public $exitCode; <add> <add> /** <add> * Create a new event instance. <add> * <add> * @param string $command <add> * @param \Symfony\Component\Console\Input\InputInterface $input <add> * @param int $exitCode <add> * @return void <add> */ <add> public function __construct($command, InputInterface $input, $exitCode) <add> { <add> $this->command = $command; <add> $this->input = $input; <add> $this->exitCode = $exitCode; <add> } <add>}
3
Python
Python
prepare 2.0.8 release
c7dd36a1bab362de478f528078261439b803aaa7
<ide><path>keras/__init__.py <ide> # Importable from root because it's technically not a layer <ide> from .layers import Input <ide> <del>__version__ = '2.0.7' <add>__version__ = '2.0.8' <ide><path>setup.py <ide> <ide> <ide> setup(name='Keras', <del> version='2.0.7', <add> version='2.0.8', <ide> description='Deep Learning for Python', <ide> author='Francois Chollet', <ide> author_email='[email protected]', <ide> url='https://github.com/fchollet/keras', <del> download_url='https://github.com/fchollet/keras/tarball/2.0.7', <add> download_url='https://github.com/fchollet/keras/tarball/2.0.8', <ide> license='MIT', <ide> install_requires=['numpy>=1.9.1', <ide> 'scipy>=0.14',
2
Javascript
Javascript
add gltfloader pointsmaterial support
8e56415cc65d0e0d061e559e94b07006f8a2eaa0
<ide><path>examples/js/loaders/GLTFLoader.js <ide> THREE.GLTFLoader = ( function () { <ide> <ide> } else if ( primitive.mode === WEBGL_CONSTANTS.POINTS ) { <ide> <add> var cacheKey = 'PointsMaterial:' + material.uuid; <add> <add> var pointsMaterial = scope.cache.get( cacheKey ); <add> <add> if ( ! pointsMaterial ) { <add> <add> pointsMaterial = new THREE.PointsMaterial(); <add> THREE.Material.prototype.copy.call( pointsMaterial, material ); <add> pointsMaterial.color.copy( material.color ); <add> pointsMaterial.map = material.map; <add> pointsMaterial.lights = false; // PointsMaterial doesn't support lights yet <add> <add> scope.cache.add( cacheKey, pointsMaterial ); <add> <add> } <add> <add> material = pointsMaterial; <add> <ide> mesh = new THREE.Points( geometry, material ); <ide> <ide> } else {
1
PHP
PHP
fix coding standards in datasource tests
346e048371178d6fbd04f9d611596d4f0eb39350
<ide><path>lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php <ide> * @package Cake.Test.Case.Model.Datasource.Database <ide> */ <ide> class MysqlTest extends CakeTestCase { <add> <ide> /** <ide> * autoFixtures property <ide> * <ide> public function testIndexDetection() { <ide> $this->Dbo->rawQuery('DROP TABLE ' . $name); <ide> $this->assertEquals($expected, $result); <ide> <del> <ide> $name = $this->Dbo->fullTableName('with_a_key'); <ide> $this->Dbo->rawQuery('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id), KEY `pointless_bool` ( `bool` ));'); <ide> $expected = array( <ide> public function testIndexOnMySQL4Output() { <ide> 'Column_name' => 'id', <ide> 'Collation' => 'A', <ide> 'Cardinality' => '0', <del> 'Sub_part' => NULL, <del> 'Packed' => NULL, <add> 'Sub_part' => null, <add> 'Packed' => null, <ide> 'Null' => '', <ide> 'Index_type' => 'BTREE', <ide> 'Comment' => '' <ide> public function testIndexOnMySQL4Output() { <ide> 'Seq_in_index' => '1', <ide> 'Column_name' => 'bool', <ide> 'Collation' => 'A', <del> 'Cardinality' => NULL, <del> 'Sub_part' => NULL, <del> 'Packed' => NULL, <add> 'Cardinality' => null, <add> 'Sub_part' => null, <add> 'Packed' => null, <ide> 'Null' => 'YES', <ide> 'Index_type' => 'BTREE', <ide> 'Comment' => '' <ide> public function testIndexOnMySQL4Output() { <ide> 'Seq_in_index' => '1', <ide> 'Column_name' => 'small_int', <ide> 'Collation' => 'A', <del> 'Cardinality' => NULL, <del> 'Sub_part' => NULL, <del> 'Packed' => NULL, <add> 'Cardinality' => null, <add> 'Sub_part' => null, <add> 'Packed' => null, <ide> 'Null' => 'YES', <ide> 'Index_type' => 'BTREE', <ide> 'Comment' => '' <ide> public function testIndexOnMySQL4Output() { <ide> 'Seq_in_index' => '1', <ide> 'Column_name' => 'bool', <ide> 'Collation' => 'A', <del> 'Cardinality' => NULL, <del> 'Sub_part' => NULL, <del> 'Packed' => NULL, <add> 'Cardinality' => null, <add> 'Sub_part' => null, <add> 'Packed' => null, <ide> 'Null' => 'YES', <ide> 'Index_type' => 'BTREE', <ide> 'Comment' => '' <ide> public function testIndexOnMySQL4Output() { <ide> 'Seq_in_index' => '2', <ide> 'Column_name' => 'small_int', <ide> 'Collation' => 'A', <del> 'Cardinality' => NULL, <del> 'Sub_part' => NULL, <del> 'Packed' => NULL, <add> 'Cardinality' => null, <add> 'Sub_part' => null, <add> 'Packed' => null, <ide> 'Null' => 'YES', <ide> 'Index_type' => 'BTREE', <ide> 'Comment' => '' <ide> public function testIndexOnMySQL4Output() { <ide> ->will($this->returnValue($resultMock)); <ide> <ide> foreach ($columnData as $i => $data) { <del> $resultMock->expects($this->at($i))->method('fetch')->will($this->returnValue((object) $data)); <add> $resultMock->expects($this->at($i))->method('fetch')->will($this->returnValue((object)$data)); <ide> } <ide> <ide> $result = $mockDbo->index($name, false); <ide> public function testAlterSchemaIndexes() { <ide> $this->Dbo->cacheSources = $this->Dbo->testing = false; <ide> $table = $this->Dbo->fullTableName('altertest'); <ide> <del> $schema1 = new CakeSchema(array( <add> $schemaA = new CakeSchema(array( <ide> 'name' => 'AlterTest1', <ide> 'connection' => 'test', <ide> 'altertest' => array( <ide> public function testAlterSchemaIndexes() { <ide> 'group1' => array('type' => 'integer', 'null' => true), <ide> 'group2' => array('type' => 'integer', 'null' => true) <ide> ))); <del> $result = $this->Dbo->createSchema($schema1); <add> $result = $this->Dbo->createSchema($schemaA); <ide> $this->assertContains('`id` int(11) DEFAULT 0 NOT NULL,', $result); <ide> $this->assertContains('`name` varchar(50) NOT NULL,', $result); <ide> $this->assertContains('`group1` int(11) DEFAULT NULL', $result); <ide> public function testAlterSchemaIndexes() { <ide> $query = $this->Dbo->getConnection()->prepare($result); <ide> $this->assertEquals($result, $query->queryString); <ide> <del> $schema2 = new CakeSchema(array( <add> $schemaB = new CakeSchema(array( <ide> 'name' => 'AlterTest2', <ide> 'connection' => 'test', <ide> 'altertest' => array( <ide> public function testAlterSchemaIndexes() { <ide> 'PRIMARY' => array('column' => 'id', 'unique' => 1)) <ide> ))); <ide> <del> $result = $this->Dbo->alterSchema($schema2->compare($schema1)); <add> $result = $this->Dbo->alterSchema($schemaB->compare($schemaA)); <ide> $this->assertContains("ALTER TABLE $table", $result); <ide> $this->assertContains('ADD KEY name_idx (`name`),', $result); <ide> $this->assertContains('ADD KEY group_idx (`group1`),', $result); <ide> public function testAlterSchemaIndexes() { <ide> $this->assertEquals($result, $query->queryString); <ide> <ide> // Change three indexes, delete one and add another one <del> $schema3 = new CakeSchema(array( <add> $schemaC = new CakeSchema(array( <ide> 'name' => 'AlterTest3', <ide> 'connection' => 'test', <ide> 'altertest' => array( <ide> public function testAlterSchemaIndexes() { <ide> 'id_name_idx' => array('column' => array('id', 'name'), 'unique' => 0)) <ide> ))); <ide> <del> $result = $this->Dbo->alterSchema($schema3->compare($schema2)); <add> $result = $this->Dbo->alterSchema($schemaC->compare($schemaB)); <ide> $this->assertContains("ALTER TABLE $table", $result); <ide> $this->assertContains('DROP PRIMARY KEY,', $result); <ide> $this->assertContains('DROP KEY name_idx,', $result); <ide> public function testAlterSchemaIndexes() { <ide> $this->assertEquals($result, $query->queryString); <ide> <ide> // Compare us to ourself. <del> $this->assertEquals($schema3->compare($schema3), array()); <add> $this->assertEquals($schemaC->compare($schemaC), array()); <ide> <ide> // Drop the indexes <del> $result = $this->Dbo->alterSchema($schema1->compare($schema3)); <add> $result = $this->Dbo->alterSchema($schemaA->compare($schemaC)); <ide> <ide> $this->assertContains("ALTER TABLE $table", $result); <ide> $this->assertContains('DROP KEY name_idx,', $result); <ide> public function testBlobSaving() { <ide> public function testAlteringTableParameters() { <ide> $this->Dbo->cacheSources = $this->Dbo->testing = false; <ide> <del> $schema1 = new CakeSchema(array( <add> $schemaA = new CakeSchema(array( <ide> 'name' => 'AlterTest1', <ide> 'connection' => 'test', <ide> 'altertest' => array( <ide> public function testAlteringTableParameters() { <ide> ) <ide> ) <ide> )); <del> $this->Dbo->rawQuery($this->Dbo->createSchema($schema1)); <del> $schema2 = new CakeSchema(array( <add> $this->Dbo->rawQuery($this->Dbo->createSchema($schemaA)); <add> $schemaB = new CakeSchema(array( <ide> 'name' => 'AlterTest1', <ide> 'connection' => 'test', <ide> 'altertest' => array( <ide> public function testAlteringTableParameters() { <ide> ) <ide> ) <ide> )); <del> $result = $this->Dbo->alterSchema($schema2->compare($schema1)); <add> $result = $this->Dbo->alterSchema($schemaB->compare($schemaA)); <ide> $this->assertContains('DEFAULT CHARSET=utf8', $result); <ide> $this->assertContains('ENGINE=InnoDB', $result); <ide> $this->assertContains('COLLATE=utf8_general_ci', $result); <ide> public function testAlteringTableParameters() { <ide> $this->assertEquals($result['Engine'], 'InnoDB'); <ide> $this->assertEquals($result['charset'], 'utf8'); <ide> <del> $this->Dbo->rawQuery($this->Dbo->dropSchema($schema1)); <add> $this->Dbo->rawQuery($this->Dbo->dropSchema($schemaA)); <ide> } <ide> <ide> /** <ide> public function testDescribeGettingFieldParameters() { <ide> ) <ide> )); <ide> <del> <ide> $this->Dbo->execute($this->Dbo->createSchema($schema)); <ide> $model = new CakeTestModel(array('table' => 'testdescribes', 'name' => 'Testdescribes')); <ide> $result = $model->getDataSource()->describe($model); <ide> public function testFieldDoubleEscaping() { <ide> $this->assertEquals($result, array('`Article`.`id`')); <ide> <ide> $test->expects($this->at(0))->method('execute') <del> ->with('SELECT `Article`.`id` FROM ' . $test->fullTableName('articles'). ' AS `Article` WHERE 1 = 1'); <add> ->with('SELECT `Article`.`id` FROM ' . $test->fullTableName('articles') . ' AS `Article` WHERE 1 = 1'); <ide> <ide> $result = $test->read($this->Model, array( <ide> 'fields' => $this->Model->escapeField(), <ide> protected function &_prepareAssociationQuery(Model $model, &$queryData, $binding <ide> * @param array $data <ide> * @return array <ide> */ <del> function _scrubQueryData($data) { <add> protected function _scrubQueryData($data) { <ide> static $base = null; <ide> if ($base === null) { <ide> $base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array()); <ide> public function testGenerateAssociationQuerySelfJoinWithConditions() { <ide> $result = $this->Dbo->generateAssociationQuery($this->Featured2, $null, null, null, null, $queryData, false, $null); <ide> <ide> $this->assertRegExp( <del> '/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+'. <add> '/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+' . <ide> '`ArticleFeatured2`\.`id`, `ArticleFeatured2`\.`title`, `ArticleFeatured2`\.`user_id`, `ArticleFeatured2`\.`published`\s+' . <ide> 'FROM\s+\S+`featured2` AS `Featured2`\s+LEFT JOIN\s+\S+`article_featured` AS `ArticleFeatured2`' . <ide> '\s+ON\s+\(`ArticleFeatured2`.`published` = \'Y\'\s+AND\s+`Featured2`\.`article_featured2_id` = `ArticleFeatured2`\.`id`\)' . <ide> public function testGenerateAssociationQueryBelongsTo() { <ide> <ide> $testModel4Table = $this->Dbo->fullTableName($this->Model->TestModel4, true, true); <ide> $result = $this->Dbo->buildJoinStatement($queryData['joins'][0]); <del> $expected = ' LEFT JOIN ' .$testModel4Table. ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)'; <add> $expected = ' LEFT JOIN ' . $testModel4Table . ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)'; <ide> $this->assertEquals(trim($result), trim($expected)); <ide> <ide> $result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null); <ide> public function testGenerateAssociationQueryBelongsToWithConditions() { <ide> <ide> $testModel4Table = $this->Dbo->fullTableName($this->Model->TestModel4, true, true); <ide> $result = $this->Dbo->buildJoinStatement($queryData['joins'][0]); <del> $expected = ' LEFT JOIN ' .$testModel4Table. ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)'; <add> $expected = ' LEFT JOIN ' . $testModel4Table . ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)'; <ide> $this->assertEquals(trim($result), trim($expected)); <ide> <ide> $result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null); <ide> public function testGenerateAssociationQueryHasManyWithLimit() { <ide> $result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external'], $resultSet); <ide> $this->assertRegExp( <ide> '/^SELECT\s+' . <del> '`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+'. <add> '`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+' . <ide> 'FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+' . <del> '`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)\s*'. <del> 'LIMIT \d*'. <add> '`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)\s*' . <add> 'LIMIT \d*' . <ide> '\s*$/', $result <ide> ); <ide> <ide> $result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null); <ide> $this->assertRegExp( <del> '/^SELECT\s+'. <del> '`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+'. <del> 'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+'. <del> '(?:\()?\s*1 = 1\s*(?:\))?'. <add> '/^SELECT\s+' . <add> '`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+' . <add> 'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+' . <add> '(?:\()?\s*1 = 1\s*(?:\))?' . <ide> '\s*$/', $result <ide> ); <ide> } <ide> public function testGenerateAssociationQueryHasManyWithOffsetAndLimit() { <ide> $this->Model->schema(); <ide> $this->_buildRelatedModels($this->Model); <ide> <del> $__backup = $this->Model->hasMany['TestModel6']; <add> $backup = $this->Model->hasMany['TestModel6']; <ide> <ide> $this->Model->hasMany['TestModel6']['offset'] = 2; <ide> $this->Model->hasMany['TestModel6']['limit'] = 5; <ide> public function testGenerateAssociationQueryHasManyWithOffsetAndLimit() { <ide> $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); <ide> $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); <ide> <del> $this->Model->hasMany['TestModel6'] = $__backup; <add> $this->Model->hasMany['TestModel6'] = $backup; <ide> } <ide> <ide> /** <ide> public function testGenerateAssociationQueryHasManyWithPageAndLimit() { <ide> $this->Model->schema(); <ide> $this->_buildRelatedModels($this->Model); <ide> <del> $__backup = $this->Model->hasMany['TestModel6']; <add> $backup = $this->Model->hasMany['TestModel6']; <ide> <ide> $this->Model->hasMany['TestModel6']['page'] = 2; <ide> $this->Model->hasMany['TestModel6']['limit'] = 5; <ide> public function testGenerateAssociationQueryHasManyWithPageAndLimit() { <ide> $this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result); <ide> $this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); <ide> <del> $this->Model->hasMany['TestModel6'] = $__backup; <add> $this->Model->hasMany['TestModel6'] = $backup; <ide> } <ide> <ide> /** <ide> public function testGenerateAssociationQueryHasAndBelongsToManyWithOffsetAndLimi <ide> $this->Model->schema(); <ide> $this->_buildRelatedModels($this->Model); <ide> <del> $__backup = $this->Model->hasAndBelongsToMany['TestModel7']; <add> $backup = $this->Model->hasAndBelongsToMany['TestModel7']; <ide> <ide> $this->Model->hasAndBelongsToMany['TestModel7']['offset'] = 2; <ide> $this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5; <ide> public function testGenerateAssociationQueryHasAndBelongsToManyWithOffsetAndLimi <ide> $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); <ide> $this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); <ide> <del> $this->Model->hasAndBelongsToMany['TestModel7'] = $__backup; <add> $this->Model->hasAndBelongsToMany['TestModel7'] = $backup; <ide> } <ide> <ide> /** <ide> public function testGenerateAssociationQueryHasAndBelongsToManyWithPageAndLimit( <ide> $this->Model->schema(); <ide> $this->_buildRelatedModels($this->Model); <ide> <del> $__backup = $this->Model->hasAndBelongsToMany['TestModel7']; <add> $backup = $this->Model->hasAndBelongsToMany['TestModel7']; <ide> <ide> $this->Model->hasAndBelongsToMany['TestModel7']['page'] = 2; <ide> $this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5; <ide> public function testGenerateAssociationQueryHasAndBelongsToManyWithPageAndLimit( <ide> $this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result); <ide> $this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result); <ide> <del> $this->Model->hasAndBelongsToMany['TestModel7'] = $__backup; <add> $this->Model->hasAndBelongsToMany['TestModel7'] = $backup; <ide> } <ide> <ide> /** <ide> public function testQuotesInStringConditions() { <ide> $expected = ' WHERE `Member`.`email` = \'[email protected]\' AND `Member`.`user` LIKE \'mariano.iglesias%\''; <ide> $this->assertEquals($expected, $result); <ide> <del> <ide> $result = $this->Dbo->conditions('Member.email = "[email protected]" AND Member.user LIKE "mariano.iglesias%"'); <ide> $expected = ' WHERE `Member`.`email` = "[email protected]" AND `Member`.`user` LIKE "mariano.iglesias%"'; <ide> $this->assertEquals($expected, $result); <ide> public function testArrayConditionsParsing() { <ide> $expected = " WHERE MAX(`Post`.`rating`) > '50'"; <ide> $this->assertEquals($expected, $result); <ide> <del> $result = $this->Dbo->conditions(array('lower(Article.title)' => 'secrets')); <add> $result = $this->Dbo->conditions(array('lower(Article.title)' => 'secrets')); <ide> $expected = " WHERE lower(`Article`.`title`) = 'secrets'"; <ide> $this->assertEquals($expected, $result); <ide> <ide> public function testHasAny() { <ide> <ide> $modelTable = $this->Dbo->fullTableName($this->Model); <ide> $this->Dbo->expects($this->at(1))->method('execute') <del> ->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' .$modelTable. ' AS `TestModel` WHERE `TestModel`.`name` = \'harry\''); <add> ->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' . $modelTable . ' AS `TestModel` WHERE `TestModel`.`name` = \'harry\''); <ide> $this->Dbo->expects($this->at(2))->method('execute') <del> ->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' .$modelTable. ' AS `TestModel` WHERE 1 = 1'); <add> ->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' . $modelTable . ' AS `TestModel` WHERE 1 = 1'); <ide> <ide> $this->Dbo->hasAny($this->Model, array('TestModel.name' => 'harry')); <ide> $this->Dbo->hasAny($this->Model, array()); <del> <ide> } <ide> <ide> /** <ide> public function testVirtualFieldsFetch() { <ide> <ide> $conditions = array('comment_count >' => 2); <ide> $query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) . <del> ' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article); <add> ' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article); <ide> $result = $this->Dbo->fetchAll($query); <ide> $expected = array(array( <ide> 'Article' => array('id' => 1, 'comment_count' => 4) <ide> public function testIntrospectType() { <ide> $data = array(2, 2.2); <ide> $this->assertEquals($this->Dbo->introspectType($data), 'integer'); <ide> <del> <del> // NULL <add> // null <ide> $result = $this->Dbo->value(null, 'boolean'); <ide> $this->assertEquals($result, 'NULL'); <ide> <ide> // EMPTY STRING <ide> $result = $this->Dbo->value('', 'boolean'); <ide> $this->assertEquals($result, "'0'"); <ide> <del> <ide> // BOOLEAN <ide> $result = $this->Dbo->value('true', 'boolean'); <ide> $this->assertEquals($result, "'1'"); <ide> public function testUpdateStatements() { <ide> $this->Dbo->update($Article, array('field1'), array('value1')); <ide> $this->Dbo->update($Article, array('field1'), array('2'), '2=2'); <ide> $this->Dbo->update($Article, array('field1'), array("'value'"), array('index' => 'val')); <del> <ide> } <ide> <ide> /** <ide><path>lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php <ide> protected function _execute($sql, $params = array(), $prepareOptions = array()) <ide> public function getLastQuery() { <ide> return $this->simulated[count($this->simulated) - 1]; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function findAll($conditions = null, $fields = null, $order = null, $recu <ide> */ <ide> public function schema($field = false) { <ide> return array( <del> 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), <add> 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), <ide> 'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'), <del> 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <del> 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <del> 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <del> 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <del> 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'), <del> 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <del> 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''), <del> 'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''), <del> 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), <del> 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) <add> 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <add> 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <add> 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <add> 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <add> 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'), <add> 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <add> 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''), <add> 'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''), <add> 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), <add> 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) <ide> ); <ide> } <add> <ide> } <ide> <ide> /** <ide> class PostgresClientTestModel extends Model { <ide> */ <ide> public function schema($field = false) { <ide> return array( <del> 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'), <del> 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <del> 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'created' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''), <del> 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) <add> 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'), <add> 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <add> 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'created' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''), <add> 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) <ide> ); <ide> } <add> <ide> } <ide> <ide> /** <ide> public function testCakeSchema() { <ide> $db1 = ConnectionManager::getDataSource('test'); <ide> $db1->cacheSources = false; <ide> <del> $db1->rawQuery('CREATE TABLE ' . $db1->fullTableName('datatype_tests') . ' ( <add> $db1->rawQuery('CREATE TABLE ' . $db1->fullTableName('datatype_tests') . ' ( <ide> id serial NOT NULL, <ide> "varchar" character varying(40) NOT NULL, <ide> "full_length" character varying NOT NULL, <ide> public function testCakeSchema() { <ide> $schema->tables = array('datatype_tests' => $result['tables']['missing']['datatype_tests']); <ide> $result = $db1->createSchema($schema, 'datatype_tests'); <ide> <del> <ide> $this->assertNotRegExp('/timestamp DEFAULT/', $result); <ide> $this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result); <ide> $this->assertRegExp('/timestamp\s*,/', $result); <ide> <del> <ide> $db1->query('DROP TABLE ' . $db1->fullTableName('datatype_tests')); <ide> <ide> $db1->query($result); <ide> public function testAlterIndexes() { <ide> $this->Dbo->query($this->Dbo->dropSchema($schema1)); <ide> } <ide> <del>/* <add>/** <ide> * Test it is possible to use virtual field with postgresql <ide> * <ide> * @return void <ide> public function testOrderAdditionalParams() { <ide> } <ide> <ide> /** <del>* Test it is possible to do a SELECT COUNT(DISTINCT Model.field) query in postgres and it gets correctly quoted <del>*/ <add> * Test it is possible to do a SELECT COUNT(DISTINCT Model.field) <add> * query in postgres and it gets correctly quoted <add> * <add> * @return void <add> */ <ide> public function testQuoteDistinctInFunction() { <ide> $this->loadFixtures('Article'); <ide> $Article = new Article; <ide> public function testAlteringTwoTables() { <ide> */ <ide> public function testEncoding() { <ide> $result = $this->Dbo->setEncoding('UTF8'); <del> $this->assertTrue($result) ; <add> $this->assertTrue($result); <ide> <ide> $result = $this->Dbo->getEncoding(); <del> $this->assertEquals('UTF8', $result) ; <add> $this->assertEquals('UTF8', $result); <ide> <ide> $result = $this->Dbo->setEncoding('EUC_JP'); /* 'EUC_JP' is right character code name in PostgreSQL */ <del> $this->assertTrue($result) ; <add> $this->assertTrue($result); <ide> <ide> $result = $this->Dbo->getEncoding(); <del> $this->assertEquals('EUC_JP', $result) ; <add> $this->assertEquals('EUC_JP', $result); <ide> } <ide> <ide> /** <ide><path>lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php <ide> protected function _execute($sql, $params = array(), $prepareOptions = array()) <ide> public function getLastQuery() { <ide> return $this->simulated[count($this->simulated) - 1]; <ide> } <add> <ide> } <ide> <ide> /** <ide><path>lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php <ide> public function clearFieldMappings() { <ide> public function describe($model) { <ide> return empty($this->describe) ? parent::describe($model) : $this->describe; <ide> } <add> <ide> } <ide> <ide> /** <ide> class SqlserverTestModel extends CakeTestModel { <ide> * @var array <ide> */ <ide> protected $_schema = array( <del> 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'), <del> 'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'), <del> 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <del> 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <del> 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <del> 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <del> 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'), <del> 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <del> 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <del> 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''), <del> 'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''), <del> 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), <del> 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) <add> 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'), <add> 'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'), <add> 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <add> 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), <add> 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <add> 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <add> 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'), <add> 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), <add> 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), <add> 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''), <add> 'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''), <add> 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), <add> 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) <ide> ); <ide> <ide> /** <ide> class SqlserverTestModel extends CakeTestModel { <ide> public function find($conditions = null, $fields = null, $order = null, $recursive = null) { <ide> return $conditions; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function find($conditions = null, $fields = null, $order = null, $recursi <ide> * @package Cake.Test.Case.Model.Datasource.Database <ide> */ <ide> class SqlserverClientTestModel extends CakeTestModel { <add> <ide> /** <ide> * name property <ide> * <ide> class SqlserverClientTestModel extends CakeTestModel { <ide> * @package Cake.Test.Case.Model.Datasource.Database <ide> */ <ide> class SqlserverTestResultIterator extends ArrayIterator { <add> <ide> /** <ide> * closeCursor method <ide> * <ide> * @return void <ide> */ <del> public function closeCursor() {} <add> public function closeCursor() { <add> } <ide> <ide> /** <ide> * fetch method <ide> public function fetch() { <ide> $this->next(); <ide> return $current; <ide> } <add> <ide> } <ide> <ide> /** <ide> public function testDistinctWithLimit() { <ide> */ <ide> public function testDescribe() { <ide> $SqlserverTableDescription = new SqlserverTestResultIterator(array( <del> (object) array( <add> (object)array( <ide> 'Default' => '((0))', <ide> 'Field' => 'count', <ide> 'Key' => 0, <ide> 'Length' => '4', <ide> 'Null' => 'NO', <ide> 'Type' => 'integer' <ide> ), <del> (object) array( <add> (object)array( <ide> 'Default' => '', <ide> 'Field' => 'body', <ide> 'Key' => 0, <ide> 'Length' => '-1', <ide> 'Null' => 'YES', <ide> 'Type' => 'nvarchar' <ide> ), <del> (object) array( <add> (object)array( <ide> 'Default' => '', <ide> 'Field' => 'published', <ide> 'Key' => 0, <ide> public function testDescribe() { <ide> 'Null' => 'YES', <ide> 'Size' => '' <ide> ), <del> (object) array( <add> (object)array( <ide> 'Default' => '', <ide> 'Field' => 'id', <ide> 'Key' => 1,
4
Javascript
Javascript
throw error for invalid remotes
40be69b50aed925c605216ef6a297f1d2c240cd5
<ide><path>lib/util/extractUrlAndGlobal.js <ide> */ <ide> module.exports = function extractUrlAndGlobal(urlAndGlobal) { <ide> const index = urlAndGlobal.indexOf("@"); <add> if (index <= 0 || index === urlAndGlobal.length - 1) { <add> throw new Error(`Invalid request "${urlAndGlobal}"`); <add> } <ide> return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)]; <ide> }; <ide><path>test/extractUrlAndGlobal.unittest.js <ide> describe("extractUrlAndGlobal", () => { <ide> "_" <ide> ]); <ide> }); <add> it("should throw error if starts with @", () => { <add> expect(() => extractUrlAndGlobal("@something")).toThrow(); <add> }); <add> <add> it("should throw error if ends with @", () => { <add> expect(() => extractUrlAndGlobal("something@")).toThrow(); <add> }); <add> <add> it("should throw error if do not have @", () => { <add> expect(() => extractUrlAndGlobal("something")).toThrow(); <add> }); <ide> });
2
Ruby
Ruby
remove debug statements
debc202d1e1e819d9263c85c80669252b3dd650c
<ide><path>Library/Homebrew/dev-cmd/bottle.rb <ide> def bottle_formula(f) <ide> bottle.sha256 sha256 => Utils::Bottles.tag <ide> <ide> old_spec = f.bottle_specification <del> p root_url <del> p old_spec.root_url(root_url) <del> p bottle.root_url(root_url) <ide> if ARGV.include?("--keep-old") && !old_spec.checksums.empty? <ide> mismatches = [:root_url, :prefix, :cellar, :rebuild].select do |key| <ide> old_spec.send(key) != bottle.send(key)
1
Text
Text
fix typo in dockerlinks.md
e1f012cf397f170e12443e4993c09171791d37db
<ide><path>docs/userguide/networking/default_network/dockerlinks.md <ide> in your network stack as `docker0`. <ide> <ide> This section briefly discuss connecting via a network port and then goes into <ide> detail on container linking. While links are still supported on Docker's default <del>network (`bridge bridge`), you should avoid them in preference of the Docker <add>network (`bridge`), you should avoid them in preference of the Docker <ide> networks feature. Linking is expected to be deprecated and removed in a future <ide> release. <ide>
1
Javascript
Javascript
fix no nice decoration in webui processlist
e13e37fd685ea6793df5102a304a0d1be764a366
<ide><path>glances/outputs/static/js/services/plugins/glances_processlist.js <ide> glancesApp.service('GlancesPluginProcessList', function($filter, GlancesPlugin) <ide> } <ide> } <ide> <del> process.isNice = process.nice !== undefined && ((data['system'].os_name === 'Windows' && nice != 32) || (!data['system'].os_name === 'Windows' && process.nice != 0)); <add> process.isNice = process.nice !== undefined && ((data['system'].os_name === 'Windows' && nice != 32) || (data['system'].os_name !== 'Windows' && process.nice != 0)); <ide> <ide> this.processes.push(process); <ide> }
1
Ruby
Ruby
fix typo of using where instead of were
13b3c4636551e6f3007f701afea17d7aa92f4f76
<ide><path>activejob/lib/active_job/test_helper.rb <ide> def assert_enqueued_with(job: nil, args: nil, at: nil, queue: nil, priority: nil <ide> <ide> message = +"No enqueued job found with #{expected}" <ide> if potential_matches.empty? <del> message << "\n\nNo jobs where enqueued" <add> message << "\n\nNo jobs were enqueued" <ide> elsif matching_class.empty? <del> message << "\n\nNo jobs of class #{expected[:job]} where enqueued, job classes enqueued: " <add> message << "\n\nNo jobs of class #{expected[:job]} were enqueued, job classes enqueued: " <ide> message << potential_matches.map { |job| job["job_class"] }.join(", ") <ide> else <ide> message << "\n\nPotential matches: #{matching_class.join("\n")}" <ide> def assert_performed_with(job: nil, args: nil, at: nil, queue: nil, priority: ni <ide> <ide> message = +"No performed job found with #{expected}" <ide> if potential_matches.empty? <del> message << "\n\nNo jobs where performed" <add> message << "\n\nNo jobs were performed" <ide> elsif matching_class.empty? <del> message << "\n\nNo jobs of class #{expected[:job]} where performed, job classes performed: " <add> message << "\n\nNo jobs of class #{expected[:job]} were performed, job classes performed: " <ide> message << potential_matches.map { |job| job["job_class"] }.join(", ") <ide> else <ide> message << "\n\nPotential matches: #{matching_class.join("\n")}" <ide><path>activejob/test/cases/test_helper_test.rb <ide> def test_show_jobs_that_are_enqueued_when_job_is_not_queued_at_all <ide> end <ide> <ide> assert_match(/No enqueued job found with {:job=>MultipleKwargsJob, :args=>\[#{wilma.inspect}\]}/, error.message) <del> assert_match(/No jobs of class MultipleKwargsJob where enqueued, job classes enqueued: HelloJob/, error.message) <add> assert_match(/No jobs of class MultipleKwargsJob were enqueued, job classes enqueued: HelloJob/, error.message) <ide> end <ide> <ide> def test_shows_no_jobs_enqueued_when_there_are_no_jobs <ide> def test_shows_no_jobs_enqueued_when_there_are_no_jobs <ide> end <ide> <ide> assert_match(/No enqueued job found with {:job=>HelloJob, :args=>\[\]}/, error.message) <del> assert_match(/No jobs where enqueued/, error.message) <add> assert_match(/No jobs were enqueued/, error.message) <ide> end <ide> <ide> def test_assert_enqueued_with_failure_with_no_block_with_global_id_args <ide> def test_assert_performed_says_no_jobs_performed <ide> end <ide> <ide> assert_match(/No performed job found with {:job=>HelloJob, :args=>\[\]}/, error.message) <del> assert_match(/No jobs where performed/, error.message) <add> assert_match(/No jobs were performed/, error.message) <ide> end <ide> <ide> def test_assert_performed_when_not_matching_the_class_shows_alteratives <ide> def test_assert_performed_when_not_matching_the_class_shows_alteratives <ide> end <ide> <ide> assert_match(/No performed job found with {:job=>MultipleKwargsJob, :args=>\[#<Person.* @id=11>\]}/, error.message) <del> assert_match(/No jobs of class MultipleKwargsJob where performed, job classes performed: HelloJob/, error.message) <add> assert_match(/No jobs of class MultipleKwargsJob were performed, job classes performed: HelloJob/, error.message) <ide> end <ide> <ide> def test_assert_performed_with_does_not_change_jobs_count
2
Java
Java
add converter support for stream
018adb04f26ba51e680449eb60b357de0b9c960f
<ide><path>spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java <ide> /* <del> * Copyright 2002-2014 the original author or authors. <add> * Copyright 2002-2015 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> import java.util.Collection; <ide> import java.util.HashMap; <ide> import java.util.Map; <add>import java.util.stream.Stream; <ide> <ide> import org.springframework.core.MethodParameter; <ide> import org.springframework.core.ResolvableType; <add>import org.springframework.lang.UsesJava8; <ide> import org.springframework.util.Assert; <ide> import org.springframework.util.ClassUtils; <ide> import org.springframework.util.ObjectUtils; <ide> * @author Juergen Hoeller <ide> * @author Phillip Webb <ide> * @author Sam Brannen <add> * @author Stephane Nicoll <ide> * @since 3.0 <ide> */ <ide> @SuppressWarnings("serial") <ide> public class TypeDescriptor implements Serializable { <ide> <ide> static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0]; <ide> <add> private static final boolean streamAvailable = ClassUtils.isPresent( <add> "java.util.stream.Stream", TypeDescriptor.class.getClassLoader()); <add> <ide> private static final Map<Class<?>, TypeDescriptor> commonTypesCache = new HashMap<Class<?>, TypeDescriptor>(18); <ide> <ide> private static final Class<?>[] CACHED_COMMON_TYPES = { <ide> public boolean isArray() { <ide> <ide> /** <ide> * If this type is an array, returns the array's component type. <add> * If this type is a {@code Stream}, returns the stream's component type. <ide> * If this type is a {@link Collection} and it is parameterized, returns the Collection's element type. <ide> * If the Collection is not parameterized, returns {@code null} indicating the element type is not declared. <ide> * @return the array component type or Collection element type, or {@code null} if this type is a <ide> public TypeDescriptor getElementTypeDescriptor() { <ide> if (this.resolvableType.isArray()) { <ide> return new TypeDescriptor(this.resolvableType.getComponentType(), null, this.annotations); <ide> } <add> if (streamAvailable && StreamHelper.isStream(this.type)) { <add> return StreamHelper.getStreamElementType(this); <add> } <ide> return getRelatedIfResolvable(this, this.resolvableType.asCollection().getGeneric()); <ide> } <ide> <ide> private static TypeDescriptor getRelatedIfResolvable(TypeDescriptor source, Reso <ide> return new TypeDescriptor(type, null, source.annotations); <ide> } <ide> <add> /** <add> * Inner class to avoid a hard dependency on Java 8. <add> */ <add> @UsesJava8 <add> private static class StreamHelper { <add> <add> private static boolean isStream(Class<?> type) { <add> return Stream.class.isAssignableFrom(type); <add> } <add> <add> private static TypeDescriptor getStreamElementType(TypeDescriptor source) { <add> return getRelatedIfResolvable(source, source.resolvableType.as(Stream.class).getGeneric()); <add> } <add> } <add> <ide> } <ide><path>spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java <ide> /* <del> * Copyright 2002-2013 the original author or authors. <add> * Copyright 2002-2015 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> * <ide> * @author Chris Beams <ide> * @author Juergen Hoeller <add> * @author Stephane Nicoll <ide> * @since 3.1 <ide> */ <ide> public class DefaultConversionService extends GenericConversionService { <ide> public class DefaultConversionService extends GenericConversionService { <ide> private static final boolean jsr310Available = <ide> ClassUtils.isPresent("java.time.ZoneId", DefaultConversionService.class.getClassLoader()); <ide> <add> /** Java 8's java.util.stream.Stream class available? */ <add> private static final boolean streamAvailable = ClassUtils.isPresent( <add> "java.util.stream.Stream", DefaultConversionService.class.getClassLoader()); <add> <add> <ide> <ide> /** <ide> * Create a new {@code DefaultConversionService} with the set of <ide> private static void addCollectionConverters(ConverterRegistry converterRegistry) <ide> <ide> converterRegistry.addConverter(new CollectionToObjectConverter(conversionService)); <ide> converterRegistry.addConverter(new ObjectToCollectionConverter(conversionService)); <add> <add> if (streamAvailable) { <add> converterRegistry.addConverter(new StreamConverter(conversionService)); <add> } <ide> } <ide> <ide> <ide><path>spring-core/src/main/java/org/springframework/core/convert/support/StreamConverter.java <add>/* <add> * Copyright 2002-2015 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.core.convert.support; <add> <add>import java.util.Collection; <add>import java.util.HashSet; <add>import java.util.List; <add>import java.util.Set; <add>import java.util.stream.Collectors; <add>import java.util.stream.Stream; <add> <add>import org.springframework.core.convert.ConversionService; <add>import org.springframework.core.convert.TypeDescriptor; <add>import org.springframework.core.convert.converter.ConditionalGenericConverter; <add>import org.springframework.lang.UsesJava8; <add> <add>/** <add> * Convert a {@link Stream} to an from a collection or array, converting the <add> * element type if necessary. <add> * <add> * @author Stephane Nicoll <add> * @since 4.2 <add> */ <add>@UsesJava8 <add>public class StreamConverter implements ConditionalGenericConverter { <add> <add> private static final TypeDescriptor STREAM_TYPE = TypeDescriptor.valueOf(Stream.class); <add> <add> private static final Set<ConvertiblePair> CONVERTIBLE_TYPES = createConvertibleTypes(); <add> <add> private final ConversionService conversionService; <add> <add> public StreamConverter(ConversionService conversionService) { <add> this.conversionService = conversionService; <add> } <add> <add> @Override <add> public Set<ConvertiblePair> getConvertibleTypes() { <add> return CONVERTIBLE_TYPES; <add> } <add> <add> @Override <add> public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { <add> if (sourceType.isAssignableTo(STREAM_TYPE)) { <add> return matchesFromStream(sourceType.getElementTypeDescriptor(), targetType); <add> } <add> if (targetType.isAssignableTo(STREAM_TYPE)) { <add> return matchesToStream(targetType.getElementTypeDescriptor(), sourceType); <add> } <add> return false; <add> } <add> <add> /** <add> * Validate that a {@link Collection} of the elements held within the stream can be <add> * converted to the specified {@code targetType}. <add> * @param elementType the type of the stream elements <add> * @param targetType the type to convert to <add> */ <add> public boolean matchesFromStream(TypeDescriptor elementType, TypeDescriptor targetType) { <add> TypeDescriptor collectionOfElement = TypeDescriptor.collection(Collection.class, elementType); <add> return this.conversionService.canConvert(collectionOfElement, targetType); <add> } <add> <add> /** <add> * Validate that the specified {@code sourceType} can be converted to a {@link Collection} of <add> * type type of the stream elements <add> * @param elementType the type of the stream elements <add> * @param sourceType the type to convert from <add> */ <add> public boolean matchesToStream(TypeDescriptor elementType, TypeDescriptor sourceType) { <add> TypeDescriptor collectionOfElement = TypeDescriptor.collection(Collection.class, elementType); <add> return this.conversionService.canConvert(sourceType, collectionOfElement); <add> } <add> <add> @Override <add> public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { <add> if (sourceType.isAssignableTo(STREAM_TYPE)) { <add> return convertFromStream((Stream<?>) source, sourceType, targetType); <add> } <add> if (targetType.isAssignableTo(STREAM_TYPE)) { <add> return convertToStream(source, sourceType, targetType); <add> } <add> // Should not happen <add> throw new IllegalStateException("Unexpected source/target types"); <add> } <add> <add> private Object convertFromStream(Stream<?> source, TypeDescriptor streamType, TypeDescriptor targetType) { <add> List<Object> content = source.collect(Collectors.toList()); <add> TypeDescriptor listType = TypeDescriptor.collection(List.class, streamType.getElementTypeDescriptor()); <add> return this.conversionService.convert(content, listType, targetType); <add> } <add> <add> private Object convertToStream(Object source, TypeDescriptor sourceType, TypeDescriptor streamType) { <add> TypeDescriptor targetCollection = <add> TypeDescriptor.collection(List.class, streamType.getElementTypeDescriptor()); <add> List<?> target = (List<?>) this.conversionService.convert(source, sourceType, targetCollection); <add> return target.stream(); <add> } <add> <add> <add> private static Set<ConvertiblePair> createConvertibleTypes() { <add> Set<ConvertiblePair> convertiblePairs = new HashSet<ConvertiblePair>(); <add> convertiblePairs.add(new ConvertiblePair(Stream.class, Collection.class)); <add> convertiblePairs.add(new ConvertiblePair(Stream.class, Object[].class)); <add> convertiblePairs.add(new ConvertiblePair(Collection.class, Stream.class)); <add> convertiblePairs.add(new ConvertiblePair(Object[].class, Stream.class)); <add> return convertiblePairs; <add> } <add> <add>} <ide><path>spring-core/src/test/java/org/springframework/core/convert/support/DefaultConversionTests.java <ide> import java.util.Optional; <ide> import java.util.Properties; <ide> import java.util.Set; <add>import java.util.stream.Stream; <ide> <ide> import org.junit.Test; <ide> <ide> /** <ide> * @author Keith Donald <ide> * @author Juergen Hoeller <add> * @author Stephane Nicoll <ide> */ <ide> public class DefaultConversionTests { <ide> <ide> public void testCharacterToString() { <ide> <ide> @Test <ide> public void testStringToBooleanTrue() { <del> assertEquals(Boolean.valueOf(true), conversionService.convert("true", Boolean.class)); <del> assertEquals(Boolean.valueOf(true), conversionService.convert("on", Boolean.class)); <del> assertEquals(Boolean.valueOf(true), conversionService.convert("yes", Boolean.class)); <del> assertEquals(Boolean.valueOf(true), conversionService.convert("1", Boolean.class)); <del> assertEquals(Boolean.valueOf(true), conversionService.convert("TRUE", Boolean.class)); <del> assertEquals(Boolean.valueOf(true), conversionService.convert("ON", Boolean.class)); <del> assertEquals(Boolean.valueOf(true), conversionService.convert("YES", Boolean.class)); <add> assertEquals(true, conversionService.convert("true", Boolean.class)); <add> assertEquals(true, conversionService.convert("on", Boolean.class)); <add> assertEquals(true, conversionService.convert("yes", Boolean.class)); <add> assertEquals(true, conversionService.convert("1", Boolean.class)); <add> assertEquals(true, conversionService.convert("TRUE", Boolean.class)); <add> assertEquals(true, conversionService.convert("ON", Boolean.class)); <add> assertEquals(true, conversionService.convert("YES", Boolean.class)); <ide> } <ide> <ide> @Test <ide> public void testStringToBooleanFalse() { <del> assertEquals(Boolean.valueOf(false), conversionService.convert("false", Boolean.class)); <del> assertEquals(Boolean.valueOf(false), conversionService.convert("off", Boolean.class)); <del> assertEquals(Boolean.valueOf(false), conversionService.convert("no", Boolean.class)); <del> assertEquals(Boolean.valueOf(false), conversionService.convert("0", Boolean.class)); <del> assertEquals(Boolean.valueOf(false), conversionService.convert("FALSE", Boolean.class)); <del> assertEquals(Boolean.valueOf(false), conversionService.convert("OFF", Boolean.class)); <del> assertEquals(Boolean.valueOf(false), conversionService.convert("NO", Boolean.class)); <add> assertEquals(false, conversionService.convert("false", Boolean.class)); <add> assertEquals(false, conversionService.convert("off", Boolean.class)); <add> assertEquals(false, conversionService.convert("no", Boolean.class)); <add> assertEquals(false, conversionService.convert("0", Boolean.class)); <add> assertEquals(false, conversionService.convert("FALSE", Boolean.class)); <add> assertEquals(false, conversionService.convert("OFF", Boolean.class)); <add> assertEquals(false, conversionService.convert("NO", Boolean.class)); <ide> } <ide> <ide> @Test <ide> public void testStringToByte() throws Exception { <ide> <ide> @Test <ide> public void testByteToString() { <del> assertEquals("65", conversionService.convert(new String("A").getBytes()[0], String.class)); <add> assertEquals("65", conversionService.convert("A".getBytes()[0], String.class)); <ide> } <ide> <ide> @Test <ide> public void testEnumToString() { <ide> assertEquals("BAR", conversionService.convert(Foo.BAR, String.class)); <ide> } <ide> <del> public static enum Foo { <add> public enum Foo { <ide> BAR, BAZ <ide> } <ide> <del> public static enum SubFoo { <add> public enum SubFoo { <ide> <ide> BAR { <ide> @Override <ide> public void testStringToString() { <ide> <ide> @Test <ide> public void testNumberToNumber() { <del> assertEquals(Long.valueOf(1), conversionService.convert(Integer.valueOf(1), Long.class)); <add> assertEquals(Long.valueOf(1), conversionService.convert(1, Long.class)); <ide> } <ide> <ide> @Test(expected=ConversionFailedException.class) <ide> public void testNumberToNumberNotSupportedNumber() { <del> conversionService.convert(Integer.valueOf(1), CustomNumber.class); <add> conversionService.convert(1, CustomNumber.class); <ide> } <ide> <ide> @SuppressWarnings("serial") <ide> public long longValue() { <ide> <ide> @Test <ide> public void testNumberToCharacter() { <del> assertEquals(Character.valueOf('A'), conversionService.convert(Integer.valueOf(65), Character.class)); <add> assertEquals(Character.valueOf('A'), conversionService.convert(65, Character.class)); <ide> } <ide> <ide> @Test <ide> public void convertArrayToCollectionInterface() { <ide> <ide> @Test <ide> public void convertArrayToCollectionGenericTypeConversion() throws Exception { <add> @SuppressWarnings("unchecked") <ide> List<Integer> result = (List<Integer>) conversionService.convert(new String[] { "1", "2", "3" }, TypeDescriptor <ide> .valueOf(String[].class), new TypeDescriptor(getClass().getDeclaredField("genericList"))); <ide> assertEquals(new Integer("1"), result.get(0)); <ide> assertEquals(new Integer("2"), result.get(1)); <ide> assertEquals(new Integer("3"), result.get(2)); <ide> } <ide> <add> public Stream<Integer> genericStream; <add> <add> @Test <add> public void convertArrayToStream() throws Exception { <add> String[] source = {"1", "3", "4"}; <add> @SuppressWarnings("unchecked") <add> Stream<Integer> result = (Stream<Integer>) this.conversionService.convert(source, <add> TypeDescriptor.valueOf(String[].class), <add> new TypeDescriptor(getClass().getDeclaredField("genericStream"))); <add> assertEquals(8, result.mapToInt((x) -> x).sum()); <add> } <add> <ide> @Test <ide> public void testSpr7766() throws Exception { <ide> ConverterRegistry registry = (conversionService); <ide> registry.addConverter(new ColorConverter()); <del> List<Color> colors = (List<Color>) conversionService.convert(new String[] { "ffffff", "#000000" }, TypeDescriptor.valueOf(String[].class), new TypeDescriptor(new MethodParameter(getClass().getMethod("handlerMethod", List.class), 0))); <add> @SuppressWarnings("unchecked") <add> List<Color> colors = (List<Color>) conversionService.convert(new String[] { "ffffff", "#000000" }, <add> TypeDescriptor.valueOf(String[].class), <add> new TypeDescriptor(new MethodParameter(getClass().getMethod("handlerMethod", List.class), 0))); <ide> assertEquals(2, colors.size()); <ide> assertEquals(Color.WHITE, colors.get(0)); <ide> assertEquals(Color.BLACK, colors.get(1)); <ide> public void convertCollectionToArrayWithElementConversion() { <ide> <ide> @Test <ide> public void convertCollectionToString() { <del> List<String> list = Arrays.asList(new String[] { "foo", "bar" }); <add> List<String> list = Arrays.asList("foo", "bar"); <ide> String result = conversionService.convert(list, String.class); <ide> assertEquals("foo,bar", result); <ide> } <ide> <ide> @Test <ide> public void convertCollectionToStringWithElementConversion() throws Exception { <del> List<Integer> list = Arrays.asList(new Integer[] { 3, 5 }); <add> List<Integer> list = Arrays.asList(3, 5); <ide> String result = (String) conversionService.convert(list, <ide> new TypeDescriptor(getClass().getField("genericList")), TypeDescriptor.valueOf(String.class)); <ide> assertEquals("3,5", result); <ide> public void convertStringToCollectionWithElementConversion() throws Exception { <ide> List result = (List) conversionService.convert("1,2,3", TypeDescriptor.valueOf(String.class), <ide> new TypeDescriptor(getClass().getField("genericList"))); <ide> assertEquals(3, result.size()); <del> assertEquals(new Integer(1), result.get(0)); <del> assertEquals(new Integer(2), result.get(1)); <del> assertEquals(new Integer(3), result.get(2)); <add> assertEquals(1, result.get(0)); <add> assertEquals(2, result.get(1)); <add> assertEquals(3, result.get(2)); <ide> } <ide> <ide> @Test <ide> public ListWrapper convert(List source) { <ide> <ide> @Test <ide> public void convertObjectToCollection() { <add> @SuppressWarnings("unchecked") <ide> List<String> result = (List<String>) conversionService.convert(3L, List.class); <ide> assertEquals(1, result.size()); <ide> assertEquals(3L, result.get(0)); <ide> } <ide> <ide> @Test <ide> public void convertObjectToCollectionWithElementConversion() throws Exception { <add> @SuppressWarnings("unchecked") <ide> List<Integer> result = (List<Integer>) conversionService.convert(3L, TypeDescriptor.valueOf(Long.class), <ide> new TypeDescriptor(getClass().getField("genericList"))); <ide> assertEquals(1, result.size()); <ide> public void convertCollectionToCollection() throws Exception { <ide> foo.add("1"); <ide> foo.add("2"); <ide> foo.add("3"); <add> @SuppressWarnings("unchecked") <ide> List<Integer> bar = (List<Integer>) conversionService.convert(foo, TypeDescriptor.forObject(foo), <ide> new TypeDescriptor(getClass().getField("genericList"))); <ide> assertEquals(new Integer(1), bar.get(0)); <ide> public void convertCollectionToCollection() throws Exception { <ide> <ide> @Test <ide> public void convertCollectionToCollectionNull() throws Exception { <add> @SuppressWarnings("unchecked") <ide> List<Integer> bar = (List<Integer>) conversionService.convert(null, <ide> TypeDescriptor.valueOf(LinkedHashSet.class), new TypeDescriptor(getClass().getField("genericList"))); <ide> assertNull(bar); <ide> public void convertCollectionToCollectionNotGeneric() throws Exception { <ide> assertEquals("3", bar.get(2)); <ide> } <ide> <add> @SuppressWarnings("unchecked") <ide> @Test <ide> public void convertCollectionToCollectionSpecialCaseSourceImpl() throws Exception { <ide> Map map = new LinkedHashMap(); <ide> public void collection() { <ide> List<String> strings = new ArrayList<String>(); <ide> strings.add("3"); <ide> strings.add("9"); <del> List<Integer> integers = (List<Integer>) conversionService.convert(strings, TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Integer.class))); <add> @SuppressWarnings("unchecked") <add> List<Integer> integers = (List<Integer>) conversionService.convert(strings, <add> TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Integer.class))); <ide> assertEquals(new Integer(3), integers.get(0)); <ide> assertEquals(new Integer(9), integers.get(1)); <ide> } <ide> public void convertMapToMap() throws Exception { <ide> Map<String, String> foo = new HashMap<String, String>(); <ide> foo.put("1", "BAR"); <ide> foo.put("2", "BAZ"); <del> Map<String, FooEnum> map = (Map<String, FooEnum>) conversionService.convert(foo, <add> @SuppressWarnings("unchecked") <add> Map<Integer, FooEnum> map = (Map<Integer, FooEnum>) conversionService.convert(foo, <ide> TypeDescriptor.forObject(foo), new TypeDescriptor(getClass().getField("genericMap"))); <ide> assertEquals(FooEnum.BAR, map.get(1)); <ide> assertEquals(FooEnum.BAZ, map.get(2)); <ide> public void map() { <ide> Map<String, String> strings = new HashMap<String, String>(); <ide> strings.put("3", "9"); <ide> strings.put("6", "31"); <del> Map<Integer, Integer> integers = (Map<Integer, Integer>) conversionService.convert(strings, TypeDescriptor.map(Map.class, TypeDescriptor.valueOf(Integer.class), TypeDescriptor.valueOf(Integer.class))); <add> @SuppressWarnings("unchecked") <add> Map<Integer, Integer> integers = (Map<Integer, Integer>) conversionService.convert(strings, <add> TypeDescriptor.map(Map.class, TypeDescriptor.valueOf(Integer.class), TypeDescriptor.valueOf(Integer.class))); <ide> assertEquals(new Integer(9), integers.get(3)); <ide> assertEquals(new Integer(31), integers.get(6)); <ide> } <ide> public void convertObjectToObjectFinderMethod() { <ide> <ide> @Test <ide> public void convertObjectToObjectFinderMethodWithNull() { <del> TestEntity e = (TestEntity) conversionService.convert(null, TypeDescriptor.valueOf(String.class), TypeDescriptor.valueOf(TestEntity.class)); <add> TestEntity e = (TestEntity) conversionService.convert(null, <add> TypeDescriptor.valueOf(String.class), TypeDescriptor.valueOf(TestEntity.class)); <ide> assertNull(e); <ide> } <ide> <ide> public void convertObjectToOptional() { <ide> <ide> @Test <ide> public void convertObjectToOptionalNull() { <del> assertSame(Optional.empty(), conversionService.convert(null, TypeDescriptor.valueOf(Object.class), TypeDescriptor.valueOf(Optional.class))); <add> assertSame(Optional.empty(), conversionService.convert(null, TypeDescriptor.valueOf(Object.class), <add> TypeDescriptor.valueOf(Optional.class))); <ide> assertSame(Optional.empty(), conversionService.convert(null, Optional.class)); <ide> } <ide> <ide><path>spring-core/src/test/java/org/springframework/core/convert/support/StreamConverterTest.java <add>/* <add> * Copyright 2002-2015 the original author or authors. <add> * <add> * Licensed under the Apache License, Version 2.0 (the "License"); <add> * you may not use this file except in compliance with the License. <add> * You may obtain a copy of the License at <add> * <add> * http://www.apache.org/licenses/LICENSE-2.0 <add> * <add> * Unless required by applicable law or agreed to in writing, software <add> * distributed under the License is distributed on an "AS IS" BASIS, <add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <add> * See the License for the specific language governing permissions and <add> * limitations under the License. <add> */ <add> <add>package org.springframework.core.convert.support; <add> <add>import java.util.Arrays; <add>import java.util.List; <add>import java.util.stream.Stream; <add> <add>import org.junit.Before; <add>import org.junit.Rule; <add>import org.junit.Test; <add>import org.junit.rules.ExpectedException; <add> <add>import org.springframework.core.convert.ConversionFailedException; <add>import org.springframework.core.convert.ConverterNotFoundException; <add>import org.springframework.core.convert.TypeDescriptor; <add>import org.springframework.core.convert.converter.Converter; <add> <add>import static org.hamcrest.CoreMatchers.*; <add>import static org.hamcrest.core.Is.is; <add>import static org.junit.Assert.*; <add> <add>public class StreamConverterTest { <add> <add> @Rule <add> public final ExpectedException thrown = ExpectedException.none(); <add> <add> private GenericConversionService conversionService; <add> <add> private StreamConverter streamConverter; <add> <add> @Before <add> public void setup() { <add> this.conversionService = new GenericConversionService(); <add> this.streamConverter = new StreamConverter(this.conversionService); <add> <add> this.conversionService.addConverter(new CollectionToCollectionConverter(this.conversionService)); <add> this.conversionService.addConverter(new ArrayToCollectionConverter(this.conversionService)); <add> this.conversionService.addConverter(new CollectionToArrayConverter(this.conversionService)); <add> this.conversionService.addConverter(this.streamConverter); <add> } <add> <add> @Test <add> public void convertFromStreamToList() throws NoSuchFieldException { <add> this.conversionService.addConverter(Number.class, String.class, new ObjectToStringConverter()); <add> Stream<Integer> stream = Arrays.asList(1, 2, 3).stream(); <add> TypeDescriptor listOfStrings = new TypeDescriptor(Types.class.getField("listOfStrings")); ; <add> Object result = this.conversionService.convert(stream, listOfStrings); <add> assertNotNull("converted object must not be null", result); <add> assertTrue("Converted object must be a list", result instanceof List); <add> @SuppressWarnings("unchecked") <add> List<String> content = (List<String>) result; <add> assertEquals("1", content.get(0)); <add> assertEquals("2", content.get(1)); <add> assertEquals("3", content.get(2)); <add> assertEquals("Wrong number of elements", 3, content.size()); <add> } <add> <add> @Test <add> public void convertFromStreamToArray() throws NoSuchFieldException { <add> this.conversionService.addConverterFactory(new NumberToNumberConverterFactory()); <add> Stream<Integer> stream = Arrays.asList(1, 2, 3).stream(); <add> TypeDescriptor arrayOfLongs = new TypeDescriptor(Types.class.getField("arrayOfLongs")); ; <add> Object result = this.conversionService.convert(stream, arrayOfLongs); <add> assertNotNull("converted object must not be null", result); <add> assertTrue("Converted object must be an array", result.getClass().isArray()); <add> Long[] content = (Long[]) result; <add> assertEquals(Long.valueOf(1L), content[0]); <add> assertEquals(Long.valueOf(2L), content[1]); <add> assertEquals(Long.valueOf(3L), content[2]); <add> assertEquals("Wrong number of elements", 3, content.length); <add> } <add> <add> @Test <add> public void convertFromStreamToRawList() throws NoSuchFieldException { <add> Stream<Integer> stream = Arrays.asList(1, 2, 3).stream(); <add> TypeDescriptor listOfStrings = new TypeDescriptor(Types.class.getField("rawList")); ; <add> Object result = this.conversionService.convert(stream, listOfStrings); <add> assertNotNull("converted object must not be null", result); <add> assertTrue("Converted object must be a list", result instanceof List); <add> @SuppressWarnings("unchecked") <add> List<Object> content = (List<Object>) result; <add> assertEquals(1, content.get(0)); <add> assertEquals(2, content.get(1)); <add> assertEquals(3, content.get(2)); <add> assertEquals("Wrong number of elements", 3, content.size()); <add> } <add> <add> @Test <add> public void convertFromStreamToArrayNoConverter() throws NoSuchFieldException { <add> Stream<Integer> stream = Arrays.asList(1, 2, 3).stream(); <add> TypeDescriptor arrayOfLongs = new TypeDescriptor(Types.class.getField("arrayOfLongs")); ; <add> <add> thrown.expect(ConversionFailedException.class); <add> thrown.expectCause(is(instanceOf(ConverterNotFoundException.class))); <add> this.conversionService.convert(stream, arrayOfLongs); <add> } <add> <add> @Test <add> public void convertFromListToStream() throws NoSuchFieldException { <add> this.conversionService.addConverterFactory(new StringToNumberConverterFactory()); <add> List<String> stream = Arrays.asList("1", "2", "3"); <add> TypeDescriptor streamOfInteger = new TypeDescriptor(Types.class.getField("streamOfIntegers")); ; <add> Object result = this.conversionService.convert(stream, streamOfInteger); <add> assertNotNull("converted object must not be null", result); <add> assertTrue("Converted object must be a stream", result instanceof Stream); <add> @SuppressWarnings("unchecked") <add> Stream<Integer> content = (Stream<Integer>) result; <add> assertEquals(6, content.mapToInt((x) -> x).sum()); <add> } <add> <add> @Test <add> public void convertFromArrayToStream() throws NoSuchFieldException { <add> Integer[] stream = new Integer[] {1, 0, 1}; <add> this.conversionService.addConverter(new Converter<Integer, Boolean>() { <add> @Override <add> public Boolean convert(Integer source) { <add> return source == 1; <add> } <add> }); <add> TypeDescriptor streamOfBoolean = new TypeDescriptor(Types.class.getField("streamOfBooleans")); ; <add> Object result = this.conversionService.convert(stream, streamOfBoolean); <add> assertNotNull("converted object must not be null", result); <add> assertTrue("Converted object must be a stream", result instanceof Stream); <add> @SuppressWarnings("unchecked") <add> Stream<Boolean> content = (Stream<Boolean>) result; <add> assertEquals(2, content.filter(x -> x).count()); <add> } <add> <add> @Test <add> public void convertFromListToRawStream() throws NoSuchFieldException { <add> List<String> stream = Arrays.asList("1", "2", "3"); <add> TypeDescriptor streamOfInteger = new TypeDescriptor(Types.class.getField("rawStream")); ; <add> Object result = this.conversionService.convert(stream, streamOfInteger); <add> assertNotNull("converted object must not be null", result); <add> assertTrue("Converted object must be a stream", result instanceof Stream); <add> @SuppressWarnings("unchecked") <add> Stream<Object> content = (Stream<Object>) result; <add> StringBuilder sb = new StringBuilder(); <add> content.forEach(sb::append); <add> assertEquals("123", sb.toString()); <add> } <add> <add> @Test <add> public void doesNotMatchIfNoStream() throws NoSuchFieldException { <add> assertFalse("Should not match non stream type", this.streamConverter.matches( <add> new TypeDescriptor(Types.class.getField("listOfStrings")), <add> new TypeDescriptor(Types.class.getField("arrayOfLongs")))); <add> } <add> <add> @Test <add> public void shouldFailToConvertIfNoStream() throws NoSuchFieldException { <add> thrown.expect(IllegalStateException.class); <add> this.streamConverter.convert(new Object(), new TypeDescriptor(Types.class.getField("listOfStrings")), <add> new TypeDescriptor(Types.class.getField("arrayOfLongs"))); <add> } <add> <add> @SuppressWarnings("unused") <add> static class Types { <add> <add> public List<String> listOfStrings; <add> <add> public Long[] arrayOfLongs; <add> <add> public Stream<Integer> streamOfIntegers; <add> <add> public Stream<Boolean> streamOfBooleans; <add> <add> public Stream rawStream; <add> <add> public List rawList; <add> } <add> <add>} <ide>\ No newline at end of file
5
Javascript
Javascript
remove excess example spacing
f3ac981c46340769beb99efa7957045377bd8813
<ide><path>packages/rn-tester/js/components/RNTesterBlock.js <ide> const styles = StyleSheet.create({ <ide> color: 'black', <ide> }, <ide> children: { <del> paddingTop: 10, <del> paddingHorizontal: 10, <del> margin: 10, <add> marginHorizontal: 20, <add> marginVertical: 10, <ide> }, <ide> }); <ide>
1
Javascript
Javascript
remove shoulddeprioritizesubtree from host config
103ed08c46198d01119ef35c37d78c6bc89705db
<ide><path>packages/react-art/src/ReactARTHostConfig.js <ide> export function resetTextContent(domElement) { <ide> // Noop <ide> } <ide> <del>export function shouldDeprioritizeSubtree(type, props) { <del> return false; <del>} <del> <ide> export function getRootHostContext() { <ide> return NO_CONTEXT; <ide> } <ide><path>packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js <ide> describe('ReactDOMServerPartialHydration', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-dom/src/__tests__/ReactUpdates-test.js <ide> describe('ReactUpdates', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-dom/src/client/ReactDOMHostConfig.js <ide> export function shouldSetTextContent(type: string, props: Props): boolean { <ide> ); <ide> } <ide> <del>export function shouldDeprioritizeSubtree(type: string, props: Props): boolean { <del> // This is obnoxiously specific so that nobody uses it, but we can still opt <del> // in via an infra-level userspace abstraction. <del> return props.hidden === 'unstable-do-not-use-legacy-hidden'; <del>} <del> <ide> export function createTextInstance( <ide> text: string, <ide> rootContainerInstance: Container, <ide><path>packages/react-native-renderer/src/ReactFabricHostConfig.js <ide> export function resetAfterCommit(containerInfo: Container): void { <ide> // Noop <ide> } <ide> <del>export function shouldDeprioritizeSubtree(type: string, props: Props): boolean { <del> return false; <del>} <del> <ide> export function shouldSetTextContent(type: string, props: Props): boolean { <ide> // TODO (bvaughn) Revisit this decision. <ide> // Always returning false simplifies the createInstance() implementation, <ide><path>packages/react-native-renderer/src/ReactNativeHostConfig.js <ide> export const scheduleTimeout = setTimeout; <ide> export const cancelTimeout = clearTimeout; <ide> export const noTimeout = -1; <ide> <del>export function shouldDeprioritizeSubtree(type: string, props: Props): boolean { <del> return false; <del>} <del> <ide> export function shouldSetTextContent(type: string, props: Props): boolean { <ide> // TODO (bvaughn) Revisit this decision. <ide> // Always returning false simplifies the createInstance() implementation, <ide><path>packages/react-noop-renderer/src/createReactNoop.js <ide> function createReactNoop(reconciler: Function, useMutation: boolean) { <ide> <ide> shouldSetTextContent, <ide> <del> shouldDeprioritizeSubtree(type: string, props: Props): boolean { <del> return !!props.hidden; <del> }, <del> <ide> createTextInstance( <ide> text: string, <ide> rootContainerInstance: Container, <ide><path>packages/react-reconciler/src/__tests__/ReactIncremental-test.js <ide> describe('ReactIncremental', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js <ide> describe('ReactIncrementalErrorHandling', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js <ide> describe('ReactIncrementalSideEffects', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-reconciler/src/__tests__/ReactNewContext-test.js <ide> describe('ReactNewContext', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js <ide> describe('ReactSchedulerIntegration', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.js <ide> describe('ReactSuspenseWithNoopRenderer', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-reconciler/src/forks/ReactFiberHostConfig.custom.js <ide> export const appendInitialChild = $$$hostConfig.appendInitialChild; <ide> export const finalizeInitialChildren = $$$hostConfig.finalizeInitialChildren; <ide> export const prepareUpdate = $$$hostConfig.prepareUpdate; <ide> export const shouldSetTextContent = $$$hostConfig.shouldSetTextContent; <del>export const shouldDeprioritizeSubtree = <del> $$$hostConfig.shouldDeprioritizeSubtree; <ide> export const createTextInstance = $$$hostConfig.createTextInstance; <ide> export const scheduleTimeout = $$$hostConfig.scheduleTimeout; <ide> export const cancelTimeout = $$$hostConfig.cancelTimeout; <ide><path>packages/react-refresh/src/__tests__/ReactFresh-test.js <ide> describe('ReactFresh', () => { <ide> // once the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children} <ide><path>packages/react-test-renderer/src/ReactTestHostConfig.js <ide> export function shouldSetTextContent(type: string, props: Props): boolean { <ide> return false; <ide> } <ide> <del>export function shouldDeprioritizeSubtree(type: string, props: Props): boolean { <del> return false; <del>} <del> <ide> export function createTextInstance( <ide> text: string, <ide> rootContainerInstance: Container, <ide><path>packages/react/src/__tests__/ReactDOMTracing-test.internal.js <ide> function loadModules() { <ide> // the extra div wrapper is no longer neccessary. <ide> function LegacyHiddenDiv({children, mode}) { <ide> return ( <del> <div <del> hidden={ <del> mode === 'hidden' ? 'unstable-do-not-use-legacy-hidden' : undefined <del> }> <add> <div hidden={mode === 'hidden'}> <ide> <React.unstable_LegacyHidden <ide> mode={mode === 'hidden' ? 'unstable-defer-without-hiding' : mode}> <ide> {children}
17
PHP
PHP
add finder options to paginator->paginate method
56d6f04136b553b1a2ee46c7cedd3b9ca801ce63
<ide><path>src/Controller/Component/PaginatorComponent.php <ide> public function paginate($object, array $settings = []) { <ide> unset($options['finder'], $options['maxLimit']); <ide> <ide> if (empty($query)) { <del> $query = $object->find($type); <add> $query = $object->find($type, $options); <ide> } <ide> <ide> $query->applyOptions($options); <ide><path>tests/TestCase/Controller/Component/PaginatorComponentTest.php <ide> public function testPaginateExtraParams() { <ide> $this->Paginator->paginate($table, $settings); <ide> } <ide> <add>/** <add> * Test to make sure options get sent to custom finder methods via paginate <add> * @return void <add> */ <add> public function testPaginateCustomFinderOptions() { <add> $this->loadFixtures('Post'); <add> $settings = [ <add> 'PaginatorPosts' => [ <add> 'finder' => 'author', <add> 'author_id' => 1 <add> ] <add> ]; <add> $table = TableRegistry::get('PaginatorPosts'); <add> <add> $expected = $table->find('author', ['conditions' => ['PaginatorPosts.author_id' => $settings['PaginatorPosts']['author_id']]]) <add> ->count(); <add> $result = $this->Paginator->paginate($table, $settings)->count(); <add> <add> $this->assertEquals($expected, $result); <add> } <add> <ide> /** <ide> * Test that special paginate types are called and that the type param doesn't leak out into defaults or options. <ide> * <ide><path>tests/test_app/TestApp/Model/Table/PaginatorPostsTable.php <ide> public function findPublished(Query $query, array $options) { <ide> return $query; <ide> } <ide> <add>/** <add> * Custom finder, used with fixture data to ensure Paginator is sending options <add> * <add> * @param Cake\ORM\Query $query <add> * @param array $options <add> * @return Cake\ORM\Query <add> */ <add> public function findAuthor(Query $query, array $options = []) { <add> if (isset($options['author_id'])) { <add> $query->where(['PaginatorPosts.author_id' => $options['author_id']]); <add> } <add> return $query; <add> } <add> <ide> }
3
Python
Python
add network_id to subnet
38a42b8e9b947370eae2fda487f56fef6226d8c6
<ide><path>libcloud/compute/drivers/openstack.py <ide> def _to_subnet(self, obj): <ide> return OpenStack_2_SubNet(id=obj['id'], <ide> name=obj['name'], <ide> cidr=obj['cidr'], <add> network_id=obj['network_id'], <ide> driver=self, <ide> extra=extra) <ide> <ide> class OpenStack_2_SubNet(object): <ide> A Virtual SubNet. <ide> """ <ide> <del> def __init__(self, id, name, cidr, driver, extra=None): <add> def __init__(self, id, name, cidr, network_id, driver, extra=None): <ide> self.id = str(id) <ide> self.name = name <ide> self.cidr = cidr <add> self.network_id = network_id <ide> self.driver = driver <ide> self.extra = extra or {} <ide>
1
Javascript
Javascript
track callback invocations
7e5ed8bad9b135c710a6623ed34e2c78de3b53de
<ide><path>test/sequential/test-net-listen-shared-ports.js <ide> const net = require('net'); <ide> if (cluster.isMaster) { <ide> const worker1 = cluster.fork(); <ide> <del> worker1.on('message', function(msg) { <add> worker1.on('message', common.mustCall(function(msg) { <ide> assert.strictEqual(msg, 'success'); <ide> const worker2 = cluster.fork(); <ide> <del> worker2.on('message', function(msg) { <add> worker2.on('message', common.mustCall(function(msg) { <ide> assert.strictEqual(msg, 'server2:EADDRINUSE'); <ide> worker1.kill(); <ide> worker2.kill(); <del> }); <del> }); <add> })); <add> })); <ide> } else { <del> const server1 = net.createServer(common.noop); <del> const server2 = net.createServer(common.noop); <add> const server1 = net.createServer(common.mustNotCall()); <add> const server2 = net.createServer(common.mustNotCall()); <ide> <ide> server1.on('error', function(err) { <ide> // no errors expected <ide> if (cluster.isMaster) { <ide> host: 'localhost', <ide> port: common.PORT, <ide> exclusive: false <del> }, function() { <del> server2.listen({port: common.PORT + 1, exclusive: true}, function() { <del> // the first worker should succeed <del> process.send('success'); <del> }); <del> }); <add> }, common.mustCall(function() { <add> server2.listen({port: common.PORT + 1, exclusive: true}, <add> common.mustCall(function() { <add> // the first worker should succeed <add> process.send('success'); <add> }) <add> ); <add> })); <ide> }
1
PHP
PHP
bind the kernels as singletons
aa8bf8a211fed6413e5c27a687b2a9f227480a3f
<ide><path>bootstrap/app.php <ide> | <ide> */ <ide> <del>$app->bind( <add>$app->singleton( <ide> 'Illuminate\Contracts\Http\Kernel', <ide> 'App\Http\Kernel' <ide> ); <ide> <del>$app->bind( <add>$app->singleton( <ide> 'Illuminate\Contracts\Console\Kernel', <ide> 'App\Console\Kernel' <ide> );
1
Ruby
Ruby
allow parameter delimiter without space
6937ecfad39743cf744e4179663b89a944477995
<ide><path>actionpack/lib/action_dispatch/http/mime_type.rb <ide> def unregister(symbol) <ide> MIME_NAME = "[a-zA-Z0-9][a-zA-Z0-9#{Regexp.escape('!#$&-^_.+')}]{0,126}" <ide> MIME_PARAMETER_KEY = "[a-zA-Z0-9][a-zA-Z0-9#{Regexp.escape('!#$&-^_.+')}]{0,126}" <ide> MIME_PARAMETER_VALUE = "#{Regexp.escape('"')}?[a-zA-Z0-9][a-zA-Z0-9#{Regexp.escape('!#$&-^_.+')}]{0,126}#{Regexp.escape('"')}?" <del> MIME_PARAMETER = "\s*\;\s+#{MIME_PARAMETER_KEY}(?:\=#{MIME_PARAMETER_VALUE})?" <add> MIME_PARAMETER = "\s*\;\s*#{MIME_PARAMETER_KEY}(?:\=#{MIME_PARAMETER_VALUE})?" <ide> MIME_REGEXP = /\A(?:\*\/\*|#{MIME_NAME}\/(?:\*|#{MIME_NAME})(?:\s*#{MIME_PARAMETER}\s*)*)\z/ <ide> <ide> class InvalidMimeType < StandardError; end <ide><path>actionpack/test/dispatch/mime_type_test.rb <ide> class MimeTypeTest < ActiveSupport::TestCase <ide> assert_equal 'text/html; parameter=abc; parameter2="xyz"', Mime::Type.new('text/html; parameter=abc; parameter2="xyz"').to_s <ide> end <ide> <add> test "can be initialized with parameters without having space after ;" do <add> assert_equal "text/html;parameter", Mime::Type.new("text/html;parameter").to_s <add> assert_equal 'text/html;parameter=abc;parameter2="xyz"', Mime::Type.new('text/html;parameter=abc;parameter2="xyz"').to_s <add> end <add> <ide> test "invalid mime types raise error" do <ide> assert_raises Mime::Type::InvalidMimeType do <ide> Mime::Type.new("too/many/slash")
2
Ruby
Ruby
add header parsing
b9b917756c6408f20a341fe47fe0385d067f14d1
<ide><path>Library/Homebrew/utils/curl.rb <ide> def curl(*args, print_stdout: true, **options) <ide> result <ide> end <ide> <add> def parse_headers(headers) <add> headers.split("\n").to_h do |h| <add> partitioned = h.partition(": ") <add> [partitioned.first, partitioned.last] <add> end <add> end <add> <ide> def curl_download(*args, to: nil, try_partial: true, **options) <ide> destination = Pathname(to) <ide> destination.dirname.mkpath
1
Ruby
Ruby
allow keg only berkeley-db
212a9efaf54ebd0414144059c54bbeead95b137e
<ide><path>Library/Homebrew/rubocops/uses_from_macos.rb <ide> class ProvidedByMacos < FormulaCop <ide> PROVIDED_BY_MACOS_FORMULAE = %w[ <ide> apr <ide> bc <add> berkeley-db <ide> bison <ide> bzip2 <ide> cups
1
Text
Text
replace single bactick with <code> tag for crowdin
22f017caa2ed57a6f8c61f0d67845472a83a2c26
<ide><path>curriculum/challenges/english/05-apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database.md <ide> In its simplest usage, `Model.find()` accepts a query document (a JSON object) a <ide> <ide> # --instructions-- <ide> <del>Modify the `findPeopleByName` function to find all the people having a given name, using `Model.find() -> [Person]` <add>Modify the `findPeopleByName` function to find all the people having a given name, using <code>Model.find() -\> [Person]</code> <ide> <ide> Use the function argument `personName` as the search key. <ide>
1
Javascript
Javascript
add trump blocker
69d5ddd349d708cfa549f0a28b08d6d07e83305c
<ide><path>website/src/react-native/showcase.js <ide> var apps = [ <ide> link: 'https://itunes.apple.com/cn/app/tong-xing-wang/id914254459?mt=8', <ide> author: 'Ho Yin Tsun Eugene', <ide> }, <add> { <add> name: 'Trump Blocker - That Filters Every Link', <add> icon: 'http://a2.mzstatic.com/us/r30/Purple69/v4/e7/91/4c/e7914cbd-c405-8411-2173-e8ed59a901bd/icon175x175.jpeg', <add> link: 'https://itunes.apple.com/us/app/trump-blocker-that-filters/id1071733244?mt=8', <add> author: 'Footbits, Inc.', <add> }, <ide> { <ide> name: 'uSwitch - Energy switching app', <ide> icon: 'https://lh3.googleusercontent.com/NpkGlwFWdj7VsK2ueVwlgdrrBrNJ-yN-4TkEHjjSjDUu7NpMcfyAp10p97f0zci0CSFQ=w300-rw',
1
PHP
PHP
remove un-necessary calls to constructclasses()
a42d56a55a75a246d9e78fecce4c9f80426bdc2b
<ide><path>src/Controller/Controller.php <ide> public function components() { <ide> * This method will also set the component to a property. <ide> * For example: <ide> * <del> * `$this->addComponent('DebugKit.Toolbar');` <add> * `$this->addComponent('Acl.Acl');` <ide> * <ide> * Will result in a `Toolbar` property being set. <ide> * <ide><path>src/Controller/ErrorController.php <ide> class ErrorController extends Controller { <ide> */ <ide> public function __construct($request = null, $response = null) { <ide> parent::__construct($request, $response); <del> $this->constructClasses(); <ide> if (count(Router::extensions()) && <ide> !isset($this->RequestHandler) <ide> ) { <ide><path>src/Shell/Task/TestTask.php <ide> protected function _processModel($subject) { <ide> * @return void <ide> */ <ide> protected function _processController($subject) { <del> $subject->constructClasses(); <ide> $models = [$subject->modelClass]; <ide> foreach ($models as $model) { <ide> list(, $model) = pluginSplit($model); <ide><path>tests/TestCase/Controller/Component/CookieComponentTest.php <ide> public function setUp() { <ide> array('redirect'), <ide> array(new Request(), new Response()) <ide> ); <del> $controller->components = array('Cookie'); <del> $controller->constructClasses(); <add> $controller->addComponent('Cookie'); <ide> $this->Controller = $controller; <ide> $this->Cookie = $controller->Cookie; <ide> $this->request = $controller->request; <ide><path>tests/TestCase/Controller/Component/RequestHandlerComponentTest.php <ide> protected function _init() { <ide> $request = new Request('controller_posts/index'); <ide> $response = $this->getMock('Cake\Network\Response', array('_sendHeader', 'stop')); <ide> $this->Controller = new RequestHandlerTestController($request, $response); <del> $this->Controller->constructClasses(); <ide> $this->RequestHandler = new RequestHandlerComponent($this->Controller->components()); <ide> <ide> Router::scope('/', function($routes) { <ide><path>tests/TestCase/Controller/Component/SecurityComponentTest.php <ide> public function setUp() { <ide> ->will($this->returnValue('/articles/index')); <ide> <ide> $this->Controller = new SecurityTestController($request); <del> $this->Controller->constructClasses(); <ide> $this->Controller->Security = $this->Controller->TestSecurity; <ide> $this->Controller->Security->config('blackHoleCallback', 'fail'); <ide> $this->Security = $this->Controller->Security; <ide><path>tests/TestCase/Controller/ComponentTest.php <ide> public function testMultipleComponentInitialize() { <ide> */ <ide> public function testSomethingReferencingCookieComponent() { <ide> $Controller = new ComponentTestController(); <del> $Controller->components = array('SomethingWithCookie'); <del> $Controller->uses = false; <del> $Controller->constructClasses(); <add> $Controller->addComponent('SomethingWithCookie'); <ide> $Controller->startupProcess(); <ide> <ide> $this->assertInstanceOf('TestApp\Controller\Component\SomethingWithCookieComponent', $Controller->SomethingWithCookie); <ide><path>tests/TestCase/Controller/ControllerTest.php <ide> public function testConstructClassesWithComponents() { <ide> Plugin::load('TestPlugin'); <ide> <ide> $Controller = new TestPluginController(new Request(), new Response()); <del> $Controller->components[] = 'TestPlugin.Other'; <add> $Controller->addComponent('TestPlugin.Other'); <ide> <del> $Controller->constructClasses(); <ide> $this->assertInstanceOf('TestPlugin\Controller\Component\OtherComponent', $Controller->Other); <ide> } <ide> <ide> public function testRedirectBeforeRedirectListenerReturnFalse() { <ide> */ <ide> public function testMergeVars() { <ide> $request = new Request(); <del> <ide> $TestController = new TestController($request); <del> $TestController->constructClasses(); <ide> <ide> $expected = [ <ide> 'Html' => null, <ide> public function testMergeVars() { <ide> $this->assertEquals($expected, $TestController->components); <ide> <ide> $TestController = new AnotherTestController($request); <del> $TestController->constructClasses(); <del> <ide> $this->assertEquals( <ide> 'Posts', <ide> $TestController->modelClass, <ide> 'modelClass should not be overwritten when defined.' <ide> ); <ide> } <ide> <del>/** <del> * test that options from child classes replace those in the parent classes. <del> * <del> * @return void <del> */ <del> public function testChildComponentOptionsSupercedeParents() { <del> $request = new Request('controller_posts/index'); <del> <del> $TestController = new TestController($request); <del> <del> $expected = array('foo'); <del> $TestController->components = array('Cookie' => $expected); <del> $TestController->constructClasses(); <del> $this->assertEquals($expected, $TestController->components['Cookie']); <del> } <del> <ide> /** <ide> * Ensure that _mergeControllerVars is not being greedy and merging with <ide> * ControllerTestAppController when you make an instance of Controller <ide> public function testPaginate() { <ide> <ide> $Controller = new Controller($request, $response); <ide> $Controller->request->query['url'] = []; <del> $Controller->constructClasses(); <ide> $this->assertEquals([], $Controller->paginate); <ide> <ide> $this->assertNotContains('Paginator', $Controller->helpers); <ide> public function testPaginateUsesModelClass() { <ide> <ide> $Controller = new Controller($request, $response); <ide> $Controller->request->query['url'] = []; <del> $Controller->constructClasses(); <ide> $Controller->modelClass = 'Posts'; <ide> $results = $Controller->paginate(); <ide> <ide><path>tests/TestCase/Shell/Task/TestTaskTest.php <ide> public function testBakeControllerTest() { <ide> <ide> $this->assertNotContains('function setUp()', $result); <ide> $this->assertNotContains("\$this->Posts = new PostsController()", $result); <del> $this->assertNotContains("\$this->Posts->constructClasses()", $result); <ide> <ide> $this->assertNotContains('function tearDown()', $result); <ide> $this->assertNotContains('unset($this->Posts)', $result); <ide> public function testBakePrefixControllerTest() { <ide> <ide> $this->assertNotContains('function setUp()', $result); <ide> $this->assertNotContains("\$this->Posts = new PostsController()", $result); <del> $this->assertNotContains("\$this->Posts->constructClasses()", $result); <ide> <ide> $this->assertNotContains('function tearDown()', $result); <ide> $this->assertNotContains('unset($this->Posts)', $result); <ide><path>tests/TestCase/View/ViewTest.php <ide> public function testRender() { <ide> $this->assertNull($View->render(false, 'ajax2')); <ide> <ide> $this->PostsController->helpers = array('Session', 'Html'); <del> $this->PostsController->constructClasses(); <ide> $this->PostsController->request->params['action'] = 'index'; <ide> Configure::write('Cache.check', true); <ide>
10
Python
Python
fix multi-target name in `ccompileropt`'s report
d54a45b28fdaad24eedf8a2ffee19d9afc7f2e69
<ide><path>numpy/distutils/ccompiler_opt.py <ide> def report(self, full=False): <ide> else: <ide> dispatch_rows.append(("Generated", '')) <ide> for tar in self.feature_sorted(target_sources): <del> tar_as_seq = [tar] if isinstance(tar, str) else tar <ide> sources = target_sources[tar] <del> name = tar if isinstance(tar, str) else '(%s)' % ' '.join(tar) <add> pretty_name = tar if isinstance(tar, str) else '(%s)' % ' '.join(tar) <ide> flags = ' '.join(self.feature_flags(tar)) <ide> implies = ' '.join(self.feature_sorted(self.feature_implies(tar))) <ide> detect = ' '.join(self.feature_detect(tar)) <ide> extra_checks = [] <del> for name in tar_as_seq: <add> for name in ((tar,) if isinstance(tar, str) else tar): <ide> extra_checks += self.feature_extra_checks(name) <ide> extra_checks = (' '.join(extra_checks) if extra_checks else "none") <ide> <ide> dispatch_rows.append(('', '')) <del> dispatch_rows.append((name, implies)) <add> dispatch_rows.append((pretty_name, implies)) <ide> dispatch_rows.append(("Flags", flags)) <ide> dispatch_rows.append(("Extra checks", extra_checks)) <ide> dispatch_rows.append(("Detect", detect))
1
Python
Python
pass conf to subdags
2e8b4ece36b2edf20e50331fbc55269033755954
<ide><path>airflow/operators/subdag_operator.py <ide> The module which provides a way to nest your DAGs and so your levels of complexity. <ide> """ <ide> from enum import Enum <del>from typing import Optional <add>from typing import Dict, Optional <ide> <ide> from sqlalchemy.orm.session import Session <ide> <ide> class SubDagOperator(BaseSensorOperator): <ide> <ide> :param subdag: the DAG object to run as a subdag of the current DAG. <ide> :param session: sqlalchemy session <add> :param conf: Configuration for the subdag <add> :type conf: dict <ide> :param propagate_skipped_state: by setting this argument you can define <ide> whether the skipped state of leaf task(s) should be propagated to the parent dag's downstream task. <ide> """ <ide> def __init__(self, <ide> *, <ide> subdag: DAG, <ide> session: Optional[Session] = None, <add> conf: Optional[Dict] = None, <ide> propagate_skipped_state: Optional[SkippedStatePropagationOptions] = None, <ide> **kwargs) -> None: <ide> super().__init__(**kwargs) <ide> self.subdag = subdag <add> self.conf = conf <ide> self.propagate_skipped_state = propagate_skipped_state <ide> <ide> self._validate_dag(kwargs) <ide> def pre_execute(self, context): <ide> run_type=DagRunType.SCHEDULED, <ide> execution_date=execution_date, <ide> state=State.RUNNING, <add> conf=self.conf, <ide> external_trigger=True, <ide> ) <ide> self.log.info("Created DagRun: %s", dag_run.run_id) <ide><path>tests/operators/test_subdag_operator.py <ide> def test_execute_create_dagrun_wait_until_success(self): <ide> subdag.create_dagrun.assert_called_once_with( <ide> run_type=DagRunType.SCHEDULED, <ide> execution_date=DEFAULT_DATE, <add> conf=None, <add> state=State.RUNNING, <add> external_trigger=True, <add> ) <add> <add> self.assertEqual(3, len(subdag_task._get_dagrun.mock_calls)) <add> <add> def test_execute_create_dagrun_with_conf(self): <add> """ <add> When SubDagOperator executes, it creates a DagRun if there is no existing one <add> and wait until the DagRun succeeds. <add> """ <add> conf = {"key": "value"} <add> dag = DAG('parent', default_args=default_args) <add> subdag = DAG('parent.test', default_args=default_args) <add> subdag_task = SubDagOperator(task_id='test', subdag=subdag, dag=dag, poke_interval=1, conf=conf) <add> <add> subdag.create_dagrun = Mock() <add> subdag.create_dagrun.return_value = self.dag_run_running <add> <add> subdag_task._get_dagrun = Mock() <add> subdag_task._get_dagrun.side_effect = [None, self.dag_run_success, self.dag_run_success] <add> <add> subdag_task.pre_execute(context={'execution_date': DEFAULT_DATE}) <add> subdag_task.execute(context={'execution_date': DEFAULT_DATE}) <add> subdag_task.post_execute(context={'execution_date': DEFAULT_DATE}) <add> <add> subdag.create_dagrun.assert_called_once_with( <add> run_type=DagRunType.SCHEDULED, <add> execution_date=DEFAULT_DATE, <add> conf=conf, <ide> state=State.RUNNING, <ide> external_trigger=True, <ide> )
2
Javascript
Javascript
add note about shims needed for ie
eee2ef6e9df90ba41a7a7d8a90d16665272b412c
<ide><path>src/ngComponentRouter/Router.js <ide> * @installation <ide> * ## Installation <ide> * <del> * Currently use `npm` to install the **Component Router** module: <add> * Currently, the **Component Router** module must be installed via `npm`, it is not yet available <add> * on Bower or the Google CDN. <ide> * <ide> * ```bash <ide> * npm install @angular/router --save <ide> * <script src="/node_modules/@angular/router/angular1/angular_1_router.js"></script> <ide> *``` <ide> * <add> * You also need to include ES6 shims to support running on Internet Explorer: <add> * ```html <add> * <!-- IE required polyfills, in this exact order --> <add> * <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js"></script> <add> * <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.20/system-polyfills.js"></script> <add> * <script src="https://npmcdn.com/angular2/es6/dev/src/testing/shims_for_IE.js"></script> <add> * ``` <add> * <ide> * Then load the module in your application by adding it as a dependent module: <ide> * <ide> * ```js
1
Ruby
Ruby
make index options to kwargs
b9e5859c6f956d25a73bea19133ab65aad41be62
<ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb <ide> def add_to(table) <ide> end <ide> <ide> if index <del> table.index(column_names, index_options) <add> table.index(column_names, **index_options) <ide> end <ide> <ide> if foreign_key <ide> def [](name) <ide> # t.references :tagger, polymorphic: true <ide> # t.references :taggable, polymorphic: { default: 'Photo' }, index: false <ide> # end <del> def column(name, type, **options) <add> def column(name, type, index: nil, **options) <ide> name = name.to_s <ide> type = type.to_sym if type <ide> <ide> def column(name, type, **options) <ide> end <ide> end <ide> <del> index_options = options.delete(:index) <del> index(name, index_options.is_a?(Hash) ? index_options : {}) if index_options <ide> @columns_hash[name] = new_column_definition(name, type, **options) <add> <add> if index <add> index_options = index.is_a?(Hash) ? index : {} <add> index(name, **index_options) <add> end <add> <ide> self <ide> end <ide> <ide> def remove_column(name) <ide> # This is primarily used to track indexes that need to be created after the table <ide> # <ide> # index(:account_id, name: 'index_projects_on_account_id') <del> def index(column_name, options = {}) <add> def index(column_name, **options) <ide> indexes << [column_name, options] <ide> end <ide> <ide> def initialize(table_name, base) <ide> # t.column(:name, :string) <ide> # <ide> # See TableDefinition#column for details of the options you can use. <del> def column(column_name, type, **options) <del> index_options = options.delete(:index) <add> def column(column_name, type, index: nil, **options) <ide> @base.add_column(name, column_name, type, **options) <del> index(column_name, index_options.is_a?(Hash) ? index_options : {}) if index_options <add> if index <add> index_options = index.is_a?(Hash) ? index : {} <add> index(column_name, **index_options) <add> end <ide> end <ide> <ide> # Checks to see if a column exists. <ide> def column_exists?(column_name, type = nil, **options) <ide> # t.index([:branch_id, :party_id], unique: true, name: 'by_branch_party') <ide> # <ide> # See {connection.add_index}[rdoc-ref:SchemaStatements#add_index] for details of the options you can use. <del> def index(column_name, options = {}) <del> @base.add_index(name, column_name, options) <add> def index(column_name, **options) <add> @base.add_index(name, column_name, **options) <ide> end <ide> <ide> # Checks to see if an index exists. <ide> def remove(*column_names, **options) <ide> # t.remove_index(:branch_id, name: :by_branch_party) <ide> # <ide> # See {connection.remove_index}[rdoc-ref:SchemaStatements#remove_index] <del> def remove_index(column_name = nil, options = {}) <del> @base.remove_index(name, column_name, options) <add> def remove_index(column_name = nil, **options) <add> @base.remove_index(name, column_name, **options) <ide> end <ide> <ide> # Removes the timestamp columns (+created_at+ and +updated_at+) from the table. <ide><path>activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb <ide> def indexes(table_name) <ide> # # Check an index with a custom name exists <ide> # index_exists?(:suppliers, :company_id, name: "idx_company_id") <ide> # <del> def index_exists?(table_name, column_name, options = {}) <add> def index_exists?(table_name, column_name, **options) <ide> checks = [] <ide> <ide> if column_name.present? <ide> def create_table(table_name, id: :primary_key, primary_key: nil, force: nil, **o <ide> <ide> unless supports_indexes_in_create? <ide> td.indexes.each do |column_name, index_options| <del> add_index(table_name, column_name, index_options.merge!(if_not_exists: td.if_not_exists)) <add> add_index(table_name, column_name, **index_options, if_not_exists: td.if_not_exists) <ide> end <ide> end <ide> <ide> def rename_column(table_name, column_name, new_column_name) <ide> # Concurrently adding an index is not supported in a transaction. <ide> # <ide> # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration]. <del> def add_index(table_name, column_name, options = {}) <add> def add_index(table_name, column_name, **options) <ide> index, algorithm, if_not_exists = add_index_options(table_name, column_name, **options) <ide> <ide> create_index = CreateIndexDefinition.new(index, algorithm, if_not_exists) <ide> def add_index(table_name, column_name, options = {}) <ide> # Concurrently removing an index is not supported in a transaction. <ide> # <ide> # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration]. <del> def remove_index(table_name, column_name = nil, options = {}) <del> return if options[:if_exists] && !index_exists?(table_name, column_name, options) <add> def remove_index(table_name, column_name = nil, **options) <add> return if options[:if_exists] && !index_exists?(table_name, column_name, **options) <ide> <ide> index_name = index_name_for_remove(table_name, column_name, options) <ide> <ide> def add_options_for_index_columns(quoted_columns, **options) <ide> end <ide> <ide> def index_name_for_remove(table_name, column_name, options) <del> if column_name.is_a?(Hash) <del> options = column_name.dup <del> column_name = options.delete(:column) <del> end <del> <ide> return options[:name] if can_remove_index_by_name?(column_name, options) <ide> <ide> checks = [] <ide> <ide> checks << lambda { |i| i.name == options[:name].to_s } if options.key?(:name) <del> column_names = index_column_names(column_name) <add> column_names = index_column_names(column_name || options[:column]) <ide> <ide> if column_names.present? <ide> checks << lambda { |i| index_name(table_name, i.columns) == index_name(table_name, column_names) } <ide><path>activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb <ide> def rename_column(table_name, column_name, new_column_name) #:nodoc: <ide> rename_column_indexes(table_name, column_name, new_column_name) <ide> end <ide> <del> def add_index(table_name, column_name, options = {}) #:nodoc: <del> index, algorithm, _ = add_index_options(table_name, column_name, **options) <add> def add_index(table_name, column_name, **options) #:nodoc: <add> index, algorithm, if_not_exists = add_index_options(table_name, column_name, **options) <add> <add> return if if_not_exists && index_exists?(table_name, column_name, name: index.name) <ide> <del> return if options[:if_not_exists] && index_exists?(table_name, column_name, name: index.name) <ide> create_index = CreateIndexDefinition.new(index, algorithm) <ide> execute schema_creation.accept(create_index) <ide> end <ide> def rename_column_for_alter(table_name, column_name, new_column_name) <ide> schema_creation.accept(ChangeColumnDefinition.new(cd, column.name)) <ide> end <ide> <del> def add_index_for_alter(table_name, column_name, options = {}) <add> def add_index_for_alter(table_name, column_name, **options) <ide> index, algorithm, _ = add_index_options(table_name, column_name, **options) <ide> algorithm = ", #{algorithm}" if algorithm <ide> <ide> "ADD #{schema_creation.accept(index)}#{algorithm}" <ide> end <ide> <del> def remove_index_for_alter(table_name, column_name = nil, options = {}) <add> def remove_index_for_alter(table_name, column_name = nil, **options) <ide> index_name = index_name_for_remove(table_name, column_name, options) <ide> "DROP INDEX #{quote_column_name(index_name)}" <ide> end <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb <ide> def rename_column(table_name, column_name, new_column_name) #:nodoc: <ide> rename_column_indexes(table_name, column_name, new_column_name) <ide> end <ide> <del> def add_index(table_name, column_name, options = {}) #:nodoc: <add> def add_index(table_name, column_name, **options) #:nodoc: <ide> index, algorithm, if_not_exists = add_index_options(table_name, column_name, **options) <ide> <ide> create_index = CreateIndexDefinition.new(index, algorithm, if_not_exists) <ide> def add_index(table_name, column_name, options = {}) #:nodoc: <ide> result <ide> end <ide> <del> def remove_index(table_name, column_name = nil, options = {}) # :nodoc: <add> def remove_index(table_name, column_name = nil, **options) # :nodoc: <ide> table = Utils.extract_schema_qualified_name(table_name.to_s) <ide> <del> if column_name.is_a?(Hash) <del> options = column_name.dup <del> column_name = options.delete(:column) <del> end <del> <ide> if options.key?(:name) <ide> provided_index = Utils.extract_schema_qualified_name(options[:name].to_s) <ide> <ide> def remove_index(table_name, column_name = nil, options = {}) # :nodoc: <ide> end <ide> end <ide> <del> return if options[:if_exists] && !index_exists?(table_name, column_name, options) <add> return if options[:if_exists] && !index_exists?(table_name, column_name, **options) <ide> <ide> index_to_remove = PostgreSQL::Name.new(table.schema, index_name_for_remove(table.to_s, column_name, options)) <ide> <ide><path>activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb <ide> def primary_keys(table_name) # :nodoc: <ide> pks.sort_by { |f| f["pk"] }.map { |f| f["name"] } <ide> end <ide> <del> def remove_index(table_name, column_name, options = {}) # :nodoc: <del> return if options[:if_exists] && !index_exists?(table_name, column_name, options) <add> def remove_index(table_name, column_name = nil, **options) # :nodoc: <add> return if options[:if_exists] && !index_exists?(table_name, column_name, **options) <ide> <ide> index_name = index_name_for_remove(table_name, column_name, options) <ide> <ide> def copy_table_indexes(from, to, rename = {}) <ide> <ide> unless columns.empty? <ide> # index name can't be the same <del> opts = { name: name.gsub(/(^|_)(#{from})_/, "\\1#{to}_"), internal: true } <del> opts[:unique] = true if index.unique <del> opts[:where] = index.where if index.where <del> add_index(to, columns, opts) <add> options = { name: name.gsub(/(^|_)(#{from})_/, "\\1#{to}_"), internal: true } <add> options[:unique] = true if index.unique <add> options[:where] = index.where if index.where <add> add_index(to, columns, **options) <ide> end <ide> end <ide> end <ide><path>activerecord/lib/active_record/migration/command_recorder.rb <ide> module StraightReversions # :nodoc: <ide> create_table: :drop_table, <ide> create_join_table: :drop_join_table, <ide> add_column: :remove_column, <add> add_index: :remove_index, <ide> add_timestamps: :remove_timestamps, <ide> add_reference: :remove_reference, <ide> add_foreign_key: :remove_foreign_key, <ide> def invert_rename_column(args) <ide> [:rename_column, [args.first] + args.last(2).reverse] <ide> end <ide> <del> def invert_add_index(args) <del> table, columns, options = *args <del> options ||= {} <del> <del> options_hash = options.slice(:name, :algorithm) <del> options_hash[:column] = columns if !options_hash[:name] <del> <del> [:remove_index, [table, options_hash]] <del> end <del> <ide> def invert_remove_index(args) <del> table, columns, options = *args <del> options ||= {} <add> options = args.extract_options! <add> table, columns = args <ide> <del> if columns.is_a?(Hash) <del> options = columns.dup <del> columns = options.delete(:column) <del> end <add> columns ||= options.delete(:column) <ide> <ide> unless columns <ide> raise ActiveRecord::IrreversibleMigration, "remove_index is only reversible if given a :column option." <ide> end <ide> <del> [:add_index, [table, columns, options]] <add> options.delete(:if_exists) <add> <add> args = [table, columns] <add> args << options unless options.empty? <add> <add> [:add_index, args] <ide> end <ide> <ide> alias :invert_add_belongs_to :invert_add_reference <ide><path>activerecord/lib/active_record/migration/compatibility.rb <ide> def add_timestamps(table_name, **options) <ide> super <ide> end <ide> <del> def index_exists?(table_name, column_name, options = {}) <add> def index_exists?(table_name, column_name, **options) <ide> column_names = Array(column_name).map(&:to_s) <ide> options[:name] = <ide> if options[:name].present? <ide> def index_exists?(table_name, column_name, options = {}) <ide> super <ide> end <ide> <del> def remove_index(table_name, options = {}) <del> options = { column: options } unless options.is_a?(Hash) <del> options[:name] = index_name_for_remove(table_name, options) <del> super(table_name, options) <add> def remove_index(table_name, column_name = nil, **options) <add> options[:name] = index_name_for_remove(table_name, column_name, options) <add> super <ide> end <ide> <ide> private <ide> class << t <ide> super <ide> end <ide> <del> def index_name_for_remove(table_name, options = {}) <del> index_name = connection.index_name(table_name, options) <add> def index_name_for_remove(table_name, column_name, options) <add> index_name = connection.index_name(table_name, column_name || options) <ide> <ide> unless connection.index_name_exists?(table_name, index_name) <del> if options.is_a?(Hash) && options.has_key?(:name) <del> options_without_column = options.dup <del> options_without_column.delete :column <add> if options.key?(:name) <add> options_without_column = options.except(:column) <ide> index_name_without_column = connection.index_name(table_name, options_without_column) <ide> <ide> if connection.index_name_exists?(table_name, index_name_without_column) <ide><path>activerecord/test/cases/adapters/postgresql/active_schema_test.rb <ide> def test_remove_index_with_wrong_option <ide> def method_missing(method_symbol, *arguments) <ide> ActiveRecord::Base.connection.send(method_symbol, *arguments) <ide> end <add> ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) <ide> end <ide><path>activerecord/test/cases/invertible_migration_test.rb <ide> def self.up <ide> t.column :name, :string <ide> t.column :color, :string <ide> t.index [:name, :color] <add> t.index [:color] <ide> end <ide> end <ide> end <ide> class RemoveIndexMigration2 < SilentMigration <ide> def change <ide> change_table("horses") do |t| <ide> t.remove_index [:name, :color] <add> t.remove_index [:color], if_exists: true <ide> end <ide> end <ide> end <ide><path>activerecord/test/cases/migration/change_table_test.rb <ide> def test_column_creates_column_with_index <ide> with_change_table do |t| <ide> if RUBY_VERSION < "2.7" <ide> @connection.expect :add_column, nil, [:delete_me, :bar, :integer, {}] <add> @connection.expect :add_index, nil, [:delete_me, :bar, {}] <ide> else <ide> @connection.expect :add_column, nil, [:delete_me, :bar, :integer] <add> @connection.expect :add_index, nil, [:delete_me, :bar] <ide> end <del> @connection.expect :add_index, nil, [:delete_me, :bar, {}] <ide> t.column :bar, :integer, index: true <ide> end <ide> end <ide> <ide> def test_index_creates_index <ide> with_change_table do |t| <del> @connection.expect :add_index, nil, [:delete_me, :bar, {}] <add> if RUBY_VERSION < "2.7" <add> @connection.expect :add_index, nil, [:delete_me, :bar, {}] <add> else <add> @connection.expect :add_index, nil, [:delete_me, :bar] <add> end <ide> t.index :bar <ide> end <ide> end <ide><path>activerecord/test/cases/migration/command_recorder_test.rb <ide> def test_invert_rename_column <ide> <ide> def test_invert_add_index <ide> remove = @recorder.inverse_of :add_index, [:table, [:one, :two]] <del> assert_equal [:remove_index, [:table, { column: [:one, :two] }]], remove <add> assert_equal [:remove_index, [:table, [:one, :two]], nil], remove <ide> end <ide> <ide> def test_invert_add_index_with_name <ide> remove = @recorder.inverse_of :add_index, [:table, [:one, :two], name: "new_index"] <del> assert_equal [:remove_index, [:table, { name: "new_index" }]], remove <add> assert_equal [:remove_index, [:table, [:one, :two], name: "new_index"], nil], remove <ide> end <ide> <ide> def test_invert_add_index_with_algorithm_option <ide> remove = @recorder.inverse_of :add_index, [:table, :one, algorithm: :concurrently] <del> assert_equal [:remove_index, [:table, { column: :one, algorithm: :concurrently }]], remove <add> assert_equal [:remove_index, [:table, :one, algorithm: :concurrently], nil], remove <ide> end <ide> <ide> def test_invert_remove_index <ide> add = @recorder.inverse_of :remove_index, [:table, :one] <del> assert_equal [:add_index, [:table, :one, {}]], add <add> assert_equal [:add_index, [:table, :one]], add <ide> end <ide> <ide> def test_invert_remove_index_with_positional_column <ide> def test_invert_remove_index_with_name <ide> <ide> def test_invert_remove_index_with_no_special_options <ide> add = @recorder.inverse_of :remove_index, [:table, { column: [:one, :two] }] <del> assert_equal [:add_index, [:table, [:one, :two], {}]], add <add> assert_equal [:add_index, [:table, [:one, :two]]], add <ide> end <ide> <ide> def test_invert_remove_index_with_no_column
11
Ruby
Ruby
remove reference to 'brew install pip'
cfdca92630aba29dab108bbc965b084ab7a34b37
<ide><path>Library/Homebrew/exceptions.rb <ide> def message <ide> <ide> def tool <ide> case type <del> when :python then 'pip' <add> when :python then 'easy_install' <ide> when :ruby, :jruby then 'rubygems' <ide> when :perl then 'cpan' <ide> end <ide> def tool <ide> def command_line <ide> case type <ide> when :python <del> "#{brew_pip}pip install" <add> "easy_install install" <ide> when :ruby <ide> "gem install" <ide> when :perl <ide> def command_line <ide> "jruby -S gem install" <ide> end <ide> end <del> <del> def brew_pip <del> 'brew install pip && ' unless Formula.factory('pip').installed? <del> end <ide> end <ide> <ide> class BuildError < Homebrew::InstallationError
1
Java
Java
accept double args in scrollview.scrollto
df36e388f17d50a08ec890a0608aec48313684d3
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.java <ide> public static <T> void receiveCommand( <ide> Assertions.assertNotNull(args); <ide> switch (commandType) { <ide> case COMMAND_SCROLL_TO: { <del> int destX = Math.round(PixelUtil.toPixelFromDIP(args.getInt(0))); <del> int destY = Math.round(PixelUtil.toPixelFromDIP(args.getInt(1))); <add> int destX = Math.round(PixelUtil.toPixelFromDIP(args.getDouble(0))); <add> int destY = Math.round(PixelUtil.toPixelFromDIP(args.getDouble(1))); <ide> viewManager.scrollTo(scrollView, new ScrollToCommandData(destX, destY)); <ide> return; <ide> } <ide> case COMMAND_SCROLL_WITHOUT_ANIMATION_TO: { <del> int destX = Math.round(PixelUtil.toPixelFromDIP(args.getInt(0))); <del> int destY = Math.round(PixelUtil.toPixelFromDIP(args.getInt(1))); <add> int destX = Math.round(PixelUtil.toPixelFromDIP(args.getDouble(0))); <add> int destY = Math.round(PixelUtil.toPixelFromDIP(args.getDouble(1))); <ide> viewManager.scrollWithoutAnimationTo(scrollView, new ScrollToCommandData(destX, destY)); <ide> return; <ide> }
1
Javascript
Javascript
fix bug with tostring
c7fa237e32581da8be1388d7f6a58ce5d8e3a9d5
<ide><path>dist/Sequence.js <ide> var Immutable = require('./Immutable'); <ide> }; <ide> <ide> <del>Sequence.prototype.inspect = Sequence.prototype.toSource = Sequence.prototype.toString; <add>Sequence.prototype.inspect = Sequence.prototype.toSource = function() { return this.toString(); }; <ide> Sequence.prototype.__toJS = Sequence.prototype.toObject; <ide> <ide> <ide><path>src/Sequence.js <ide> class Sequence { <ide> } <ide> } <ide> <del>Sequence.prototype.inspect = Sequence.prototype.toSource = Sequence.prototype.toString; <add>Sequence.prototype.inspect = Sequence.prototype.toSource = function() { return this.toString(); }; <ide> Sequence.prototype.__toJS = Sequence.prototype.toObject; <ide> <ide>
2
Java
Java
avoid npe in hasunresolvablegenerics()
6cfbcf4f17eb43224cbb1613c0c800a955b40260
<ide><path>spring-core/src/main/java/org/springframework/core/ResolvableType.java <ide> public boolean hasUnresolvableGenerics() { <ide> } <ide> } <ide> Class<?> resolved = resolve(); <del> Type[] ifcs = resolved.getGenericInterfaces(); <del> for (Type ifc : ifcs) { <del> if (ifc instanceof Class) { <del> if (forClass((Class) ifc).hasGenerics()) { <del> return true; <add> if (resolved != null) { <add> Type[] ifcs = resolved.getGenericInterfaces(); <add> for (Type ifc : ifcs) { <add> if (ifc instanceof Class) { <add> if (forClass((Class) ifc).hasGenerics()) { <add> return true; <add> } <ide> } <ide> } <del> } <del> if (resolved.getGenericSuperclass() != null) { <del> return getSuperType().hasUnresolvableGenerics(); <add> if (resolved.getGenericSuperclass() != null) { <add> return getSuperType().hasUnresolvableGenerics(); <add> } <ide> } <ide> return false; <ide> }
1
PHP
PHP
fresh command
f6511d477f73b3033ef2336257f4cac5f20594a0
<ide><path>src/Illuminate/Database/Console/Migrations/FreshCommand.php <add><?php <add> <add>namespace Illuminate\Database\Console\Migrations; <add> <add>use Illuminate\Console\Command; <add>use Illuminate\Console\ConfirmableTrait; <add>use Symfony\Component\Console\Input\InputOption; <add> <add>class FreshCommand extends Command <add>{ <add> use ConfirmableTrait; <add> <add> /** <add> * The console command name. <add> * <add> * @var string <add> */ <add> protected $name = 'migrate:fresh'; <add> <add> /** <add> * The console command description. <add> * <add> * @var string <add> */ <add> protected $description = 'Drop all tables and re-run all migrations'; <add> <add> /** <add> * Execute the console command. <add> * <add> * @return void <add> */ <add> public function fire() <add> { <add> if (! $this->confirmToProceed()) { <add> return; <add> } <add> <add> $this->dropAllTables( <add> $database = $this->input->getOption('database') <add> ); <add> <add> $this->call('migrate', [ <add> '--database' => $database, <add> '--path' => $this->input->getOption('path'), <add> '--force' => $this->input->getOption('force'), <add> ]); <add> <add> if ($this->needsSeeding()) { <add> $this->runSeeder($database); <add> } <add> } <add> <add> /** <add> * Drop all of the database tables. <add> * <add> * @param string $database <add> * @return void <add> */ <add> protected function dropAllTables($database) <add> { <add> $this->laravel['db']->connection($database) <add> ->getSchemaBuilder() <add> ->dropAllTables(); <add> } <add> <add> /** <add> * Determine if the developer has requested database seeding. <add> * <add> * @return bool <add> */ <add> protected function needsSeeding() <add> { <add> return $this->option('seed') || $this->option('seeder'); <add> } <add> <add> /** <add> * Run the database seeder command. <add> * <add> * @param string $database <add> * @return void <add> */ <add> protected function runSeeder($database) <add> { <add> $this->call('db:seed', [ <add> '--database' => $database, <add> '--class' => $this->option('seeder') ?: 'DatabaseSeeder', <add> '--force' => $this->option('force'), <add> ]); <add> } <add> <add> /** <add> * Get the console command options. <add> * <add> * @return array <add> */ <add> protected function getOptions() <add> { <add> return [ <add> ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], <add> <add> ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], <add> <add> ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'], <add> <add> ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'], <add> <add> ['seeder', null, InputOption::VALUE_OPTIONAL, 'The class name of the root seeder.'], <add> ]; <add> } <add>} <ide><path>src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php <ide> use Illuminate\Queue\Console\FlushFailedCommand as FlushFailedQueueCommand; <ide> use Illuminate\Queue\Console\ForgetFailedCommand as ForgetFailedQueueCommand; <ide> use Illuminate\Database\Console\Migrations\ResetCommand as MigrateResetCommand; <add>use Illuminate\Database\Console\Migrations\FreshCommand as MigrateFreshCommand; <ide> use Illuminate\Database\Console\Migrations\StatusCommand as MigrateStatusCommand; <ide> use Illuminate\Database\Console\Migrations\InstallCommand as MigrateInstallCommand; <ide> use Illuminate\Database\Console\Migrations\RefreshCommand as MigrateRefreshCommand; <ide> class ArtisanServiceProvider extends ServiceProvider <ide> 'Environment' => 'command.environment', <ide> 'KeyGenerate' => 'command.key.generate', <ide> 'Migrate' => 'command.migrate', <add> 'MigrateFresh' => 'command.migrate.fresh', <ide> 'MigrateInstall' => 'command.migrate.install', <ide> 'MigrateRefresh' => 'command.migrate.refresh', <ide> 'MigrateReset' => 'command.migrate.reset', <ide> protected function registerMigrateCommand() <ide> }); <ide> } <ide> <add> /** <add> * Register the command. <add> * <add> * @return void <add> */ <add> protected function registerMigrateFreshCommand() <add> { <add> $this->app->singleton('command.migrate.fresh', function () { <add> return new MigrateFreshCommand; <add> }); <add> } <add> <ide> /** <ide> * Register the command. <ide> *
2
Go
Go
return usage on parseexec error
7fdbd90f8805736aa78156faf7e6f8fdd2384af7
<ide><path>api/client/commands.go <ide> func (cli *DockerCli) CmdExec(args ...string) error { <ide> <ide> execConfig, err := runconfig.ParseExec(cmd, args) <ide> if err != nil { <add> cmd.Usage() <ide> return err <ide> } <ide> if execConfig.Container == "" { <ide><path>integration-cli/docker_cli_exec_test.go <ide> func TestExecTtyWithoutStdin(t *testing.T) { <ide> <ide> logDone("exec - forbid piped stdin to tty enabled container") <ide> } <add> <add>func TestExecParseError(t *testing.T) { <add> defer deleteAllContainers() <add> <add> runCmd := exec.Command(dockerBinary, "run", "-d", "--name", "top", "busybox", "top") <add> if out, _, err := runCommandWithOutput(runCmd); err != nil { <add> t.Fatal(out, err) <add> } <add> <add> // Test normal (non-detached) case first <add> cmd := exec.Command(dockerBinary, "exec", "top") <add> if out, _, err := runCommandWithOutput(cmd); err == nil || !strings.Contains(out, "Usage:") { <add> t.Fatalf("Should have thrown error & given usage: %s", out) <add> } <add> logDone("exec - error on parseExec should return usage") <add>}
2
Ruby
Ruby
use zero-padding for number_to_rounded_converter
9bf2e5ec305bcb5aa7713fea66ac0fbfbad0612a
<ide><path>activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb <ide> def convert <ide> a, b = s.split('.', 2) <ide> a + '.' + b[0, precision] <ide> else <del> "%01.#{precision}f" % rounded_number <add> "%00.#{precision}f" % rounded_number <ide> end <ide> <ide> delimited_number = NumberToDelimitedConverter.convert(formatted_string, options)
1
Javascript
Javascript
remove unnecessary timer
755e07cb738558841880e32795b6f1df4005c5b9
<ide><path>test/addons-napi/test_callback_scope/test-resolve-async.js <ide> 'use strict'; <ide> <ide> const common = require('../../common'); <del>const assert = require('assert'); <ide> const { testResolveAsync } = require(`./build/${common.buildType}/binding`); <ide> <del>let called = false; <del>testResolveAsync().then(common.mustCall(() => { <del> called = true; <del>})); <del> <del>setTimeout(common.mustCall(() => { assert(called); }), <del> common.platformTimeout(20)); <add>testResolveAsync().then(common.mustCall());
1
Text
Text
fix small typo in configuring guide [skip ci]
6bf5c2af94fb7a9e805e732ad0cb8bafc77c63cb
<ide><path>guides/source/configuring.md <ide> NOTE: There is no guarantee that your initializers will run after all the gem in <ide> <ide> NOTE: You can use subfolders to organize your initializers if you like, because Rails will look into the whole file hierarchy from the initializers folder on down. <ide> <del>TIP: While Rails supports numbering of initializer file names for load ordering purposes, a better technique is to place any code that need to load in a specific order within the same file. This reduces file name churn, makes dependencies more explicit, and can help surface new concepts within your application. <add>TIP: While Rails supports numbering of initializer file names for load ordering purposes, a better technique is to place any code that needs to load in a specific order within the same file. This reduces file name churn, makes dependencies more explicit, and can help surface new concepts within your application. <ide> <ide> Initialization events <ide> ---------------------
1
Mixed
Ruby
remove deprecated `databaseconfig#config` method
7b9d4d2d8a6a7e2bb489343e83e7aa24dbcd2c7e
<ide><path>activerecord/CHANGELOG.md <add>* Remove deprecated `DatabaseConfig#config` method. <add> <add> *Rafael Mendonça França* <add> <ide> * Rollback transactions when the block returns earlier than expected. <ide> <ide> Before this change, when a transaction block returned early, the transaction would be committed. <ide><path>activerecord/lib/active_record/database_configurations/database_config.rb <ide> def spec_name <ide> end <ide> deprecate spec_name: "please use name instead" <ide> <del> def config <del> raise NotImplementedError <del> end <del> <ide> def adapter_method <ide> "#{adapter}_connection" <ide> end <ide><path>activerecord/lib/active_record/database_configurations/hash_config.rb <ide> def initialize(env_name, name, configuration_hash) <ide> @configuration_hash = configuration_hash.symbolize_keys.freeze <ide> end <ide> <del> def config <del> ActiveSupport::Deprecation.warn("DatabaseConfig#config will be removed in 7.0.0 in favor of DatabaseConfig#configuration_hash which returns a hash with symbol keys") <del> configuration_hash.stringify_keys <del> end <del> <ide> # Determines whether a database configuration is for a replica / readonly <ide> # connection. If the +replica+ key is present in the config, +replica?+ will <ide> # return +true+. <ide><path>activerecord/test/cases/database_configurations_test.rb <ide> def test_can_turn_configurations_into_a_hash_and_is_deprecated <ide> end <ide> end <ide> <del> def test_deprecated_config_method <del> db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary") <del> <del> assert_equal db_config.configuration_hash.stringify_keys, assert_deprecated { db_config.config } <del> end <del> <ide> def test_unsupported_method_raises <ide> assert_raises NoMethodError do <ide> ActiveRecord::Base.configurations.fetch(:foo) <ide><path>guides/source/7_0_release_notes.md <ide> Please refer to the [Changelog][active-record] for detailed changes. <ide> <ide> * Remove deprecated support to pass a column to `type_cast`. <ide> <add>* Remove deprecated `DatabaseConfig#config` method. <add> <ide> ### Deprecations <ide> <ide> ### Notable changes
5
Ruby
Ruby
add license field as parsable arg
d92f747b1e1ac9e4fdc4f839174cf36d89aab879
<ide><path>Library/Homebrew/dev-cmd/create.rb <ide> def create_args <ide> description: "Explicitly set the <name> of the new formula." <ide> flag "--set-version=", <ide> description: "Explicitly set the <version> of the new formula." <add> flag "--set-license=", <add> description: "Explicitly set the <license> of the new formula." <ide> flag "--tap=", <ide> description: "Generate the new formula within the given tap, specified as <user>`/`<repo>." <add> <ide> switch :force <ide> switch :verbose <ide> switch :debug <ide> def create <ide> <ide> version = args.set_version <ide> name = args.set_name <add> license = args.set_license <ide> tap = args.tap <ide> <ide> fc = FormulaCreator.new <ide> fc.name = name <ide> fc.version = version <add> fc.license = license <ide> fc.tap = Tap.fetch(tap || "homebrew/core") <ide> raise TapUnavailableError, tap unless fc.tap.installed? <ide> <ide><path>Library/Homebrew/formula_creator.rb <ide> <ide> module Homebrew <ide> class FormulaCreator <del> attr_reader :url, :sha256, :desc, :homepage, :license <del> attr_accessor :name, :version, :tap, :path, :mode <add> attr_reader :url, :sha256, :desc, :homepage <add> attr_accessor :name, :version, :tap, :path, :mode, :license <ide> <ide> def url=(url) <ide> @url = url <ide> def head? <ide> end <ide> <ide> def generate! <add> p "generate" <ide> raise "#{path} already exists" if path.exist? <ide> <ide> if version.nil? || version.null?
2
PHP
PHP
info
ce879dd84d2d86023a0d50c6e34873a0b25fddd3
<ide><path>src/Illuminate/Notifications/Messages/SlackMessage.php <ide> class SlackMessage <ide> */ <ide> public $http = []; <ide> <add> /** <add> * Indicate that the notification gives information about an operation. <add> * <add> * @return $this <add> */ <add> public function info() <add> { <add> $this->level = 'info'; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Indicate that the notification gives information about a successful operation. <ide> *
1
Text
Text
adjust application pack in webpacker guide
6d0773a468a1f45e7f35ddfe44af48adeaf0ca76
<ide><path>guides/source/webpacker.md <ide> So if you have a file called `app/javascript/packs/application.js`, Webpacker wi <ide> The default pack created for you by Webpacker will link to Rails default JavaScript packages if they have been included in the project: <ide> <ide> ``` <del>require("@rails/ujs").start() <del>require("turbolinks").start() <del>require("@rails/activestorage").start() <del>require("channels") <add>import Rails from "@rails/ujs" <add>import Turbolinks from "turbolinks" <add>import * as ActiveStorage from "@rails/activestorage" <add>import "channels" <add> <add>Rails.start() <add>Turbolinks.start() <add>ActiveStorage.start() <ide> ``` <ide> <ide> You'll need to include a pack that requires these packages to use them in your Rails application.
1
Text
Text
update nodejitsu logo
8bd9c0c71c7b18955d5639b658cccff9a83b12da
<ide><path>README.md <ide> Add this to `package.json`, after *name* and *version*. This is necessary becaus <ide> - **Note**: The first time you run this command, you have to pass `-f` (force) flag because OpenShift creates a dummy server with the welcome page when you create a new Node.js app. Passing `-f` flag will override everything with your *Hackathon Starter* project repository. Please **do not** do `git pull` as it will create unnecessary merge conflicts. <ide> - And you are done! (Not quite as simple as Heroku, huh?) <ide> <del><img src="https://nodejs-in-production.nodejitsu.com/img/nodejitsu.png" width="200"> <add><img src="https://www.nodejitsu.com/img/media/nodejitsu-transparent.png" width="200"> <ide> <ide> TODO: Will be added soon. <ide>
1
Text
Text
revise addon mulitple initializations text
850c4668bad7f705d8a0a0bbbd24b5ea0c4b01c5
<ide><path>doc/api/addons.md <ide> There are environments in which Node.js addons may need to be loaded multiple <ide> times in multiple contexts. For example, the [Electron][] runtime runs multiple <ide> instances of Node.js in a single process. Each instance will have its own <ide> `require()` cache, and thus each instance will need a native addon to behave <del>correctly when loaded via `require()`. From the addon's perspective, this means <del>that it must support multiple initializations. <add>correctly when loaded via `require()`. This means that the addon <add>must support multiple initializations. <ide> <ide> A context-aware addon can be constructed by using the macro <ide> `NODE_MODULE_INITIALIZER`, which expands to the name of a function which Node.js
1
Python
Python
add note for future optimisation
cbf9bdcf5481ed25ea302e85f2b6adf68edf3b5b
<ide><path>glances/plugins/glances_plugin.py <ide> def set_stats(self, input_stats): <ide> <ide> def set_stats_snmp(self, snmp_oid={}): <ide> # Update stats using SNMP <add> # TODO: optimisation with bulk command: <add> # http://pysnmp.sourceforge.net/examples/4.x/v3arch/oneliner/manager/bulkgen.html <ide> from glances.core.glances_snmp import GlancesSNMPClient <ide> <ide> # Init the SNMP request
1
Javascript
Javascript
fix doc api
7830f434af827923e1c3cdeee4103f5535047183
<ide><path>packages/ember-runtime/lib/system/array_proxy.js <ide> var get = Ember.get, set = Ember.set; <ide> A simple example of usage: <ide> <ide> var pets = ['dog', 'cat', 'fish']; <del> var arrayProxy = Ember.ArrayProxy.create({ content: Ember.A(pets) }); <add> var ap = Ember.ArrayProxy.create({ content: Ember.A(pets) }); <ide> ap.get('firstObject'); // => 'dog' <ide> ap.set('content', ['amoeba', 'paramecium']); <ide> ap.get('firstObject'); // => 'amoeba'
1
Javascript
Javascript
fix race write() before and after connect()
cd5d2473a463cec5d2d1eeeac4770aa1b20a692a
<ide><path>lib/net.js <ide> function afterConnect(status, handle, req, readable, writable) { <ide> handle.readStart(); <ide> } <ide> <del> self.emit('connect'); <del> <ide> if (self._connectQueue) { <ide> debug('Drain the connect queue'); <ide> for (var i = 0; i < self._connectQueue.length; i++) { <ide> function afterConnect(status, handle, req, readable, writable) { <ide> self._connectQueueCleanUp(); <ide> } <ide> <add> self.emit('connect'); <add> <ide> if (self._flags & FLAG_SHUTDOWNQUED) { <ide> // end called before connected - call end now with no data <ide> self._flags &= ~FLAG_SHUTDOWNQUED; <ide><path>test/simple/test-net-write-connect-write.js <add>// Copyright Joyent, Inc. and other Node contributors. <add>// <add>// Permission is hereby granted, free of charge, to any person obtaining a <add>// copy of this software and associated documentation files (the <add>// "Software"), to deal in the Software without restriction, including <add>// without limitation the rights to use, copy, modify, merge, publish, <add>// distribute, sublicense, and/or sell copies of the Software, and to permit <add>// persons to whom the Software is furnished to do so, subject to the <add>// following conditions: <add>// <add>// The above copyright notice and this permission notice shall be included <add>// in all copies or substantial portions of the Software. <add>// <add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS <add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN <add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, <add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR <add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE <add>// USE OR OTHER DEALINGS IN THE SOFTWARE. <add> <add>var common = require('../common'); <add>var assert = require('assert'); <add>var net = require('net'); <add> <add>var received = ''; <add> <add>var server = net.createServer(function(socket) { <add> socket.pipe(socket); <add>}).listen(common.PORT, function() { <add> var conn = net.connect(common.PORT); <add> conn.setEncoding('utf8'); <add> conn.write('before'); <add> conn.on('connect', function() { <add> conn.write('after'); <add> }); <add> conn.on('data', function(buf) { <add> received += buf; <add> conn.end(); <add> }); <add> conn.on('end', function() { <add> server.close(); <add> }); <add>}); <add> <add>process.on('exit', function() { <add> assert.equal(received, 'before' + 'after'); <add>});
2
PHP
PHP
remove unused import
942f1d38f33bdb6d1bc5f978805836083794a96d
<ide><path>src/Cache/Cache.php <ide> namespace Cake\Cache; <ide> <ide> use Cake\Cache\Engine\NullEngine; <del>use Cake\Core\ObjectRegistry; <ide> use Cake\Core\StaticConfigTrait; <ide> use InvalidArgumentException; <ide> use RuntimeException;
1
Ruby
Ruby
add tests for argument error cases
5bbab5110b141df0f856221a59a6f4ad1ea7c88c
<ide><path>actionpack/test/dispatch/routing_test.rb <ide> def draw(&block) <ide> @app.draw(&block) <ide> end <ide> <add> def test_missing_controller <add> ex = assert_raises(ArgumentError) { <add> draw do <add> get '/foo/bar', :to => :index <add> end <add> } <add> assert_match(/Missing :controller/, ex.message) <add> end <add> <add> def test_missing_action <add> ex = assert_raises(ArgumentError) { <add> draw do <add> get '/foo/bar', :to => 'foo' <add> end <add> } <add> assert_match(/Missing :action/, ex.message) <add> end <add> <add> def test_missing_action_on_hash <add> ex = assert_raises(ArgumentError) { <add> draw do <add> get '/foo/bar', :to => 'foo#' <add> end <add> } <add> assert_match(/Missing :action/, ex.message) <add> end <add> <ide> def test_valid_controller_options_inside_namespace <ide> draw do <ide> namespace :admin do
1
Javascript
Javascript
improve concat() performance
2170259940fc5d1e9d3a6cd425f8e761dbb99432
<ide><path>benchmark/buffers/buffer-concat-fill.js <add>'use strict'; <add>const common = require('../common.js'); <add> <add>const bench = common.createBenchmark(main, { <add> extraSize: [1, 256, 4 * 256], <add> n: [8e5] <add>}); <add> <add>function main({ n, extraSize }) { <add> const pieces = 4; <add> const pieceSize = 256; <add> <add> const list = Array.from({ length: pieces }) <add> .fill(Buffer.allocUnsafe(pieceSize)); <add> <add> const totalLength = (pieces * pieceSize) + extraSize; <add> <add> bench.start(); <add> for (let i = 0; i < n; i++) { <add> Buffer.concat(list, totalLength); <add> } <add> bench.end(n); <add>} <ide><path>lib/buffer.js <ide> function _copy(source, target, targetStart, sourceStart, sourceEnd) { <ide> sourceStart); <ide> } <ide> <add> return _copyActual(source, target, targetStart, sourceStart, sourceEnd); <add>} <add> <add>function _copyActual(source, target, targetStart, sourceStart, sourceEnd) { <ide> if (sourceEnd - sourceStart > target.length - targetStart) <ide> sourceEnd = sourceStart + target.length - targetStart; <ide> <ide> Buffer.concat = function concat(list, length) { <ide> throw new ERR_INVALID_ARG_TYPE( <ide> `list[${i}]`, ['Buffer', 'Uint8Array'], list[i]); <ide> } <del> _copy(buf, buffer, pos); <del> pos += buf.length; <add> pos += _copyActual(buf, buffer, pos, 0, buf.length); <ide> } <ide> <ide> // Note: `length` is always equal to `buffer.length` at this point <ide> if (pos < length) { <ide> // Zero-fill the remaining bytes if the specified `length` was more than <ide> // the actual total length, i.e. if we have some remaining allocated bytes <ide> // there were not initialized. <del> buffer.fill(0, pos, length); <add> TypedArrayFill.call(buffer, 0, pos, length); <ide> } <ide> <ide> return buffer; <ide><path>test/benchmark/test-benchmark-buffer.js <ide> runBenchmark('buffers', <ide> 'difflen=false', <ide> 'encoding=utf8', <ide> 'endian=BE', <add> 'extraSize=1', <ide> 'len=256', <ide> 'linesCount=1', <ide> 'method=',
3
Ruby
Ruby
apply tables to the whole tree from the outside
c5fe508df19028d9fcb5c958019f61b55b24edb1
<ide><path>activerecord/lib/active_record/associations/join_dependency.rb <ide> def initialize(base, associations, joins) <ide> @alias_tracker.aliased_name_for(base.table_name) # Updates the count for base.table_name to 1 <ide> tree = self.class.make_tree associations <ide> build tree, @join_root, Arel::InnerJoin <del> @join_root.children.each do |child| <del> apply_tables! @join_root, child <del> end <add> apply_tables! @join_root <ide> end <ide> <ide> def reflections <ide> def merge_outer_joins!(other) <ide> deep_copy left, node <ide> } <ide> end <del> @join_root.children.each do |child| <del> apply_tables! @join_root, child <del> end <add> apply_tables! @join_root <add> end <add> <add> def apply_tables!(node) <add> node.children.each { |child| construct_tables! node, child } <ide> end <ide> <ide> def join_constraints <ide> def make_joins(node) <ide> end <ide> <ide> def construct_tables!(parent, node) <del> return if node.tables <del> <ide> node.tables = node.reflection.chain.map { |reflection| <ide> alias_tracker.aliased_table_for( <ide> reflection.table_name, <ide> table_alias_for(reflection, parent, reflection != node.reflection) <ide> ) <del> } <add> } unless node.tables <add> node.children.each { |child| construct_tables! node, child } <ide> end <ide> <ide> def table_alias_for(reflection, parent, join) <ide> def build_join_association(reflection, parent, join_type) <ide> node <ide> end <ide> <del> def apply_tables!(parent, node) <del> construct_tables!(parent, node) <del> node.children.each { |child| apply_tables! node, child } <del> end <del> <ide> def construct(ar_parent, parent, row, rs, seen, model_cache, aliases) <ide> primary_id = ar_parent.id <ide>
1
Javascript
Javascript
improve the explanation of keys
9093efe062a9d60a35136e444e2130daa6161988
<ide><path>src/ng/directive/ngRepeat.js <ide> * <div ng-repeat="(key, value) in myObj"> ... </div> <ide> * ``` <ide> * <del> * You need to be aware that the JavaScript specification does not define what order <del> * it will return the keys for an object. (To mitigate this in Angular 1.3 the `ngRepeat` directive <add> * You need to be aware that the JavaScript specification does not define the order of keys <add> * returned for an object. (To mitigate this in Angular 1.3 the `ngRepeat` directive <ide> * used to sort the keys alphabetically.) <ide> * <ide> * Version 1.4 removed the alphabetic sorting. We now rely on the order returned by the browser
1
Java
Java
use typereference consistently in hints writer
100ce9642afb14b806e42ae9277f77171a7bc04c
<ide><path>spring-core/src/main/java/org/springframework/aot/nativex/ProxyHintsWriter.java <ide> <ide> import org.springframework.aot.hint.JdkProxyHint; <ide> import org.springframework.aot.hint.ProxyHints; <del>import org.springframework.aot.hint.TypeReference; <ide> <ide> /** <ide> * Write {@link JdkProxyHint}s contained in a {@link ProxyHints} to the JSON <ide> public void write(BasicJsonWriter writer, ProxyHints hints) { <ide> private Map<String, Object> toAttributes(JdkProxyHint hint) { <ide> Map<String, Object> attributes = new LinkedHashMap<>(); <ide> handleCondition(attributes, hint); <del> attributes.put("interfaces", hint.getProxiedInterfaces().stream() <del> .map(TypeReference::getCanonicalName).toList()); <add> attributes.put("interfaces", hint.getProxiedInterfaces()); <ide> return attributes; <ide> } <ide> <ide><path>spring-core/src/main/java/org/springframework/aot/nativex/ReflectionHintsWriter.java <ide> import org.springframework.aot.hint.MemberCategory; <ide> import org.springframework.aot.hint.ReflectionHints; <ide> import org.springframework.aot.hint.TypeHint; <del>import org.springframework.aot.hint.TypeReference; <ide> import org.springframework.lang.Nullable; <ide> <ide> /** <ide> private void handleExecutables(Map<String, Object> attributes, List<ExecutableHi <ide> private Map<String, Object> toAttributes(ExecutableHint hint) { <ide> Map<String, Object> attributes = new LinkedHashMap<>(); <ide> attributes.put("name", hint.getName()); <del> attributes.put("parameterTypes", hint.getParameterTypes().stream().map(TypeReference::getCanonicalName).toList()); <add> attributes.put("parameterTypes", hint.getParameterTypes()); <ide> return attributes; <ide> } <ide> <ide> private void handleCategories(Map<String, Object> attributes, Set<MemberCategory <ide> switch (category) { <ide> case PUBLIC_FIELDS -> attributes.put("allPublicFields", true); <ide> case DECLARED_FIELDS -> attributes.put("allDeclaredFields", true); <del> case INTROSPECT_PUBLIC_CONSTRUCTORS -> attributes.put("queryAllPublicConstructors", true); <del> case INTROSPECT_DECLARED_CONSTRUCTORS -> attributes.put("queryAllDeclaredConstructors", true); <del> case INVOKE_PUBLIC_CONSTRUCTORS -> attributes.put("allPublicConstructors", true); <del> case INVOKE_DECLARED_CONSTRUCTORS -> attributes.put("allDeclaredConstructors", true); <del> case INTROSPECT_PUBLIC_METHODS -> attributes.put("queryAllPublicMethods", true); <del> case INTROSPECT_DECLARED_METHODS -> attributes.put("queryAllDeclaredMethods", true); <add> case INTROSPECT_PUBLIC_CONSTRUCTORS -> <add> attributes.put("queryAllPublicConstructors", true); <add> case INTROSPECT_DECLARED_CONSTRUCTORS -> <add> attributes.put("queryAllDeclaredConstructors", true); <add> case INVOKE_PUBLIC_CONSTRUCTORS -> <add> attributes.put("allPublicConstructors", true); <add> case INVOKE_DECLARED_CONSTRUCTORS -> <add> attributes.put("allDeclaredConstructors", true); <add> case INTROSPECT_PUBLIC_METHODS -> <add> attributes.put("queryAllPublicMethods", true); <add> case INTROSPECT_DECLARED_METHODS -> <add> attributes.put("queryAllDeclaredMethods", true); <ide> case INVOKE_PUBLIC_METHODS -> attributes.put("allPublicMethods", true); <del> case INVOKE_DECLARED_METHODS -> attributes.put("allDeclaredMethods", true); <add> case INVOKE_DECLARED_METHODS -> <add> attributes.put("allDeclaredMethods", true); <ide> case PUBLIC_CLASSES -> attributes.put("allPublicClasses", true); <ide> case DECLARED_CLASSES -> attributes.put("allDeclaredClasses", true); <ide> } <ide><path>spring-core/src/test/java/org/springframework/aot/nativex/ProxyHintsWriterTests.java <ide> void shouldWriteMultipleEntries() throws JSONException { <ide> ]""", hints); <ide> } <ide> <add> @Test <add> void shouldWriteInnerClass() throws JSONException { <add> ProxyHints hints = new ProxyHints(); <add> hints.registerJdkProxy(Inner.class); <add> assertEquals(""" <add> [ <add> { "interfaces": [ "org.springframework.aot.nativex.ProxyHintsWriterTests$Inner" ] } <add> ]""", hints); <add> } <add> <ide> @Test <ide> void shouldWriteCondition() throws JSONException { <ide> ProxyHints hints = new ProxyHints(); <ide> private void assertEquals(String expectedString, ProxyHints hints) throws JSONEx <ide> JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.NON_EXTENSIBLE); <ide> } <ide> <add> interface Inner { <add> <add> } <add> <ide> } <ide><path>spring-core/src/test/java/org/springframework/aot/nativex/ReflectionHintsWriterTests.java <ide> void methods() throws JSONException { <ide> """, hints); <ide> } <ide> <add> @Test <add> void methodWithInnerClassParameter() throws JSONException { <add> ReflectionHints hints = new ReflectionHints(); <add> hints.registerType(Integer.class, builder -> builder.withMethod("test", List.of(TypeReference.of(Inner.class)), <add> b -> b.withMode(ExecutableMode.INVOKE))); <add> <add> assertEquals(""" <add> [ <add> { <add> "name": "java.lang.Integer", <add> "methods": [ <add> { <add> "name": "test", <add> "parameterTypes": ["org.springframework.aot.nativex.ReflectionHintsWriterTests$Inner"] <add> } <add> ] <add> } <add> ] <add> """, hints); <add> } <add> <ide> @Test <ide> void methodAndQueriedMethods() throws JSONException { <ide> ReflectionHints hints = new ReflectionHints(); <ide> private void assertEquals(String expectedString, ReflectionHints hints) throws J <ide> JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.NON_EXTENSIBLE); <ide> } <ide> <add> <add> static class Inner { <add> <add> } <add> <ide> }
4
Java
Java
fix tests and checkstyle violations
52453279622a1b2b27c33cfb8d082516be601bbe
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java <ide> private class IframeHandler implements SockJsRequestHandler { <ide> <!DOCTYPE html> <ide> <html> <ide> <head> <del> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <del> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <del> <script> <del> document.domain = document.domain; <del> _sockjs_onload = function(){SockJS.bootstrap_iframe();}; <del> </script> <del> <script src="%s"></script> <add> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <add> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <add> <script> <add> document.domain = document.domain; <add> _sockjs_onload = function(){SockJS.bootstrap_iframe();}; <add> </script> <add> <script src="%s"></script> <ide> </head> <ide> <body> <del> <h2>Don't panic!</h2> <del> <p>This is a SockJS hidden iframe. It's used for cross domain magic.</p> <add> <h2>Don't panic!</h2> <add> <p>This is a SockJS hidden iframe. It's used for cross domain magic.</p> <ide> </body> <ide> </html>"""; <ide> <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/HtmlFileTransportHandler.java <ide> public class HtmlFileTransportHandler extends AbstractHttpSendingTransportHandle <ide> static { <ide> StringBuilder sb = new StringBuilder( <ide> """ <del> <!doctype html> <add> <!DOCTYPE html> <ide> <html><head> <del> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <del> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <add> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <add> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <ide> </head><body><h2>Don't panic!</h2> <del> <script> <del> document.domain = document.domain; <del> var c = parent.%s; <del> c.start(); <del> function p(d) {c.message(d);}; <del> window.onload = function() {c.stop();}; <del> </script>""" <add> <script> <add> document.domain = document.domain; <add> var c = parent.%s; <add> c.start(); <add> function p(d) {c.message(d);}; <add> window.onload = function() {c.stop();}; <add> </script>""" <ide> ); <ide> <ide> while (sb.length() < MINIMUM_PARTIAL_HTML_CONTENT_LENGTH) { <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java <ide> public void handleIframeRequest() throws IOException { <ide> <ide> assertThat(this.servletResponse.getContentType()).isEqualTo("text/html;charset=UTF-8"); <ide> assertThat(this.servletResponse.getContentAsString().startsWith("<!DOCTYPE html>\n")).isTrue(); <del> assertThat(this.servletResponse.getContentLength()).isEqualTo(490); <add> assertThat(this.servletResponse.getContentLength()).isEqualTo(479); <ide> assertThat(this.response.getHeaders().getCacheControl()).isEqualTo("no-store, no-cache, must-revalidate, max-age=0"); <del> assertThat(this.response.getHeaders().getETag()).isEqualTo("\"0096cbd37f2a5218c33bb0826a7c74cbf\""); <add> assertThat(this.response.getHeaders().getETag()).isEqualTo("\"096aaf2482e2a85effc0ab65a61993ae0\""); <ide> } <ide> <ide> @Test <ide> public void handleIframeRequestNotModified() { <del> this.servletRequest.addHeader("If-None-Match", "\"0096cbd37f2a5218c33bb0826a7c74cbf\""); <add> this.servletRequest.addHeader("If-None-Match", "\"096aaf2482e2a85effc0ab65a61993ae0\""); <ide> resetResponseAndHandleRequest("GET", "/echo/iframe.html", HttpStatus.NOT_MODIFIED); <ide> } <ide> <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/HttpReceivingTransportHandlerTests.java <ide> <ide> package org.springframework.web.socket.sockjs.transport.handler; <ide> <add>import java.nio.charset.StandardCharsets; <add> <ide> import org.junit.jupiter.api.Test; <ide> <ide> import org.springframework.web.socket.AbstractHttpRequestTests; <ide> import org.springframework.web.socket.sockjs.transport.session.StubSockJsServiceConfig; <ide> import org.springframework.web.socket.sockjs.transport.session.TestHttpSockJsSession; <ide> <del>import java.nio.charset.StandardCharsets; <del> <ide> import static org.assertj.core.api.Assertions.assertThat; <ide> import static org.assertj.core.api.Assertions.assertThatExceptionOfType; <ide> import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
4
Java
Java
isolate thrown exception in asserttests
dba48a1ff5eef94504a129902d59788c4dfd0c6b
<ide><path>spring-core/src/test/java/org/springframework/util/AssertTests.java <ide> /* <del> * Copyright 2002-2013 the original author or authors. <add> * Copyright 2002-2015 the original author or authors. <ide> * <ide> * Licensed under the Apache License, Version 2.0 (the "License"); <ide> * you may not use this file except in compliance with the License. <ide> * @author Erwin Vervaet <ide> * @author Rick Evans <ide> * @author Arjen Poutsma <add> * @author Sam Brannen <ide> */ <ide> public class AssertTests { <ide> <ide> @Rule <ide> public ExpectedException thrown = ExpectedException.none(); <ide> <del> @Test(expected = IllegalArgumentException.class) <add> <add> @Test <ide> public void instanceOf() { <del> final Set<?> set = new HashSet<Object>(); <del> Assert.isInstanceOf(HashSet.class, set); <del> Assert.isInstanceOf(HashMap.class, set); <add> Assert.isInstanceOf(HashSet.class, new HashSet<Object>()); <add> } <add> <add> @Test(expected = IllegalArgumentException.class) <add> public void instanceOfWithTypeMismatch() { <add> Assert.isInstanceOf(HashMap.class, new HashSet<Object>()); <ide> } <ide> <ide> @Test
1
PHP
PHP
update docblocks as suggested
44a014a9d8e296bf628793eb33646b36360a7b9e
<ide><path>src/View/Helper/UrlHelper.php <ide> public function build($url = null, $full = false) <ide> } <ide> <ide> /** <del> * Generate URL for given image file. Depending on options passed provides full URL <del> * with domain name. Also calls Helper::assetTimestamp() to add timestamp to local files <add> * Generates URL for given image file. <add> * <add> * Depending on options passed provides full URL with domain name. Also calls <add> * `Helper::assetTimestamp()` to add timestamp to local files. <ide> * <ide> * @param string|array $path Path string or URL array <ide> * @param array $options Options array. Possible keys: <ide> public function imageUrl($path, array $options = []) <ide> } <ide> <ide> /** <del> * Generate URL for given CSS file. Depending on options passed provides full URL <del> * with domain name. Also calls Helper::assetTimestamp() to add timestamp to local files <add> * Generates URL for given CSS file. <add> * <add> * Depending on options passed provides full URL with domain name. Also calls <add> * `Helper::assetTimestamp()` to add timestamp to local files. <ide> * <ide> * @param string|array $path Path string or URL array <ide> * @param array $options Options array. Possible keys: <ide> public function cssUrl($path, array $options = []) <ide> } <ide> <ide> /** <del> * Generate URL for given javascript file. Depending on options passed provides full <del> * URL with domain name. Also calls Helper::assetTimestamp() to add timestamp to local files <add> * Generates URL for given javascript file. <add> * <add> * Depending on options passed provides full URL with domain name. Also calls <add> * `Helper::assetTimestamp()` to add timestamp to local files. <ide> * <ide> * @param string|array $path Path string or URL array <ide> * @param array $options Options array. Possible keys: <ide> public function scriptUrl($path, array $options = []) <ide> } <ide> <ide> /** <del> * Generate URL for given asset file. Depending on options passed provides full URL with domain name. <del> * Also calls Helper::assetTimestamp() to add timestamp to local files <add> * Generates URL for given asset file. <add> * <add> * Depending on options passed provides full URL with domain name. Also calls <add> * `Helper::assetTimestamp()` to add timestamp to local files. <ide> * <ide> * @param string|array $path Path string or URL array <ide> * @param array $options Options array. Possible keys:
1
Python
Python
fix bug in flax seq2seq models
741e49305d31cd76028cfcf82638b1e40183e8b4
<ide><path>src/transformers/models/encoder_decoder/modeling_flax_encoder_decoder.py <ide> <ide> [What are decoder input IDs?](../glossary#decoder-input-ids) <ide> <del> For sequence to sequence training, `decoder_input_ids` should be provided. If no `decoder_input_ids` is <del> provided, the model will create this tensor by shifting the `input_ids` to the right for denoising <del> pre-training. <add> For sequence to sequence training, `decoder_input_ids` should be provided. `decoder_input_ids` should be <add> created outside of the model by shifting the `labels` to the right, replacing -100 by the `pad_token_id` <add> and prepending them with the `decoder_start_token_id`. <ide> decoder_attention_mask (`jnp.ndarray` of shape `(batch_size, target_sequence_length)`, *optional*): <ide> Default behavior: generate a tensor that ignores pad tokens in `decoder_input_ids`. Causal mask will also <ide> be used by default. <ide> If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see <ide> `past_key_values`). <ide> <del> For sequence to sequence training, `decoder_input_ids` should be provided. If no `decoder_input_ids` is <del> provided, the model will create this tensor by shifting the `input_ids` to the right for denoising <del> pre-training. <add> For sequence to sequence training, `decoder_input_ids` should be provided. `decoder_input_ids` should be <add> created outside of the model by shifting the `labels` to the right, replacing -100 by the `pad_token_id` <add> and prepending them with the `decoder_start_token_id`. <ide> encoder_outputs (`tuple(tuple(jnp.ndarray)`): <ide> Tuple consists of (`last_hidden_state`, *optional*: `hidden_states`, *optional*: `attentions`) <ide> `last_hidden_state` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) is a sequence of <ide> def __call__( <ide> batch_size, sequence_length = input_ids.shape <ide> position_ids = jnp.broadcast_to(jnp.arange(sequence_length)[None, :], (batch_size, sequence_length)) <ide> <add> # prepare decoder inputs <add> if decoder_input_ids is None: <add> raise ValueError( <add> "`decoder_input_ids` cannot be `None`. For sequence to sequence training, `decoder_position_ids` must be specified as an input argument." <add> ) <ide> if decoder_attention_mask is None: <ide> decoder_attention_mask = jnp.ones_like(decoder_input_ids) <ide> if decoder_position_ids is None: <ide><path>src/transformers/models/speech_encoder_decoder/modeling_flax_speech_encoder_decoder.py <ide> If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see <ide> `past_key_values`). <ide> <del> For training, `decoder_input_ids` are automatically created by the model by shifting the `labels` to the <del> right, replacing -100 by the `pad_token_id` and prepending them with the `decoder_start_token_id`. <add> For sequence to sequence training, `decoder_input_ids` should be provided. `decoder_input_ids` should be <add> created outside of the model by shifting the `labels` to the right, replacing -100 by the `pad_token_id` <add> and prepending them with the `decoder_start_token_id`. <ide> decoder_attention_mask (`jnp.ndarray` of shape `(batch_size, target_sequence_length)`, *optional*): <ide> Default behavior: generate a tensor that ignores pad tokens in `decoder_input_ids`. Causal mask will also <ide> be used by default. <ide> If `past_key_values` is used, optionally only the last `decoder_input_ids` have to be input (see <ide> `past_key_values`). <ide> <del> For sequence to sequence training, `decoder_input_ids` should be provided. If no `decoder_input_ids` is <del> provided, the model will create this tensor by shifting the `input_ids` to the right for denoising <del> pre-training. <add> For sequence to sequence training, `decoder_input_ids` should be provided. `decoder_input_ids` should be <add> created outside of the model by shifting the `labels` to the right, replacing -100 by the `pad_token_id` <add> and prepending them with the `decoder_start_token_id`. <ide> encoder_outputs (`tuple(tuple(jnp.ndarray)`): <ide> Tuple consists of (`last_hidden_state`, *optional*: `hidden_states`, *optional*: `attentions`) <ide> `last_hidden_state` of shape `(batch_size, sequence_length, hidden_size)`, *optional*) is a sequence of <ide> def __call__( <ide> attention_mask = jnp.ones_like(inputs) <ide> <ide> # prepare decoder inputs <add> if decoder_input_ids is None: <add> raise ValueError( <add> "`decoder_input_ids` cannot be `None`. For sequence to sequence training, `decoder_position_ids` must be specified as an input argument." <add> ) <ide> if decoder_attention_mask is None: <ide> decoder_attention_mask = jnp.ones_like(decoder_input_ids) <ide> if decoder_position_ids is None:
2
Go
Go
avoid extra notification on node leave
3e544bc500fee6ac353361bbb2e2092841f8b65b
<ide><path>libnetwork/networkdb/event_delegate.go <ide> func (e *eventDelegate) NotifyLeave(mn *memberlist.Node) { <ide> // If the node instead left because was going down, then it makes sense to just delete all its state <ide> e.nDB.Lock() <ide> defer e.nDB.Unlock() <del> e.nDB.deleteNetworkEntriesForNode(mn.Name) <add> e.nDB.deleteNodeFromNetworks(mn.Name) <ide> e.nDB.deleteNodeTableEntries(mn.Name) <ide> if n, ok := e.nDB.nodes[mn.Name]; ok { <ide> delete(e.nDB.nodes, mn.Name) <ide><path>libnetwork/networkdb/networkdb.go <ide> func (nDB *NetworkDB) DeleteEntry(tname, nid, key string) error { <ide> return nil <ide> } <ide> <del>func (nDB *NetworkDB) deleteNetworkEntriesForNode(deletedNode string) { <add>func (nDB *NetworkDB) deleteNodeFromNetworks(deletedNode string) { <ide> for nid, nodes := range nDB.networkNodes { <ide> updatedNodes := make([]string, 0, len(nodes)) <ide> for _, node := range nodes { <ide> func (nDB *NetworkDB) deleteNodeTableEntries(node string) { <ide> <ide> nDB.deleteEntry(nid, tname, key) <ide> <del> nDB.broadcaster.Write(makeEvent(opDelete, tname, nid, key, oldEntry.value)) <add> if !oldEntry.deleting { <add> nDB.broadcaster.Write(makeEvent(opDelete, tname, nid, key, oldEntry.value)) <add> } <ide> return false <ide> }) <ide> }
2
Python
Python
add test for new __ne__ method on promise
52d2a8b3119479246225f7f888c370320cf8622f
<ide><path>tests/utils_tests/test_functional.py <ide> def value(self): <ide> <ide> # check that it behaves like a property when there's no instance <ide> self.assertIsInstance(A.value, cached_property) <add> <add> def test_lazy_equality(self): <add> """ <add> Tests that == and != work correctly for Promises. <add> """ <add> <add> lazy_a = lazy(lambda: 4, int) <add> lazy_b = lazy(lambda: 4, int) <add> lazy_c = lazy(lambda: 5, int) <add> <add> self.assertEqual(lazy_a(), lazy_b()) <add> self.assertNotEqual(lazy_b(), lazy_c())
1
Python
Python
add tests for basecontentnegotiation
c2ce2fb3f05da00134d5fc671f017ea3eed3c66f
<ide><path>tests/test_negotiation.py <ide> from django.http import Http404 <ide> from django.test import TestCase <ide> <del>from rest_framework.negotiation import DefaultContentNegotiation <add>from rest_framework.negotiation import ( <add> BaseContentNegotiation, DefaultContentNegotiation <add>) <ide> from rest_framework.renderers import BaseRenderer <ide> from rest_framework.request import Request <ide> from rest_framework.test import APIRequestFactory <ide> class MockRenderer(object): <ide> renderers = [MockRenderer()] <ide> with pytest.raises(Http404): <ide> self.negotiator.filter_renderers(renderers, format='json') <add> <add> <add>class BaseContentNegotiationTests(TestCase): <add> <add> def setUp(self): <add> self.negotiator = BaseContentNegotiation() <add> <add> def test_raise_error_for_abstract_select_parser_method(self): <add> with pytest.raises(NotImplementedError): <add> self.negotiator.select_parser(None, None) <add> <add> def test_raise_error_for_abstract_select_renderer_method(self): <add> with pytest.raises(NotImplementedError): <add> self.negotiator.select_renderer(None, None)
1
Python
Python
fix typos in docstrings
67c428f7e0431b1a8197dcf939936653d0a3a059
<ide><path>keras/callbacks.py <ide> class BackupAndRestore(Callback): <ide> >>> history = model.fit(np.arange(100).reshape(5, 20), np.zeros(5), <ide> ... epochs=10, batch_size=1, callbacks=[callback], <ide> ... verbose=0) <del> >>> # Only 6 more epochs are run, since first trainning got interrupted at <add> >>> # Only 6 more epochs are run, since first training got interrupted at <ide> >>> # zero-indexed epoch 4, second training will continue from 4 to 9. <ide> >>> len(history.history['loss']) <ide> 6 <ide><path>keras/losses.py <ide> def _ragged_tensor_apply_loss(loss_fn, y_true, y_pred, y_pred_extra_dim=False): <ide> """ <ide> <ide> def rt_is_equiv_dense(rt): <del> """Returns true if this RaggedTensor has the same row_lenghts across <add> """Returns true if this RaggedTensor has the same row_lengths across <ide> <ide> all ragged dimensions and thus can be converted to a dense tensor <ide> without loss of information.
2
Ruby
Ruby
remove unnecessary check for pour_bottle?
d1e6f04651ea87654d13c6a786e57581eb22ec15
<ide><path>Library/Homebrew/formula_installer.rb <ide> def summary <ide> end <ide> <ide> def build_time <del> @build_time ||= Time.now - @start_time unless pour_bottle? or ARGV.interactive? or @start_time.nil? <add> @build_time ||= Time.now - @start_time unless ARGV.interactive? or @start_time.nil? <ide> end <ide> <ide> def sanitized_ARGV_options
1
Python
Python
fix it to work with bart
c225e872ed4129a8939bfb9fb567ea0cfba797dd
<ide><path>examples/question-answering/run_squad.py <ide> def train(args, train_dataset, model, tokenizer): <ide> "end_positions": batch[4], <ide> } <ide> <del> if args.model_type in ["xlm", "roberta", "distilbert", "camembert"]: <add> if args.model_type in ["xlm", "roberta", "distilbert", "camembert", "bart"]: <ide> del inputs["token_type_ids"] <ide> <ide> if args.model_type in ["xlnet", "xlm"]: <ide> def evaluate(args, model, tokenizer, prefix=""): <ide> "token_type_ids": batch[2], <ide> } <ide> <del> if args.model_type in ["xlm", "roberta", "distilbert", "camembert"]: <add> if args.model_type in ["xlm", "roberta", "distilbert", "camembert", "bart"]: <ide> del inputs["token_type_ids"] <ide> <ide> feature_indices = batch[3]
1
Ruby
Ruby
add test to make sure pick works in a nullrelation
4c615a53e0409ddddf13d48cbc328a22d0026ed2
<ide><path>activerecord/test/cases/calculations_test.rb <ide> def test_pluck_loaded_relation_sql_fragment <ide> <ide> def test_pick_one <ide> assert_equal "The First Topic", Topic.order(:id).pick(:heading) <add> assert_nil Topic.none.pick(:heading) <ide> assert_nil Topic.where("1=0").pick(:heading) <ide> end <ide> <ide> def test_pick_two <ide> assert_equal ["David", "[email protected]"], Topic.order(:id).pick(:author_name, :author_email_address) <add> assert_nil Topic.none.pick(:author_name, :author_email_address) <ide> assert_nil Topic.where("1=0").pick(:author_name, :author_email_address) <ide> end <ide>
1
Javascript
Javascript
fix wrong spacing for format 6
841fabd4e99214f63f1a0e504e0ac53cec68956c
<ide><path>fonts.js <ide> var Font = (function Font() { <ide> var index = firstCode; <ide> for (var j = start; j <= end; j++) { <ide> var code = j - firstCode - 1; <del> var mapping = encoding[index + 1] || {}; <add> var mapping = encoding[index] || {}; <ide> mapping.unicode = glyphs[code].unicode; <ide> encoding[index++] = mapping; <ide> }
1
Ruby
Ruby
silence all specs by default
2ad3a87045246f89aa267251315d660f663c42f2
<ide><path>Library/Homebrew/test/cask/accessibility_spec.rb <ide> sudo: true, <ide> ) <ide> <del> shutup do <del> installer.enable_accessibility_access <del> end <add> installer.enable_accessibility_access <ide> end <ide> <ide> it "warns about disabling accessibility access on old macOS releases" do <ide> sudo: true, <ide> ) <ide> <del> shutup do <del> installer.enable_accessibility_access <del> end <add> installer.enable_accessibility_access <ide> end <ide> <ide> it "can disable accessibility access" do <ide> sudo: true, <ide> ) <ide> <del> shutup do <del> installer.disable_accessibility_access <del> end <add> installer.disable_accessibility_access <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/cask/artifact/alt_target_spec.rb <ide> expect(source_path).to be_a_directory <ide> expect(target_path).not_to exist <ide> <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> <ide> expect(target_path).to be_a_directory <ide> expect(source_path).not_to exist <ide> appsubdir = cask.staged_path.join("subdir").tap(&:mkpath) <ide> FileUtils.mv(source_path, appsubdir) <ide> <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> <ide> expect(target_path).to be_a_directory <ide> expect(appsubdir.join("Caffeine.app")).not_to exist <ide> staged_app_copy = source_path.sub("Caffeine.app", "Caffeine Deluxe.app") <ide> FileUtils.cp_r source_path, staged_app_copy <ide> <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> <ide> expect(target_path).to be_a_directory <ide> expect(source_path).not_to exist <ide><path>Library/Homebrew/test/cask/artifact/app_spec.rb <ide> <ide> describe "install_phase" do <ide> it "installs the given app using the proper target directory" do <del> shutup do <del> install_phase <del> end <add> install_phase <ide> <ide> expect(target_path).to be_a_directory <ide> expect(source_path).not_to exist <ide> appsubdir = cask.staged_path.join("subdir").tap(&:mkpath) <ide> FileUtils.mv(source_path, appsubdir) <ide> <del> shutup do <del> install_phase <del> end <add> install_phase <ide> <ide> expect(target_path).to be_a_directory <ide> expect(appsubdir.join("Caffeine.app")).not_to exist <ide> staged_app_copy = source_path.sub("Caffeine.app", "Caffeine Deluxe.app") <ide> FileUtils.cp_r source_path, staged_app_copy <ide> <del> shutup do <del> install_phase <del> end <add> install_phase <ide> <ide> expect(target_path).to be_a_directory <ide> expect(source_path).not_to exist <ide> <ide> describe "uninstall_phase" do <ide> it "deletes managed apps" do <del> shutup do <del> install_phase <del> end <add> install_phase <ide> <ide> expect(target_path).to exist <ide> <del> shutup do <del> uninstall_phase <del> end <add> uninstall_phase <ide> <ide> expect(target_path).not_to exist <ide> end <ide> <ide> describe "app is correctly installed" do <ide> it "returns the path to the app" do <del> shutup do <del> install_phase <del> end <add> install_phase <ide> <ide> expect(contents).to eq(["#{target_path} (#{target_path.abv})"]) <ide> end <ide><path>Library/Homebrew/test/cask/artifact/binary_spec.rb <ide> describe Hbc::Artifact::Binary, :cask do <ide> let(:cask) { <ide> Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-binary.rb").tap do |cask| <del> shutup do <del> InstallHelper.install_without_artifacts(cask) <del> end <add> InstallHelper.install_without_artifacts(cask) <ide> end <ide> } <ide> let(:expected_path) { Hbc.binarydir.join("binary") } <ide> } <ide> <ide> it "doesn't link the binary when --no-binaries is specified" do <del> shutup do <del> Hbc::Installer.new(cask, binaries: false).install <del> end <del> <add> Hbc::Installer.new(cask, binaries: false).install <ide> expect(expected_path).not_to exist <ide> end <ide> end <ide> <ide> it "links the binary to the proper directory" do <del> shutup do <del> Hbc::Artifact::Binary.new(cask).install_phase <del> end <add> Hbc::Artifact::Binary.new(cask).install_phase <add> <ide> expect(expected_path).to be_a_symlink <ide> expect(expected_path.readlink).to exist <ide> end <ide> <ide> context "when the binary is not executable" do <ide> let(:cask) { <ide> Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-non-executable-binary.rb").tap do |cask| <del> shutup do <del> InstallHelper.install_without_artifacts(cask) <del> end <add> InstallHelper.install_without_artifacts(cask) <ide> end <ide> } <ide> <ide> expect(FileUtils).to receive(:chmod) <ide> .with("+x", cask.staged_path.join("naked_non_executable")).and_call_original <ide> <del> shutup do <del> Hbc::Artifact::Binary.new(cask).install_phase <del> end <add> Hbc::Artifact::Binary.new(cask).install_phase <ide> <ide> expect(expected_path).to be_a_symlink <ide> expect(expected_path.readlink).to be_executable <ide> FileUtils.touch expected_path <ide> <ide> expect { <del> shutup do <del> Hbc::Artifact::Binary.new(cask).install_phase <del> end <add> Hbc::Artifact::Binary.new(cask).install_phase <ide> }.to raise_error(Hbc::CaskError) <ide> <ide> expect(expected_path).not_to be :symlink? <ide> it "clobbers an existing symlink" do <ide> expected_path.make_symlink("/tmp") <ide> <del> shutup do <del> Hbc::Artifact::Binary.new(cask).install_phase <del> end <add> Hbc::Artifact::Binary.new(cask).install_phase <ide> <ide> expect(File.readlink(expected_path)).not_to eq("/tmp") <ide> end <ide> <ide> it "creates parent directory if it doesn't exist" do <ide> FileUtils.rmdir Hbc.binarydir <ide> <del> shutup do <del> Hbc::Artifact::Binary.new(cask).install_phase <del> end <add> Hbc::Artifact::Binary.new(cask).install_phase <ide> <ide> expect(expected_path.exist?).to be true <ide> end <ide> <ide> context "binary is inside an app package" do <ide> let(:cask) { <ide> Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-embedded-binary.rb").tap do |cask| <del> shutup do <del> InstallHelper.install_without_artifacts(cask) <del> end <add> InstallHelper.install_without_artifacts(cask) <ide> end <ide> } <ide> <ide> it "links the binary to the proper directory" do <del> shutup do <del> Hbc::Artifact::App.new(cask).install_phase <del> Hbc::Artifact::Binary.new(cask).install_phase <del> end <add> Hbc::Artifact::App.new(cask).install_phase <add> Hbc::Artifact::Binary.new(cask).install_phase <ide> <ide> expect(expected_path).to be_a_symlink <ide> expect(expected_path.readlink).to exist <ide><path>Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb <ide> end <ide> <ide> it "moves the artifact to the proper directory" do <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> <ide> expect(target_path).to be_a_directory <ide> expect(source_path).not_to exist <ide> target_path.mkpath <ide> <ide> expect { <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> }.to raise_error(Hbc::CaskError) <ide> <ide> expect(source_path).to be_a_directory <ide><path>Library/Homebrew/test/cask/artifact/nested_container_spec.rb <ide> InstallHelper.install_without_artifacts(c) <ide> end <ide> <del> shutup do <del> Hbc::Artifact::NestedContainer.new(cask).install_phase <del> end <add> Hbc::Artifact::NestedContainer.new(cask).install_phase <ide> <ide> expect(cask.staged_path.join("MyNestedApp.app")).to be_a_directory <ide> end <ide><path>Library/Homebrew/test/cask/artifact/pkg_spec.rb <ide> let(:fake_system_command) { class_double(Hbc::SystemCommand) } <ide> <ide> before(:each) do <del> shutup do <del> InstallHelper.install_without_artifacts(cask) <del> end <add> InstallHelper.install_without_artifacts(cask) <ide> end <ide> <ide> describe "install_phase" do <ide> print_stdout: true, <ide> ) <ide> <del> shutup do <del> pkg.install_phase <del> end <add> pkg.install_phase <ide> end <ide> end <ide> <ide> print_stdout: true, <ide> ) <ide> <del> shutup do <del> pkg.install_phase <del> end <add> pkg.install_phase <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/test/cask/artifact/suite_spec.rb <ide> end <ide> <ide> it "creates a suite containing the expected app" do <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> <ide> expect(target_path.join("Caffeine.app")).to exist <ide> end <ide> target_path.mkpath <ide> <ide> expect { <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> }.to raise_error(Hbc::CaskError) <ide> <ide> expect(source_path).to be_a_directory <ide><path>Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb <ide> end <ide> <ide> it "installs both apps using the proper target directory" do <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> <ide> expect(target_path_mini).to be_a_directory <ide> expect(source_path_mini).not_to exist <ide> let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-subdir.rb") } <ide> <ide> it "installs both apps using the proper target directory" do <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> <ide> expect(target_path_mini).to be_a_directory <ide> expect(source_path_mini).not_to exist <ide> it "only uses apps when they are specified" do <ide> FileUtils.cp_r source_path_mini, source_path_mini.sub("Caffeine Mini.app", "Caffeine Deluxe.app") <ide> <del> shutup do <del> install_phase.call <del> end <add> install_phase.call <ide> <ide> expect(target_path_mini).to be_a_directory <ide> expect(source_path_mini).not_to exist <ide><path>Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb <ide> Hbc::Artifact::Zap.new(cask) <ide> } <ide> <del> before do <del> shutup do <del> InstallHelper.install_without_artifacts(cask) <del> end <add> before(:each) do <add> InstallHelper.install_without_artifacts(cask) <ide> end <ide> <ide> describe "#uninstall_phase" do <ide><path>Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb <ide> let(:artifact) { described_class.new(cask, command: fake_system_command) } <ide> let(:fake_system_command) { Hbc::FakeSystemCommand } <ide> <del> subject do <del> shutup do <del> artifact.public_send(:"#{artifact_name}_phase") <del> end <del> end <add> subject { artifact.public_send(:"#{artifact_name}_phase") } <ide> <ide> context "using :launchctl" do <ide> let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_name}-launchctl.rb") } <ide><path>Library/Homebrew/test/cask/cask_spec.rb <ide> end <ide> <ide> it "returns an instance of the Cask from a url" do <del> c = shutup do <del> Hbc::CaskLoader.load("file://#{tap_path}/Casks/local-caffeine.rb") <del> end <add> c = Hbc::CaskLoader.load("file://#{tap_path}/Casks/local-caffeine.rb") <ide> expect(c).to be_kind_of(Hbc::Cask) <ide> expect(c.token).to eq("local-caffeine") <ide> end <ide> <ide> it "raises an error when failing to download a Cask from a url" do <ide> expect { <ide> url = "file://#{tap_path}/Casks/notacask.rb" <del> shutup do <del> Hbc::CaskLoader.load(url) <del> end <add> <add> Hbc::CaskLoader.load(url) <ide> }.to raise_error(Hbc::CaskUnavailableError) <ide> end <ide> <ide><path>Library/Homebrew/test/cask/cli/fetch_spec.rb <ide> } <ide> <ide> it "allows download the installer of a Cask" do <del> shutup do <del> Hbc::CLI::Fetch.run("local-transmission", "local-caffeine") <del> end <add> Hbc::CLI::Fetch.run("local-transmission", "local-caffeine") <ide> expect(Hbc::CurlDownloadStrategy.new(local_transmission).cached_location).to exist <ide> expect(Hbc::CurlDownloadStrategy.new(local_caffeine).cached_location).to exist <ide> end <ide> <ide> it "prevents double fetch (without nuking existing installation)" do <ide> download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission) <ide> <del> shutup do <del> Hbc::Download.new(local_transmission).perform <del> end <add> Hbc::Download.new(local_transmission).perform <ide> old_ctime = File.stat(download_stategy.cached_location).ctime <ide> <del> shutup do <del> Hbc::CLI::Fetch.run("local-transmission") <del> end <add> Hbc::CLI::Fetch.run("local-transmission") <ide> new_ctime = File.stat(download_stategy.cached_location).ctime <ide> <ide> expect(old_ctime.to_i).to eq(new_ctime.to_i) <ide> end <ide> <ide> it "allows double fetch with --force" do <del> shutup do <del> Hbc::Download.new(local_transmission).perform <del> end <add> Hbc::Download.new(local_transmission).perform <ide> <ide> download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission) <ide> old_ctime = File.stat(download_stategy.cached_location).ctime <ide> sleep(1) <ide> <del> shutup do <del> Hbc::CLI::Fetch.run("local-transmission", "--force") <del> end <add> Hbc::CLI::Fetch.run("local-transmission", "--force") <ide> download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission) <ide> new_ctime = File.stat(download_stategy.cached_location).ctime <ide> <ide> <ide> it "properly handles Casks that are not present" do <ide> expect { <del> shutup do <del> Hbc::CLI::Fetch.run("notacask") <del> end <add> Hbc::CLI::Fetch.run("notacask") <ide> }.to raise_error(Hbc::CaskError, "Fetch incomplete.") <ide> end <ide> <ide><path>Library/Homebrew/test/cask/cli/install_spec.rb <ide> end <ide> <ide> it "allows staging and activation of multiple Casks at once" do <del> shutup do <del> Hbc::CLI::Install.run("local-transmission", "local-caffeine") <del> end <add> Hbc::CLI::Install.run("local-transmission", "local-caffeine") <ide> <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed <ide> expect(Hbc.appdir.join("Transmission.app")).to be_a_directory <ide> end <ide> <ide> it "skips double install (without nuking existing installation)" do <del> shutup do <del> Hbc::CLI::Install.run("local-transmission") <del> end <del> shutup do <del> Hbc::CLI::Install.run("local-transmission") <del> end <add> Hbc::CLI::Install.run("local-transmission") <add> Hbc::CLI::Install.run("local-transmission") <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed <ide> end <ide> <ide> it "prints a warning message on double install" do <del> shutup do <del> Hbc::CLI::Install.run("local-transmission") <del> end <add> Hbc::CLI::Install.run("local-transmission") <ide> <ide> expect { <ide> Hbc::CLI::Install.run("local-transmission") <ide> }.to output(/Warning: Cask 'local-transmission' is already installed./).to_stderr <ide> end <ide> <ide> it "allows double install with --force" do <del> shutup do <del> Hbc::CLI::Install.run("local-transmission") <del> end <add> Hbc::CLI::Install.run("local-transmission") <ide> <ide> expect { <ide> expect { <ide> end <ide> <ide> it "skips dependencies with --skip-cask-deps" do <del> shutup do <del> Hbc::CLI::Install.run("with-depends-on-cask-multiple", "--skip-cask-deps") <del> end <add> Hbc::CLI::Install.run("with-depends-on-cask-multiple", "--skip-cask-deps") <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb")).to be_installed <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")).not_to be_installed <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).not_to be_installed <ide> end <ide> <ide> it "properly handles Casks that are not present" do <ide> expect { <del> shutup do <del> Hbc::CLI::Install.run("notacask") <del> end <add> Hbc::CLI::Install.run("notacask") <ide> }.to raise_error(Hbc::CaskError, "Install incomplete.") <ide> end <ide> <ide><path>Library/Homebrew/test/cask/cli/list_spec.rb <ide> it "lists the installed files for those Casks" do <ide> casks.each(&InstallHelper.method(:install_without_artifacts_with_caskfile)) <ide> <del> shutup do <del> Hbc::Artifact::App.new(transmission).install_phase <del> end <add> Hbc::Artifact::App.new(transmission).install_phase <ide> <ide> expect { <ide> Hbc::CLI::List.run("local-transmission", "local-caffeine") <ide><path>Library/Homebrew/test/cask/cli/outdated_spec.rb <ide> end <ide> <ide> before do <del> shutup do <del> installed.each { |cask| InstallHelper.install_with_caskfile(cask) } <del> end <add> installed.each { |cask| InstallHelper.install_with_caskfile(cask) } <add> <ide> allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) <ide> end <ide> <ide><path>Library/Homebrew/test/cask/cli/reinstall_spec.rb <ide> it "displays the reinstallation progress" do <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> <del> shutup do <del> Hbc::Installer.new(caffeine).install <del> end <add> Hbc::Installer.new(caffeine).install <ide> <ide> output = Regexp.new <<-EOS.undent <ide> ==> Downloading file:.*caffeine.zip <ide> end <ide> <ide> it "allows reinstalling a Cask" do <del> shutup do <del> Hbc::CLI::Install.run("local-transmission") <del> end <add> Hbc::CLI::Install.run("local-transmission") <add> <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed <ide> <del> shutup do <del> Hbc::CLI::Reinstall.run("local-transmission") <del> end <add> Hbc::CLI::Reinstall.run("local-transmission") <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed <ide> end <ide> <ide> it "allows reinstalling a non installed Cask" do <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).not_to be_installed <ide> <del> shutup do <del> Hbc::CLI::Reinstall.run("local-transmission") <del> end <add> Hbc::CLI::Reinstall.run("local-transmission") <ide> expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed <ide> end <ide> end <ide><path>Library/Homebrew/test/cask/cli/search_spec.rb <ide> end <ide> <ide> it "highlights installed packages" do <del> shutup do <del> Hbc::CLI::Install.run("local-caffeine") <del> end <add> Hbc::CLI::Install.run("local-caffeine") <ide> <ide> expect(Hbc::CLI::Search.highlight_installed("local-caffeine")).to eq(pretty_installed("local-caffeine")) <ide> end <ide><path>Library/Homebrew/test/cask/cli/style_spec.rb <ide> let(:args) { [] } <ide> let(:cli) { described_class.new(*args) } <ide> <del> around do |example| <del> shutup { example.run } <del> end <add> around(&:run) <ide> <ide> describe "#run" do <ide> subject { cli.run } <ide><path>Library/Homebrew/test/cask/cli/uninstall_spec.rb <ide> it "displays the uninstallation progress" do <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> <del> shutup do <del> Hbc::Installer.new(caffeine).install <del> end <add> Hbc::Installer.new(caffeine).install <ide> <ide> output = Regexp.new <<-EOS.undent <ide> ==> Uninstalling Cask local-caffeine <ide> <ide> it "tries anyway on a non-present Cask when --force is given" do <ide> expect { <del> shutup do <del> Hbc::CLI::Uninstall.run("local-caffeine", "--force") <del> end <add> Hbc::CLI::Uninstall.run("local-caffeine", "--force") <ide> }.not_to raise_error <ide> end <ide> <ide> it "can uninstall and unlink multiple Casks at once" do <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") <ide> <del> shutup do <del> Hbc::Installer.new(caffeine).install <del> Hbc::Installer.new(transmission).install <del> end <add> Hbc::Installer.new(caffeine).install <add> Hbc::Installer.new(transmission).install <ide> <ide> expect(caffeine).to be_installed <ide> expect(transmission).to be_installed <ide> <del> shutup do <del> Hbc::CLI::Uninstall.run("local-caffeine", "local-transmission") <del> end <add> Hbc::CLI::Uninstall.run("local-caffeine", "local-transmission") <ide> <ide> expect(caffeine).not_to be_installed <ide> expect(Hbc.appdir.join("Transmission.app")).not_to exist <ide> it "calls `uninstall` before removing artifacts" do <ide> cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script-app.rb") <ide> <del> shutup do <del> Hbc::Installer.new(cask).install <del> end <add> Hbc::Installer.new(cask).install <ide> <ide> expect(cask).to be_installed <ide> expect(Hbc.appdir.join("MyFancyApp.app")).to exist <ide> <ide> expect { <del> shutup do <del> Hbc::CLI::Uninstall.run("with-uninstall-script-app") <del> end <add> Hbc::CLI::Uninstall.run("with-uninstall-script-app") <ide> }.not_to raise_error <ide> <ide> expect(cask).not_to be_installed <ide> it "can uninstall Casks when the uninstall script is missing, but only when using `--force`" do <ide> cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script-app.rb") <ide> <del> shutup do <del> Hbc::Installer.new(cask).install <del> end <add> Hbc::Installer.new(cask).install <ide> <ide> expect(cask).to be_installed <ide> <ide> Hbc.appdir.join("MyFancyApp.app").rmtree <ide> <del> expect { shutup { Hbc::CLI::Uninstall.run("with-uninstall-script-app") } } <add> expect { Hbc::CLI::Uninstall.run("with-uninstall-script-app") } <ide> .to output(/does not exist/).to_stderr <ide> .and raise_error(Hbc::CaskError, "Uninstall incomplete.") <ide> <ide> expect(cask).to be_installed <ide> <ide> expect { <del> shutup do <del> Hbc::CLI::Uninstall.run("with-uninstall-script-app", "--force") <del> end <add> Hbc::CLI::Uninstall.run("with-uninstall-script-app", "--force") <ide> }.not_to raise_error <ide> <ide> expect(cask).not_to be_installed <ide> end <ide> <ide> it "uninstalls one version at a time" do <del> shutup do <del> Hbc::CLI::Uninstall.run("versioned-cask") <del> end <add> Hbc::CLI::Uninstall.run("versioned-cask") <ide> <ide> expect(caskroom_path.join(first_installed_version)).to exist <ide> expect(caskroom_path.join(last_installed_version)).not_to exist <ide> expect(caskroom_path).to exist <ide> <del> shutup do <del> Hbc::CLI::Uninstall.run("versioned-cask") <del> end <add> Hbc::CLI::Uninstall.run("versioned-cask") <ide> <ide> expect(caskroom_path.join(first_installed_version)).not_to exist <ide> expect(caskroom_path).not_to exist <ide> end <ide> <ide> it "can still uninstall those Casks" do <del> shutup do <del> Hbc::CLI::Uninstall.run("ive-been-renamed") <del> end <add> Hbc::CLI::Uninstall.run("ive-been-renamed") <ide> <ide> expect(app).not_to exist <ide> expect(caskroom_path).not_to exist <ide><path>Library/Homebrew/test/cask/cli/zap_spec.rb <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") <ide> <del> shutup do <del> Hbc::Installer.new(caffeine).install <del> Hbc::Installer.new(transmission).install <del> end <add> Hbc::Installer.new(caffeine).install <add> Hbc::Installer.new(transmission).install <ide> <ide> expect(caffeine).to be_installed <ide> expect(transmission).to be_installed <ide> <del> shutup do <del> Hbc::CLI::Zap.run("local-caffeine", "local-transmission") <del> end <add> Hbc::CLI::Zap.run("local-caffeine", "local-transmission") <ide> <ide> expect(caffeine).not_to be_installed <ide> expect(Hbc.appdir.join("Caffeine.app")).not_to be_a_symlink <ide> # it "dispatches both uninstall and zap stanzas" do <ide> # with_zap = Hbc::CaskLoader.load('with-zap') <ide> # <del> # shutup do <del> # Hbc::Installer.new(with_zap).install <del> # end <add> # Hbc::Installer.new(with_zap).install <ide> # <ide> # with_zap.must_be :installed? <ide> # <ide> # Hbc::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/rm', '-rf', '--', <ide> # Pathname.new('~/Library/Preferences/my.fancy.app.plist').expand_path]) <ide> # <del> # shutup do <del> # Hbc::CLI::Zap.run('with-zap') <del> # end <add> # Hbc::CLI::Zap.run('with-zap') <add> # <ide> # with_zap.wont_be :installed? <ide> # end <ide> <ide><path>Library/Homebrew/test/cask/cli_spec.rb <ide> cli = described_class.new("--language=en") <ide> expect(cli).to receive(:detect_command_and_arguments).with(no_args) <ide> expect(cli).to receive(:exit).with(1) <del> shutup { cli.run } <add> cli.run <ide> end <ide> <ide> context "when no option is specified" do <ide> allow(noop_command).to receive(:run) <ide> end <ide> <del> around do |example| <del> shutup { example.run } <del> end <del> <ide> it "passes `--version` along to the subcommand" do <ide> version_command = double("CLI::Version") <ide> allow(described_class).to receive(:lookup_command).with("--version").and_return(version_command) <ide><path>Library/Homebrew/test/cask/container/naked_spec.rb <ide> container = Hbc::Container::Naked.new(cask, path, Hbc::FakeSystemCommand) <ide> <ide> expect { <del> shutup do <del> container.extract <del> end <add> container.extract <ide> }.not_to raise_error <ide> <ide> expect(Hbc::FakeSystemCommand.system_calls[expected_command]).to eq(1) <ide><path>Library/Homebrew/test/cask/depends_on_spec.rb <ide> describe "Satisfy Dependencies and Requirements", :cask do <ide> subject { <ide> lambda do <del> shutup do <del> Hbc::Installer.new(cask).install <del> end <add> Hbc::Installer.new(cask).install <ide> end <ide> } <ide> <ide><path>Library/Homebrew/test/cask/download_strategy_spec.rb <ide> it "calls curl with default arguments for a simple Cask" do <ide> allow(downloader).to receive(:curl) <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(downloader).to have_received(:curl).with( <ide> cask.url.to_s, <ide> curl_args = [] <ide> allow(downloader).to receive(:curl) { |*args| curl_args = args } <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(curl_args.each_cons(2)).to include(["-A", "Mozilla/25.0.1"]) <ide> end <ide> curl_args = [] <ide> allow(downloader).to receive(:curl) { |*args| curl_args = args } <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(curl_args.each_cons(2)).to include(["-A", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10) https://caskroom.github.io"]) <ide> end <ide> curl_args = [] <ide> allow(downloader).to receive(:curl) { |*args| curl_args = args } <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(curl_args.each_cons(2)).to include(["-b", "coo=kie;mon=ster"]) <ide> end <ide> curl_args = [] <ide> allow(downloader).to receive(:curl) { |*args| curl_args = args } <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(curl_args.each_cons(2)).to include(["-e", "http://somehost/also"]) <ide> end <ide> curl_args = [] <ide> allow(downloader).to receive(:curl) { |*args| curl_args = args } <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(curl_args.each_cons(2)).to include(["-d", "form=data"]) <ide> expect(curl_args.each_cons(2)).to include(["-d", "is=good"]) <ide> curl_args = [] <ide> allow(downloader).to receive(:curl) { |*args| curl_args = args } <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(curl_args.each_cons(2)).to include(["-X", "POST"]) <ide> end <ide> allow(downloader).to receive(:compress) <ide> allow(downloader).to receive(:fetch_repo) <ide> <del> retval = shutup { downloader.fetch } <del> <del> expect(retval).to equal(downloader.tarball_path) <add> expect(downloader.fetch).to equal(downloader.tarball_path) <ide> end <ide> <ide> it "calls fetch_repo with default arguments for a simple Cask" do <ide> allow(downloader).to receive(:compress) <ide> allow(downloader).to receive(:fetch_repo) <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(downloader).to have_received(:fetch_repo).with( <ide> downloader.cached_location, <ide> it "calls svn with default arguments for a simple Cask" do <ide> allow(downloader).to receive(:compress) <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(fake_system_command).to have_received(:run!).with( <ide> "/usr/bin/svn", <ide> it "adds svn arguments for :trust_cert" do <ide> allow(downloader).to receive(:compress) <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(fake_system_command).to have_received(:run!).with( <ide> "/usr/bin/svn", <ide> it "adds svn arguments for :revision" do <ide> allow(downloader).to receive(:compress) <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(fake_system_command).to have_received(:run!).with( <ide> "/usr/bin/svn", <ide> downloader.cached_location.mkdir <ide> } <ide> <del> shutup do <del> downloader.fetch <del> end <add> downloader.fetch <ide> <ide> expect(fake_system_command).to have_received(:run!).with( <ide> "/usr/bin/tar", <ide> # FileUtils.touch(target.join('empty_file.txt')) <ide> # File.utime(1000,1000,target.join('empty_file.txt')) <ide> # end <del> # expect(shutup { downloader.fetch }).to equal(downloader.tarball_path) <add> # expect(downloader.fetch).to equal(downloader.tarball_path) <ide> # d = Hbc::Download.new(cask) <ide> # d.send(:_check_sums, downloader.tarball_path, cask.sums) <ide> # end <ide><path>Library/Homebrew/test/cask/dsl_spec.rb <ide> <ide> it "will simply warn, not throw an exception" do <ide> expect { <del> shutup do <del> attempt_unknown_method.call <del> end <add> attempt_unknown_method.call <ide> }.not_to raise_error <ide> end <ide> end <ide> it "may use deprecated DSL version hash syntax" do <ide> allow(ENV).to receive(:[]).with("HOMEBREW_DEVELOPER").and_return(nil) <ide> <del> shutup do <del> expect(cask.token).to eq("with-dsl-version") <del> expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg") <del> expect(cask.homepage).to eq("http://example.com/") <del> expect(cask.version.to_s).to eq("1.2.3") <del> end <add> expect(cask.token).to eq("with-dsl-version") <add> expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg") <add> expect(cask.homepage).to eq("http://example.com/") <add> expect(cask.version.to_s).to eq("1.2.3") <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/test/cask/installer_spec.rb <ide> it "downloads and installs a nice fresh Cask" do <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> <del> shutup do <del> Hbc::Installer.new(caffeine).install <del> end <add> Hbc::Installer.new(caffeine).install <ide> <ide> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).to be_a_directory <ide> expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory <ide> it "works with dmg-based Casks" do <ide> asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-dmg.rb") <ide> <del> shutup do <del> Hbc::Installer.new(asset).install <del> end <add> Hbc::Installer.new(asset).install <ide> <ide> expect(Hbc.caskroom.join("container-dmg", asset.version)).to be_a_directory <ide> expect(Hbc.appdir.join("container")).to be_a_file <ide> it "works with tar-gz-based Casks" do <ide> asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-tar-gz.rb") <ide> <del> shutup do <del> Hbc::Installer.new(asset).install <del> end <add> Hbc::Installer.new(asset).install <ide> <ide> expect(Hbc.caskroom.join("container-tar-gz", asset.version)).to be_a_directory <ide> expect(Hbc.appdir.join("container")).to be_a_file <ide> it "works with xar-based Casks" do <ide> asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xar.rb") <ide> <del> shutup do <del> Hbc::Installer.new(asset).install <del> end <add> Hbc::Installer.new(asset).install <ide> <ide> expect(Hbc.caskroom.join("container-xar", asset.version)).to be_a_directory <ide> expect(Hbc.appdir.join("container")).to be_a_file <ide> it "works with pure bzip2-based Casks" do <ide> asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-bzip2.rb") <ide> <del> shutup do <del> Hbc::Installer.new(asset).install <del> end <add> Hbc::Installer.new(asset).install <ide> <ide> expect(Hbc.caskroom.join("container-bzip2", asset.version)).to be_a_directory <ide> expect(Hbc.appdir.join("container-bzip2--#{asset.version}")).to be_a_file <ide> it "works with pure gzip-based Casks" do <ide> asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-gzip.rb") <ide> <del> shutup do <del> Hbc::Installer.new(asset).install <del> end <add> Hbc::Installer.new(asset).install <ide> <ide> expect(Hbc.caskroom.join("container-gzip", asset.version)).to be_a_directory <ide> expect(Hbc.appdir.join("container")).to be_a_file <ide> it "blows up on a bad checksum" do <ide> bad_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/bad-checksum.rb") <ide> expect { <del> shutup do <del> Hbc::Installer.new(bad_checksum).install <del> end <add> Hbc::Installer.new(bad_checksum).install <ide> }.to raise_error(Hbc::CaskSha256MismatchError) <ide> end <ide> <ide> it "blows up on a missing checksum" do <ide> missing_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/missing-checksum.rb") <ide> expect { <del> shutup do <del> Hbc::Installer.new(missing_checksum).install <del> end <add> Hbc::Installer.new(missing_checksum).install <ide> }.to raise_error(Hbc::CaskSha256MissingError) <ide> end <ide> <ide> it "installs fine if sha256 :no_check is used" do <ide> no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb") <ide> <del> shutup do <del> Hbc::Installer.new(no_checksum).install <del> end <add> Hbc::Installer.new(no_checksum).install <ide> <ide> expect(no_checksum).to be_installed <ide> end <ide> <ide> it "fails to install if sha256 :no_check is used with --require-sha" do <ide> no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb") <ide> expect { <del> shutup do <del> Hbc::Installer.new(no_checksum, require_sha: true).install <del> end <add> Hbc::Installer.new(no_checksum, require_sha: true).install <ide> }.to raise_error(Hbc::CaskNoShasumError) <ide> end <ide> <ide> it "installs fine if sha256 :no_check is used with --require-sha and --force" do <ide> no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb") <ide> <del> shutup do <del> Hbc::Installer.new(no_checksum, require_sha: true, force: true).install <del> end <add> Hbc::Installer.new(no_checksum, require_sha: true, force: true).install <ide> <ide> expect(no_checksum).to be_installed <ide> end <ide> it "does not extract __MACOSX directories from zips" do <ide> with_macosx_dir = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-macosx-dir.rb") <ide> <del> shutup do <del> Hbc::Installer.new(with_macosx_dir).install <del> end <add> Hbc::Installer.new(with_macosx_dir).install <ide> <ide> expect(with_macosx_dir.staged_path.join("__MACOSX")).not_to be_a_directory <ide> end <ide> <ide> expect(with_auto_updates).not_to be_installed <ide> <del> shutup do <del> Hbc::Installer.new(with_auto_updates).install <del> end <add> Hbc::Installer.new(with_auto_updates).install <ide> <ide> expect { <del> shutup do <del> Hbc::Installer.new(with_auto_updates, force: true).install <del> end <add> Hbc::Installer.new(with_auto_updates, force: true).install <ide> }.not_to raise_error <ide> end <ide> <ide> <ide> installer = Hbc::Installer.new(transmission) <ide> <del> shutup do <del> installer.install <del> end <add> installer.install <ide> <ide> expect { <ide> installer.install <ide> <ide> expect(transmission).not_to be_installed <ide> <del> shutup do <del> Hbc::Installer.new(transmission).install <del> end <add> Hbc::Installer.new(transmission).install <ide> <del> shutup do <add> expect { <ide> Hbc::Installer.new(transmission, force: true).install <del> end # wont_raise <add> }.not_to raise_error <ide> end <ide> <ide> it "works naked-pkg-based Casks" do <ide> naked_pkg = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-pkg.rb") <ide> <del> shutup do <del> Hbc::Installer.new(naked_pkg).install <del> end <add> Hbc::Installer.new(naked_pkg).install <ide> <ide> expect(Hbc.caskroom.join("container-pkg", naked_pkg.version, "container.pkg")).to be_a_file <ide> end <ide> <ide> it "works properly with an overridden container :type" do <ide> naked_executable = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/naked-executable.rb") <ide> <del> shutup do <del> Hbc::Installer.new(naked_executable).install <del> end <add> Hbc::Installer.new(naked_executable).install <ide> <ide> expect(Hbc.caskroom.join("naked-executable", naked_executable.version, "naked_executable")).to be_a_file <ide> end <ide> <ide> it "works fine with a nested container" do <ide> nested_app = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb") <ide> <del> shutup do <del> Hbc::Installer.new(nested_app).install <del> end <add> Hbc::Installer.new(nested_app).install <ide> <ide> expect(Hbc.appdir.join("MyNestedApp.app")).to be_a_directory <ide> end <ide> <ide> it "generates and finds a timestamped metadata directory for an installed Cask" do <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> <del> shutup do <del> Hbc::Installer.new(caffeine).install <del> end <add> Hbc::Installer.new(caffeine).install <ide> <ide> m_path = caffeine.metadata_timestamped_path(timestamp: :now, create: true) <ide> expect(caffeine.metadata_timestamped_path(timestamp: :latest)).to eq(m_path) <ide> it "generates and finds a metadata subdirectory for an installed Cask" do <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> <del> shutup do <del> Hbc::Installer.new(caffeine).install <del> end <add> Hbc::Installer.new(caffeine).install <ide> <ide> subdir_name = "Casks" <ide> m_subdir = caffeine.metadata_subdir(subdir_name, timestamp: :now, create: true) <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> installer = Hbc::Installer.new(caffeine) <ide> <del> shutup do <del> installer.install <del> installer.uninstall <del> end <add> installer.install <add> installer.uninstall <ide> <ide> expect(Hbc.caskroom.join("local-caffeine", caffeine.version, "Caffeine.app")).not_to be_a_directory <ide> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory <ide> caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") <ide> mutated_version = caffeine.version + ".1" <ide> <del> shutup do <del> Hbc::Installer.new(caffeine).install <del> end <add> Hbc::Installer.new(caffeine).install <ide> <ide> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).to be_a_directory <ide> expect(Hbc.caskroom.join("local-caffeine", mutated_version)).not_to be_a_directory <ide> FileUtils.mv(Hbc.caskroom.join("local-caffeine", caffeine.version), Hbc.caskroom.join("local-caffeine", mutated_version)) <ide> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory <ide> expect(Hbc.caskroom.join("local-caffeine", mutated_version)).to be_a_directory <ide> <del> shutup do <del> Hbc::Installer.new(caffeine, force: true).uninstall <del> end <add> Hbc::Installer.new(caffeine, force: true).uninstall <ide> <ide> expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory <ide> expect(Hbc.caskroom.join("local-caffeine", mutated_version)).not_to be_a_directory <ide><path>Library/Homebrew/test/cask/pkg_spec.rb <ide> allow(pkg).to receive(:root).and_return(fake_root) <ide> allow(pkg).to receive(:forget) <ide> <del> shutup do <del> pkg.uninstall <del> end <add> pkg.uninstall <ide> <ide> expect(fake_dir).to be_a_directory <ide> expect(fake_file).not_to be_a_file <ide><path>Library/Homebrew/test/cask/staged_spec.rb <ide> let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") } <ide> let(:installer) { Hbc::Installer.new(cask) } <ide> it "fetches the bundle ID from a staged cask" do <del> shutup do <del> installer.install <del> end <del> <add> installer.install <ide> expect(installer.bundle_identifier).to eq("org.m0k.transmission") <ide> end <ide> end <ide><path>Library/Homebrew/test/cask/system_command_spec.rb <ide> <ide> shared_examples "it returns '1 2 3 4 5 6'" do <ide> describe "its result" do <del> subject { shutup { described_class.run(command, options) } } <add> subject { described_class.run(command, options) } <ide> <ide> it { is_expected.to be_a_success } <ide> its(:stdout) { is_expected.to eq([1, 3, 5, nil].join("\n")) } <ide> <ide> it "returns without deadlocking" do <ide> wait(15).for { <del> shutup { described_class.run(command, options) } <add> described_class.run(command, options) <ide> }.to be_a_success <ide> end <ide> end <ide><path>Library/Homebrew/test/cask/verify/checksum_spec.rb <ide> allow(cask).to receive(:sha256).and_return(sha256) <ide> end <ide> <del> around do |example| <del> shutup { example.run } <del> end <del> <ide> describe ".me?" do <ide> subject { described_class.me?(cask) } <ide> <ide><path>Library/Homebrew/test/checksum_verification_spec.rb <ide> def formula(&block) <ide> describe "#brew" do <ide> it "does not raise an error when the checksum matches" do <ide> expect { <del> shutup do <del> f = formula do <del> sha256 TESTBALL_SHA256 <del> end <del> <del> f.brew {} <add> f = formula do <add> sha256 TESTBALL_SHA256 <ide> end <add> <add> f.brew {} <ide> }.not_to raise_error <ide> end <ide> <ide> it "raises an error when the checksum doesn't match" do <ide> expect { <del> shutup do <del> f = formula do <del> sha256 "dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8" <del> end <del> <del> f.brew {} <add> f = formula do <add> sha256 "dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8" <ide> end <add> <add> f.brew {} <ide> }.to raise_error(ChecksumMismatchError) <ide> end <ide> end <ide><path>Library/Homebrew/test/cleanup_spec.rb <ide> <ide> describe "::cleanup" do <ide> it "removes .DS_Store files" do <del> shutup do <del> described_class.cleanup <del> end <add> described_class.cleanup <ide> <ide> expect(ds_store).not_to exist <ide> end <ide> <ide> it "doesn't remove anything if `--dry-run` is specified" do <ide> ARGV << "--dry-run" <ide> <del> shutup do <del> described_class.cleanup <del> end <add> described_class.cleanup <ide> <ide> expect(ds_store).to exist <ide> end <ide> <ide> before(:each) do <ide> described_class.instance_variable_set(:@unremovable_kegs, []) <del> shutup do <del> [f1, f2].each do |f| <del> f.brew do <del> f.install <del> end <del> <del> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write <add> [f1, f2].each do |f| <add> f.brew do <add> f.install <ide> end <add> <add> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write <ide> end <ide> <ide> allow_any_instance_of(Keg) <ide> end <ide> <ide> it "doesn't remove any kegs" do <del> shutup { described_class.cleanup_formula f2 } <add> described_class.cleanup_formula f2 <ide> expect(f1.installed_kegs.size).to eq(2) <ide> end <ide> <ide> it "lists the unremovable kegs" do <del> shutup { described_class.cleanup_formula f2 } <add> described_class.cleanup_formula f2 <ide> expect(described_class.unremovable_kegs).to contain_exactly(f1.installed_kegs[0]) <ide> end <ide> end <ide> version_scheme 2 <ide> end.new <ide> <del> shutup do <del> [f1, f2, f3, f4].each do |f| <del> f.brew do <del> f.install <del> end <del> <del> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write <add> [f1, f2, f3, f4].each do |f| <add> f.brew do <add> f.install <ide> end <add> <add> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write <ide> end <ide> <ide> expect(f1).to be_installed <ide> expect(f2).to be_installed <ide> expect(f3).to be_installed <ide> expect(f4).to be_installed <ide> <del> shutup do <del> described_class.cleanup_formula f3 <del> end <add> described_class.cleanup_formula f3 <ide> <ide> expect(f1).not_to be_installed <ide> expect(f2).not_to be_installed <ide> path.mkpath <ide> ARGV << "--prune=all" <ide> <del> shutup do <del> described_class.cleanup_logs <del> end <add> described_class.cleanup_logs <ide> <ide> expect(path).not_to exist <ide> end <ide> incomplete = (HOMEBREW_CACHE/"something.incomplete") <ide> incomplete.mkpath <ide> <del> shutup do <del> described_class.cleanup_cache <del> end <add> described_class.cleanup_cache <ide> <ide> expect(incomplete).not_to exist <ide> end <ide> java_cache = (HOMEBREW_CACHE/"java_cache") <ide> java_cache.mkpath <ide> <del> shutup do <del> described_class.cleanup_cache <del> end <add> described_class.cleanup_cache <ide> <ide> expect(java_cache).not_to exist <ide> end <ide> npm_cache = (HOMEBREW_CACHE/"npm_cache") <ide> npm_cache.mkpath <ide> <del> shutup do <del> described_class.cleanup_cache <del> end <add> described_class.cleanup_cache <ide> <ide> expect(npm_cache).not_to exist <ide> end <ide><path>Library/Homebrew/test/cmd/analytics_spec.rb <ide> describe "brew analytics", :integration_test do <ide> before(:each) do <ide> HOMEBREW_REPOSITORY.cd do <del> shutup do <del> system "git", "init" <del> end <add> system "git", "init" <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/cmd/bundle_spec.rb <ide> setup_remote_tap "homebrew/bundle" <ide> <ide> HOMEBREW_REPOSITORY.cd do <del> shutup do <del> system "git", "init" <del> system "git", "commit", "--allow-empty", "-m", "This is a test commit" <del> end <add> system "git", "init" <add> system "git", "commit", "--allow-empty", "-m", "This is a test commit" <ide> end <ide> <ide> mktmpdir do |path| <ide><path>Library/Homebrew/test/cmd/cask_spec.rb <ide> describe "list" do <ide> it "returns a list of installed Casks" do <ide> setup_remote_tap("caskroom/cask") <del> shutup do <del> expect { brew "cask", "list" }.to be_a_success <del> end <add> <add> expect { brew "cask", "list" }.to be_a_success <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/test/cmd/desc_spec.rb <ide> it "creates a description cache" do <ide> expect(desc_cache).not_to exist <ide> <del> shutup do <del> expect { brew "desc", "--description", "testball" }.to be_a_success <del> end <add> expect { brew "desc", "--description", "testball" }.to be_a_success <ide> <ide> expect(desc_cache).to exist <ide> end <ide><path>Library/Homebrew/test/cmd/fetch_spec.rb <ide> <ide> expect(HOMEBREW_CACHE/"testball-0.1.tbz").not_to exist <ide> <del> shutup do <del> expect { brew "fetch", "testball" }.to be_a_success <del> end <add> expect { brew "fetch", "testball" }.to be_a_success <ide> <ide> expect(HOMEBREW_CACHE/"testball-0.1.tbz").to exist <ide> end <ide><path>Library/Homebrew/test/cmd/install_spec.rb <ide> .and not_to_output.to_stderr <ide> .and be_a_success <ide> <del> shutup do <del> expect { brew "switch", "testball1", "3.0" }.to be_a_success <del> end <add> expect { brew "switch", "testball1", "3.0" }.to be_a_success <ide> <ide> expect { brew "install", "testball1" } <ide> .to output(/2.0 is already installed/).to_stderr <ide> repo_path.join("bin").mkpath <ide> <ide> repo_path.cd do <del> shutup do <del> system "git", "init" <del> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" <del> FileUtils.touch "bin/something.bin" <del> FileUtils.touch "README" <del> system "git", "add", "--all" <del> system "git", "commit", "-m", "Initial repo commit" <del> end <add> system "git", "init" <add> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" <add> FileUtils.touch "bin/something.bin" <add> FileUtils.touch "README" <add> system "git", "add", "--all" <add> system "git", "commit", "-m", "Initial repo commit" <ide> end <ide> <ide> setup_test_formula "testball1", <<-EOS.undent <ide><path>Library/Homebrew/test/cmd/link_spec.rb <ide> it "does not fail if the given Formula is already linked" do <ide> setup_test_formula "testball1" <ide> <del> shutup do <del> expect { brew "install", "testball1" }.to be_a_success <del> expect { brew "link", "testball1" }.to be_a_success <del> end <add> expect { brew "install", "testball1" }.to be_a_success <add> expect { brew "link", "testball1" }.to be_a_success <ide> end <ide> <ide> it "links a given Formula" do <ide> setup_test_formula "testball1" <ide> <del> shutup do <del> expect { brew "install", "testball1" }.to be_a_success <del> expect { brew "unlink", "testball1" }.to be_a_success <del> end <add> expect { brew "install", "testball1" }.to be_a_success <add> expect { brew "unlink", "testball1" }.to be_a_success <ide> <ide> expect { brew "link", "--dry-run", "testball1" } <ide> .to output(/Would link/).to_stdout <ide> keg_only "just because" <ide> EOS <ide> <del> shutup do <del> expect { brew "install", "testball1" }.to be_a_success <del> end <add> expect { brew "install", "testball1" }.to be_a_success <ide> <ide> expect { brew "link", "testball1", "SHELL" => "/bin/zsh" } <ide> .to output(/testball1 is keg-only/).to_stderr <ide><path>Library/Homebrew/test/cmd/log_spec.rb <ide> describe "brew log", :integration_test do <ide> it "shows the Git log for the Homebrew repository when no argument is given" do <ide> HOMEBREW_REPOSITORY.cd do <del> shutup do <del> system "git", "init" <del> system "git", "commit", "--allow-empty", "-m", "This is a test commit" <del> end <add> system "git", "init" <add> system "git", "commit", "--allow-empty", "-m", "This is a test commit" <ide> end <ide> <ide> expect { brew "log" } <ide> <ide> core_tap = CoreTap.new <ide> core_tap.path.cd do <del> shutup do <del> system "git", "init" <del> system "git", "add", "--all" <del> system "git", "commit", "-m", "This is a test commit for Testball" <del> end <add> system "git", "init" <add> system "git", "add", "--all" <add> system "git", "commit", "-m", "This is a test commit for Testball" <ide> end <ide> <ide> core_tap_url = "file://#{core_tap.path}" <ide> shallow_tap = Tap.fetch("homebrew", "shallow") <del> shutup do <del> system "git", "clone", "--depth=1", core_tap_url, shallow_tap.path <del> end <add> <add> system "git", "clone", "--depth=1", core_tap_url, shallow_tap.path <ide> <ide> expect { brew "log", "#{shallow_tap}/testball" } <ide> .to output(/This is a test commit for Testball/).to_stdout <ide><path>Library/Homebrew/test/cmd/outdated_spec.rb <ide> setup_test_formula "testball" <ide> (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath <ide> <del> shutup do <del> expect { brew "pin", "testball" }.to be_a_success <del> end <add> expect { brew "pin", "testball" }.to be_a_success <ide> <ide> expect { brew "outdated", "--verbose" } <ide> .to output("testball (0.0.1) < 0.1 [pinned at 0.0.1]\n").to_stdout <ide> setup_test_formula "testball" <ide> (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath <ide> <del> shutup do <del> expect { brew "pin", "testball" }.to be_a_success <del> end <add> expect { brew "pin", "testball" }.to be_a_success <ide> <ide> expected_json = [ <ide> { <ide><path>Library/Homebrew/test/cmd/pin_spec.rb <ide> setup_test_formula "testball" <ide> (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath <ide> <del> shutup do <del> expect { brew "pin", "testball" }.to be_a_success <del> expect { brew "upgrade" }.to be_a_success <del> end <add> expect { brew "pin", "testball" }.to be_a_success <add> expect { brew "upgrade" }.to be_a_success <ide> <ide> expect(HOMEBREW_CELLAR/"testball/0.1").not_to be_a_directory <ide> end <ide><path>Library/Homebrew/test/cmd/reinstall_spec.rb <ide> before(:each) do <ide> setup_test_formula "testball" <ide> <del> shutup do <del> expect { brew "install", "testball", "--with-foo" }.to be_a_success <del> end <add> expect { brew "install", "testball", "--with-foo" }.to be_a_success <ide> end <ide> <ide> it "reinstalls a Formula" do <ide><path>Library/Homebrew/test/cmd/switch_spec.rb <ide> keg_only "just because" <ide> EOS <ide> <del> shutup do <del> expect { brew "install", "testball" }.to be_a_success <del> end <add> expect { brew "install", "testball" }.to be_a_success <ide> <ide> testball_rack = HOMEBREW_CELLAR/"testball" <ide> FileUtils.cp_r testball_rack/"0.1", testball_rack/"0.2" <ide><path>Library/Homebrew/test/cmd/uninstall_spec.rb <ide> <ide> describe "brew uninstall", :integration_test do <ide> it "uninstalls a given Formula" do <del> shutup do <del> expect { brew "install", testball }.to be_a_success <del> end <add> expect { brew "install", testball }.to be_a_success <ide> <ide> expect { brew "uninstall", "--force", testball } <ide> .to output(/Uninstalling testball/).to_stdout <ide><path>Library/Homebrew/test/cmd/unlink_spec.rb <ide> it "unlinks a Formula" do <ide> setup_test_formula "testball" <ide> <del> shutup do <del> expect { brew "install", "testball" }.to be_a_success <del> end <add> expect { brew "install", "testball" }.to be_a_success <ide> <ide> expect { brew "unlink", "--dry-run", "testball" } <ide> .to output(/Would remove/).to_stdout <ide><path>Library/Homebrew/test/cmd/unpack_spec.rb <ide> setup_test_formula "testball" <ide> <ide> mktmpdir do |path| <del> shutup do <del> expect { brew "unpack", "testball", "--destdir=#{path}" } <del> .to be_a_success <del> end <add> expect { brew "unpack", "testball", "--destdir=#{path}" } <add> .to be_a_success <ide> <ide> expect(path/"testball-0.1").to be_a_directory <ide> end <ide><path>Library/Homebrew/test/cmd/unpin_spec.rb <ide> setup_test_formula "testball" <ide> (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath <ide> <del> shutup do <del> expect { brew "pin", "testball" }.to be_a_success <del> expect { brew "unpin", "testball" }.to be_a_success <del> expect { brew "upgrade" }.to be_a_success <del> end <add> expect { brew "pin", "testball" }.to be_a_success <add> expect { brew "unpin", "testball" }.to be_a_success <add> expect { brew "upgrade" }.to be_a_success <ide> <ide> expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory <ide> end <ide><path>Library/Homebrew/test/cmd/upgrade_spec.rb <ide> setup_test_formula "testball" <ide> (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath <ide> <del> shutup do <del> expect { brew "upgrade" }.to be_a_success <del> end <add> expect { brew "upgrade" }.to be_a_success <ide> <ide> expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory <ide> end <ide><path>Library/Homebrew/test/dev-cmd/audit_spec.rb <ide> class Foo < Formula <ide> specify "GithubGistFormula", :needs_compat do <ide> ENV.delete("HOMEBREW_DEVELOPER") <ide> <del> fa = shutup do <del> formula_auditor "foo", <<-EOS.undent <del> class Foo < GithubGistFormula <del> url "http://example.com/foo-1.0.tgz" <del> end <del> EOS <del> end <add> fa = formula_auditor "foo", <<-EOS.undent <add> class Foo < GithubGistFormula <add> url "http://example.com/foo-1.0.tgz" <add> end <add> EOS <ide> <ide> fa.audit_class <ide> expect(fa.problems) <ide> class Foo#{@foo_version} < Formula <ide> <ide> origin_tap_path.mkpath <ide> origin_tap_path.cd do <del> shutup do <del> system "git", "init" <del> system "git", "add", "--all" <del> system "git", "commit", "-m", "init" <del> end <add> system "git", "init" <add> system "git", "add", "--all" <add> system "git", "commit", "-m", "init" <ide> end <ide> <ide> tap_path.mkpath <ide> tap_path.cd do <del> shutup do <del> system "git", "clone", origin_tap_path, "." <del> end <add> system "git", "clone", origin_tap_path, "." <ide> end <ide> end <ide> <ide> def formula_gsub_commit(before, after = "") <ide> origin_formula_path.write text <ide> <ide> origin_tap_path.cd do <del> shutup do <del> system "git", "commit", "-am", "commit" <del> end <add> system "git", "commit", "-am", "commit" <ide> end <ide> <ide> tap_path.cd do <del> shutup do <del> system "git", "fetch" <del> system "git", "reset", "--hard", "origin/master" <del> end <add> system "git", "fetch" <add> system "git", "reset", "--hard", "origin/master" <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/dev-cmd/bottle_spec.rb <ide> describe "brew bottle", :integration_test do <ide> it "builds a bottle for the given Formula" do <ide> begin <del> shutup do <del> expect { brew "install", "--build-bottle", testball } <del> .to be_a_success <del> end <add> expect { brew "install", "--build-bottle", testball } <add> .to be_a_success <ide> <ide> expect { brew "bottle", "--no-rebuild", testball } <ide> .to output(/Formula not from core or any taps/).to_stderr <ide><path>Library/Homebrew/test/dev-cmd/create_spec.rb <ide> let(:formula_file) { CoreTap.new.formula_dir/"testball.rb" } <ide> <ide> it "creates a new Formula file for a given URL" do <del> shutup do <del> brew "create", url, "HOMEBREW_EDITOR" => "/bin/cat" <del> end <add> brew "create", url, "HOMEBREW_EDITOR" => "/bin/cat" <ide> <ide> expect(formula_file).to exist <ide> expect(formula_file.read).to match(%Q(sha256 "#{TESTBALL_SHA256}")) <ide><path>Library/Homebrew/test/dev-cmd/edit_spec.rb <ide> describe "brew edit", :integration_test do <ide> it "opens a given Formula in an editor" do <ide> HOMEBREW_REPOSITORY.cd do <del> shutup do <del> system "git", "init" <del> end <add> system "git", "init" <ide> end <ide> <ide> setup_test_formula "testball" <ide><path>Library/Homebrew/test/dev-cmd/pull_spec.rb <ide> <ide> it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network do <ide> CoreTap.instance.path.cd do <del> shutup do <del> system "git", "init" <del> system "git", "checkout", "-b", "new-branch" <del> end <add> system "git", "init" <add> system "git", "checkout", "-b", "new-branch" <ide> end <ide> <ide> expect { brew "pull", "https://jenkins.brew.sh/job/Homebrew\%20Testing/1028/" } <ide><path>Library/Homebrew/test/dev-cmd/tap_spec.rb <ide> path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo" <ide> path.mkpath <ide> path.cd do <del> shutup do <del> system "git", "init" <del> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" <del> FileUtils.touch "readme" <del> system "git", "add", "--all" <del> system "git", "commit", "-m", "init" <del> end <add> system "git", "init" <add> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" <add> FileUtils.touch "readme" <add> system "git", "add", "--all" <add> system "git", "commit", "-m", "init" <ide> end <ide> <ide> expect { brew "tap" } <ide><path>Library/Homebrew/test/dev-cmd/test_spec.rb <ide> end <ide> <ide> it "fails when a Formula has no test" do <del> shutup do <del> expect { brew "install", testball }.to be_a_success <del> end <add> expect { brew "install", testball }.to be_a_success <ide> <ide> expect { brew "test", testball } <ide> .to output(/testball defines no test/).to_stderr <ide> end <ide> EOS <ide> <del> shutup do <del> expect { brew "install", "testball" }.to be_a_success <del> end <add> expect { brew "install", "testball" }.to be_a_success <ide> <ide> expect { brew "test", "--HEAD", "testball" } <ide> .to output(/Testing testball/).to_stdout <ide><path>Library/Homebrew/test/download_strategies_spec.rb <ide> end <ide> <ide> def git_commit_all <del> shutup do <del> system "git", "add", "--all" <del> system "git", "commit", "-m", "commit number #{@commit_id}" <del> @commit_id += 1 <del> end <add> system "git", "add", "--all" <add> system "git", "commit", "-m", "commit number #{@commit_id}" <add> @commit_id += 1 <ide> end <ide> <ide> def setup_git_repo <del> shutup do <del> system "git", "init" <del> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" <del> end <add> system "git", "init" <add> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" <ide> FileUtils.touch "README" <ide> git_commit_all <ide> end <ide><path>Library/Homebrew/test/formula_installer_bottle_spec.rb <ide> def temporarily_install_bottle(formula) <ide> expect(formula).to be_bottled <ide> expect(formula).to pour_bottle <ide> <del> shutup do <del> described_class.new(formula).install <del> end <add> described_class.new(formula).install <ide> <ide> keg = Keg.new(formula.prefix) <ide> <ide><path>Library/Homebrew/test/formula_installer_spec.rb <ide> def temporary_install(formula) <ide> <ide> installer = described_class.new(formula) <ide> <del> shutup do <del> installer.install <del> end <add> installer.install <ide> <ide> keg = Keg.new(formula.prefix) <ide> <ide><path>Library/Homebrew/test/formula_spec.rb <ide> cached_location.cd do <ide> FileUtils.touch "LICENSE" <ide> <del> shutup do <del> system("git", "init") <del> system("git", "add", "--all") <del> system("git", "commit", "-m", "Initial commit") <del> end <add> system("git", "init") <add> system("git", "add", "--all") <add> system("git", "commit", "-m", "Initial commit") <ide> end <ide> <ide> f.update_head_version <ide> def test <ide> version_scheme(2) <ide> end.new <ide> <del> shutup do <del> [f1, f2, f3, f4].each do |f| <del> f.brew { f.install } <del> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write <del> end <add> [f1, f2, f3, f4].each do |f| <add> f.brew { f.install } <add> Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write <ide> end <ide> <ide> expect(f1).to be_installed <ide> def test <ide> f2 = Class.new(Testball) { version("0.2") }.new <ide> f3 = Class.new(Testball) { version("0.3") }.new <ide> <del> shutup do <del> f1.brew { f1.install } <del> f1.pin <del> f2.brew { f2.install } <del> f3.brew { f3.install } <del> end <add> f1.brew { f1.install } <add> f1.pin <add> f2.brew { f2.install } <add> f3.brew { f3.install } <ide> <ide> expect(f1.prefix).to eq((HOMEBREW_PINNED_KEGS/f1.name).resolved_path) <ide> expect(f1).to be_installed <ide> expect(f2).to be_installed <ide> expect(f3).to be_installed <del> expect(shutup { f3.eligible_kegs_for_cleanup }).to eq([Keg.new(f2.prefix)]) <add> expect(f3.eligible_kegs_for_cleanup).to eq([Keg.new(f2.prefix)]) <ide> end <ide> <ide> specify "with HEAD installed" do <ide> def reset_outdated_kegs <ide> testball_repo.cd do <ide> FileUtils.touch "LICENSE" <ide> <del> shutup do <del> system("git", "init") <del> system("git", "add", "--all") <del> system("git", "commit", "-m", "Initial commit") <del> end <add> system("git", "init") <add> system("git", "add", "--all") <add> system("git", "commit", "-m", "Initial commit") <ide> end <ide> <ide> expect(f.outdated_kegs(fetch_head: true)).not_to be_empty <ide><path>Library/Homebrew/test/formulary_spec.rb <ide> class Wrong#{subject.class_s(formula_name)} < Formula <ide> end <ide> <ide> it "returns a Formula when given a URL" do <del> formula = shutup do <del> subject.factory("file://#{formula_path}") <del> end <del> <add> formula = subject.factory("file://#{formula_path}") <ide> expect(formula).to be_kind_of(Formula) <ide> end <ide> <ide> class Wrong#{subject.class_s(formula_name)} < Formula <ide> let(:installer) { FormulaInstaller.new(formula) } <ide> <ide> it "returns a Formula when given a rack" do <del> shutup do <del> installer.install <del> end <add> installer.install <ide> <ide> f = subject.from_rack(formula.rack) <ide> expect(f).to be_kind_of(Formula) <ide> expect(f.build).to be_kind_of(Tab) <ide> end <ide> <ide> it "returns a Formula when given a Keg" do <del> shutup do <del> installer.install <del> end <add> installer.install <ide> <ide> keg = Keg.new(formula.prefix) <ide> f = subject.from_keg(keg) <ide> class Wrong#{subject.class_s(formula_name)} < Formula <ide> it "prioritizes Formulae from pinned Taps" do <ide> begin <ide> tap.pin <del> formula = shutup do <del> subject.find_with_priority(formula_name) <del> end <add> formula = subject.find_with_priority(formula_name) <ide> expect(formula).to be_kind_of(Formula) <ide> expect(formula.path).to eq(tap_path.realpath) <ide> ensure <ide><path>Library/Homebrew/test/language/go_spec.rb <ide> expect(described_class).to receive(:opoo).once <ide> <ide> mktmpdir do |path| <del> shutup do <del> described_class.stage_deps [], path <del> end <add> described_class.stage_deps [], path <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/test/migrator_spec.rb <ide> <ide> specify "#move_to_new_directory" do <ide> keg.unlink <del> shutup do <del> subject.move_to_new_directory <del> end <add> subject.move_to_new_directory <ide> <ide> expect(new_keg_record).to be_a_directory <ide> expect(new_keg_record/"bin").to be_a_directory <ide> expect(HOMEBREW_LINKED_KEGS.children.count).to eq(1) <ide> expect((HOMEBREW_PREFIX/"opt").children.count).to eq(1) <ide> <del> shutup do <del> subject.unlink_oldname <del> end <add> subject.unlink_oldname <ide> <ide> expect(HOMEBREW_LINKED_KEGS).not_to exist <ide> expect(HOMEBREW_LIBRARY/"bin").not_to exist <ide> FileUtils.touch new_keg_record/"bin"/file <ide> end <ide> <del> shutup do <del> subject.link_newname <del> end <add> subject.link_newname <ide> <ide> expect(HOMEBREW_LINKED_KEGS.children.count).to eq(1) <ide> expect((HOMEBREW_PREFIX/"opt").children.count).to eq(1) <ide> tab.source["path"] = old_formula.path.to_s <ide> tab.write <ide> <del> shutup do <del> subject.migrate <del> end <add> subject.migrate <ide> <ide> expect(new_keg_record).to exist <ide> expect(old_keg_record.parent).to be_a_symlink <ide><path>Library/Homebrew/test/missing_formula_spec.rb <ide> (tap_path/"deleted-formula.rb").write "placeholder" <ide> <ide> tap_path.cd do <del> shutup do <del> system "git", "init" <del> system "git", "add", "--all" <del> system "git", "commit", "-m", "initial state" <del> system "git", "rm", "deleted-formula.rb" <del> system "git", "commit", "-m", "delete formula 'deleted-formula'" <del> end <add> system "git", "init" <add> system "git", "add", "--all" <add> system "git", "commit", "-m", "initial state" <add> system "git", "rm", "deleted-formula.rb" <add> system "git", "commit", "-m", "delete formula 'deleted-formula'" <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/patching_spec.rb <ide> def formula(name = "formula_name", path: Formulary.core_path(name), spec: :stabl <ide> <ide> matcher :be_patched do <ide> match do |formula| <del> shutup do <del> formula.brew do <del> formula.patch <del> s = File.read("libexec/NOOP") <del> expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected" <del> expect(s).to include("ABCD"), "libexec/NOOP was not patched as expected" <del> end <add> formula.brew do <add> formula.patch <add> s = File.read("libexec/NOOP") <add> expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected" <add> expect(s).to include("ABCD"), "libexec/NOOP was not patched as expected" <ide> end <ide> end <ide> end <ide> <ide> matcher :be_sequentially_patched do <ide> match do |formula| <del> shutup do <del> formula.brew do <del> formula.patch <del> s = File.read("libexec/NOOP") <del> expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected" <del> expect(s).not_to include("ABCD"), "libexec/NOOP was not patched as expected" <del> expect(s).to include("1234"), "libexec/NOOP was not patched as expected" <del> end <add> formula.brew do <add> formula.patch <add> s = File.read("libexec/NOOP") <add> expect(s).not_to include("NOOP"), "libexec/NOOP was not patched as expected" <add> expect(s).not_to include("ABCD"), "libexec/NOOP was not patched as expected" <add> expect(s).to include("1234"), "libexec/NOOP was not patched as expected" <ide> end <ide> end <ide> end <ide> <ide> matcher :miss_apply do <ide> match do |formula| <ide> expect { <del> shutup do <del> formula.brew do <del> formula.patch <del> end <add> formula.brew do <add> formula.patch <ide> end <ide> }.to raise_error(MissingApplyError) <ide> end <ide> def patches <ide> <ide> specify "single_patch_dsl_with_incorrect_strip" do <ide> expect { <del> shutup do <del> f = formula do <del> patch :p0 do <del> url PATCH_URL_A <del> sha256 PATCH_A_SHA256 <del> end <add> f = formula do <add> patch :p0 do <add> url PATCH_URL_A <add> sha256 PATCH_A_SHA256 <ide> end <del> <del> f.brew { |formula, _staging| formula.patch } <ide> end <add> <add> f.brew { |formula, _staging| formula.patch } <ide> }.to raise_error(ErrorDuringExecution) <ide> end <ide> <ide> specify "single_patch_dsl_with_incorrect_strip_with_apply" do <ide> expect { <del> shutup do <del> f = formula do <del> patch :p0 do <del> url TESTBALL_PATCHES_URL <del> sha256 TESTBALL_PATCHES_SHA256 <del> apply APPLY_A <del> end <add> f = formula do <add> patch :p0 do <add> url TESTBALL_PATCHES_URL <add> sha256 TESTBALL_PATCHES_SHA256 <add> apply APPLY_A <ide> end <del> <del> f.brew { |formula, _staging| formula.patch } <ide> end <add> <add> f.brew { |formula, _staging| formula.patch } <ide> }.to raise_error(ErrorDuringExecution) <ide> end <ide> <ide> def patches <ide> <ide> specify "single_patch_dsl_with_apply_enoent_fail" do <ide> expect { <del> shutup do <del> f = formula do <del> patch do <del> url TESTBALL_PATCHES_URL <del> sha256 TESTBALL_PATCHES_SHA256 <del> apply "patches/#{APPLY_A}" <del> end <add> f = formula do <add> patch do <add> url TESTBALL_PATCHES_URL <add> sha256 TESTBALL_PATCHES_SHA256 <add> apply "patches/#{APPLY_A}" <ide> end <del> <del> f.brew { |formula, _staging| formula.patch } <ide> end <add> <add> f.brew { |formula, _staging| formula.patch } <ide> }.to raise_error(ErrorDuringExecution) <ide> end <ide> end <ide><path>Library/Homebrew/test/resource_spec.rb <ide> expect(fn).to receive(:verify_checksum).and_raise(ChecksumMissingError) <ide> expect(fn).to receive(:sha256) <ide> <del> shutup do <del> subject.verify_download_integrity(fn) <del> end <add> subject.verify_download_integrity(fn) <ide> end <ide> <ide> specify "#verify_download_integrity_mismatch" do <ide> expect(fn).to receive(:verify_checksum).with(checksum) <ide> .and_raise(ChecksumMismatchError.new(fn, checksum, Object.new)) <ide> <del> shutup do <del> expect { <del> subject.verify_download_integrity(fn) <del> }.to raise_error(ChecksumMismatchError) <del> end <add> expect { <add> subject.verify_download_integrity(fn) <add> }.to raise_error(ChecksumMismatchError) <ide> end <ide> end <ide><path>Library/Homebrew/test/sandbox_spec.rb <ide> <ide> describe "#exec" do <ide> it "fails when writing to file not specified with ##allow_write" do <del> shutup do <del> expect { <del> subject.exec "touch", file <del> }.to raise_error(ErrorDuringExecution) <del> end <add> expect { <add> subject.exec "touch", file <add> }.to raise_error(ErrorDuringExecution) <ide> <ide> expect(file).not_to exist <ide> end <ide><path>Library/Homebrew/test/spec_helper.rb <ide> require "global" <ide> require "tap" <ide> <del>require "test/support/helper/shutup" <ide> require "test/support/helper/fixtures" <ide> require "test/support/helper/formula" <ide> require "test/support/helper/mktmpdir" <ide> <ide> config.filter_run_when_matching :focus <ide> <del> config.include(Test::Helper::Shutup) <ide> config.include(Test::Helper::Fixtures) <ide> config.include(Test::Helper::Formula) <ide> config.include(Test::Helper::MkTmpDir) <ide> def find_files <ide> @__argv = ARGV.dup <ide> @__env = ENV.to_hash # dup doesn't work on ENV <ide> <add> unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS") <add> @__stdout = $stdout.clone <add> @__stderr = $stderr.clone <add> $stdout.reopen(File::NULL) <add> $stderr.reopen(File::NULL) <add> end <add> <ide> example.run <ide> ensure <ide> ARGV.replace(@__argv) <ide> ENV.replace(@__env) <ide> <add> unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS") <add> $stdout.reopen(@__stdout) <add> $stderr.reopen(@__stderr) <add> @__stdout.close <add> @__stderr.close <add> end <add> <ide> Tab.clear_cache <ide> <ide> FileUtils.rm_rf [ <ide><path>Library/Homebrew/test/support/helper/cask/install_helper.rb <ide> module InstallHelper <ide> module_function <ide> <del> require "test/support/helper/shutup" <del> extend Test::Helper::Shutup <del> <ide> def self.install_without_artifacts(cask) <ide> Hbc::Installer.new(cask).tap do |i| <del> shutup do <del> i.download <del> i.extract_primary_container <del> end <add> i.download <add> i.extract_primary_container <ide> end <ide> end <ide> <ide> def self.install_without_artifacts_with_caskfile(cask) <ide> Hbc::Installer.new(cask).tap do |i| <del> shutup do <del> i.download <del> i.extract_primary_container <del> i.save_caskfile <del> end <add> i.download <add> i.extract_primary_container <add> i.save_caskfile <ide> end <ide> end <ide> <ide> def install_without_artifacts(cask) <ide> Hbc::Installer.new(cask).tap do |i| <del> shutup do <del> i.download <del> i.extract_primary_container <del> end <add> i.download <add> i.extract_primary_container <ide> end <ide> end <ide> <ide> def install_with_caskfile(cask) <del> Hbc::Installer.new(cask).tap do |i| <del> shutup do <del> i.save_caskfile <del> end <del> end <add> Hbc::Installer.new(cask).tap(&:save_caskfile) <ide> end <ide> end <ide><path>Library/Homebrew/test/support/helper/shutup.rb <del>module Test <del> module Helper <del> module Shutup <del> def shutup <del> if ENV.key?("VERBOSE_TESTS") <del> yield <del> else <del> begin <del> tmperr = $stderr.clone <del> tmpout = $stdout.clone <del> $stderr.reopen("/dev/null") <del> $stdout.reopen("/dev/null") <del> yield <del> ensure <del> $stderr.reopen(tmperr) <del> $stdout.reopen(tmpout) <del> tmperr.close <del> tmpout.close <del> end <del> end <del> end <del> end <del> end <del>end <ide><path>Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb <ide> def setup_remote_tap(name) <ide> end <ide> <ide> def install_and_rename_coretap_formula(old_name, new_name) <del> shutup do <del> CoreTap.instance.path.cd do |tap_path| <del> system "git", "init" <del> system "git", "add", "--all" <del> system "git", "commit", "-m", <del> "#{old_name.capitalize} has not yet been renamed" <add> CoreTap.instance.path.cd do |tap_path| <add> system "git", "init" <add> system "git", "add", "--all" <add> system "git", "commit", "-m", <add> "#{old_name.capitalize} has not yet been renamed" <ide> <del> brew "install", old_name <add> brew "install", old_name <ide> <del> (tap_path/"Formula/#{old_name}.rb").unlink <del> (tap_path/"formula_renames.json").write JSON.generate(old_name => new_name) <add> (tap_path/"Formula/#{old_name}.rb").unlink <add> (tap_path/"formula_renames.json").write JSON.generate(old_name => new_name) <ide> <del> system "git", "add", "--all" <del> system "git", "commit", "-m", <del> "#{old_name.capitalize} has been renamed to #{new_name.capitalize}" <del> end <add> system "git", "add", "--all" <add> system "git", "commit", "-m", <add> "#{old_name.capitalize} has been renamed to #{new_name.capitalize}" <ide> end <ide> end <ide> <ide><path>Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb <ide> ["echo", "homebrew-cask", "rocks!"], <ide> ) <ide> <del> shutup do <del> staged.system_command("echo", args: ["homebrew-cask", "rocks!"]) <del> end <add> staged.system_command("echo", args: ["homebrew-cask", "rocks!"]) <ide> end <ide> <ide> it "can get the Info.plist file for the primary app" do <ide> ["/usr/libexec/PlistBuddy", "-c", "Print CFBundleIdentifier", staged.info_plist_file], <ide> ) <ide> <del> shutup do <del> staged.plist_exec("Print CFBundleIdentifier") <del> end <add> staged.plist_exec("Print CFBundleIdentifier") <ide> end <ide> <ide> it "can set a key in the Info.plist file" do <ide> ["/usr/libexec/PlistBuddy", "-c", "Set :JVMOptions:JVMVersion 1.6+", staged.info_plist_file], <ide> ) <ide> <del> shutup do <del> staged.plist_set(":JVMOptions:JVMVersion", "1.6+") <del> end <add> staged.plist_set(":JVMOptions:JVMVersion", "1.6+") <ide> end <ide> <ide> it "can set the permissions of a file" do <ide> ["/bin/chmod", "-R", "--", "777", fake_pathname], <ide> ) <ide> <del> shutup do <del> staged.set_permissions(fake_pathname.to_s, "777") <del> end <add> staged.set_permissions(fake_pathname.to_s, "777") <ide> end <ide> <ide> it "can set the permissions of multiple files" do <ide> ["/bin/chmod", "-R", "--", "777", fake_pathname, fake_pathname], <ide> ) <ide> <del> shutup do <del> staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777") <del> end <add> staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777") <ide> end <ide> <ide> it "cannot set the permissions of a file that does not exist" do <ide> ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname], <ide> ) <ide> <del> shutup do <del> staged.set_ownership(fake_pathname.to_s) <del> end <add> staged.set_ownership(fake_pathname.to_s) <ide> end <ide> <ide> it "can set the ownership of multiple files" do <ide> ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname, fake_pathname], <ide> ) <ide> <del> shutup do <del> staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s]) <del> end <add> staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s]) <ide> end <ide> <ide> it "can set the ownership of a file with a different user and group" do <ide> ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "other_user:other_group", fake_pathname], <ide> ) <ide> <del> shutup do <del> staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group") <del> end <add> staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group") <ide> end <ide> <ide> it "cannot set the ownership of a file that does not exist" do <ide> allow(staged).to receive(:current_user).and_return("fake_user") <ide> fake_pathname = non_existent_path <ide> allow(staged).to receive(:Pathname).and_return(fake_pathname) <ide> <del> shutup do <del> staged.set_ownership(fake_pathname.to_s) <del> end <add> staged.set_ownership(fake_pathname.to_s) <ide> end <ide> end <ide><path>Library/Homebrew/test/tap_spec.rb <ide> class Foo < Formula <ide> <ide> def setup_git_repo <ide> path.cd do <del> shutup do <del> system "git", "init" <del> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" <del> system "git", "add", "--all" <del> system "git", "commit", "-m", "init" <del> end <add> system "git", "init" <add> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" <add> system "git", "add", "--all" <add> system "git", "commit", "-m", "init" <ide> end <ide> end <ide> <ide> def setup_git_repo <ide> path = Tap::TAP_DIRECTORY/"someone/homebrew-foo" <ide> path.mkpath <ide> cd path do <del> shutup { system "git", "init" } <add> system "git", "init" <ide> system "git", "remote", "add", "origin", <ide> "https://github.com/someone/homebrew-foo" <ide> end <ide> def setup_git_repo <ide> services_tap = described_class.new("Homebrew", "services") <ide> services_tap.path.mkpath <ide> services_tap.path.cd do <del> shutup do <del> system "git", "init" <del> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-services" <del> end <add> system "git", "init" <add> system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-services" <ide> end <ide> expect(services_tap).not_to be_private <ide> end <ide> def setup_git_repo <ide> tap = described_class.new("user", "repo") <ide> <ide> expect { <del> shutup { tap.install clone_target: "file:///not/existed/remote/url" } <add> tap.install clone_target: "file:///not/existed/remote/url" <ide> }.to raise_error(ErrorDuringExecution) <ide> <ide> expect(tap).not_to be_installed <ide> def setup_git_repo <ide> setup_git_repo <ide> <ide> tap = Tap.new("Homebrew", "bar") <del> shutup do <del> tap.install clone_target: subject.path/".git" <del> end <add> <add> tap.install clone_target: subject.path/".git" <add> <ide> expect(tap).to be_installed <ide> expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").to be_a_file <ide> expect(HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").to be_a_file <ide> expect(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").to be_a_file <ide> expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file <del> shutup do <del> tap.uninstall <del> end <add> tap.uninstall <add> <ide> expect(tap).not_to be_installed <ide> expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").not_to exist <ide> expect(HOMEBREW_PREFIX/"share/man/man1").not_to exist <ide> def setup_git_repo <ide> setup_tap_files <ide> setup_git_repo <ide> tap = Tap.new("Homebrew", "baz") <del> shutup { tap.install clone_target: subject.path/".git" } <add> tap.install clone_target: subject.path/".git" <ide> (HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").delete <ide> (HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").delete <ide> (HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").delete <ide> (HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").delete <del> shutup { tap.link_completions_and_manpages } <add> tap.link_completions_and_manpages <ide> expect(HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1").to be_a_file <ide> expect(HOMEBREW_PREFIX/"etc/bash_completion.d/brew-tap-cmd").to be_a_file <ide> expect(HOMEBREW_PREFIX/"share/zsh/site-functions/_brew-tap-cmd").to be_a_file <ide> expect(HOMEBREW_PREFIX/"share/fish/vendor_completions.d/brew-tap-cmd.fish").to be_a_file <del> shutup { tap.uninstall } <add> tap.uninstall <ide> ensure <ide> (HOMEBREW_PREFIX/"etc").rmtree if (HOMEBREW_PREFIX/"etc").exist? <ide> (HOMEBREW_PREFIX/"share").rmtree if (HOMEBREW_PREFIX/"share").exist?
74
Text
Text
add stroeer labs to airflow users list
cc4f245758340f5fc278bbbdc958a40b85f39bb8
<ide><path>INTHEWILD.md <ide> Currently, **officially** using Airflow: <ide> 1. [Strava](https://strava.com) [[@strava](https://github.com/strava), [@dhuang](https://github.com/dhuang) & [@liamstewart](https://github.com/liamstewart)] <ide> 1. [Stripe](https://stripe.com) [[@jbalogh](https://github.com/jbalogh)] <ide> 1. [Strongmind](https://www.strongmind.com) [[@tomchapin](https://github.com/tomchapin) & [@wongstein](https://github.com/wongstein)] <add>1. [Ströer Labs](https://stroeer-labs.com) [[@mbrtargeting](https://github.com/mbrtargeting/)] <ide> 1. [Surfline](https://www.surfline.com/) [[@jawang35](https://github.com/jawang35)] <ide> 1. [Syapse](https://www.syapse.com/) [[@zedmor](https://github.com/zedmor)] <ide> 1. [T2 Systems](http://t2systems.com) [[@unclaimedpants](https://github.com/unclaimedpants)]
1
Ruby
Ruby
skip `mtime` for non-existent symlink
ae18bdf1619103ab6a5b78d94df9c150ae8e0f03
<ide><path>Library/Homebrew/cleanup.rb <ide> def prune?(days) <ide> return false unless days <ide> return true if days.zero? <ide> <add> return true if symlink? && !exist? <add> <ide> # TODO: Replace with ActiveSupport's `.days.ago`. <ide> mtime < ((@time ||= Time.now) - days * 60 * 60 * 24) <ide> end
1
Javascript
Javascript
remove redundant log in network.js
0f4fe7f762e60b3add20d7c7d6584b14212a4db1
<ide><path>src/network.js <ide> // // TODO(mack): dump() doesn't seem to work here... <ide> // dump(msg + '\n'); <ide> //} <del>//#else <del>function log(aMsg) { <del> console.log(aMsg); <del>} <ide> //#endif <ide> <ide> var NetworkManager = (function NetworkManagerClosure() {
1