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 |
|---|---|---|---|---|---|
Python | Python | prepare exception even if errors ignored | 7877c627f1d2becbdd535b48a22e1a854ebf3fc5 | <ide><path>celery/worker/job.py
<ide> def handle_retry(self, exc, type_, tb, strtb):
<ide>
<ide> def handle_failure(self, exc, type_, tb, strtb):
<ide> """Handle exception."""
<del> # mark_as_failure returns an exception that is guaranteed to
<del> # be pickleable.
<ide> if self._store_errors:
<del> stored_exc = self.task.backend.mark_as_failure(self.task_id,
<del> exc, strtb)
<add> # mark_as_failure returns an exception that is guaranteed to
<add> # be pickleable.
<add> exc = self.task.backend.mark_as_failure(self.task_id, exc, strtb)
<add> else:
<add> exc = self.task.backend.prepare_exception(exc)
<add>
<ide> return super(WorkerTaskTrace, self).handle_failure(
<del> stored_exc, type_, tb, strtb)
<add> exc, type_, tb, strtb)
<ide>
<ide>
<ide> def execute_and_trace(task_name, *args, **kwargs): | 1 |
PHP | PHP | add a method to get nodes from debugger | 2f5b982c934a30143cb0ff64e316f41d23313d3c | <ide><path>src/Error/Debugger.php
<ide> public static function exportVar($var, int $maxDepth = 3): string
<ide> return static::getInstance()->getExportFormatter()->dump($node);
<ide> }
<ide>
<add> /**
<add> * Convert the variable to the internal node tree.
<add> *
<add> * The node tree can be manipulated and serialized more easily
<add> * than many object graphs can.
<add> *
<add> * @param mixed $var Variable to convert.
<add> * @param int $maxDepth The depth to generate nodes to. Defaults to 3.
<add> * @return NodeInterface The root node of the tree.
<add> */
<add> public static function exportNodes($var, int $maxDepth = 3): NodeInterface
<add> {
<add> $context = new DebugContext($maxDepth);
<add>
<add> return static::export($var, $context);
<add> }
<add>
<ide> /**
<ide> * Protected export function used to keep track of indentation and recursion.
<ide> *
<ide><path>tests/TestCase/Error/DebuggerTest.php
<ide>
<ide> use Cake\Controller\Controller;
<ide> use Cake\Core\Configure;
<add>use Cake\Error\Debug\NodeInterface;
<add>use Cake\Error\Debug\ScalarNode;
<add>use Cake\Error\Debug\SpecialNode;
<ide> use Cake\Error\Debug\TextFormatter;
<ide> use Cake\Error\Debugger;
<ide> use Cake\Log\Log;
<ide> public function testExportVarSplFixedArray()
<ide> $this->assertTextEquals($expected, $result);
<ide> }
<ide>
<add> /**
<add> * Text exportNodes()
<add> *
<add> * @return void
<add> */
<add> public function testExportNodes()
<add> {
<add> $data = [
<add> 1 => 'Index one',
<add> 5 => 'Index five',
<add> ];
<add> $result = Debugger::exportNodes($data);
<add> $this->assertInstanceOf(NodeInterface::class, $result);
<add> $this->assertCount(2, $result->getChildren());
<add>
<add> /** @var \Cake\Error\Debug\ArrayItemNode */
<add> $item = $result->getChildren()[0];
<add> $key = new ScalarNode('int', 1);
<add> $this->assertEquals($key, $item->getKey());
<add> $value = new ScalarNode('string', 'Index one');
<add> $this->assertEquals($value, $item->getValue());
<add>
<add> $data = [
<add> 'key' => [
<add> 'value',
<add> ],
<add> ];
<add> $result = Debugger::exportNodes($data, 1);
<add>
<add> $item = $result->getChildren()[0];
<add> $nestedItem = $item->getValue()->getChildren()[0];
<add> $expected = new SpecialNode('[maximum depth reached]');
<add> $this->assertEquals($expected, $nestedItem->getValue());
<add> }
<add>
<ide> /**
<ide> * testLog method
<ide> * | 2 |
PHP | PHP | add missing calls to parent | 3f9e8e811326a34b848cc804e4b6b6105e81718f | <ide><path>lib/Cake/Test/Case/Network/CakeResponseTest.php
<ide> class CakeResponseTest extends CakeTestCase {
<ide> * @return void
<ide> */
<ide> public function setUp() {
<add> parent::setUp();
<ide> ob_start();
<ide> }
<ide>
<ide> public function setUp() {
<ide> * @return void
<ide> */
<ide> public function tearDown() {
<add> parent::tearDown();
<ide> ob_end_clean();
<ide> }
<ide> | 1 |
Javascript | Javascript | add a format100 table for mac | 3726686d22deac5d299b890bd0f7359053717956 | <ide><path>fonts.js
<ide> var Font = (function () {
<ide> glyphs.push({ unicode: 0x0000 });
<ide> var ranges = getRanges(glyphs);
<ide>
<add> var numTables = 2;
<add> var kFormat100ArraySize = 256;
<add> var cmap = "\x00\x00" + // version
<add> string16(numTables) + // numTables
<add> "\x00\x01" + // platformID
<add> "\x00\x00" + // encodingID
<add> string32(4 + numTables * 8) + // start of the table record
<add> "\x00\x03" + // platformID
<add> "\x00\x01" + // encodingID
<add> string32(4 + numTables * 8 + 6 + kFormat100ArraySize); // start of the table record
<add>
<add> var format100 = "\x00\x00" + // format
<add> string16(6 + kFormat100ArraySize) + // length
<add> "\x00\x00"; // language
<add>
<add> for (var i = 0; i < kFormat100ArraySize; i++)
<add> format100 += String.fromCharCode(i);
<add>
<ide> var headerSize = (12 * 2 + (ranges.length * 4 * 2));
<ide> var segCount = ranges.length + 1;
<ide> var segCount2 = segCount * 2;
<ide> var searchRange = FontsUtils.getMaxPower2(segCount) * 2;
<ide> var searchEntry = Math.log(segCount) / Math.log(2);
<ide> var rangeShift = 2 * segCount - searchRange;
<ide>
<del> var cmap = "\x00\x00" + // version
<del> "\x00\x01" + // numTables
<del> "\x00\x03" + // platformID
<del> "\x00\x01" + // encodingID
<del> "\x00\x00\x00\x0C" + // start of the table record
<del> "\x00\x04" + // format
<del> string16(headerSize) + // length
<del> "\x00\x00" + // languages
<del> string16(segCount2) +
<del> string16(searchRange) +
<del> string16(searchEntry) +
<del> string16(rangeShift);
<add> var format314 = "\x00\x04" + // format
<add> string16(headerSize) + // length
<add> "\x00\x00" + // language
<add> string16(segCount2) +
<add> string16(searchRange) +
<add> string16(searchEntry) +
<add> string16(rangeShift);
<ide>
<ide> // Fill up the 4 parallel arrays describing the segments.
<ide> var startCount = "";
<ide> var Font = (function () {
<ide> }
<ide> }
<ide>
<del> startCount += "\xFF\xFF";
<ide> endCount += "\xFF\xFF";
<add> startCount += "\xFF\xFF";
<ide> idDeltas += "\x00\x01";
<ide> idRangeOffsets += "\x00\x00";
<add> format314 += endCount + "\x00\x00" + startCount +
<add> idDeltas + idRangeOffsets + glyphsIds;
<ide>
<del> return stringToArray(cmap + endCount + "\x00\x00" + startCount +
<del> idDeltas + idRangeOffsets + glyphsIds);
<add> return stringToArray(cmap + format100 + format314);
<ide> };
<ide>
<ide> function createOS2Table(properties) {
<ide><path>utils/fonts_utils.js
<ide> /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
<ide> /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
<ide>
<del>"use strict";
<del>
<ide> /**
<ide> * The Type2 reader code below is only used for debugging purpose since Type2
<ide> * is only a CharString format and is never used directly as a Font file.
<ide> * CharString or to understand the structure of the CFF format.
<ide> */
<ide>
<del>"use strict";
<del>
<ide> /**
<ide> * Build a charset by assigning the glyph name and the human readable form
<ide> * of the glyph data.
<ide> function writeToFile(aBytes, aFilePath) {
<ide>
<ide> var stream = Cc["@mozilla.org/network/file-output-stream;1"]
<ide> .createInstance(Ci.nsIFileOutputStream);
<del> stream.init(file, 0x04 | 0x08 | 0x20, 600, 0);
<add> stream.init(file, 0x04 | 0x08 | 0x20, 0600, 0);
<ide>
<ide> var bos = Cc["@mozilla.org/binaryoutputstream;1"]
<ide> .createInstance(Ci.nsIBinaryOutputStream); | 2 |
Javascript | Javascript | remove unused webpack import in flyfile.js | a0b16e03b89122295fb46d3e9ecb9e9f90d9056a | <ide><path>flyfile.js
<del>const webpack = require('webpack')
<ide> const notifier = require('node-notifier')
<ide> const childProcess = require('child_process')
<ide> const isWindows = /^win/.test(process.platform) | 1 |
Ruby | Ruby | return the calculated remote_ip or ip | 4f2bf6491cbc482d25a9357c2eb7fc8047d4f12e | <ide><path>actionpack/lib/action_dispatch/http/request.rb
<ide> def ip
<ide>
<ide> # Originating IP address, usually set by the RemoteIp middleware.
<ide> def remote_ip
<del> @remote_ip ||= (@env["action_dispatch.remote_ip"] || ip).to_s
<add> # Coerce the remote_ip object into a string, because to_s could return nil
<add> @remote_ip ||= @env["action_dispatch.remote_ip"].to_s || ip
<ide> end
<ide>
<ide> # Returns the unique request id, which is based off either the X-Request-Id header that can | 1 |
Python | Python | fix example in ctypeslib module documentation | 9118887ccb0e62d8814e31a80e1e6caf0e99eb3c | <ide><path>numpy/ctypeslib.py
<ide>
<ide> We wrap it using:
<ide>
<del>>>> lib.foo_func.restype = None #doctest: +SKIP
<del>>>> lib.foo.argtypes = [array_1d_double, c_int] #doctest: +SKIP
<add>>>> _lib.foo_func.restype = None #doctest: +SKIP
<add>>>> _lib.foo_func.argtypes = [array_1d_double, c_int] #doctest: +SKIP
<ide>
<ide> Then, we're ready to call ``foo_func``:
<ide> | 1 |
Python | Python | fix syntax error in generate docstrings | e4b234834a79541f31be227aadce13f5aafda85a | <ide><path>src/transformers/generation_utils.py
<ide> def generate(
<ide> This value is subtracted from a beam's score if it generates a token same as any beam from other group
<ide> at a particular time. Note that `diversity_penalty` is only effective if `group beam search` is
<ide> enabled.
<del> prefix_allowed_tokens_fn: (`Callable[[int, torch.Tensor], List[int]]`, *optional*):
<add> prefix_allowed_tokens_fn (`Callable[[int, torch.Tensor], List[int]]`, *optional*):
<ide> If provided, this function constraints the beam search to allowed tokens only at each step. If not
<ide> provided no constraint is applied. This function takes 2 arguments: the batch ID `batch_id` and
<ide> `input_ids`. It has to return a list with the allowed tokens for the next generation step conditioned | 1 |
Mixed | Python | add message to custom permission | 9ea615af14303663a47fd155ab541d8302d609e4 | <ide><path>docs/api-guide/permissions.md
<ide> If you need to test if a request is a read operation or a write operation, you s
<ide>
<ide> ---
<ide>
<add>Custom permissions will raise a `PermissionDenied` exception if the test fails. To change the error message associated with the exception, implement a `message` attribute directly on your custom permission. Otherwise the `default_detail` attribute from `PermissionDenied` will be used.
<add>
<add> from rest_framework import permissions
<add>
<add> class CustomerAccessPermission(permissions.BasePermission):
<add> message = 'Adding customers not allowed.'
<add>
<add> def has_permission(self, request, view):
<add> ...
<add>
<ide> ## Examples
<ide>
<ide> The following is an example of a permission class that checks the incoming request's IP address against a blacklist, and denies the request if the IP has been blacklisted.
<ide><path>rest_framework/views.py
<ide> def http_method_not_allowed(self, request, *args, **kwargs):
<ide> """
<ide> raise exceptions.MethodNotAllowed(request.method)
<ide>
<del> def permission_denied(self, request):
<add> def permission_denied(self, request, message=None):
<ide> """
<ide> If request is not permitted, determine what kind of exception to raise.
<ide> """
<ide> if not request.successful_authenticator:
<ide> raise exceptions.NotAuthenticated()
<add> if message is not None:
<add> raise exceptions.PermissionDenied(message)
<ide> raise exceptions.PermissionDenied()
<ide>
<ide> def throttled(self, request, wait):
<ide> def check_permissions(self, request):
<ide> """
<ide> for permission in self.get_permissions():
<ide> if not permission.has_permission(request, self):
<add> if hasattr(permission, 'message'):
<add> self.permission_denied(request, permission.message)
<ide> self.permission_denied(request)
<ide>
<ide> def check_object_permissions(self, request, obj):
<ide> def check_object_permissions(self, request, obj):
<ide> """
<ide> for permission in self.get_permissions():
<ide> if not permission.has_object_permission(request, self, obj):
<add> if hasattr(permission, 'message'):
<add> self.permission_denied(request, permission.message)
<ide> self.permission_denied(request)
<ide>
<ide> def check_throttles(self, request):
<ide><path>tests/test_permissions.py
<ide> def test_cannot_read_list_permissions(self):
<ide> response = object_permissions_list_view(request)
<ide> self.assertEqual(response.status_code, status.HTTP_200_OK)
<ide> self.assertListEqual(response.data, [])
<add>
<add>
<add>class BasicPerm(permissions.BasePermission):
<add> def has_permission(self, request, view):
<add> return False
<add>
<add>
<add>class BasicPermWithDetail(permissions.BasePermission):
<add> message = 'Custom: You cannot post to this resource'
<add>
<add> def has_permission(self, request, view):
<add> return False
<add>
<add>
<add>class BasicObjectPerm(permissions.BasePermission):
<add> def has_object_permission(self, request, view, obj):
<add> return False
<add>
<add>
<add>class BasicObjectPermWithDetail(permissions.BasePermission):
<add> message = 'Custom: You cannot post to this resource'
<add>
<add> def has_object_permission(self, request, view, obj):
<add> return False
<add>
<add>
<add>class PermissionInstanceView(generics.RetrieveUpdateDestroyAPIView):
<add> queryset = BasicModel.objects.all()
<add> serializer_class = BasicSerializer
<add>
<add>
<add>class DeniedView(PermissionInstanceView):
<add> permission_classes = (BasicPerm,)
<add>
<add>
<add>class DeniedViewWithDetail(PermissionInstanceView):
<add> permission_classes = (BasicPermWithDetail,)
<add>
<add>
<add>class DeniedObjectView(PermissionInstanceView):
<add> permission_classes = (BasicObjectPerm,)
<add>
<add>
<add>class DeniedObjectViewWithDetail(PermissionInstanceView):
<add> permission_classes = (BasicObjectPermWithDetail,)
<add>
<add>denied_view = DeniedView.as_view()
<add>
<add>denied_view_with_detail = DeniedViewWithDetail.as_view()
<add>
<add>denied_object_view = DeniedObjectView.as_view()
<add>
<add>denied_object_view_with_detail = DeniedObjectViewWithDetail.as_view()
<add>
<add>
<add>class CustomPermissionsTests(TestCase):
<add> def setUp(self):
<add> BasicModel(text='foo').save()
<add> User.objects.create_user('username', 'username@example.com', 'password')
<add> credentials = basic_auth_header('username', 'password')
<add> self.request = factory.get('/1', format='json', HTTP_AUTHORIZATION=credentials)
<add> self.custom_message = 'Custom: You cannot post to this resource'
<add>
<add> def test_permission_denied(self):
<add> response = denied_view(self.request, pk=1)
<add> detail = response.data.get('detail')
<add> self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
<add> self.assertNotEqual(detail, self.custom_message)
<add>
<add> def test_permission_denied_with_custom_detail(self):
<add> response = denied_view_with_detail(self.request, pk=1)
<add> detail = response.data.get('detail')
<add> self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
<add> self.assertEqual(detail, self.custom_message)
<add>
<add> def test_permission_denied_for_object(self):
<add> response = denied_object_view(self.request, pk=1)
<add> detail = response.data.get('detail')
<add> self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
<add> self.assertNotEqual(detail, self.custom_message)
<add>
<add> def test_permission_denied_for_object_with_custom_detail(self):
<add> response = denied_object_view_with_detail(self.request, pk=1)
<add> detail = response.data.get('detail')
<add> self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
<add> self.assertEqual(detail, self.custom_message) | 3 |
PHP | PHP | fix more types | 8907b66e7e37bba1b0a62338da09060ebb9b3359 | <ide><path>src/Filesystem/File.php
<ide> public function open(string $mode = 'r', bool $force = false): bool
<ide> * @param string|bool $bytes where to start
<ide> * @param string $mode A `fread` compatible mode.
<ide> * @param bool $force If true then the file will be re-opened even if its already opened, otherwise it won't
<del> * @return string|false string on success, false on failure
<add> * @return string|null string on success, false on failure
<ide> */
<del> public function read($bytes = false, string $mode = 'rb', bool $force = false)
<add> public function read($bytes = false, string $mode = 'rb', bool $force = false): ?string
<ide> {
<ide> if ($bytes === false && $this->lock === null) {
<ide> return file_get_contents($this->path);
<ide> }
<ide> if ($this->open($mode, $force) === false) {
<del> return false;
<add> return null;
<ide> }
<ide> if ($this->lock !== null && flock($this->handle, LOCK_SH) === false) {
<del> return false;
<add> return null;
<ide> }
<ide> if (is_int($bytes)) {
<ide> return fread($this->handle, $bytes);
<ide> public function safe(?string $name = null, ?string $ext = null): string
<ide> * Get md5 Checksum of file with previous check of Filesize
<ide> *
<ide> * @param int|bool $maxsize in MB or true to force
<del> * @return string|false md5 Checksum {@link https://secure.php.net/md5_file See md5_file()}, or false in case of an error
<add> * @return string|null md5 Checksum {@link https://secure.php.net/md5_file See md5_file()}, or null in case of an error
<ide> */
<ide> public function md5($maxsize = 5): ?string
<ide> {
<ide><path>tests/PHPStan/AssociationTableMixinClassReflectionExtension.php
<ide> class AssociationTableMixinClassReflectionExtension implements PropertiesClassRe
<ide> * @param Broker $broker Class reflection broker
<ide> * @return void
<ide> */
<del> public function setBroker(Broker $broker)
<add> public function setBroker(Broker $broker): void
<ide> {
<ide> $this->broker = $broker;
<ide> } | 2 |
Javascript | Javascript | use utf8stream for http streams with utf8 encoding | f987ecf45be6f5c7c18d5cebd38be0b411648140 | <ide><path>lib/http.js
<ide> function debug (x) {
<ide>
<ide> var sys = require('sys');
<ide> var net = require('net');
<add>var Utf8Stream = require('utf8_stream').Utf8Stream;
<ide> var events = require('events');
<ide> var Buffer = require('buffer').Buffer;
<ide>
<ide> var parsers = new FreeList('parsers', 1000, function () {
<ide> var enc = parser.incoming._encoding;
<ide> if (!enc) {
<ide> parser.incoming.emit('data', b.slice(start, start+len));
<add> } else if (this._decoder) {
<add> this._decoder.write(pool.slice(start, end));
<ide> } else {
<ide> var string = b.toString(enc, start, start+len);
<ide> parser.incoming.emit('data', string);
<ide> IncomingMessage.prototype.setBodyEncoding = function (enc) {
<ide> IncomingMessage.prototype.setEncoding = function (enc) {
<ide> // TODO check values, error out on bad, and deprecation message?
<ide> this._encoding = enc.toLowerCase();
<add> if (this._encoding == 'utf-8' || this._encoding == 'utf8') {
<add> this._decoder = new Utf8Stream();
<add> this._decoder.onString = function(str) {
<add> this.emit('data', str);
<add> };
<add> } else if (this._decoder) {
<add> delete this._decoder;
<add> }
<add>
<ide> };
<ide>
<ide> IncomingMessage.prototype.pause = function () { | 1 |
Python | Python | add env opts for optimizer | f403c2cd5f62a3213a9348597b4f779ac558416e | <ide><path>spacy/language.py
<ide> def begin_training(self, get_gold_tuples, **cfg):
<ide> context = proc.begin_training(get_gold_tuples(),
<ide> pipeline=self.pipeline)
<ide> contexts.append(context)
<del> optimizer = Adam(Model.ops, 0.001)
<add> learn_rate = util.env_opt('learn_rate', 0.001)
<add> beta1 = util.env_opt('optimizer_B1', 0.9)
<add> beta2 = util.env_opt('optimizer_B2', 0.999)
<add> eps = util.env_opt('optimizer_eps', 1e-08)
<add> L2 = util.env_opt('L2_penalty', 1e-6)
<add> max_grad_norm = util.env_opt('grad_norm_clip', 1.)
<add> optimizer = Adam(Model.ops, learn_rate, L2=L2, beta1=beta1,
<add> beta2=beta2, eps=eps)
<add> optimizer.max_grad_norm = max_grad_norm
<ide> return optimizer
<ide>
<ide> def evaluate(self, docs_golds): | 1 |
Text | Text | move context api in changelog to "react" section | 18ba36d89165ec15655f2606b0a6ba2e709ce641 | <ide><path>CHANGELOG.md
<ide>
<ide> ### React
<ide>
<add>* Add a new officially supported context API. ([@acdlite](https://github.com/acdlite) in [#11818](https://github.com/facebook/react/pull/11818))
<ide> * Add a new `React.createRef()` API as an ergonomic alternative to callback refs. ([@trueadm](https://github.com/trueadm) in [#12162](https://github.com/facebook/react/pull/12162))
<ide> * Add a new `React.forwardRef()` API to let components forward their refs to a child. ([@bvaughn](https://github.com/bvaughn) in [#12346](https://github.com/facebook/react/pull/12346))
<ide> * Fix a false positive warning in IE11 when using `React.Fragment`. ([@XaveScor](https://github.com/XaveScor) in [#11823](https://github.com/facebook/react/pull/11823))
<ide>
<ide> ### React DOM
<ide>
<del>* Add a new officially supported context API. ([@acdlite](https://github.com/acdlite) in [#11818](https://github.com/facebook/react/pull/11818))
<ide> * Add a new `getDerivedStateFromProps()` lifecycle and `UNSAFE_` aliases for the legacy lifecycles. ([@bvaughn](https://github.com/bvaughn) in [#12028](https://github.com/facebook/react/pull/12028))
<ide> * Add a new `getSnapshotForUpdate()` lifecycle. ([@bvaughn](https://github.com/bvaughn) in [#12404](https://github.com/facebook/react/pull/12404))
<ide> * Add a new `<React.StrictMode>` wrapper to help prepare apps for async rendering. ([@bvaughn](https://github.com/bvaughn) in [#12083](https://github.com/facebook/react/pull/12083)) | 1 |
Javascript | Javascript | use template strings | e266d9e37f7ca337c944a39231d257839f547fb8 | <ide><path>lib/dependencies/ModuleDependencyTemplateAsRequireId.js
<ide> class ModuleDependencyTemplateAsRequireId {
<ide> apply(dep, source, outputOptions, requestShortener) {
<ide> if(!dep.range) return;
<ide> let comment = "";
<del> if(outputOptions.pathinfo) comment = "/*! " + requestShortener.shorten(dep.request) + " */ ";
<add> if(outputOptions.pathinfo) comment = `/*! ${requestShortener.shorten(dep.request)} */ `;
<ide> let content;
<ide> if(dep.module)
<del> content = "__webpack_require__(" + comment + JSON.stringify(dep.module.id) + ")";
<add> content = `__webpack_require__(${comment}${JSON.stringify(dep.module.id)})`;
<ide> else
<ide> content = require("./WebpackMissingModule").module(dep.request);
<ide> source.replace(dep.range[0], dep.range[1] - 1, content); | 1 |
Java | Java | add fast path for classutils.hasmethod() | 8e5cad2af3d0465c98f7269ec1a6262a3f30c1bb | <ide><path>spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
<ide> public int hashCode() {
<ide> */
<ide> private static boolean implementsInterface(Method method, Set<Class<?>> ifcs) {
<ide> for (Class<?> ifc : ifcs) {
<del> if (ClassUtils.hasMethod(ifc, method.getName(), method.getParameterTypes())) {
<add> if (ClassUtils.hasMethod(ifc, method)) {
<ide> return true;
<ide> }
<ide> }
<ide><path>spring-beans/src/main/java/org/springframework/beans/factory/support/AutowireUtils.java
<ide> public static boolean isExcludedFromDependencyCheck(PropertyDescriptor pd) {
<ide> // It was declared by CGLIB, but we might still want to autowire it
<ide> // if it was actually declared by the superclass.
<ide> Class<?> superclass = wm.getDeclaringClass().getSuperclass();
<del> return !ClassUtils.hasMethod(superclass, wm.getName(), wm.getParameterTypes());
<add> return !ClassUtils.hasMethod(superclass, wm);
<ide> }
<ide>
<ide> /**
<ide> public static boolean isSetterDefinedInInterface(PropertyDescriptor pd, Set<Clas
<ide> if (setter != null) {
<ide> Class<?> targetClass = setter.getDeclaringClass();
<ide> for (Class<?> ifc : interfaces) {
<del> if (ifc.isAssignableFrom(targetClass) &&
<del> ClassUtils.hasMethod(ifc, setter.getName(), setter.getParameterTypes())) {
<add> if (ifc.isAssignableFrom(targetClass) && ClassUtils.hasMethod(ifc, setter)) {
<ide> return true;
<ide> }
<ide> }
<ide><path>spring-context/src/main/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssembler.java
<ide> protected boolean includeOperation(Method method, String beanKey) {
<ide> * configured interfaces and is public, otherwise {@code false}.
<ide> */
<ide> private boolean isPublicInInterface(Method method, String beanKey) {
<del> return ((method.getModifiers() & Modifier.PUBLIC) > 0) && isDeclaredInInterface(method, beanKey);
<add> return Modifier.isPublic(method.getModifiers()) && isDeclaredInInterface(method, beanKey);
<ide> }
<ide>
<ide> /**
<ide><path>spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java
<ide> else if (FactoryBean.class.isAssignableFrom(clazz)) {
<ide> factoryBeanType = FactoryBean.class;
<ide> }
<ide> return (factoryBeanType != null && !method.getName().equals("getObject") &&
<del> ClassUtils.hasMethod(factoryBeanType, method.getName(), method.getParameterTypes()));
<add> ClassUtils.hasMethod(factoryBeanType, method));
<ide> }
<ide>
<ide> /**
<ide><path>spring-core/src/main/java/org/springframework/util/ClassUtils.java
<ide> public static boolean hasMethod(Class<?> clazz, String methodName, Class<?>... p
<ide> return (getMethodIfAvailable(clazz, methodName, paramTypes) != null);
<ide> }
<ide>
<add> /**
<add> * Determine whether the given class has a public method with the given signature.
<add> * @param clazz the clazz to analyze
<add> * @param method checked method
<add> * @return whether the class has a corresponding method
<add> * @see Method#getDeclaringClass
<add> */
<add> public static boolean hasMethod(Class<?> clazz, Method method) {
<add> Assert.notNull(clazz, "Class must not be null");
<add> Assert.notNull(method, "Method must not be null");
<add> if (clazz == method.getDeclaringClass()) {
<add> return true;
<add> }
<add> String methodName = method.getName();
<add> Class<?>[] paramTypes = method.getParameterTypes();
<add> return getMethodOrNull(clazz, methodName, paramTypes) != null;
<add> }
<add>
<ide> /**
<ide> * Determine whether the given class has a public method with the given signature,
<ide> * and return it if available (else throws an {@code IllegalStateException}).
<ide> public static Method getMethodIfAvailable(Class<?> clazz, String methodName, @Nu
<ide> Assert.notNull(clazz, "Class must not be null");
<ide> Assert.notNull(methodName, "Method name must not be null");
<ide> if (paramTypes != null) {
<del> try {
<del> return clazz.getMethod(methodName, paramTypes);
<del> }
<del> catch (NoSuchMethodException ex) {
<del> return null;
<del> }
<add> return getMethodOrNull(clazz, methodName, paramTypes);
<ide> }
<ide> else {
<ide> Set<Method> candidates = findMethodCandidatesByName(clazz, methodName);
<ide> private static Set<Method> findMethodCandidatesByName(Class<?> clazz, String met
<ide> }
<ide> return candidates;
<ide> }
<add>
<add> @Nullable
<add> private static Method getMethodOrNull(Class<?> clazz, String methodName, Class<?>[] paramTypes) {
<add> try {
<add> return clazz.getMethod(methodName, paramTypes);
<add> } catch (NoSuchMethodException ex) {
<add> return null;
<add> }
<add> }
<ide> } | 5 |
Ruby | Ruby | fix comment example in ar enum [ci skip] | b4d7be95e635da64b99e833a93c345bb4d6f2ba2 | <ide><path>activerecord/lib/active_record/enum.rb
<ide> def enum(definitions)
<ide> # def active?() status == 0 end
<ide> define_method("#{value}?") { self[name] == i }
<ide>
<del> # def active! update! status: :active end
<add> # def active!() update! status: :active end
<ide> define_method("#{value}!") { update! name => value }
<ide> end
<ide> end | 1 |
PHP | PHP | add seetext and dontseetext methods | 0fe971b5dc41bb5afe51a530dcc17ed3d58ce19f | <ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php
<ide> protected function crawler()
<ide> }
<ide>
<ide> /**
<del> * Assert that a given string is seen on the page.
<add> * Get the HTML from the current context or the full response.
<add> *
<add> * @return string
<add> */
<add> protected function html()
<add> {
<add> return $this->crawler()
<add> ? $this->crawler()->html()
<add> : $this->response->getContent();
<add> }
<add>
<add> /**
<add> * Get the plain text from the current context or the full response.
<add> *
<add> * @return string
<add> */
<add> protected function text()
<add> {
<add> return $this->crawler()
<add> ? $this->crawler()->text()
<add> : strip_tags($this->response->getContent());
<add> }
<add>
<add> /**
<add> * Get the escaped text pattern.
<add> *
<add> * @param string $text
<add> * @return string
<add> */
<add> protected function getEscapedPattern($text)
<add> {
<add> $rawPattern = preg_quote($text, '/');
<add>
<add> $escapedPattern = preg_quote(e($text), '/');
<add>
<add> return $rawPattern == $escapedPattern
<add> ? $rawPattern : "({$rawPattern}|{$escapedPattern})";
<add> }
<add>
<add> /**
<add> * Assert that a given string is seen on the current HTML.
<ide> *
<ide> * @param string $text
<ide> * @param bool $negate
<ide> protected function see($text, $negate = false)
<ide> {
<ide> $method = $negate ? 'assertNotRegExp' : 'assertRegExp';
<ide>
<del> $rawPattern = preg_quote($text, '/');
<add> $pattern = $this->getEscapedPattern($text);
<ide>
<del> $escapedPattern = preg_quote(e($text), '/');
<add> $this->$method("/$pattern/i", $this->html());
<ide>
<del> $pattern = $rawPattern == $escapedPattern
<del> ? $rawPattern : "({$rawPattern}|{$escapedPattern})";
<add> return $this;
<add> }
<add>
<add> /**
<add> * Assert that a given string is not seen on the current HTML.
<add> *
<add> * @param string $text
<add> * @return $this
<add> */
<add> protected function dontSee($text)
<add> {
<add> return $this->see($text, true);
<add> }
<add>
<add> /**
<add> * Assert that a given string is seen on the current text.
<add> *
<add> * @param string $text
<add> * @param bool $negate
<add> * @return $this
<add> */
<add> protected function seeText($text, $negate = false)
<add> {
<add> $method = $negate ? 'assertNotRegExp' : 'assertRegExp';
<ide>
<del> $html = $this->crawler()
<del> ? $this->crawler()->html()
<del> : $this->response->getContent();
<add> $pattern = $this->getEscapedPattern($text);
<ide>
<del> $this->$method("/$pattern/i", $html);
<add> $this->$method("/$pattern/i", $this->text());
<ide>
<ide> return $this;
<ide> }
<ide>
<ide> /**
<del> * Assert that a given string is not seen on the page.
<add> * Assert that a given string is not seen on the current text.
<ide> *
<ide> * @param string $text
<ide> * @return $this
<ide> */
<del> protected function dontSee($text)
<add> protected function dontSeeText($text)
<ide> {
<del> return $this->see($text, true);
<add> return $this->seeText($text, true);
<ide> }
<ide>
<ide> /**
<ide> protected function hasInElement($element, $text)
<ide> {
<ide> $elements = $this->crawler()->filter($element);
<ide>
<del> $rawPattern = preg_quote($text, '/');
<del>
<del> $escapedPattern = preg_quote(e($text), '/');
<del>
<del> $pattern = $rawPattern == $escapedPattern
<del> ? $rawPattern : "({$rawPattern}|{$escapedPattern})";
<add> $pattern = $this->getEscapedPattern($text);
<ide>
<ide> foreach ($elements as $element) {
<ide> $element = new Crawler($element);
<ide><path>tests/Foundation/FoundationInteractsWithPagesTest.php
<ide> public function testDontSee()
<ide> $this->dontSee('Webmasters');
<ide> }
<ide>
<add> public function testSeeTextAndDontSeeText()
<add> {
<add> $this->setCrawler('<p>Laravel is a <strong>PHP Framework</strong>.');
<add>
<add> // The methods see and dontSee compare against the HTML.
<add> $this->see('strong');
<add> $this->dontSee('Laravel is a PHP Framework');
<add>
<add> // seeText and dontSeeText strip the HTML and compare against the plain text.
<add> $this->seeText('Laravel is a PHP Framework.');
<add> $this->dontSeeText('strong');
<add> }
<add>
<ide> public function testSeeInElement()
<ide> {
<ide> $this->setCrawler('<div>Laravel was created by <strong>Taylor Otwell</strong></div>'); | 2 |
Java | Java | implement java.io.closeable where appropriate | ea95da126af330863eb6b0431e86d3819bc97632 | <ide><path>spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java
<ide> /*
<del> * Copyright 2002-2010 the original author or authors.
<add> * Copyright 2002-2012 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> package org.springframework.context;
<ide>
<add>import java.io.Closeable;
<add>
<ide> import org.springframework.beans.BeansException;
<ide> import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
<ide> import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
<ide> * @author Chris Beams
<ide> * @since 03.11.2003
<ide> */
<del>public interface ConfigurableApplicationContext extends ApplicationContext, Lifecycle {
<add>public interface ConfigurableApplicationContext extends ApplicationContext, Lifecycle, Closeable {
<ide>
<ide> /**
<ide> * Any number of these characters are considered delimiters between
<ide><path>spring-jdbc/src/main/java/org/springframework/jdbc/support/lob/LobCreator.java
<ide> /*
<del> * Copyright 2002-2010 the original author or authors.
<add> * Copyright 2002-2012 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> package org.springframework.jdbc.support.lob;
<ide>
<add>import java.io.Closeable;
<ide> import java.io.InputStream;
<ide> import java.io.Reader;
<ide> import java.sql.PreparedStatement;
<ide> * @see java.sql.PreparedStatement#setAsciiStream
<ide> * @see java.sql.PreparedStatement#setCharacterStream
<ide> */
<del>public interface LobCreator {
<add>public interface LobCreator extends Closeable {
<ide>
<ide> /**
<ide> * Set the given content as bytes on the given statement, using the given
<ide><path>spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java
<ide>
<ide> package org.springframework.http.client;
<ide>
<add>import java.io.Closeable;
<ide> import java.io.IOException;
<ide>
<ide> import org.springframework.http.HttpInputMessage;
<ide> * @author Arjen Poutsma
<ide> * @since 3.0
<ide> */
<del>public interface ClientHttpResponse extends HttpInputMessage {
<add>public interface ClientHttpResponse extends HttpInputMessage, Closeable {
<ide>
<ide> /**
<ide> * Return the HTTP status code of the response.
<ide><path>spring-web/src/main/java/org/springframework/http/server/ServerHttpResponse.java
<ide> /*
<del> * Copyright 2002-2009 the original author or authors.
<add> * Copyright 2002-2012 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> package org.springframework.http.server;
<ide>
<add>import java.io.Closeable;
<add>
<ide> import org.springframework.http.HttpOutputMessage;
<ide> import org.springframework.http.HttpStatus;
<ide>
<ide> * @author Arjen Poutsma
<ide> * @since 3.0
<ide> */
<del>public interface ServerHttpResponse extends HttpOutputMessage {
<add>public interface ServerHttpResponse extends HttpOutputMessage, Closeable {
<ide>
<ide> /**
<ide> * Set the HTTP status code of the response. | 4 |
Python | Python | check flask_skip_dotenv in app.run | 6e1e3e03ca188a4d9b3aef493e572157c8ae2313 | <ide><path>flask/app.py
<ide> from .config import Config, ConfigAttribute
<ide> from .ctx import AppContext, RequestContext, _AppCtxGlobals
<ide> from .globals import _request_ctx_stack, g, request, session
<del>from .helpers import _PackageBoundObject, \
<del> _endpoint_from_view_func, find_package, get_env, get_debug_flag, \
<del> get_flashed_messages, locked_cached_property, url_for
<add>from .helpers import (
<add> _PackageBoundObject,
<add> _endpoint_from_view_func, find_package, get_env, get_debug_flag,
<add> get_flashed_messages, locked_cached_property, url_for, get_load_dotenv
<add>)
<ide> from .logging import create_logger
<ide> from .sessions import SecureCookieSessionInterface
<ide> from .signals import appcontext_tearing_down, got_request_exception, \
<ide> def run(self, host=None, port=None, debug=None,
<ide> explain_ignored_app_run()
<ide> return
<ide>
<del> if load_dotenv:
<add> if get_load_dotenv(load_dotenv):
<ide> cli.load_dotenv()
<ide>
<ide> # if set, let env vars override previous values | 1 |
Ruby | Ruby | remove unused variable | 7ecaa0057c6bf653da8a9781454da1dfdc20f143 | <ide><path>guides/rails_guides/markdown/renderer.rb
<ide> def convert_notes(body)
<ide> # if a bulleted list follows the first item is not rendered
<ide> # as a list item, but as a paragraph starting with a plain
<ide> # asterisk.
<del> body.gsub(/^(TIP|IMPORTANT|CAUTION|WARNING|NOTE|INFO|TODO)[.:](.*?)(\n(?=\n)|\Z)/m) do |m|
<add> body.gsub(/^(TIP|IMPORTANT|CAUTION|WARNING|NOTE|INFO|TODO)[.:](.*?)(\n(?=\n)|\Z)/m) do
<ide> css_class = case $1
<ide> when 'CAUTION', 'IMPORTANT'
<ide> 'warning' | 1 |
Mixed | Python | update catch phrase | bbc3fcfa542a2489e838b793a9778eac360f5ae4 | <ide><path>README.md
<del># Keras: Deep Learning for Python
<add># Keras: Deep Learning for humans
<ide>
<ide> 
<ide>
<ide><path>setup.py
<ide>
<ide> setup(name='Keras',
<ide> version='2.1.2',
<del> description='Deep Learning for Python',
<add> description='Deep Learning for humans',
<ide> author='Francois Chollet',
<ide> author_email='francois.chollet@gmail.com',
<ide> url='https://github.com/keras-team/keras', | 2 |
Ruby | Ruby | pass explicit sort to handle apfs | ca69d654564246cf4db326dfb905ab02f32828b9 | <ide><path>Library/Homebrew/cmd/update-report.rb
<ide> def dump_formula_report(key, title)
<ide> return if formulae.empty?
<ide> # Dump formula list.
<ide> ohai title
<del> puts Formatter.columns(formulae)
<add> puts Formatter.columns(formulae.sort)
<ide> end
<ide>
<ide> def installed?(formula) | 1 |
Javascript | Javascript | add loc helper | 0e919f5e99c3615759a11e9bf8832434e8711ee8 | <ide><path>packages/ember-handlebars/lib/helpers.js
<ide> require("ember-handlebars/helpers/each");
<ide> require("ember-handlebars/helpers/template");
<ide> require("ember-handlebars/helpers/partial");
<ide> require("ember-handlebars/helpers/yield");
<add>require("ember-handlebars/helpers/loc");
<ide><path>packages/ember-handlebars/lib/helpers/loc.js
<add>require('ember-handlebars/ext');
<add>
<add>/**
<add>@module ember
<add>@submodule ember-handlebars
<add>*/
<add>
<add>/**
<add> `loc` looks up the string in the localized strings hash.
<add> This is a convenient way to localize text. For example:
<add>
<add> ```html
<add> <script type="text/x-handlebars" data-template-name="home">
<add> {{loc welcome}}
<add> </script>
<add> ```
<add>
<add> @method loc
<add> @for Ember.Handlebars.helpers
<add> @param {String} str The string to format
<add>*/
<add>
<add>Ember.Handlebars.registerHelper('loc', function(str) {
<add> return Ember.String.loc(str);
<add>}); | 2 |
Javascript | Javascript | remove some unnecessary local variables | d4e8b41639bde03bab4520caa7e60358ddc8d045 | <ide><path>src/core/evaluator.js
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide> xobj, smask,
<ide> operatorList,
<ide> state) {
<del> var self = this;
<del>
<ide> var matrix = xobj.dict.get('Matrix');
<ide> var bbox = xobj.dict.get('BBox');
<ide> var group = xobj.dict.get('Group');
<ide><path>web/text_layer_builder.js
<ide> var TextLayerBuilder = function textLayerBuilder(options) {
<ide> };
<ide>
<ide> this.renderLayer = function textLayerBuilderRenderLayer() {
<del> var self = this;
<ide> var textDivs = this.textDivs;
<del> var bidiTexts = this.textContent;
<del> var textLayerDiv = this.textLayerDiv;
<ide> var canvas = document.createElement('canvas');
<ide> var ctx = canvas.getContext('2d');
<ide>
<ide> var TextLayerBuilder = function textLayerBuilder(options) {
<ide> }
<ide> }
<ide>
<del> textLayerDiv.appendChild(textLayerFrag);
<add> this.textLayerDiv.appendChild(textLayerFrag);
<ide> this.renderingDone = true;
<ide> this.updateMatches();
<ide> }; | 2 |
Ruby | Ruby | try tests on gem load failure | 8b63214c2e7493903f40511a59aba4dd60419349 | <ide><path>Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
<ide> def brew(*args)
<ide> ]
<ide> if ENV["HOMEBREW_TESTS_COVERAGE"]
<ide> simplecov_spec = Gem.loaded_specs["simplecov"]
<del> specs = simplecov_spec.runtime_dependencies.flat_map(&:to_specs)
<del> specs << simplecov_spec
<add> specs = [simplecov_spec]
<add> simplecov_spec.runtime_dependencies.each do |dep|
<add> begin
<add> specs += dep.to_specs
<add> rescue Gem::LoadError => e
<add> onoe e
<add> end
<add> end
<ide> libs = specs.flat_map do |spec|
<ide> full_gem_path = spec.full_gem_path
<ide> # full_require_paths isn't available in RubyGems < 2.2. | 1 |
Python | Python | fix 2.3 compatibility on windows | ee8e27ad4facd8123858f3b046f6bba78fea7c89 | <ide><path>numpy/testing/utils.py
<ide> def memusage():
<ide> """ Return memory usage of running python. [Not implemented]"""
<ide> return
<ide>
<del>if os.name=='nt':
<add>if os.name=='nt' and sys.version[:3] > '2.3':
<ide> # Code stolen from enthought/debug/memusage.py
<ide> import win32pdh
<ide> # from win32pdhutil, part of the win32all package | 1 |
Python | Python | add dilation to separableconv2d | 7610c55bdc046ff0b0d6300af5ea9dcfd0a427cb | <ide><path>keras/layers/convolutional.py
<ide> def call(self, inputs):
<ide> self.pointwise_kernel,
<ide> data_format=self.data_format,
<ide> strides=self.strides,
<del> padding=self.padding)
<add> padding=self.padding,
<add> dilation_rate=self.dilation_rate)
<ide>
<ide> if self.bias:
<ide> outputs = K.bias_add(
<ide> def call(self, inputs):
<ide> return self.activation(outputs)
<ide> return outputs
<ide>
<del> def compute_output_shape(self, input_shape):
<del> if self.data_format == 'channels_first':
<del> rows = input_shape[2]
<del> cols = input_shape[3]
<del> elif self.data_format == 'channels_last':
<del> rows = input_shape[1]
<del> cols = input_shape[2]
<del>
<del> rows = conv_utils.conv_output_length(rows, self.kernel_size[0],
<del> self.padding,
<del> self.strides[0])
<del> cols = conv_utils.conv_output_length(cols, self.kernel_size[1],
<del> self.padding,
<del> self.strides[1])
<del> if self.data_format == 'channels_first':
<del> return (input_shape[0], self.filters, rows, cols)
<del> elif self.data_format == 'channels_last':
<del> return (input_shape[0], rows, cols, self.filters)
<del>
<ide> def get_config(self):
<ide> config = super(SeparableConv2D, self).get_config()
<ide> config.pop('kernel_initializer')
<ide><path>tests/keras/layers/convolutional_test.py
<ide> def test_separable_conv_2d():
<ide> for padding in _convolution_paddings:
<ide> for strides in [(1, 1), (2, 2)]:
<ide> for multiplier in [1, 2]:
<del> if padding == 'same' and strides != (1, 1):
<del> continue
<del>
<del> layer_test(convolutional.SeparableConv2D,
<del> kwargs={'filters': filters,
<del> 'kernel_size': (3, 3),
<del> 'padding': padding,
<del> 'strides': strides,
<del> 'depth_multiplier': multiplier},
<del> input_shape=(num_samples, num_row, num_col, stack_size))
<add> for dilation_rate in [(1, 1), (2, 2), (2, 1), (1, 2)]:
<add> if padding == 'same' and strides != (1, 1):
<add> continue
<add> if dilation_rate != (1, 1) and strides != (1, 1):
<add> continue
<add>
<add> layer_test(convolutional.SeparableConv2D,
<add> kwargs={'filters': filters,
<add> 'kernel_size': (3, 3),
<add> 'padding': padding,
<add> 'strides': strides,
<add> 'depth_multiplier': multiplier,
<add> 'dilation_rate': dilation_rate},
<add> input_shape=(num_samples, num_row, num_col, stack_size))
<ide>
<ide> layer_test(convolutional.SeparableConv2D,
<ide> kwargs={'filters': filters, | 2 |
Javascript | Javascript | return a point from cursor word methods | 87d38c0a4d3820d894acbc8d3d1dce8d4f1e17f0 | <ide><path>src/cursor.js
<ide> class Cursor extends Model {
<ide> let result
<ide> for (let range of ranges) {
<ide> if (position.isLessThanOrEqual(range.start)) break
<del> if (allowPrevious || position.isLessThanOrEqual(range.end)) result = range.start
<add> if (allowPrevious || position.isLessThanOrEqual(range.end)) result = Point.fromObject(range.start)
<ide> }
<ide>
<ide> return result || (allowPrevious ? new Point(0, 0) : position)
<ide> class Cursor extends Model {
<ide>
<ide> for (let range of ranges) {
<ide> if (position.isLessThan(range.start) && !allowNext) break
<del> if (position.isLessThan(range.end)) return range.end
<add> if (position.isLessThan(range.end)) return Point.fromObject(range.end)
<ide> }
<ide>
<ide> return allowNext ? this.editor.getEofBufferPosition() : position
<ide> class Cursor extends Model {
<ide> options.wordRegex || this.wordRegExp(),
<ide> new Range(new Point(position.row, 0), new Point(position.row, Infinity))
<ide> )
<del> return ranges.find(range =>
<add> const range = ranges.find(range =>
<ide> range.end.column >= position.column && range.start.column <= position.column
<del> ) || new Range(position, position)
<add> )
<add> return range ? Range.fromObject(range) : new Range(position, position)
<ide> }
<ide>
<ide> // Public: Returns the buffer Range for the current line. | 1 |
Ruby | Ruby | assign `content_type` only once | 235a0b5a5a7930bf20b66128496ee082ee76f6c9 | <ide><path>actionpack/lib/action_controller/metal/data_streaming.rb
<ide> def send_data(data, options = {}) #:doc:
<ide> def send_file_headers!(options)
<ide> type_provided = options.has_key?(:type)
<ide>
<del> self.content_type = DEFAULT_SEND_FILE_TYPE
<add> content_type = options.fetch(:type, DEFAULT_SEND_FILE_TYPE)
<add> self.content_type = content_type
<ide> response.sending_file = true
<ide>
<del> content_type = options.fetch(:type, DEFAULT_SEND_FILE_TYPE)
<ide> raise ArgumentError, ":type option required" if content_type.nil?
<ide>
<ide> if content_type.is_a?(Symbol) | 1 |
Text | Text | add initial changelog for 1.11.0 | 9f3f96220d4243bad86e40b2d3f9283ce46bef85 | <ide><path>CHANGELOG.md
<ide>
<ide> Items starting with `DEPRECATE` are important deprecation notices. For more
<ide> information on the list of deprecated flags and APIs please have a look at
<del>https://docs.docker.com/misc/deprecated/ where target removal dates can also
<add>https://docs.docker.com/engine/deprecated/ where target removal dates can also
<ide> be found.
<ide>
<add>## 1.11.0 (2016-04-12)
<add>
<add>**IMPORTANT**: With Docker 1.11, a docker installation is now made of 4 binaries (`docker`, [`docker-containerd`](https://github.com/docker/containerd), [`docker-containerd-shim`](https://github.com/docker/containerd) and [`docker-runc`](https://github.com/opencontainers/runc)). If you have scripts relying on docker being a single static binaries, please make sure to update them. Interaction with the daemon stay the same otherwise, the usage of the other binaries should be transparent.
<add>
<add>### Builder
<add>
<add>- Fix a bug where Docker would not used the correct uid/gid when processing the `WORKDIR` command ([#21033](https://github.com/docker/docker/pull/21033))
<add>- Fix a bug where copy operations with userns would not use the proper uid/gid ([#20782](https://github.com/docker/docker/pull/20782), [#21162](https://github.com/docker/docker/pull/21162))
<add>
<add>### Client
<add>
<add>* Usage of the `:` separator for security option has been deprecated. `=` should be used instead ([#21232](https://github.com/docker/docker/pull/21232))
<add>+ The client user agent is now passed to the registry on `pull`, `build`, `push`, `login` and `search` operations ([#21306](https://github.com/docker/docker/pull/21306), [#21373](https://github.com/docker/docker/pull/21373))
<add>* Allow setting the Domainname and Hostname separately through the API ([#20200](https://github.com/docker/docker/pull/20200))
<add>* Docker info will now warn users if it can not detect the kernel version or the operating system ([#21128](https://github.com/docker/docker/pull/21128))
<add>- Fix an issue where `docker stats --no-stream` output could be all 0s ([#20803](https://github.com/docker/docker/pull/20803))
<add>- Fix a bug where some newly started container would not appear in a running `docker stats` command ([#20792](https://github.com/docker/docker/pull/20792))
<add>* Post processing is no longer enabled for linux-cgo terminals ([#20587](https://github.com/docker/docker/pull/20587))
<add>- Values to `--hostname` are now refused if they do not comply with [RFC1123](https://tools.ietf.org/html/rfc1123) ([#20566](https://github.com/docker/docker/pull/20566))
<add>+ Docker learned how to use a SOCKS proxy ([#20366](https://github.com/docker/docker/pull/20366), [#18373](https://github.com/docker/docker/pull/18373))
<add>+ Docker now supports external credential stores ([#20107](https://github.com/docker/docker/pull/20107))
<add>* `docker ps` now supports displaying the list of volumes mounted inside a container ([#20017](https://github.com/docker/docker/pull/20017))
<add>* `docker info` now also report Docker's root directory location ([#19986](https://github.com/docker/docker/pull/19986))
<add>- Docker now prohibits login in with an empty username (spaces are trimmed) ([#19806](https://github.com/docker/docker/pull/19806))
<add>* Docker events attributes are now sorted by key ([#19761](https://github.com/docker/docker/pull/19761))
<add>* `docker ps` no longer show exported port for stopped containers ([#19483](https://github.com/docker/docker/pull/19483))
<add>- Docker now cleans after itself if a save/export command fails ([#17849](https://github.com/docker/docker/pull/17849))
<add>* Docker load learned how to display a progress bar ([#17329](https://github.com/docker/docker/pull/17329), [#120078](https://github.com/docker/docker/pull/20078))
<add>
<add>### Distribution
<add>
<add>- Fix a panic that occurred when pulling an images with 0 layers ([#21222](https://github.com/docker/docker/pull/21222))
<add>- Fix a panic that could occur on error while pushing to a registry with a misconfigured token service ([#21212](https://github.com/docker/docker/pull/21212))
<add>+ All first-level delegation roles are now signed when doing a trusted push ([#21046](https://github.com/docker/docker/pull/21046))
<add>+ OAuth support for registries was added ([#20970](https://github.com/docker/docker/pull/20970))
<add>* `docker login` now handles token using the implementation found in [docker/distribution](https://github.com/docker/distribution) ([#20832](https://github.com/docker/docker/pull/20832))
<add>* `docker login` will no longer prompt for an email ([#20565](https://github.com/docker/docker/pull/20565))
<add>* Docker will now fallback to registry V1 if no basic auth credentials are available ([#20241](https://github.com/docker/docker/pull/20241))
<add>* Docker will now try to resume layer download where it left off after a network error/timeout ([#19840](https://github.com/docker/docker/pull/19840))
<add>- Fix generated manifest mediaType when pushing cross-repository ([#19509](https://github.com/docker/docker/pull/19509))
<add>
<add>### Logging
<add>
<add>- Fix a race in the journald log driver ([#21311](https://github.com/docker/docker/pull/21311))
<add>* Docker syslog driver now uses the RFC-5424 format when emitting logs ([#20121](https://github.com/docker/docker/pull/20121))
<add>* Docker GELF log driver now allows to specify the compression algorithm and level via the `gelf-compression-type` and `gelf-compression-level` options ([#19831](https://github.com/docker/docker/pull/19831))
<add>* Docker daemon learned to output uncolorized logs via the `--raw-logs` options ([#19794](https://github.com/docker/docker/pull/19794))
<add>+ Docker, on Windows platform, now includes an ETW (Event Tracing in Windows) logging driver named `etwlogs` ([#19689](https://github.com/docker/docker/pull/19689))
<add>* Journald log driver learned how to handle tags ([#19564](https://github.com/docker/docker/pull/19564))
<add>+ The fluentd log driver learned the following options: `fluentd-address`, `fluentd-buffer-limit`, `fluentd-retry-wait`, `fluentd-max-retries` and `fluentd-async-connect` ([#19439](https://github.com/docker/docker/pull/19439))
<add>+ Docker learned to send log to Google Cloud via the new `gcplogs` logging driver. ([#18766](https://github.com/docker/docker/pull/18766))
<add>
<add>
<add>### Misc
<add>
<add>+ When saving linked images together with `docker save` a subsequent `docker load` will correctly restore their parent/child relationship ([#21385](https://github.com/docker/docker/pull/c))
<add>+ Support for building the Docker cli for OpenBSD was added ([#21325](https://github.com/docker/docker/pull/21325))
<add>+ Labels can now be applied at network, volume and image creation ([#21270](https://github.com/docker/docker/pull/21270))
<add>* The `dockremap` is now created as a system user ([#21266](https://github.com/docker/docker/pull/21266))
<add>- Fix a few response body leaks ([#21258](https://github.com/docker/docker/pull/21258))
<add>- Docker, when run as a service with systemd, will now properly manage its processes cgroups ([#20633](https://github.com/docker/docker/pull/20633))
<add>* Docker info now reports the value of cgroup KernelMemory or emits a warning if it is not supported ([#20863](https://github.com/docker/docker/pull/20863))
<add>* Docker info now also reports the cgroup driver in use ([#20388](https://github.com/docker/docker/pull/20388))
<add>* Docker completion is now available on PowerShell ([#19894](https://github.com/docker/docker/pull/19894))
<add>* `dockerinit` is no more ([#19490](https://github.com/docker/docker/pull/19490),[#19851](https://github.com/docker/docker/pull/19851))
<add>+ Support for building Docker on arm64 was added ([#19013](https://github.com/docker/docker/pull/19013))
<add>+ Experimental support for building docker.exe in a native Windows Docker installation ([#18348](https://github.com/docker/docker/pull/18348))
<add>
<add>### Networking
<add>
<add>- Fix a bug where IPv6 addresses were not properly handled ([#20842](https://github.com/docker/docker/pull/20842))
<add>* `docker network inspect` will now report all endpoints whether they have an active container or not ([#21160](https://github.com/docker/docker/pull/21160))
<add>+ Experimental support for the MacVlan and IPVlan network drivers have been added ([#21122](https://github.com/docker/docker/pull/21122))
<add>* Output of `docker network ls` is now sorted by network name ([#20383](https://github.com/docker/docker/pull/20383))
<add>- Fix a bug where Docker would allow a network to be created with the reserved `default` name ([#19431](https://github.com/docker/docker/pull/19431))
<add>* `docker network inspect` now returns whether a network is internal or not ([#19357](https://github.com/docker/docker/pull/19357))
<add>+ Control IPv6 via explicit option when creating a network (`docker network create --ipv6`). This shows up as a new `EnableIPv6` field in `docker network inspect` ([#17513](https://github.com/docker/docker/pull/17513))
<add>* Support for AAAA Records (aka IPv6 Service Discovery) in embedded DNS Server [#21396](https://github.com/docker/docker/pull/21396)
<add>* Multiple A/AAAA records from embedded DNS Server for DNS Round robin [#21019](https://github.com/docker/docker/pull/21019)
<add>
<add>### Plugins
<add>
<add>- Fix a file descriptor leak that would occur every time plugins were enumerated ([#20686](https://github.com/docker/docker/pull/20686))
<add>- Fix an issue where Authz plugin would corrupt the payload body when faced with a large amount of data ([#20602](https://github.com/docker/docker/pull/20602))
<add>
<add>### Runtime
<add>
<add>+ It is now possible for containers to share the NET and IPC namespaces when `userns` is enabled ([#21383](https://github.com/docker/docker/pull/21383))
<add>+ `docker inspect <image-id>` will now expose the rootfs layers ([#21370](https://github.com/docker/docker/pull/21370))
<add>+ Docker Windows gained a minimal `top` implementation ([#21354](https://github.com/docker/docker/pull/21354))
<add>* Docker learned to report the faulty exe when a container cannot be started due to its condition ([#21345](https://github.com/docker/docker/pull/21345))
<add>* Docker with device mapper will now refuse to run if `udev sync` is not available ([#21097](https://github.com/docker/docker/pull/21097))
<add>- Fix a bug where Docker would not validate the config file upon configuration reload ([#21089](https://github.com/docker/docker/pull/21089))
<add>- Fix a hang that would happen on attach if initial start was to fail ([#21048](https://github.com/docker/docker/pull/21048))
<add>- Fix an issue where registry service options in the daemon configuration file were not properly taken into account ([#21045](https://github.com/docker/docker/pull/21045))
<add>- Fix a race between the exec and resize operations ([#21022](https://github.com/docker/docker/pull/21022))
<add>- Fix an issue where nanoseconds were not correctly taken in account when filtering Docker events ([#21013](https://github.com/docker/docker/pull/21013))
<add>+ pkcs11 hardware signing is no longer an experimental feature ([#21003](https://github.com/docker/docker/pull/21003))
<add>- Fix the handling of Docker command when passed a 64 bytes id ([#21002](https://github.com/docker/docker/pull/21002))
<add>* Docker will now return a `204` (i.e http.StatusNoContent) code when it successfully deleted a network ([#20977](https://github.com/docker/docker/pull/20977))
<add>- Fix a bug where the daemon would wait indefinitely in case the process it was about to killed had already exited on its own ([#20967](https://github.com/docker/docker/pull/20967)
<add>* The devmapper driver learned the `dm.min_free_space` option. If the mapped device free space reaches the passed value, new device creation will be prohibited. ([#20786](https://github.com/docker/docker/pull/20786))
<add>+ Docker can now prevent processes in container to gain new privileges via the `--security-opt=no-new-privileges` flag ([#20727](https://github.com/docker/docker/pull/20727))
<add>- Starting a container with the `--device` option will now correctly resolves symlinks ([#20684](https://github.com/docker/docker/pull/20684))
<add>+ Docker now relies on [`containerd`](https://github.com/docker/containerd) and [`runc`](https://github.com/opencontainers/runc) to spawn containers. ([#20662](https://github.com/docker/docker/pull/20662))
<add>- Fix docker configuration reloading to only alter value present in the given config file ([#20604](https://github.com/docker/docker/pull/20604))
<add>+ Docker now allows setting a container hostname via the `--hostname` flag when `--net=host` ([#20177](https://github.com/docker/docker/pull/20177))
<add>+ Docker now allows executing privileged container while running with `--userns-remap` if both `--privileged` and the new `--userns=host` flag are specified ([#20111](https://github.com/docker/docker/pull/20111))
<add>- Fix Docker not cleaning up correctly old containers upon restarting after a crash ([#19679](https://github.com/docker/docker/pull/19679))
<add>* Docker will now error out if it doesn't recognize a configuration key within the config file ([#19517](https://github.com/docker/docker/pull/19517))
<add>- Fix container loading, on daemon startup, when they depends on a plugin running within a container ([#19500](https://github.com/docker/docker/pull/19500))
<add>* `docker update` learned how to change a container restart policy ([#19116](https://github.com/docker/docker/pull/19116))
<add>* `docker inspect` now also returns a new `State` field containing the container state in a human readable way (i.e. one of `created`, `restarting`, `running`, `paused`, `exited` or `dead`)([#18966](https://github.com/docker/docker/pull/18966))
<add>+ Docker learned to limit the number of active pids (i.e. processes) within the container via the `pids-limit` flags. NOTE: This requires `CGROUP_PIDS=y` to be in the kernel configuration. ([#18697](https://github.com/docker/docker/pull/18697))
<add>
<add>### Security
<add>
<add>* Object with the `pcp_pmcd_t` selinux type were given management access to `/var/lib/docker(/.*)?` ([#21370](https://github.com/docker/docker/pull/21370))
<add>* `restart_syscall`, `copy_file_range`, `mlock2` joined the list of allowed calls in the default seccomp profile ([#21117](https://github.com/docker/docker/pull/21117), [#21262](https://github.com/docker/docker/pull/21262))
<add>* `send`, `recv` and `x32` were added to the list of allowed syscalls and arch in the default seccomp profile ([#19432](https://github.com/docker/docker/pull/19432))
<add>
<add>### Volumes
<add>
<add>* Output of `docker volume ls` is now sorted by volume name ([#20389](https://github.com/docker/docker/pull/20389))
<add>* Local volumes can now accepts options similar to the unix `mount` tool ([#20262](https://github.com/docker/docker/pull/20262))
<add>- Fix an issue where one letter directory name could not be used as source for volumes ([#21106](https://github.com/docker/docker/pull/21106))
<add>+ `docker run -v` now accepts a new flag `nocopy`. This tell the runtime not to copy the container path content into the volume (which is the default behavior) ([#21223](https://github.com/docker/docker/pull/21223))
<add>
<ide> ## 1.10.3 (2016-03-10)
<ide>
<ide> ### Runtime
<ide> be found.
<ide>
<ide> ### Security
<ide>
<del>- Fix linux32 emulation to fail during docker build [#20672](https://github.com/docker/docker/pull/20672)
<add>- Fix linux32 emulation to fail during docker build [#20672](https://github.com/docker/docker/pull/20672)
<ide> It was due to the `personality` syscall being blocked by the default seccomp profile.
<del>- Fix Oracle XE 10g failing to start in a container [#20981](https://github.com/docker/docker/pull/20981)
<add>- Fix Oracle XE 10g failing to start in a container [#20981](https://github.com/docker/docker/pull/20981)
<ide> It was due to the `ipc` syscall being blocked by the default seccomp profile.
<ide> - Fix user namespaces not working on Linux From Scratch [#20685](https://github.com/docker/docker/pull/20685)
<ide> - Fix issue preventing daemon to start if userns is enabled and the `subuid` or `subgid` files contain comments [#20725](https://github.com/docker/docker/pull/20725)
<ide> Engine 1.10 migrator can be found on Docker Hub: https://hub.docker.com/r/docker
<ide> + Add `--tmpfs` flag to `docker run` to create a tmpfs mount in a container [#13587](https://github.com/docker/docker/pull/13587)
<ide> + Add `--format` flag to `docker images` command [#17692](https://github.com/docker/docker/pull/17692)
<ide> + Allow to set daemon configuration in a file and hot-reload it with the `SIGHUP` signal [#18587](https://github.com/docker/docker/pull/18587)
<del>+ Updated docker events to include more meta-data and event types [#18888](https://github.com/docker/docker/pull/18888)
<add>+ Updated docker events to include more meta-data and event types [#18888](https://github.com/docker/docker/pull/18888)
<ide> This change is backward compatible in the API, but not on the CLI.
<ide> + Add `--blkio-weight-device` flag to `docker run` [#13959](https://github.com/docker/docker/pull/13959)
<ide> + Add `--device-read-bps` and `--device-write-bps` flags to `docker run` [#14466](https://github.com/docker/docker/pull/14466)
<ide> Engine 1.10 migrator can be found on Docker Hub: https://hub.docker.com/r/docker
<ide> + Add support for custom seccomp profiles in `--security-opt` [#17989](https://github.com/docker/docker/pull/17989)
<ide> + Add default seccomp profile [#18780](https://github.com/docker/docker/pull/18780)
<ide> + Add `--authorization-plugin` flag to `daemon` to customize ACLs [#15365](https://github.com/docker/docker/pull/15365)
<del>+ Docker Content Trust now supports the ability to read and write user delegations [#18887](https://github.com/docker/docker/pull/18887)
<del> This is an optional, opt-in feature that requires the explicit use of the Notary command-line utility in order to be enabled.
<add>+ Docker Content Trust now supports the ability to read and write user delegations [#18887](https://github.com/docker/docker/pull/18887)
<add> This is an optional, opt-in feature that requires the explicit use of the Notary command-line utility in order to be enabled.
<ide> Enabling delegation support in a specific repository will break the ability of Docker 1.9 and 1.8 to pull from that repository, if content trust is enabled.
<ide> * Allow SELinux to run in a container when using the BTRFS storage driver [#16452](https://github.com/docker/docker/pull/16452)
<ide>
<ide> ### Distribution
<ide>
<del>* Use content-addressable storage for images and layers [#17924](https://github.com/docker/docker/pull/17924)
<del> Note that a migration is performed the first time docker is run; it can take a significant amount of time depending on the number of images and containers present.
<del> Images no longer depend on the parent chain but contain a list of layer references.
<add>* Use content-addressable storage for images and layers [#17924](https://github.com/docker/docker/pull/17924)
<add> Note that a migration is performed the first time docker is run; it can take a significant amount of time depending on the number of images and containers present.
<add> Images no longer depend on the parent chain but contain a list of layer references.
<ide> `docker load`/`docker save` tarballs now also contain content-addressable image configurations.
<del> For more information: https://github.com/docker/docker/wiki/Engine-v1.10.0-content-addressability-migration
<add> For more information: https://github.com/docker/docker/wiki/Engine-v1.10.0-content-addressability-migration
<ide> * Add support for the new [manifest format ("schema2")](https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md) [#18785](https://github.com/docker/docker/pull/18785)
<ide> * Lots of improvements for push and pull: performance++, retries on failed downloads, cancelling on client disconnect [#18353](https://github.com/docker/docker/pull/18353), [#18418](https://github.com/docker/docker/pull/18418), [#19109](https://github.com/docker/docker/pull/19109), [#18353](https://github.com/docker/docker/pull/18353)
<ide> * Limit v1 protocol fallbacks [#18590](https://github.com/docker/docker/pull/18590)
<ide> Engine 1.10 migrator can be found on Docker Hub: https://hub.docker.com/r/docker
<ide> ### Volumes
<ide>
<ide> + Add support to set the mount propagation mode for a volume [#17034](https://github.com/docker/docker/pull/17034)
<del>* Add `ls` and `inspect` endpoints to volume plugin API [#16534](https://github.com/docker/docker/pull/16534)
<del> Existing plugins need to make use of these new APIs to satisfy users' expectation
<add>* Add `ls` and `inspect` endpoints to volume plugin API [#16534](https://github.com/docker/docker/pull/16534)
<add> Existing plugins need to make use of these new APIs to satisfy users' expectation
<ide> For that, please use the new MIME type `application/vnd.docker.plugins.v1.2+json` [#19549](https://github.com/docker/docker/pull/19549)
<ide> - Fix data not being copied to named volumes [#19175](https://github.com/docker/docker/pull/19175)
<ide> - Fix issues preventing volume drivers from being containerized [#19500](https://github.com/docker/docker/pull/19500) | 1 |
Javascript | Javascript | add color palette to tailwind config file | fcc29419c6f29ebc9157243bb11e2da93693cee7 | <ide><path>tools/ui-components/tailwind.config.js
<ide> module.exports = {
<ide> theme: {
<ide> colors: {
<ide> // Configure the color palette here
<del> darkGreen: '#00471b'
<add> // Layout Colors
<add> gray00: '#ffffff',
<add> gray05: '#f5f6f7',
<add> gray10: '#dfdfe2',
<add> gray15: '#d0d0d5',
<add> gray45: '#858591',
<add> gray75: '#3b3b4f',
<add> gray80: '#2a2a40',
<add> gray85: '#1b1b32',
<add> gray90: '#0a0a23',
<add> // Accent Colors - Primary
<add> blue: '#99c9ff',
<add> green: '#acd157',
<add> purple: '#dbb8ff',
<add> yellow: '#f1be32',
<add> // Accent Colors - Secondary
<add> darkBlue: '#002ead',
<add> darkGreen: '#00471b',
<add> darkPurple: '#5a01a7',
<add> darkYellow: '#4d3800',
<add> // Colors in variables.css
<add> blueMid: '#198eee',
<add> blueTranslucent: 'rgba(0, 46, 173, 0.3)',
<add> blueTranslucentDark: 'rgba(153, 201, 255, 0.3)',
<add> editorBackgroundDark: '#2a2b40',
<add> loveDark: '#f82153',
<add> darkRed: '#850000',
<add> editorBackground: '#fffffe',
<add> love: '#f8577c',
<add> purpleMid: '#9400d3',
<add> red: '#ffadad',
<add> yellowGold: '#ffbf00',
<add> yellowLight: '#ffc300'
<ide> }
<ide> },
<ide> variants: { | 1 |
Text | Text | use generated binstubs in guides examples | 981dda53dbb0f573e537e107271d2dce76447110 | <ide><path>guides/source/action_mailer_basics.md
<ide> views.
<ide> #### Create the Mailer
<ide>
<ide> ```bash
<del>$ rails generate mailer UserMailer
<add>$ bin/rails generate mailer UserMailer
<ide> create app/mailers/user_mailer.rb
<ide> invoke erb
<ide> create app/views/user_mailer
<ide> Setting this up is painfully simple.
<ide> First, let's create a simple `User` scaffold:
<ide>
<ide> ```bash
<del>$ rails generate scaffold user name email login
<del>$ rake db:migrate
<add>$ bin/rails generate scaffold user name email login
<add>$ bin/rake db:migrate
<ide> ```
<ide>
<ide> Now that we have a user model to play with, we will just edit the
<ide><path>guides/source/action_view_overview.md
<ide> For each controller there is an associated directory in the `app/views` director
<ide> Let's take a look at what Rails does by default when creating a new resource using the scaffold generator:
<ide>
<ide> ```bash
<del>$ rails generate scaffold post
<add>$ bin/rails generate scaffold post
<ide> [...]
<ide> invoke scaffold_controller
<ide> create app/controllers/posts_controller.rb
<ide><path>guides/source/active_record_validations.md
<ide> end
<ide> We can see how it works by looking at some `rails console` output:
<ide>
<ide> ```ruby
<del>$ rails console
<add>$ bin/rails console
<ide> >> p = Person.new(name: "John Doe")
<ide> => #<Person id: nil, name: "John Doe", created_at: nil, updated_at: nil>
<ide> >> p.new_record?
<ide><path>guides/source/asset_pipeline.md
<ide> information on compiling locally.
<ide> The rake task is:
<ide>
<ide> ```bash
<del>$ RAILS_ENV=production bundle exec rake assets:precompile
<add>$ RAILS_ENV=production bin/rake assets:precompile
<ide> ```
<ide>
<ide> Capistrano (v2.15.1 and above) includes a recipe to handle this in deployment.
<ide><path>guides/source/command_line.md
<ide> With no further work, `rails server` will run our new shiny Rails app:
<ide>
<ide> ```bash
<ide> $ cd commandsapp
<del>$ rails server
<add>$ bin/rails server
<ide> => Booting WEBrick
<ide> => Rails 4.0.0 application starting in development on http://0.0.0.0:3000
<ide> => Call with -d to detach
<ide> INFO: You can also use the alias "s" to start the server: `rails s`.
<ide> The server can be run on a different port using the `-p` option. The default development environment can be changed using `-e`.
<ide>
<ide> ```bash
<del>$ rails server -e production -p 4000
<add>$ bin/rails server -e production -p 4000
<ide> ```
<ide>
<ide> The `-b` option binds Rails to the specified IP, by default it is 0.0.0.0. You can run a server as a daemon by passing a `-d` option.
<ide> The `rails generate` command uses templates to create a whole lot of things. Run
<ide> INFO: You can also use the alias "g" to invoke the generator command: `rails g`.
<ide>
<ide> ```bash
<del>$ rails generate
<add>$ bin/rails generate
<ide> Usage: rails generate GENERATOR [args] [options]
<ide>
<ide> ...
<ide> Let's make our own controller with the controller generator. But what command sh
<ide> INFO: All Rails console utilities have help text. As with most *nix utilities, you can try adding `--help` or `-h` to the end, for example `rails server --help`.
<ide>
<ide> ```bash
<del>$ rails generate controller
<add>$ bin/rails generate controller
<ide> Usage: rails generate controller NAME [action action] [options]
<ide>
<ide> ...
<ide> Example:
<ide> The controller generator is expecting parameters in the form of `generate controller ControllerName action1 action2`. Let's make a `Greetings` controller with an action of **hello**, which will say something nice to us.
<ide>
<ide> ```bash
<del>$ rails generate controller Greetings hello
<add>$ bin/rails generate controller Greetings hello
<ide> create app/controllers/greetings_controller.rb
<ide> route get "greetings/hello"
<ide> invoke erb
<ide> Then the view, to display our message (in `app/views/greetings/hello.html.erb`):
<ide> Fire up your server using `rails server`.
<ide>
<ide> ```bash
<del>$ rails server
<add>$ bin/rails server
<ide> => Booting WEBrick...
<ide> ```
<ide>
<ide> INFO: With a normal, plain-old Rails application, your URLs will generally follo
<ide> Rails comes with a generator for data models too.
<ide>
<ide> ```bash
<del>$ rails generate model
<add>$ bin/rails generate model
<ide> Usage:
<ide> rails generate model NAME [field[:type][:index] field[:type][:index]] [options]
<ide>
<ide> But instead of generating a model directly (which we'll be doing later), let's s
<ide> We will set up a simple resource called "HighScore" that will keep track of our highest score on video games we play.
<ide>
<ide> ```bash
<del>$ rails generate scaffold HighScore game:string score:integer
<add>$ bin/rails generate scaffold HighScore game:string score:integer
<ide> invoke active_record
<ide> create db/migrate/20130717151933_create_high_scores.rb
<ide> create app/models/high_score.rb
<ide> The generator checks that there exist the directories for models, controllers, h
<ide> The migration requires that we **migrate**, that is, run some Ruby code (living in that `20130717151933_create_high_scores.rb`) to modify the schema of our database. Which database? The SQLite3 database that Rails will create for you when we run the `rake db:migrate` command. We'll talk more about Rake in-depth in a little while.
<ide>
<ide> ```bash
<del>$ rake db:migrate
<add>$ bin/rake db:migrate
<ide> == CreateHighScores: migrating ===============================================
<ide> -- create_table(:high_scores)
<ide> -> 0.0017s
<ide> INFO: Let's talk about unit tests. Unit tests are code that tests and makes asse
<ide> Let's see the interface Rails created for us.
<ide>
<ide> ```bash
<del>$ rails server
<add>$ bin/rails server
<ide> ```
<ide>
<ide> Go to your browser and open [http://localhost:3000/high_scores](http://localhost:3000/high_scores), now we can create new high scores (55,160 on Space Invaders!)
<ide> INFO: You can also use the alias "c" to invoke the console: `rails c`.
<ide> You can specify the environment in which the `console` command should operate.
<ide>
<ide> ```bash
<del>$ rails console staging
<add>$ bin/rails console staging
<ide> ```
<ide>
<ide> If you wish to test out some code without changing any data, you can do that by invoking `rails console --sandbox`.
<ide>
<ide> ```bash
<del>$ rails console --sandbox
<add>$ bin/rails console --sandbox
<ide> Loading development environment in sandbox (Rails 4.0.0)
<ide> Any modifications you make will be rolled back on exit
<ide> irb(main):001:0>
<ide> INFO: You can also use the alias "db" to invoke the dbconsole: `rails db`.
<ide> `runner` runs Ruby code in the context of Rails non-interactively. For instance:
<ide>
<ide> ```bash
<del>$ rails runner "Model.long_running_method"
<add>$ bin/rails runner "Model.long_running_method"
<ide> ```
<ide>
<ide> INFO: You can also use the alias "r" to invoke the runner: `rails r`.
<ide>
<ide> You can specify the environment in which the `runner` command should operate using the `-e` switch.
<ide>
<ide> ```bash
<del>$ rails runner -e staging "Model.long_running_method"
<add>$ bin/rails runner -e staging "Model.long_running_method"
<ide> ```
<ide>
<ide> ### `rails destroy`
<ide> Think of `destroy` as the opposite of `generate`. It'll figure out what generate
<ide> INFO: You can also use the alias "d" to invoke the destroy command: `rails d`.
<ide>
<ide> ```bash
<del>$ rails generate model Oops
<add>$ bin/rails generate model Oops
<ide> invoke active_record
<ide> create db/migrate/20120528062523_create_oops.rb
<ide> create app/models/oops.rb
<ide> $ rails generate model Oops
<ide> create test/fixtures/oops.yml
<ide> ```
<ide> ```bash
<del>$ rails destroy model Oops
<add>$ bin/rails destroy model Oops
<ide> invoke active_record
<ide> remove db/migrate/20120528062523_create_oops.rb
<ide> remove app/models/oops.rb
<ide> To get the full backtrace for running rake task you can pass the option
<ide> ```--trace``` to command line, for example ```rake db:create --trace```.
<ide>
<ide> ```bash
<del>$ rake --tasks
<add>$ bin/rake --tasks
<ide> rake about # List versions of all Rails frameworks and the environment
<ide> rake assets:clean # Remove compiled assets
<ide> rake assets:precompile # Compile all the assets named in config.assets.precompile
<ide> INFO: You can also use ```rake -T``` to get the list of tasks.
<ide> `rake about` gives information about version numbers for Ruby, RubyGems, Rails, the Rails subcomponents, your application's folder, the current Rails environment name, your app's database adapter, and schema version. It is useful when you need to ask for help, check if a security patch might affect you, or when you need some stats for an existing Rails installation.
<ide>
<ide> ```bash
<del>$ rake about
<add>$ bin/rake about
<ide> About your application's environment
<ide> Ruby version 1.9.3 (x86_64-linux)
<ide> RubyGems version 1.3.6
<ide> The `doc:` namespace has the tools to generate documentation for your app, API d
<ide> `rake notes` will search through your code for comments beginning with FIXME, OPTIMIZE or TODO. The search is done in files with extension `.builder`, `.rb`, `.rake`, `.yml`, `.yaml`, `.ruby`, `.css`, `.js` and `.erb` for both default and custom annotations.
<ide>
<ide> ```bash
<del>$ rake notes
<add>$ bin/rake notes
<ide> (in /home/foobar/commandsapp)
<ide> app/controllers/admin/users_controller.rb:
<ide> * [ 20] [TODO] any other way to do this?
<ide> config.annotations.register_extensions("scss", "sass", "less") { |annotation| /\
<ide> If you are looking for a specific annotation, say FIXME, you can use `rake notes:fixme`. Note that you have to lower case the annotation's name.
<ide>
<ide> ```bash
<del>$ rake notes:fixme
<add>$ bin/rake notes:fixme
<ide> (in /home/foobar/commandsapp)
<ide> app/controllers/admin/users_controller.rb:
<ide> * [132] high priority for next deploy
<ide> app/models/school.rb:
<ide> You can also use custom annotations in your code and list them using `rake notes:custom` by specifying the annotation using an environment variable `ANNOTATION`.
<ide>
<ide> ```bash
<del>$ rake notes:custom ANNOTATION=BUG
<add>$ bin/rake notes:custom ANNOTATION=BUG
<ide> (in /home/foobar/commandsapp)
<ide> app/models/post.rb:
<ide> * [ 23] Have to fix this one before pushing!
<ide> By default, `rake notes` will look in the `app`, `config`, `lib`, `bin` and `tes
<ide>
<ide> ```bash
<ide> $ export SOURCE_ANNOTATION_DIRECTORIES='spec,vendor'
<del>$ rake notes
<add>$ bin/rake notes
<ide> (in /home/foobar/commandsapp)
<ide> app/models/user.rb:
<ide> * [ 35] [FIXME] User should have a subscription at this point
<ide> end
<ide> Invocation of the tasks will look like:
<ide>
<ide> ```bash
<del>rake task_name
<del>rake "task_name[value 1]" # entire argument string should be quoted
<del>rake db:nothing
<add>$ bin/rake task_name
<add>$ bin/rake "task_name[value 1]" # entire argument string should be quoted
<add>$ bin/rake db:nothing
<ide> ```
<ide>
<ide> NOTE: If your need to interact with your application models, perform database queries and so on, your task should depend on the `environment` task, which will load your application code.
<ide><path>guides/source/configuring.md
<ide> development:
<ide> $ echo $DATABASE_URL
<ide> postgresql://localhost/my_database
<ide>
<del>$ rails runner 'puts ActiveRecord::Base.connections'
<add>$ bin/rails runner 'puts ActiveRecord::Base.connections'
<ide> {"development"=>{"adapter"=>"postgresql", "host"=>"localhost", "database"=>"my_database"}}
<ide> ```
<ide>
<ide> development:
<ide> $ echo $DATABASE_URL
<ide> postgresql://localhost/my_database
<ide>
<del>$ rails runner 'puts ActiveRecord::Base.connections'
<add>$ bin/rails runner 'puts ActiveRecord::Base.connections'
<ide> {"development"=>{"adapter"=>"postgresql", "host"=>"localhost", "database"=>"my_database", "pool"=>5}}
<ide> ```
<ide>
<ide> development:
<ide> $ echo $DATABASE_URL
<ide> postgresql://localhost/my_database
<ide>
<del>$ rails runner 'puts ActiveRecord::Base.connections'
<add>$ bin/rails runner 'puts ActiveRecord::Base.connections'
<ide> {"development"=>{"adapter"=>"sqlite3", "database"=>"NOT_my_database"}}
<ide> ```
<ide>
<ide><path>guides/source/engines.md
<ide> options as appropriate to the need. For the "blorgh" example, you will need to
<ide> create a "mountable" engine, running this command in a terminal:
<ide>
<ide> ```bash
<del>$ rails plugin new blorgh --mountable
<add>$ bin/rails plugin new blorgh --mountable
<ide> ```
<ide>
<ide> The full list of options for the plugin generator may be seen by typing:
<ide>
<ide> ```bash
<del>$ rails plugin --help
<add>$ bin/rails plugin --help
<ide> ```
<ide>
<ide> The `--full` option tells the generator that you want to create an engine,
<ide> within the `Engine` class definition. Without it, classes generated in an engine
<ide> **may** conflict with an application.
<ide>
<ide> What this isolation of the namespace means is that a model generated by a call
<del>to `rails g model`, such as `rails g model post`, won't be called `Post`, but
<add>to `bin/rails g model`, such as `bin/rails g model post`, won't be called `Post`, but
<ide> instead be namespaced and called `Blorgh::Post`. In addition, the table for the
<ide> model is namespaced, becoming `blorgh_posts`, rather than simply `posts`.
<ide> Similar to the model namespacing, a controller called `PostsController` becomes
<ide> This means that you will be able to generate new controllers and models for this
<ide> engine very easily by running commands like this:
<ide>
<ide> ```bash
<del>rails g model
<add>$ bin/rails g model
<ide> ```
<ide>
<ide> Keep in mind, of course, that anything generated with these commands inside of
<ide> The first thing to generate for a blog engine is the `Post` model and related
<ide> controller. To quickly generate this, you can use the Rails scaffold generator.
<ide>
<ide> ```bash
<del>$ rails generate scaffold post title:string text:text
<add>$ bin/rails generate scaffold post title:string text:text
<ide> ```
<ide>
<ide> This command will output this information:
<ide> From the application root, run the model generator. Tell it to generate a
<ide> and `text` text column.
<ide>
<ide> ```bash
<del>$ rails generate model Comment post_id:integer text:text
<add>$ bin/rails generate model Comment post_id:integer text:text
<ide> ```
<ide>
<ide> This will output the following:
<ide> called `Blorgh::Comment`. Now run the migration to create our blorgh_comments
<ide> table:
<ide>
<ide> ```bash
<del>$ rake db:migrate
<add>$ bin/rake db:migrate
<ide> ```
<ide>
<ide> To show the comments on a post, edit `app/views/blorgh/posts/show.html.erb` and
<ide> The route now exists, but the controller that this route goes to does not. To
<ide> create it, run this command from the application root:
<ide>
<ide> ```bash
<del>$ rails g controller comments
<add>$ bin/rails g controller comments
<ide> ```
<ide>
<ide> This will generate the following things:
<ide> engine's models can query them correctly. To copy these migrations into the
<ide> application use this command:
<ide>
<ide> ```bash
<del>$ rake blorgh:install:migrations
<add>$ bin/rake blorgh:install:migrations
<ide> ```
<ide>
<ide> If you have multiple engines that need migrations copied over, use
<ide> `railties:install:migrations` instead:
<ide>
<ide> ```bash
<del>$ rake railties:install:migrations
<add>$ bin/rake railties:install:migrations
<ide> ```
<ide>
<ide> This command, when run for the first time, will copy over all the migrations
<ide> of associating the records in the `blorgh_posts` table with the records in the
<ide> To generate this new column, run this command within the engine:
<ide>
<ide> ```bash
<del>$ rails g migration add_author_id_to_blorgh_posts author_id:integer
<add>$ bin/rails g migration add_author_id_to_blorgh_posts author_id:integer
<ide> ```
<ide>
<ide> NOTE: Due to the migration's name and the column specification after it, Rails
<ide> This migration will need to be run on the application. To do that, it must first
<ide> be copied using this command:
<ide>
<ide> ```bash
<del>$ rake blorgh:install:migrations
<add>$ bin/rake blorgh:install:migrations
<ide> ```
<ide>
<ide> Notice that only _one_ migration was copied over here. This is because the first
<ide> with the same name already exists. Copied migration
<ide> Run the migration using:
<ide>
<ide> ```bash
<del>$ rake db:migrate
<add>$ bin/rake db:migrate
<ide> ```
<ide>
<ide> Now with all the pieces in place, an action will take place that will associate
<ide><path>guides/source/generators.md
<ide> When you create an application using the `rails` command, you are in fact using
<ide> ```bash
<ide> $ rails new myapp
<ide> $ cd myapp
<del>$ rails generate
<add>$ bin/rails generate
<ide> ```
<ide>
<ide> You will get a list of all generators that comes with Rails. If you need a detailed description of the helper generator, for example, you can simply do:
<ide>
<ide> ```bash
<del>$ rails generate helper --help
<add>$ bin/rails generate helper --help
<ide> ```
<ide>
<ide> Creating Your First Generator
<ide> Our new generator is quite simple: it inherits from `Rails::Generators::Base` an
<ide> To invoke our new generator, we just need to do:
<ide>
<ide> ```bash
<del>$ rails generate initializer
<add>$ bin/rails generate initializer
<ide> ```
<ide>
<ide> Before we go on, let's see our brand new generator description:
<ide>
<ide> ```bash
<del>$ rails generate initializer --help
<add>$ bin/rails generate initializer --help
<ide> ```
<ide>
<ide> Rails is usually able to generate good descriptions if a generator is namespaced, as `ActiveRecord::Generators::ModelGenerator`, but not in this particular case. We can solve this problem in two ways. The first one is calling `desc` inside our generator:
<ide> Creating Generators with Generators
<ide> Generators themselves have a generator:
<ide>
<ide> ```bash
<del>$ rails generate generator initializer
<add>$ bin/rails generate generator initializer
<ide> create lib/generators/initializer
<ide> create lib/generators/initializer/initializer_generator.rb
<ide> create lib/generators/initializer/USAGE
<ide> First, notice that we are inheriting from `Rails::Generators::NamedBase` instead
<ide> We can see that by invoking the description of this new generator (don't forget to delete the old generator file):
<ide>
<ide> ```bash
<del>$ rails generate initializer --help
<add>$ bin/rails generate initializer --help
<ide> Usage:
<ide> rails generate initializer NAME [options]
<ide> ```
<ide> end
<ide> And let's execute our generator:
<ide>
<ide> ```bash
<del>$ rails generate initializer core_extensions
<add>$ bin/rails generate initializer core_extensions
<ide> ```
<ide>
<ide> We can see that now an initializer named core_extensions was created at `config/initializers/core_extensions.rb` with the contents of our template. That means that `copy_file` copied a file in our source root to the destination path we gave. The method `file_name` is automatically created when we inherit from `Rails::Generators::NamedBase`.
<ide> end
<ide> Before we customize our workflow, let's first see what our scaffold looks like:
<ide>
<ide> ```bash
<del>$ rails generate scaffold User name:string
<add>$ bin/rails generate scaffold User name:string
<ide> invoke active_record
<ide> create db/migrate/20130924151154_create_users.rb
<ide> create app/models/user.rb
<ide> If we generate another resource with the scaffold generator, we can see that sty
<ide> To demonstrate this, we are going to create a new helper generator that simply adds some instance variable readers. First, we create a generator within the rails namespace, as this is where rails searches for generators used as hooks:
<ide>
<ide> ```bash
<del>$ rails generate generator rails/my_helper
<add>$ bin/rails generate generator rails/my_helper
<ide> create lib/generators/rails/my_helper
<ide> create lib/generators/rails/my_helper/my_helper_generator.rb
<ide> create lib/generators/rails/my_helper/USAGE
<ide> end
<ide> We can try out our new generator by creating a helper for products:
<ide>
<ide> ```bash
<del>$ rails generate my_helper products
<add>$ bin/rails generate my_helper products
<ide> create app/helpers/products_helper.rb
<ide> ```
<ide>
<ide> end
<ide> and see it in action when invoking the generator:
<ide>
<ide> ```bash
<del>$ rails generate scaffold Post body:text
<add>$ bin/rails generate scaffold Post body:text
<ide> [...]
<ide> invoke my_helper
<ide> create app/helpers/posts_helper.rb
<ide> end
<ide> Now, if you create a Comment scaffold, you will see that the shoulda generators are being invoked, and at the end, they are just falling back to TestUnit generators:
<ide>
<ide> ```bash
<del>$ rails generate scaffold Comment body:text
<add>$ bin/rails generate scaffold Comment body:text
<ide> invoke active_record
<ide> create db/migrate/20130924143118_create_comments.rb
<ide> create app/models/comment.rb
<ide><path>guides/source/getting_started.md
<ide> To verify that you have everything installed correctly, you should be able to
<ide> run the following:
<ide>
<ide> ```bash
<del>$ rails --version
<add>$ bin/rails --version
<ide> ```
<ide>
<ide> If it says something like "Rails 4.1.0", you are ready to continue.
<ide> start a web server on your development machine. You can do this by running the
<ide> following in the `blog` directory:
<ide>
<ide> ```bash
<del>$ rails server
<add>$ bin/rails server
<ide> ```
<ide>
<ide> TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the
<ide> tell it you want a controller called "welcome" with an action called "index",
<ide> just like this:
<ide>
<ide> ```bash
<del>$ rails generate controller welcome index
<add>$ bin/rails generate controller welcome index
<ide> ```
<ide>
<ide> Rails will create several files and a route for you.
<ide> will be seen later, but for now notice that Rails has inferred the
<ide> singular form `article` and makes meaningful use of the distinction.
<ide>
<ide> ```bash
<del>$ rake routes
<add>$ bin/rake routes
<ide> Prefix Verb URI Pattern Controller#Action
<ide> articles GET /articles(.:format) articles#index
<ide> POST /articles(.:format) articles#create
<ide> a controller called `ArticlesController`. You can do this by running this
<ide> command:
<ide>
<ide> ```bash
<del>$ rails g controller articles
<add>$ bin/rails g controller articles
<ide> ```
<ide>
<ide> If you open up the newly generated `app/controllers/articles_controller.rb`
<ide> To see what Rails will do with this, we look back at the output of
<ide> `rake routes`:
<ide>
<ide> ```bash
<del>$ rake routes
<add>$ bin/rake routes
<ide> Prefix Verb URI Pattern Controller#Action
<ide> articles GET /articles(.:format) articles#index
<ide> POST /articles(.:format) articles#create
<ide> Rails developers tend to use when creating new models. To create the new model,
<ide> run this command in your terminal:
<ide>
<ide> ```bash
<del>$ rails generate model Article title:string text:text
<add>$ bin/rails generate model Article title:string text:text
<ide> ```
<ide>
<ide> With that command we told Rails that we want a `Article` model, together
<ide> TIP: For more information about migrations, refer to [Rails Database Migrations]
<ide> At this point, you can use a rake command to run the migration:
<ide>
<ide> ```bash
<del>$ rake db:migrate
<add>$ bin/rake db:migrate
<ide> ```
<ide>
<ide> Rails will execute this migration command and tell you it created the Articles
<ide> the `Article` model. This time we'll create a `Comment` model to hold
<ide> reference of article comments. Run this command in your terminal:
<ide>
<ide> ```bash
<del>$ rails generate model Comment commenter:string body:text article:references
<add>$ bin/rails generate model Comment commenter:string body:text article:references
<ide> ```
<ide>
<ide> This command will generate four files:
<ide> the two models. An index for this association is also created on this column.
<ide> Go ahead and run the migration:
<ide>
<ide> ```bash
<del>$ rake db:migrate
<add>$ bin/rake db:migrate
<ide> ```
<ide>
<ide> Rails is smart enough to only execute the migrations that have not already been
<ide> With the model in hand, you can turn your attention to creating a matching
<ide> controller. Again, we'll use the same generator we used before:
<ide>
<ide> ```bash
<del>$ rails generate controller Comments
<add>$ bin/rails generate controller Comments
<ide> ```
<ide>
<ide> This creates six files and one empty directory:
<ide><path>guides/source/migrations.md
<ide> Of course, calculating timestamps is no fun, so Active Record provides a
<ide> generator to handle making it for you:
<ide>
<ide> ```bash
<del>$ rails generate migration AddPartNumberToProducts
<add>$ bin/rails generate migration AddPartNumberToProducts
<ide> ```
<ide>
<ide> This will create an empty but appropriately named migration:
<ide> followed by a list of column names and types then a migration containing the
<ide> appropriate `add_column` and `remove_column` statements will be created.
<ide>
<ide> ```bash
<del>$ rails generate migration AddPartNumberToProducts part_number:string
<add>$ bin/rails generate migration AddPartNumberToProducts part_number:string
<ide> ```
<ide>
<ide> will generate
<ide> end
<ide> If you'd like to add an index on the new column, you can do that as well:
<ide>
<ide> ```bash
<del>$ rails generate migration AddPartNumberToProducts part_number:string:index
<add>$ bin/rails generate migration AddPartNumberToProducts part_number:string:index
<ide> ```
<ide>
<ide> will generate
<ide> end
<ide> Similarly, you can generate a migration to remove a column from the command line:
<ide>
<ide> ```bash
<del>$ rails generate migration RemovePartNumberFromProducts part_number:string
<add>$ bin/rails generate migration RemovePartNumberFromProducts part_number:string
<ide> ```
<ide>
<ide> generates
<ide> end
<ide> You are not limited to one magically generated column. For example:
<ide>
<ide> ```bash
<del>$ rails generate migration AddDetailsToProducts part_number:string price:decimal
<add>$ bin/rails generate migration AddDetailsToProducts part_number:string price:decimal
<ide> ```
<ide>
<ide> generates
<ide> followed by a list of column names and types then a migration creating the table
<ide> XXX with the columns listed will be generated. For example:
<ide>
<ide> ```bash
<del>$ rails generate migration CreateProducts name:string part_number:string
<add>$ bin/rails generate migration CreateProducts name:string part_number:string
<ide> ```
<ide>
<ide> generates
<ide> Also, the generator accepts column type as `references`(also available as
<ide> `belongs_to`). For instance:
<ide>
<ide> ```bash
<del>$ rails generate migration AddUserRefToProducts user:references
<add>$ bin/rails generate migration AddUserRefToProducts user:references
<ide> ```
<ide>
<ide> generates
<ide> This migration will create a `user_id` column and appropriate index.
<ide> There is also a generator which will produce join tables if `JoinTable` is part of the name:
<ide>
<ide> ```bash
<del>rails g migration CreateJoinTableCustomerProduct customer product
<add>$ bin/rails g migration CreateJoinTableCustomerProduct customer product
<ide> ```
<ide>
<ide> will produce the following migration:
<ide> relevant table. If you tell Rails what columns you want, then statements for
<ide> adding these columns will also be created. For example, running:
<ide>
<ide> ```bash
<del>$ rails generate model Product name:string description:text
<add>$ bin/rails generate model Product name:string description:text
<ide> ```
<ide>
<ide> will create a migration that looks like this
<ide> braces. You can use the following modifiers:
<ide> For instance, running:
<ide>
<ide> ```bash
<del>$ rails generate migration AddDetailsToProducts 'price:decimal{5,2}' supplier:references{polymorphic}
<add>$ bin/rails generate migration AddDetailsToProducts 'price:decimal{5,2}' supplier:references{polymorphic}
<ide> ```
<ide>
<ide> will produce a migration that looks like this
<ide> is the numerical prefix on the migration's filename. For example, to migrate
<ide> to version 20080906120000 run:
<ide>
<ide> ```bash
<del>$ rake db:migrate VERSION=20080906120000
<add>$ bin/rake db:migrate VERSION=20080906120000
<ide> ```
<ide>
<ide> If version 20080906120000 is greater than the current version (i.e., it is
<ide> mistake in it and wish to correct it. Rather than tracking down the version
<ide> number associated with the previous migration you can run:
<ide>
<ide> ```bash
<del>$ rake db:rollback
<add>$ bin/rake db:rollback
<ide> ```
<ide>
<ide> This will rollback the latest migration, either by reverting the `change`
<ide> method or by running the `down` method. If you need to undo
<ide> several migrations you can provide a `STEP` parameter:
<ide>
<ide> ```bash
<del>$ rake db:rollback STEP=3
<add>$ bin/rake db:rollback STEP=3
<ide> ```
<ide>
<ide> will revert the last 3 migrations.
<ide> back up again. As with the `db:rollback` task, you can use the `STEP` parameter
<ide> if you need to go more than one version back, for example:
<ide>
<ide> ```bash
<del>$ rake db:migrate:redo STEP=3
<add>$ bin/rake db:migrate:redo STEP=3
<ide> ```
<ide>
<ide> Neither of these Rake tasks do anything you could not do with `db:migrate`. They
<ide> the corresponding migration will have its `change`, `up` or `down` method
<ide> invoked, for example:
<ide>
<ide> ```bash
<del>$ rake db:migrate:up VERSION=20080906120000
<add>$ bin/rake db:migrate:up VERSION=20080906120000
<ide> ```
<ide>
<ide> will run the 20080906120000 migration by running the `change` method (or the
<ide> To run migrations against another environment you can specify it using the
<ide> migrations against the `test` environment you could run:
<ide>
<ide> ```bash
<del>$ rake db:migrate RAILS_ENV=test
<add>$ bin/rake db:migrate RAILS_ENV=test
<ide> ```
<ide>
<ide> ### Changing the Output of Running Migrations
<ide><path>guides/source/plugins.md
<ide> to run integration tests using a dummy Rails application. Create your
<ide> plugin with the command:
<ide>
<ide> ```bash
<del>$ rails plugin new yaffle
<add>$ bin/rails plugin new yaffle
<ide> ```
<ide>
<ide> See usage and options by asking for help:
<ide>
<ide> ```bash
<del>$ rails plugin --help
<add>$ bin/rails plugin --help
<ide> ```
<ide>
<ide> Testing Your Newly Generated Plugin
<ide> To test that your method does what it says it does, run the unit tests with `rak
<ide> To see this in action, change to the test/dummy directory, fire up a console and start squawking:
<ide>
<ide> ```bash
<del>$ rails console
<add>$ bin/rails console
<ide> >> "Hello World".to_squawk
<ide> => "squawk! Hello World"
<ide> ```
<ide> test/dummy directory:
<ide>
<ide> ```bash
<ide> $ cd test/dummy
<del>$ rails generate model Hickwall last_squawk:string
<del>$ rails generate model Wickwall last_squawk:string last_tweet:string
<add>$ bin/rails generate model Hickwall last_squawk:string
<add>$ bin/rails generate model Wickwall last_squawk:string last_tweet:string
<ide> ```
<ide>
<ide> Now you can create the necessary database tables in your testing database by navigating to your dummy app
<ide> and migrating the database. First, run:
<ide>
<ide> ```bash
<ide> $ cd test/dummy
<del>$ rake db:migrate
<add>$ bin/rake db:migrate
<ide> ```
<ide>
<ide> While you are here, change the Hickwall and Wickwall models so that they know that they are supposed to act
<ide> Once your README is solid, go through and add rdoc comments to all of the method
<ide> Once your comments are good to go, navigate to your plugin directory and run:
<ide>
<ide> ```bash
<del>$ rake rdoc
<add>$ bin/rake rdoc
<ide> ```
<ide>
<ide> ### References
<ide><path>guides/source/rails_application_templates.md
<ide> $ rails new blog -m http://example.com/template.rb
<ide> You can use the rake task `rails:template` to apply templates to an existing Rails application. The location of the template needs to be passed in to an environment variable named LOCATION. Again, this can either be path to a file or a URL.
<ide>
<ide> ```bash
<del>$ rake rails:template LOCATION=~/template.rb
<del>$ rake rails:template LOCATION=http://example.com/template.rb
<add>$ bin/rake rails:template LOCATION=~/template.rb
<add>$ bin/rake rails:template LOCATION=http://example.com/template.rb
<ide> ```
<ide>
<ide> Template API
<ide><path>guides/source/rails_on_rack.md
<ide> NOTE: `ActionDispatch::MiddlewareStack` is Rails equivalent of `Rack::Builder`,
<ide> Rails has a handy rake task for inspecting the middleware stack in use:
<ide>
<ide> ```bash
<del>$ rake middleware
<add>$ bin/rake middleware
<ide> ```
<ide>
<ide> For a freshly generated Rails application, this might produce something like:
<ide> And now if you inspect the middleware stack, you'll find that `Rack::Lock` is
<ide> not a part of it.
<ide>
<ide> ```bash
<del>$ rake middleware
<add>$ bin/rake middleware
<ide> (in /Users/lifo/Rails/blog)
<ide> use ActionDispatch::Static
<ide> use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000001c304c8>
<ide><path>guides/source/routing.md
<ide> edit_user GET /users/:id/edit(.:format) users#edit
<ide> You may restrict the listing to the routes that map to a particular controller setting the `CONTROLLER` environment variable:
<ide>
<ide> ```bash
<del>$ CONTROLLER=users rake routes
<add>$ CONTROLLER=users bin/rake routes
<ide> ```
<ide>
<ide> TIP: You'll find that the output from `rake routes` is much more readable if you widen your terminal window until the output lines don't wrap.
<ide><path>guides/source/testing.md
<ide> NOTE: For more information on Rails <i>scaffolding</i>, refer to [Getting Starte
<ide> When you use `rails generate scaffold`, for a resource among other things it creates a test stub in the `test/models` folder:
<ide>
<ide> ```bash
<del>$ rails generate scaffold post title:string body:text
<add>$ bin/rails generate scaffold post title:string body:text
<ide> ...
<ide> create app/models/post.rb
<ide> create test/models/post_test.rb
<ide> In order to run your tests, your test database will need to have the current str
<ide> Running a test is as simple as invoking the file containing the test cases through `rake test` command.
<ide>
<ide> ```bash
<del>$ rake test test/models/post_test.rb
<add>$ bin/rake test test/models/post_test.rb
<ide> .
<ide>
<ide> Finished tests in 0.009262s, 107.9680 tests/s, 107.9680 assertions/s.
<ide> Finished tests in 0.009262s, 107.9680 tests/s, 107.9680 assertions/s.
<ide> You can also run a particular test method from the test case by running the test and providing the `test method name`.
<ide>
<ide> ```bash
<del>$ rake test test/models/post_test.rb test_the_truth
<add>$ bin/rake test test/models/post_test.rb test_the_truth
<ide> .
<ide>
<ide> Finished tests in 0.009064s, 110.3266 tests/s, 110.3266 assertions/s.
<ide> end
<ide> Let us run this newly added test.
<ide>
<ide> ```bash
<del>$ rake test test/models/post_test.rb test_should_not_save_post_without_title
<add>$ bin/rake test test/models/post_test.rb test_should_not_save_post_without_title
<ide> F
<ide>
<ide> Finished tests in 0.044632s, 22.4054 tests/s, 22.4054 assertions/s.
<ide> end
<ide> Now the test should pass. Let us verify by running the test again:
<ide>
<ide> ```bash
<del>$ rake test test/models/post_test.rb test_should_not_save_post_without_title
<add>$ bin/rake test test/models/post_test.rb test_should_not_save_post_without_title
<ide> .
<ide>
<ide> Finished tests in 0.047721s, 20.9551 tests/s, 20.9551 assertions/s.
<ide> end
<ide> Now you can see even more output in the console from running the tests:
<ide>
<ide> ```bash
<del>$ rake test test/models/post_test.rb test_should_report_error
<add>$ bin/rake test test/models/post_test.rb test_should_report_error
<ide> E
<ide>
<ide> Finished tests in 0.030974s, 32.2851 tests/s, 0.0000 assertions/s.
<ide> backtrace. simply set the `BACKTRACE` environment variable to enable this
<ide> behavior:
<ide>
<ide> ```bash
<del>$ BACKTRACE=1 rake test test/models/post_test.rb
<add>$ BACKTRACE=1 bin/rake test test/models/post_test.rb
<ide> ```
<ide>
<ide> ### What to Include in Your Unit Tests
<ide> Integration tests are used to test the interaction among any number of controlle
<ide> Unlike Unit and Functional tests, integration tests have to be explicitly created under the 'test/integration' folder within your application. Rails provides a generator to create an integration test skeleton for you.
<ide>
<ide> ```bash
<del>$ rails generate integration_test user_flows
<add>$ bin/rails generate integration_test user_flows
<ide> exists test/integration/
<ide> create test/integration/user_flows_test.rb
<ide> ```
<ide> located under the `test/helpers` directory. Rails provides a generator which
<ide> generates both the helper and the test file:
<ide>
<ide> ```bash
<del>$ rails generate helper User
<add>$ bin/rails generate helper User
<ide> create app/helpers/user_helper.rb
<ide> invoke test_unit
<ide> create test/helpers/user_helper_test.rb
<ide><path>guides/source/upgrading_ruby_on_rails.md
<ide> AppName::Application.config.session_store :cookie_store, key: 'SOMETHINGNEW'
<ide> or
<ide>
<ide> ```bash
<del>$ rake db:sessions:clear
<add>$ bin/rake db:sessions:clear
<ide> ```
<ide>
<ide> ### Remove :cache and :concat options in asset helpers references in views | 16 |
Java | Java | convert field to local | 0669a38b0113a5c4de14ad93d1845a332dcdd566 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/XReactInstanceManagerImpl.java
<ide> private final MemoryPressureRouter mMemoryPressureRouter;
<ide> private final @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
<ide> private final JSCConfig mJSCConfig;
<del> private @Nullable RedBoxHandler mRedBoxHandler;
<ide>
<ide> private final ReactInstanceDevCommandsHandler mDevInterface =
<ide> new ReactInstanceDevCommandsHandler() {
<ide> public T get() throws Exception {
<ide> mJSMainModuleName = jsMainModuleName;
<ide> mPackages = packages;
<ide> mUseDeveloperSupport = useDeveloperSupport;
<del> mRedBoxHandler = redBoxHandler;
<ide> mDevSupportManager = DevSupportManagerFactory.create(
<ide> applicationContext,
<ide> mDevInterface,
<ide> mJSMainModuleName,
<ide> useDeveloperSupport,
<del> mRedBoxHandler);
<add> redBoxHandler);
<ide> mBridgeIdleDebugListener = bridgeIdleDebugListener;
<ide> mLifecycleState = initialLifecycleState;
<ide> mUIImplementationProvider = uiImplementationProvider; | 1 |
Text | Text | remove old changelogs | 8a6010be76cd2fb514a8698e652e12d08be5a300 | <ide><path>CHANGELOG-5.2.md
<del># Release Notes
<del>
<del>## [Unreleased]
<del>
<del>### Fixed
<del>- Fixed deferring write connection ([#16673](https://github.com/laravel/framework/pull/16673))
<del>
<del>
<del>## v5.2.45 (2016-08-26)
<del>
<del>### Fixed
<del>- Revert changes to Eloquent `Builder` that breaks `firstOr*` methods ([#15018](https://github.com/laravel/framework/pull/15018))
<del>- Revert aggregate changes in [#14793](https://github.com/laravel/framework/pull/14793) ([#14994](https://github.com/laravel/framework/pull/14994))
<del>
<del>
<del>## v5.2.44 (2016-08-23)
<del>
<del>### Added
<del>- Added `BelongsToMany::syncWithoutDetaching()` method ([33aee31](https://github.com/laravel/framework/commit/33aee31523b9fc280aced35a5eb5f6b627263b45))
<del>- Added `withoutTrashed()` method to `SoftDeletingScope` ([#14805](https://github.com/laravel/framework/pull/14805))
<del>- Support Flysystem's `disable_asserts` config value ([#14864](https://github.com/laravel/framework/pull/14864))
<del>
<del>### Changed
<del>- Support multi-dimensional `$data` arrays in `invalid()` and `valid()` methods ([#14651](https://github.com/laravel/framework/pull/14651))
<del>- Support column aliases in `chunkById()` ([#14711](https://github.com/laravel/framework/pull/14711))
<del>- Re-attempt transaction when encountering a deadlock ([#14930](https://github.com/laravel/framework/pull/14930))
<del>
<del>### Fixed
<del>- Only return floats or integers in `aggregate()` ([#14781](https://github.com/laravel/framework/pull/14781))
<del>- Fixed numeric aggregate queries ([#14793](https://github.com/laravel/framework/pull/14793))
<del>- Create new row in `firstOrCreate()` when a model has a mutator ([#14656](https://github.com/laravel/framework/pull/14656))
<del>- Protect against empty paths in the `view:clear` command ([#14812](https://github.com/laravel/framework/pull/14812))
<del>- Convert `$attributes` in `makeHidden()` to array ([#14852](https://github.com/laravel/framework/pull/14852), [#14857](https://github.com/laravel/framework/pull/14857))
<del>- Prevent conflicting class name import to namespace in `ValidatesWhenResolvedTrait` ([#14878](https://github.com/laravel/framework/pull/14878))
<del>
<del>
<del>## v5.2.43 (2016-08-10)
<del>
<del>### Changed
<del>- Throw exception if `$amount` is not numeric in `increment()` and `decrement()` ([915cb84](https://github.com/laravel/framework/commit/915cb843981ad434b10709425d968bf2db37cb1a))
<del>
<del>
<del>## v5.2.42 (2016-08-08)
<del>
<del>### Added
<del>- Allow `BelongsToMany::detach()` to accept a collection ([#14412](https://github.com/laravel/framework/pull/14412))
<del>- Added `whereTime()` and `orWhereTime()` to query builder ([#14528](https://github.com/laravel/framework/pull/14528))
<del>- Added PHP 7.1 support ([#14549](https://github.com/laravel/framework/pull/14549))
<del>- Allow collections to be created from objects that implement `Traversable` ([#14628](https://github.com/laravel/framework/pull/14628))
<del>- Support dot notation in `Request::exists()` ([#14660](https://github.com/laravel/framework/pull/14660))
<del>- Added missing `Model::makeHidden()` method ([#14641](https://github.com/laravel/framework/pull/14641))
<del>
<del>### Changed
<del>- Return `true` when `$key` is empty in `MessageBag::has()` ([#14409](https://github.com/laravel/framework/pull/14409))
<del>- Optimized `Filesystem::moveDirectory` ([#14362](https://github.com/laravel/framework/pull/14362))
<del>- Convert `$count` to integer in `Str::plural()` ([#14502](https://github.com/laravel/framework/pull/14502))
<del>- Handle arrays in `validateIn()` method ([#14607](https://github.com/laravel/framework/pull/14607))
<del>
<del>### Fixed
<del>- Fixed an issue with `wherePivotIn()` ([#14397](https://github.com/laravel/framework/issues/14397))
<del>- Fixed PDO connection on HHVM ([#14429](https://github.com/laravel/framework/pull/14429))
<del>- Prevent `make:migration` from creating duplicate classes ([#14432](https://github.com/laravel/framework/pull/14432))
<del>- Fixed lazy eager loading issue in `LengthAwarePaginator` collection ([#14476](https://github.com/laravel/framework/pull/14476))
<del>- Fixed plural form of Pokémon ([#14525](https://github.com/laravel/framework/pull/14525))
<del>- Fixed authentication bug in `TokenGuard::validate()` ([#14568](https://github.com/laravel/framework/pull/14568))
<del>- Fix missing middleware parameters when using `authorizeResource()` ([#14592](https://github.com/laravel/framework/pull/14592))
<del>
<del>### Removed
<del>- Removed duplicate interface implementation in `Dispatcher` ([#14515](https://github.com/laravel/framework/pull/14515))
<del>
<del>
<del>## v5.2.41 (2016-07-20)
<del>
<del>### Changed
<del>- Run session garbage collection before response is returned ([#14386](https://github.com/laravel/framework/pull/14386))
<del>
<del>### Fixed
<del>- Fixed pagination bug introduced in [#14188](https://github.com/laravel/framework/pull/14188) ([#14389](https://github.com/laravel/framework/pull/14389))
<del>- Fixed `median()` issue when collection is out of order ([#14381](https://github.com/laravel/framework/pull/14381))
<del>
<del>
<del>## v5.2.40 (2016-07-19)
<del>
<del>### Added
<del>- Added `--tags` option to `cache:clear` command ([#13927](https://github.com/laravel/framework/pull/13927))
<del>- Added `scopes()` method to Eloquent query builder ([#14049](https://github.com/laravel/framework/pull/14049))
<del>- Added `hasAny()` method to `MessageBag` ([#14151](https://github.com/laravel/framework/pull/14151))
<del>- Allowing passing along transmission options to SparkPost ([#14166](https://github.com/laravel/framework/pull/14166))
<del>- Added `Filesystem::moveDirectory()` ([#14198](https://github.com/laravel/framework/pull/14198))
<del>- Added `increment()` and `decrement()` methods to session store ([#14196](https://github.com/laravel/framework/pull/14196))
<del>- Added `pipe()` method to `Collection` ([#13899](https://github.com/laravel/framework/pull/13899))
<del>- Added additional PostgreSQL operators ([#14224](https://github.com/laravel/framework/pull/14224))
<del>- Support `::` expressions in Blade directive names ([#14265](https://github.com/laravel/framework/pull/14265))
<del>- Added `median()` and `mode()` methods to collections ([#14305](https://github.com/laravel/framework/pull/14305))
<del>- Add `tightenco/collect` to Composer `replace` list ([#14118](https://github.com/laravel/framework/pull/14118), [#14127](https://github.com/laravel/framework/pull/14127))
<del>
<del>### Changed
<del>- Don't release jobs that have been reserved too long ([#13833](https://github.com/laravel/framework/pull/13833))
<del>- Throw `Exception` if `Queue` has no encrypter ([#14038](https://github.com/laravel/framework/pull/14038))
<del>- Cast `unique` validation rule `id` to integer ([#14076](https://github.com/laravel/framework/pull/14076))
<del>- Ensure database transaction count is not negative ([#14085](https://github.com/laravel/framework/pull/14085))
<del>- Use `session.lifetime` for CSRF cookie ([#14080](https://github.com/laravel/framework/pull/14080))
<del>- Allow the `shuffle()` method to be seeded ([#14099](https://github.com/laravel/framework/pull/14099))
<del>- Allow passing of multiple keys to `MessageBag::has()` ([a0cd0ae](https://github.com/laravel/framework/commit/a0cd0aea9a475f76baf968ef2f53aeb71fcda4c0))
<del>- Allow model connection in `newFromBuilder()` to be overridden ([#14194](https://github.com/laravel/framework/pull/14194))
<del>- Only load pagination results if `$total` is greater than zero ([#14188](https://github.com/laravel/framework/pull/14188))
<del>- Accept fallback parameter in `UrlGenerator::previous` ([#14207](https://github.com/laravel/framework/pull/14207))
<del>- Only do `use` call if `database` is not empty ([#14225](https://github.com/laravel/framework/pull/14225))
<del>- Removed unnecessary nesting in the `Macroable` trait ([#14222](https://github.com/laravel/framework/pull/14222))
<del>- Refactored `DatabaseQueue::getNextAvailableJob()` ([cffcd34](https://github.com/laravel/framework/commit/cffcd347901617b19e8eca05be55cda280e0d262))
<del>- Look for `getUrl()` method on Filesystem adapter before throwing exception ([#14246](https://github.com/laravel/framework/pull/14246))
<del>- Make `seeIsSelected()` work with `<option>` elements without `value` attributes ([#14279](https://github.com/laravel/framework/pull/14279))
<del>- Improved performance of `Filesystem::sharedGet()` ([#14319](https://github.com/laravel/framework/pull/14319))
<del>- Throw exception if view cache path is empty ([#14291](https://github.com/laravel/framework/pull/14291))
<del>- Changes several validation methods return type from integers to booleans ([#14373](https://github.com/laravel/framework/pull/14373))
<del>- Remove files from input in `withInput()` method ([85249be](https://github.com/laravel/framework/commit/85249beed1e4512d71f7ae52474b9a59a80381d2))
<del>
<del>### Fixed
<del>- Require file instance for `dimensions` validation rule ([#14025](https://github.com/laravel/framework/pull/14025))
<del>- Fixes for SQL Server `processInsertGetId()` with ODBC ([#14121](https://github.com/laravel/framework/pull/14121))
<del>- Fixed PostgreSQL `processInsertGetId()` with `PDO::FETCH_CLASS` ([#14115](https://github.com/laravel/framework/pull/14115))
<del>- Fixed `PDO::FETCH_CLASS` support in `Connection::cursor()` ([#14052](https://github.com/laravel/framework/pull/14052))
<del>- Fixed eager loading of multi-level `morphTo` relationships ([#14190](https://github.com/laravel/framework/pull/14190))
<del>- Fixed MySQL multiple-table DELETE ([#14179](https://github.com/laravel/framework/pull/14179))
<del>- Always cast `vendor:publish` tags to array ([#14228](https://github.com/laravel/framework/pull/14228))
<del>- Fixed translation capitalization when replacements are a numerical array ([#14249](https://github.com/laravel/framework/pull/14249))
<del>- Fixed double `urldecode()` on route parameters ([#14370](https://github.com/laravel/framework/pull/14370))
<del>
<del>### Removed
<del>- Remove method overwrites in `PostgresGrammar` ([#14372](https://github.com/laravel/framework/pull/14372))
<del>
<del>
<del>## v5.2.39 (2016-06-17)
<del>
<del>### Added
<del>- Added `without()` method to Eloquent query builder ([#14031](https://github.com/laravel/framework/pull/14031))
<del>- Added `keyType` property Eloquent models to set key type cast ([#13985](https://github.com/laravel/framework/pull/13985))
<del>- Added support for mail transport `StreamOptions` ([#13925](https://github.com/laravel/framework/pull/13925))
<del>- Added `validationData()` method to `FormRequest` ([#13914](https://github.com/laravel/framework/pull/13914))
<del>
<del>### Changed
<del>- Only `set names` for MySQL connections if `charset` is set in config ([#13930](https://github.com/laravel/framework/pull/13930))
<del>- Support recursive container alias resolution ([#13976](https://github.com/laravel/framework/pull/13976))
<del>- Use late static binding in `PasswordBroker` ([#13975](https://github.com/laravel/framework/pull/13975))
<del>- Make sure Ajax requests are not Pjax requests in `FormRequest` ([#14024](https://github.com/laravel/framework/pull/14024))
<del>- Set existence state of expired database sessions, instead of deleting them ([53c0440](https://github.com/laravel/framework/commit/53c04406baa5f63bbb41127f40afee0a0facadd1))
<del>- Release Beanstalkd jobs before burying them ([#13963](https://github.com/laravel/framework/pull/13963))
<del>
<del>### Fixed
<del>- Use `getIncrementing()` method instead of the `$incrementing` attribute ([#14005](https://github.com/laravel/framework/pull/14005))
<del>- Fixed fatal error when `services.json` is empty ([#14030](https://github.com/laravel/framework/pull/14030))
<del>
<del>
<del>## v5.2.38 (2016-06-13)
<del>
<del>### Changed
<del>- Convert multiple `Model::fresh()` arguments to array before passing to `with()` ([#13950](https://github.com/laravel/framework/pull/13950))
<del>- Iterate only through files that contain a namespace in `app:name` command. ([#13961](https://github.com/laravel/framework/pull/13961))
<del>
<del>### Fixed
<del>- Close swift mailer connection after sending mail ([#13583](https://github.com/laravel/framework/pull/13583))
<del>- Prevent possible key overlap in `Str::snake` cache ([#13943](https://github.com/laravel/framework/pull/13943))
<del>- Fixed issue when eager loading chained `MorphTo` relationships ([#13967](https://github.com/laravel/framework/pull/13967))
<del>- Delete database session record if it's expired ([09b09eb](https://github.com/laravel/framework/commit/09b09ebad480940f2b49f96bbfbea0647783025e))
<del>
<del>
<del>## v5.2.37 (2016-06-10)
<del>
<del>### Added
<del>- Added `hasArgument()` and `hasOption()` methods to `Command` class ([#13919](https://github.com/laravel/framework/pull/13919))
<del>- Added `$failedId` property to `JobFailed` event ([#13920](https://github.com/laravel/framework/pull/13920))
<del>
<del>### Fixed
<del>- Fixed session expiration on several drivers ([0831312](https://github.com/laravel/framework/commit/0831312aec47d904a65039e07574f41ab7492418))
<del>
<del>
<del>## v5.2.36 (2016-06-06)
<del>
<del>### Added
<del>- Allow passing along options to the S3 client ([#13791](https://github.com/laravel/framework/pull/13791))
<del>- Allow nested `WHERE` clauses in `whereHas()` queries ([#13794](https://github.com/laravel/framework/pull/13794))
<del>- Support `DateTime` instances in `Before`/`After` date validation ([#13844](https://github.com/laravel/framework/pull/13844))
<del>- Support queueing collections ([d159f02](https://github.com/laravel/framework/commit/d159f02fe8cb5310b90c73d416a684e4bf51785a))
<del>
<del>### Changed
<del>- Reverted SparkPost driver back to `email_rfc822` parameter for simplicity ([#13780](https://github.com/laravel/framework/pull/13780))
<del>- Simplified `Model::__isset()` ([8fb89c6](https://github.com/laravel/framework/commit/8fb89c61c24af905b0b9db4d645d68a2c4a133b9))
<del>- Set exception handler even on non-daemon `queue:work` calls ([d5bbda9](https://github.com/laravel/framework/commit/d5bbda95a6435fa8cb38b8b640440b38de6b7f83))
<del>- Show handler class names in `queue:work` console output ([4d7eb59](https://github.com/laravel/framework/commit/4d7eb59f9813723bab00b4e42ce9885b54e65778))
<del>- Use queue events to update the console output of `queue:work` ([ace7f04](https://github.com/laravel/framework/commit/ace7f04ae579146ca3adf1c5992256c50ddc05a8))
<del>- Made `ResetsPasswords` trait easier to customize ([#13818](https://github.com/laravel/framework/pull/13818))
<del>- Refactored Eloquent relations and scopes ([#13824](https://github.com/laravel/framework/pull/13824), [#13884](https://github.com/laravel/framework/pull/13884), [#13894](https://github.com/laravel/framework/pull/13894))
<del>- Respected `session.http_only` option in `StartSession` middleware ([#13825](https://github.com/laravel/framework/pull/13825))
<del>- Don't return in `ApcStore::forever()` ([#13871](https://github.com/laravel/framework/pull/13871))
<del>- Allow Redis key expiration to be lower than one minute ([#13810](https://github.com/laravel/framework/pull/13810))
<del>
<del>### Fixed
<del>- Fixed `morphTo` relations across database connections ([#13784](https://github.com/laravel/framework/pull/13784))
<del>- Fixed `morphTo` relations without soft deletes ([13806](https://github.com/laravel/framework/pull/13806))
<del>- Fixed edge case on `morphTo` relations macro call that only exists on the related model ([#13828](https://github.com/laravel/framework/pull/13828))
<del>- Fixed formatting of `updatedAt` timestamp when calling `touch()` on `BelongsToMany` relation ([#13799](https://github.com/laravel/framework/pull/13799))
<del>- Don't get `$id` from Recaller in `Auth::id()` ([#13769](https://github.com/laravel/framework/pull/13769))
<del>- Fixed `AuthorizesResources` trait ([25443e3](https://github.com/laravel/framework/commit/25443e3e218cce1121f546b596dd70b5fd2fb619))
<del>
<del>### Removed
<del>- Removed unused `ArrayStore::putMultiple()` method ([#13840](https://github.com/laravel/framework/pull/13840))
<del>
<del>
<del>## v5.2.35 (2016-05-30)
<del>
<del>### Added
<del>- Added failed login event ([#13761](https://github.com/laravel/framework/pull/13761))
<del>
<del>### Changed
<del>- Always cast `FileStore::expiration()` return value to integer ([#13708](https://github.com/laravel/framework/pull/13708))
<del>- Simplified `Container::isCallableWithAtSign()` ([#13757](https://github.com/laravel/framework/pull/13757))
<del>- Pass key to the `Collection::keyBy()` callback ([#13766](https://github.com/laravel/framework/pull/13766))
<del>- Support unlimited log files by setting `app.log_max_files` to `0` ([#13776](https://github.com/laravel/framework/pull/13776))
<del>- Wathan-ize `MorphTo::getEagerLoadsForInstance()` ([#13741](https://github.com/laravel/framework/pull/13741), [#13777](https://github.com/laravel/framework/pull/13777))
<del>
<del>### Fixed
<del>- Fixed MySQL JSON boolean binding update grammar ([38acdd8](https://github.com/laravel/framework/commit/38acdd807faec4b85fd47051341ccaf666499551))
<del>- Fixed loading of nested polymorphic relationships ([#13737](https://github.com/laravel/framework/pull/13737))
<del>- Fixed early return in `AuthManager::shouldUse()` ([5b88244](https://github.com/laravel/framework/commit/5b88244c0afd5febe9f54e8544b0870b55ef6cfd))
<del>- Fixed the remaining attempts calculation in `ThrottleRequests` ([#13756](https://github.com/laravel/framework/pull/13756), [#13759](https://github.com/laravel/framework/pull/13759))
<del>- Fixed strict `TypeError` in `AbstractPaginator::url()` ([#13758](https://github.com/laravel/framework/pull/13758))
<del>
<del>## v5.2.34 (2016-05-26)
<del>
<del>### Added
<del>- Added correct MySQL JSON boolean handling and updating grammar ([#13242](https://github.com/laravel/framework/pull/13242))
<del>- Added `stream` option to mail `TransportManager` ([#13715](https://github.com/laravel/framework/pull/13715))
<del>- Added `when()` method to eloquent query builder ([#13726](https://github.com/laravel/framework/pull/13726))
<del>
<del>### Changed
<del>- Catch exceptions in `Worker::pop()` to prevent log spam ([#13688](https://github.com/laravel/framework/pull/13688))
<del>- Use write connection when validating uniqueness ([#13718](https://github.com/laravel/framework/pull/13718))
<del>- Use `withException()` method in `Handler::toIlluminateResponse()` ([#13712](https://github.com/laravel/framework/pull/13712))
<del>- Apply constraints to `morphTo` relationships when using eager loading ([#13724](https://github.com/laravel/framework/pull/13724))
<del>- Use SETs rather than LISTs for storing Redis cache key references ([#13731](https://github.com/laravel/framework/pull/13731))
<del>
<del>### Fixed
<del>- Map `destroy` instead of `delete` in `AuthorizesResources` ([#13716](https://github.com/laravel/framework/pull/13716))
<del>- Reverted [#13519](https://github.com/laravel/framework/pull/13519) ([#13733](https://github.com/laravel/framework/pull/13733))
<del>
<del>
<del>## v5.2.33 (2016-05-25)
<del>
<del>### Added
<del>- Allow query results to be traversed using a cursor ([#13030](https://github.com/laravel/framework/pull/13030))
<del>- Added support for log levels ([#13513](https://github.com/laravel/framework/pull/13513))
<del>- Added `inRandomOrder()` method to query builder ([#13642](https://github.com/laravel/framework/pull/13642))
<del>- Added support for custom connection in `PasswordBrokerManager` ([#13646](https://github.com/laravel/framework/pull/13646))
<del>- Allow connection timeouts in `TransportManager` ([#13621](https://github.com/laravel/framework/pull/13621))
<del>- Added missing `$test` argument to `UploadedFile` ([#13656](https://github.com/laravel/framework/pull/13656))
<del>- Added `authenticate()` method to guards ([#13651](https://github.com/laravel/framework/pull/13651))
<del>
<del>### Changed
<del>- Use locking to migrate stale jobs ([26a24d6](https://github.com/laravel/framework/commit/26a24d61ced4c5833eba6572d585af90b22fcdb7))
<del>- Avoid `chunkById` duplicating `orders` clause with the same column ([#13604](https://github.com/laravel/framework/pull/13604))
<del>- Fire `RouteMatched` event on `route:list` command ([#13474](https://github.com/laravel/framework/pull/13474))
<del>- Set user resolver for request in `AuthManager::shouldUse()` ([bf5303f](https://github.com/laravel/framework/commit/bf5303fdc919d9d560df128b92a1891dc64ea488))
<del>- Always execute `use` call, unless database is empty ([#13701](https://github.com/laravel/framework/pull/13701), [ef770ed](https://github.com/laravel/framework/commit/ef770edb08f3540aefffd916ae6ef5c8db58f0af))
<del>- Allow `elixir()` `$buildDirectory` to be `null`. ([#13661](https://github.com/laravel/framework/pull/13661))
<del>- Simplified calling `Model::replicate()` with `$except` argument ([#13676](https://github.com/laravel/framework/pull/13676))
<del>- Allow auth events to be serialized ([#13704](https://github.com/laravel/framework/pull/13704))
<del>- Added `for` and `id` attributes to auth scaffold ([#13689](https://github.com/laravel/framework/pull/13689))
<del>- Acquire lock before deleting reserved job ([4b502dc](https://github.com/laravel/framework/commit/4b502dc6eecd80efad01e845469b9a2bac26dae0#diff-b05083dc38b4e45d38d28c676abbad83))
<del>
<del>### Fixed
<del>- Prefix timestamps when updating many-to-many relationships ([#13519](https://github.com/laravel/framework/pull/13519))
<del>- Fixed missing wheres defined on the relation when creating the subquery for a relation count ([#13612](https://github.com/laravel/framework/pull/13612))
<del>- Fixed `Model::makeVisible()` when `$visible` property is not empty ([#13625](https://github.com/laravel/framework/pull/13625))
<del>- Fixed PostgreSQL's `Schema::hasTable()` ([#13008](https://github.com/laravel/framework/pull/13008))
<del>- Fixed `url` validation rule when missing trailing slash ([#13700](https://github.com/laravel/framework/pull/13700))
<del>
<del>
<del>## v5.2.32 (2016-05-17)
<del>
<del>### Added
<del>- Allow user to enable/disable foreign key checks dynamically ([#13333](https://github.com/laravel/framework/pull/13333))
<del>- Added `file` validation rule ([#13371](https://github.com/laravel/framework/pull/13371))
<del>- Added `guestMiddleware()` method to get guest middleware with guard parameter ([#13384](https://github.com/laravel/framework/pull/13384))
<del>- Added `Pivot::fromRawAttributes()` to create a new pivot model from raw values returned from a query ([f356419](https://github.com/laravel/framework/commit/f356419fa6f6b6fbc3322ca587b0bc1e075ba8d2))
<del>- Added `Builder::withCount()` to add a relationship subquery count ([#13414](https://github.com/laravel/framework/pull/13414))
<del>- Support `reply_to` field when using SparkPost ([#13410](https://github.com/laravel/framework/pull/13410))
<del>- Added validation rule for image dimensions ([#13428](https://github.com/laravel/framework/pull/13428))
<del>- Added "Generated Columns" support to MySQL grammar ([#13430](https://github.com/laravel/framework/pull/13430))
<del>- Added `Response::throwResponse()` ([#13473](https://github.com/laravel/framework/pull/13473))
<del>- Added `page` parameter to the `simplePaginate()` method ([#13502](https://github.com/laravel/framework/pull/13502))
<del>- Added `whereColumn()` method to Query Builder ([#13549](https://github.com/laravel/framework/pull/13549))
<del>- Allow `File::allFiles()` to show hidden dot files ([#13555](https://github.com/laravel/framework/pull/13555))
<del>
<del>### Changed
<del>- Return `null` instead of `0` for a default `BelongsTo` key ([#13378](https://github.com/laravel/framework/pull/13378))
<del>- Avoid useless logical operation ([#13397](https://github.com/laravel/framework/pull/13397))
<del>- Stop using `{!! !!}` for `csrf_field()` ([#13398](https://github.com/laravel/framework/pull/13398))
<del>- Improvements for `SessionGuard` methods `loginUsingId()` and `onceUsingId()` ([#13393](https://github.com/laravel/framework/pull/13393))
<del>- Added Work-around due to lack of `lastInsertId()` for ODBC for MSSQL ([#13423](https://github.com/laravel/framework/pull/13423))
<del>- Ensure `MigrationCreator::create()` receives `$create` as boolean ([#13439](https://github.com/laravel/framework/pull/13439))
<del>- Allow custom validators to be called with out function name ([#13444](https://github.com/laravel/framework/pull/13444))
<del>- Moved the `payload` column of jobs table to the end ([#13469](https://github.com/laravel/framework/pull/13469))
<del>- Stabilized table aliases for self joins by adding count ([#13401](https://github.com/laravel/framework/pull/13401))
<del>- Account for `__isset` changes in PHP 7 ([#13509](https://github.com/laravel/framework/pull/13509))
<del>- Bring back support for `Carbon` instances to `before` and `after` validators ([#13494](https://github.com/laravel/framework/pull/13494))
<del>- Allow method chaining for `MakesHttpRequest` trait ([#13529](https://github.com/laravel/framework/pull/13529))
<del>- Allow `Request::intersect()` to accept argument list ([#13515](https://github.com/laravel/framework/pull/13515))
<del>
<del>### Fixed
<del>- Accept `!=` and `<>` as operators while value is `null` ([#13370](https://github.com/laravel/framework/pull/13370))
<del>- Fixed SparkPost BCC issue ([#13361](https://github.com/laravel/framework/pull/13361))
<del>- Fixed fatal error with optional `morphTo` relationship ([#13360](https://github.com/laravel/framework/pull/13360))
<del>- Fixed using `onlyTrashed()` and `withTrashed()` with `whereHas()` ([#13396](https://github.com/laravel/framework/pull/13396))
<del>- Fixed automatic scope nesting ([#13413](https://github.com/laravel/framework/pull/13413))
<del>- Fixed scheduler issue when using `user()` and `withoutOverlapping()` combined ([#13412](https://github.com/laravel/framework/pull/13412))
<del>- Fixed SqlServer grammar issue when table name is equal to a reserved keyword ([#13458](https://github.com/laravel/framework/pull/13458))
<del>- Fixed replacing route default parameters ([#13514](https://github.com/laravel/framework/pull/13514))
<del>- Fixed missing model attribute on `ModelNotFoundException` ([#13537](https://github.com/laravel/framework/pull/13537))
<del>- Decrement transaction count when `beginTransaction()` errors ([#13551](https://github.com/laravel/framework/pull/13551))
<del>- Fixed `seeJson()` issue when comparing two equal arrays ([#13531](https://github.com/laravel/framework/pull/13531))
<del>- Fixed a Scheduler issue where would no longer run in background ([#12628](https://github.com/laravel/framework/issues/12628))
<del>- Fixed sending attachments with SparkPost ([#13577](https://github.com/laravel/framework/pull/13577))
<del>
<del>
<del>## v5.2.31 (2016-04-27)
<del>
<del>### Added
<del>- Added missing suggested dependency `SuperClosure` ([09a793f](https://git.io/vwZx4))
<del>- Added ODBC connection support for SQL Server ([#13298](https://github.com/laravel/framework/pull/13298))
<del>- Added `Request::hasHeader()` method ([#13271](https://github.com/laravel/framework/pull/13271))
<del>- Added `@elsecan` and `@elsecannot` Blade directives ([#13256](https://github.com/laravel/framework/pull/13256))
<del>- Support booleans in `required_if` Validator rule ([#13327](https://github.com/laravel/framework/pull/13327))
<del>
<del>### Changed
<del>- Simplified `Translator::parseLocale()` method ([#13244](https://github.com/laravel/framework/pull/13244))
<del>- Simplified `Builder::shouldRunExistsQuery()` method ([#13321](https://github.com/laravel/framework/pull/13321))
<del>- Use `Gate` contract instead of Facade ([#13260](https://github.com/laravel/framework/pull/13260))
<del>- Return result in `SoftDeletes::forceDelete()` ([#13272](https://github.com/laravel/framework/pull/13272))
<del>
<del>### Fixed
<del>- Fixed BCC for SparkPost ([#13237](https://github.com/laravel/framework/pull/13237))
<del>- Use Carbon for everything time related in `DatabaseTokenRepository` ([#13234](https://github.com/laravel/framework/pull/13234))
<del>- Fixed an issue with `data_set()` affecting the Validator ([#13224](https://github.com/laravel/framework/pull/13224))
<del>- Fixed setting nested namespaces with `app:name` command ([#13208](https://github.com/laravel/framework/pull/13208))
<del>- Decode base64 encoded keys before using it in `PasswordBrokerManager` ([#13270](https://github.com/laravel/framework/pull/13270))
<del>- Prevented race condition in `RateLimiter` ([#13283](https://github.com/laravel/framework/pull/13283))
<del>- Use `DIRECTORY_SEPARATOR` to create path for migrations ([#13254](https://github.com/laravel/framework/pull/13254))
<del>- Fixed adding implicit rules via `sometimes()` method ([#12976](https://github.com/laravel/framework/pull/12976))
<del>- Fixed `Schema::hasTable()` when using PostgreSQL ([#13008](https://github.com/laravel/framework/pull/13008))
<del>- Allow `seeAuthenticatedAs()` to be called with any user object ([#13308](https://github.com/laravel/framework/pull/13308))
<del>
<del>### Removed
<del>- Removed unused base64 decoding from `Encrypter` ([#13291](https://github.com/laravel/framework/pull/13291))
<del>
<del>
<del>## v5.2.30 (2016-04-19)
<del>
<del>### Added
<del>- Added messages and custom attributes to the password reset validation ([#12997](https://github.com/laravel/framework/pull/12997))
<del>- Added `Before` and `After` dependent rules array ([#13025](https://github.com/laravel/framework/pull/13025))
<del>- Exposed token methods to user in password broker ([#13054](https://github.com/laravel/framework/pull/13054))
<del>- Added array support on `Cache::has()` ([#13028](https://github.com/laravel/framework/pull/13028))
<del>- Allow objects to be passed as pipes ([#13024](https://github.com/laravel/framework/pull/13024))
<del>- Adding alias for `FailedJobProviderInterface` ([#13088](https://github.com/laravel/framework/pull/13088))
<del>- Allow console commands registering from `Kernel` class ([#13097](https://github.com/laravel/framework/pull/13097))
<del>- Added the ability to get routes keyed by method ([#13146](https://github.com/laravel/framework/pull/13146))
<del>- Added PostgreSQL specific operators for `jsonb` type ([#13161](https://github.com/laravel/framework/pull/13161))
<del>- Added `makeHidden()` method to the Eloquent collection ([#13152](https://github.com/laravel/framework/pull/13152))
<del>- Added `intersect()` method to `Request` ([#13167](https://github.com/laravel/framework/pull/13167))
<del>- Allow disabling of model observers in tests ([#13178](https://github.com/laravel/framework/pull/13178))
<del>- Allow `ON` clauses on cross joins ([#13159](https://github.com/laravel/framework/pull/13159))
<del>
<del>### Changed
<del>- Use relation setter when setting relations ([#13001](https://github.com/laravel/framework/pull/13001))
<del>- Use `isEmpty()` to check for empty message bag in `Validator::passes()` ([#13014](https://github.com/laravel/framework/pull/13014))
<del>- Refresh `remember_token` when resetting password ([#13016](https://github.com/laravel/framework/pull/13016))
<del>- Use multibyte string functions in `Str` class ([#12953](https://github.com/laravel/framework/pull/12953))
<del>- Use CloudFlare CDN and use SRI checking for assets ([#13044](https://github.com/laravel/framework/pull/13044))
<del>- Enabling array on method has() ([#13028](https://github.com/laravel/framework/pull/13028))
<del>- Allow unix timestamps to be numeric in `Validator` ([da62677](https://git.io/vVi3M))
<del>- Reverted forcing middleware uniqueness ([#13075](https://github.com/laravel/framework/pull/13075))
<del>- Forget keys that contain periods ([#13121](https://github.com/laravel/framework/pull/13121))
<del>- Don't limit column selection while chunking by id ([#13137](https://github.com/laravel/framework/pull/13137))
<del>- Prefix table name on `getColumnType()` call ([#13136](https://github.com/laravel/framework/pull/13136))
<del>- Moved ability map in `AuthorizesResources` trait to a method ([#13214](https://github.com/laravel/framework/pull/13214))
<del>- Make sure `unguarded()` does not change state on exception ([#13186](https://github.com/laravel/framework/pull/13186))
<del>- Return `$this` in `InteractWithPages::within()` to allow method chaining ([13200](https://github.com/laravel/framework/pull/13200))
<del>
<del>### Fixed
<del>- Fixed a empty value case with `Arr:dot()` ([#13009](https://github.com/laravel/framework/pull/13009))
<del>- Fixed a Scheduler issues on Windows ([#13004](https://github.com/laravel/framework/issues/13004))
<del>- Prevent crashes with bad `Accept` headers ([#13039](https://github.com/laravel/framework/pull/13039), [#13059](https://github.com/laravel/framework/pull/13059))
<del>- Fixed explicit depending rules when the explicit keys are non-numeric ([#13058](https://github.com/laravel/framework/pull/13058))
<del>- Fixed an issue with fluent routes with `uses()` ([#13076](https://github.com/laravel/framework/pull/13076))
<del>- Prevent generating listeners for listeners ([3079175](https://git.io/vVNdg))
<del>
<del>### Removed
<del>- Removed unused parameter call in `Filesystem::exists()` ([#13102](https://github.com/laravel/framework/pull/13102))
<del>- Removed duplicate "[y/N]" from confirmable console commands ([#13203](https://github.com/laravel/framework/pull/13203))
<del>- Removed unused parameter in `route()` helper ([#13206](https://github.com/laravel/framework/pull/13206))
<del>
<del>
<del>## v5.2.29 (2016-04-02)
<del>
<del>### Fixed
<del>- Fixed `Arr::get()` when given array is empty ([#12975](https://github.com/laravel/framework/pull/12975))
<del>- Add backticks around JSON selector field names in PostgreSQL query builder ([#12978](https://github.com/laravel/framework/pull/12978))
<del>- Reverted #12899 ([#12991](https://github.com/laravel/framework/pull/12991))
<del>
<del>
<del>## v5.2.28 (2016-04-01)
<del>
<del>### Added
<del>- Added `Authorize` middleware ([#12913](https://git.io/vVLel), [0c48ba4](https://git.io/vVlib), [183f8e1](https://git.io/vVliF))
<del>- Added `UploadedFile::clientExtension()` ([75a7c01](https://git.io/vVO7I))
<del>- Added cross join support for query builder ([#12950](https://git.io/vVZqP))
<del>- Added `ThrottlesLogins::secondsRemainingOnLockout()` ([#12963](https://git.io/vVc1Z), [7c2c098](https://git.io/vVli9))
<del>
<del>### Changed
<del>- Optimized validation performance of large arrays ([#12651](https://git.io/v2xhi))
<del>- Never retry database query, if failed within transaction ([#12929](https://git.io/vVYUB))
<del>- Allow customization of email sent by `ResetsPasswords::sendResetLinkEmail()` ([#12935](https://git.io/vVYKE), [aae873e](https://git.io/vVliD))
<del>- Improved file system tests ([#12940](https://git.io/vVsTV), [#12949](https://git.io/vVGjP), [#12970](https://git.io/vVCBq))
<del>- Allowing merging an array of rules ([a5ea1aa](https://git.io/vVli1))
<del>- Consider implicit attributes while guessing column names in validator ([#12961](https://git.io/vVcgA), [a3827cf](https://git.io/vVliX))
<del>- Reverted [#12307](https://git.io/vgQeJ) ([#12928](https://git.io/vVqni))
<del>
<del>### Fixed
<del>- Fixed elixir manifest caching to detect different build paths ([#12920](https://git.io/vVtJR))
<del>- Fixed `Str::snake()` to work with UTF-8 strings ([#12923](https://git.io/vVtVp))
<del>- Trim the input name in the generator commands ([#12933](https://git.io/vVY4a))
<del>- Check for non-string values in validation rules ([#12973](https://git.io/vVWew))
<del>- Add backticks around JSON selector field names in MySQL query builder ([#12964](https://git.io/vVc9n))
<del>- Fixed terminable middleware assigned to controller ([#12899](https://git.io/vVTnt), [74b0636](https://git.io/vVliP))
<del>
<del>
<del>## v5.2.27 (2016-03-29)
<del>### Added
<del>- Allow ignoring an id using an array key in the `unique` validation rule ([#12612](https://git.io/v29rH))
<del>- Added `InteractsWithSession::assertSessionMissing()` ([#12860](https://git.io/vajXr))
<del>- Added `chunkById()` method to query builder for faster chunking of large sets of data ([#12861](https://git.io/vajSd))
<del>- Added Blade `@hasSection` directive to determine whether something can be yielded ([#12866](https://git.io/vVem5))
<del>- Allow optional query builder calls via `when()` method ([#12878](https://git.io/vVflh))
<del>- Added IP and MAC address column types ([#12884](https://git.io/vVJsj))
<del>- Added Collections `union` method for true unions of two collections ([#12910](https://git.io/vVIzh))
<del>
<del>### Changed
<del>- Allow array size validation of implicit attributes ([#12640](https://git.io/v2Nzl))
<del>- Separated logic of Blade `@push` and `@section` directives ([#12808](https://git.io/vaD8n))
<del>- Ensured that middleware is applied only once ([#12911](https://git.io/vVIr2))
<del>
<del>### Fixed
<del>- Reverted improvements to Redis cache tagging ([#12897](https://git.io/vVUD5))
<del>- Removed route group from `make:auth` stub ([#12903](https://git.io/vVkHI))
<del>
<del>
<del>## v5.2.26 (2016-03-25)
<del>### Added
<del>- Added support for Base64 encoded `Encrypter` keys ([370ae34](https://git.io/vapFX))
<del>- Added `EncryptionServiceProvider::getEncrypterForKeyAndCipher()` ([17ce4ed](https://git.io/vahbo))
<del>- Added `Application::environmentFilePath()` ([370ae34](https://git.io/vapFX))
<del>
<del>### Fixed
<del>- Fixed mock in `ValidationValidatorTest::testValidateMimetypes()` ([7f35988](https://git.io/vaxfB))
<del>
<del>
<del>## v5.2.25 (2016-03-24)
<del>### Added
<del>- Added bootstrap Composer scripts to avoid loading of config/compiled files ([#12827](https://git.io/va5ja))
<del>
<del>### Changed
<del>- Use `File::guessExtension()` instead of `UploadedFile::guessClientExtension()` ([87e6175](https://git.io/vaAxC))
<del>
<del>### Fixed
<del>- Fix an issue with explicit custom validation attributes ([#12822](https://git.io/vaQbD))
<del>- Fix an issue where a view would run the `BladeEngine` instead of the `PhpEngine` ([#12830](https://git.io/vad1X))
<del>- Prevent wrong auth driver from causing unexpected end of execution ([#12821](https://git.io/vajFq))
<ide><path>CHANGELOG-5.3.md
<del># Release Notes for 5.3.x
<del>
<del>## v5.3.30 (2017-01-26)
<del>
<del>### Added
<del>- Added `read()` and `unread()` methods to `DatabaseNotification` ([#17243](https://github.com/laravel/framework/pull/17243))
<del>
<del>### Changed
<del>- Show seed output prior to running, instead of after ([#17318](https://github.com/laravel/framework/pull/17318))
<del>- Support starting slash in `elixir()` helper ([#17359](https://github.com/laravel/framework/pull/17359))
<del>
<del>### Fixed
<del>- Use regex in `KeyGenerateCommand` to match `APP_KEY` ([#17151](https://github.com/laravel/framework/pull/17151))
<del>- Fixed integrity constraints for database session driver ([#17301](https://github.com/laravel/framework/pull/17301))
<del>
<del>
<del>## v5.3.29 (2017-01-06)
<del>
<del>### Added
<del>- Added `Blueprint::nullableMorphs()` ([#16879](https://github.com/laravel/framework/pull/16879))
<del>- Support `BaseCollection` in `BelongsToMany::sync()` ([#16882](https://github.com/laravel/framework/pull/16882))
<del>- Added `--model` flag to `make:controller` command ([#16787](https://github.com/laravel/framework/pull/16787))
<del>- Allow notifications to be broadcasted now instead of using the queue ([#16867](https://github.com/laravel/framework/pull/16867), [40f30f1](https://github.com/laravel/framework/commit/40f30f1a2131904eb4f6e6c456823e7b2cb726eb))
<del>- Support `redirectTo()` in `RedirectsUsers` ([#16896](https://github.com/laravel/framework/pull/16896))
<del>- Added `ArrayTransport` to mail component to store Swift messages in memory ([#16906](https://github.com/laravel/framework/pull/16906), [69d3d04](https://github.com/laravel/framework/commit/69d3d0463cf6bd114d2beecd8480556efb168678))
<del>- Added fallback to `SlackAttachment` notification ([#16912](https://github.com/laravel/framework/pull/16912))
<del>- Added `Macroable` trait to `RedirectResponse` ([#16929](https://github.com/laravel/framework/pull/16929))
<del>- Support namespaces when using `make:policy --model` ([#16981](https://github.com/laravel/framework/pull/16981))
<del>- Added `HourlyAt()` option for scheduled events ([#17168](https://github.com/laravel/framework/pull/17168))
<del>
<del>### Changed
<del>- Allow SparkPost transport transmission metadata to be set at runtime ([#16838](https://github.com/laravel/framework/pull/16838))
<del>- Pass keys to `Collection::unique()` callback ([#16883](https://github.com/laravel/framework/pull/16883))
<del>- Support calling `MailFake::send()` when `build()` has dependencies ([#16918](https://github.com/laravel/framework/pull/16918))
<del>- Changed `Mailable` properties visibility to public ([#16916](https://github.com/laravel/framework/pull/16916))
<del>- Bind `serve` command to `127.0.0.1` instead of `localhost` ([#16937](https://github.com/laravel/framework/pull/16937))
<del>- Added `old('remember')` call to `login.stub` ([#16944](https://github.com/laravel/framework/pull/16944))
<del>- Check for `db` before setting presence verifier in `ValidationServiceProvider` ([038840d](https://github.com/laravel/framework/commit/038840d477e606735f9179d97eeb20639450e8ae))
<del>- Make Eloquent's `getTimeZone()` method call adhere to `DateTimeInterface` ([#16955](https://github.com/laravel/framework/pull/16955))
<del>- Support customizable response in `SendsPasswordResetEmails` ([#16982](https://github.com/laravel/framework/pull/16982))
<del>- Stricter comparison when replacing URL for `LocalAdapter` ([#17097](https://github.com/laravel/framework/pull/17097))
<del>- Use `notification()` relationship in `HasDatabaseNotifications` ([#17093](https://github.com/laravel/framework/pull/17093))
<del>- Allow float value as expiration in Memcached cache store ([#17106](https://github.com/laravel/framework/pull/17106))
<del>
<del>### Fixed
<del>- Fixed a wildcard issue with `sometimes` validation rule ([#16826](https://github.com/laravel/framework/pull/16826))
<del>- Prevent error when SqlServer port is empty ([#16824](https://github.com/laravel/framework/pull/16824))
<del>- Reverted false-positive fix for `date_format` validation [#16692](https://github.com/laravel/framework/pull/16692) ([#16845](https://github.com/laravel/framework/pull/16845))
<del>- Fixed `withCount()` aliasing using multiple tables ([#16853](https://github.com/laravel/framework/pull/16853))
<del>- Fixed broken event interface listening ([#16877](https://github.com/laravel/framework/pull/16877))
<del>- Fixed empty model creation ([#16864](https://github.com/laravel/framework/pull/16864))
<del>- Fixed column overlapping on using `withCount()` on `BelongsToMany` ([#16895](https://github.com/laravel/framework/pull/16895))
<del>- Fixed `Unique::ignore()` issue ([#16948](https://github.com/laravel/framework/pull/16948))
<del>- Fixed logic in `ChannelManager::sendNow()` if `$channels` is `null` ([#17068](https://github.com/laravel/framework/pull/17068))
<del>- Fixed validating distinct for nested keys ([#17102](https://github.com/laravel/framework/pull/17102))
<del>- Fixed `HasManyThrough::updateOrCreate()` ([#17105](https://github.com/laravel/framework/pull/17105))
<del>
<del>### Security
<del>- Changed SwiftMailer version to `~5.4` ([#17131](https://github.com/laravel/framework/pull/17131))
<del>
<del>
<del>## v5.3.28 (2016-12-15)
<del>
<del>### Changed
<del>- Refactored `ControllerMakeCommand` class ([59a1ce2](https://github.com/laravel/framework/commit/59a1ce21413221131aaf0086cd1eb7c887c701c0))
<del>
<del>### Fixed
<del>- Fixed implicit Router binding through IoC ([#16802](https://github.com/laravel/framework/pull/16802))
<del>- `Collection::min()` incorrectly excludes `0` when calculating minimum ([#16821](https://github.com/laravel/framework/pull/16821))
<del>
<del>
<del>## v5.3.27 (2016-12-15)
<del>
<del>### Added
<del>- Added `Authenticatable::$rememberTokenName` ([#16617](https://github.com/laravel/framework/pull/16617), [38612c0](https://github.com/laravel/framework/commit/38612c0e88a48cca5744cc464a764b976f79a46d))
<del>- Added `Collection::partition()` method ([#16627](https://github.com/laravel/framework/pull/16627), [#16644](https://github.com/laravel/framework/pull/16644))
<del>- Added resource routes translations ([#16429](https://github.com/laravel/framework/pull/16429), [e91f04b](https://github.com/laravel/framework/commit/e91f04b52603194dbc90dbbaee730e171bee1449))
<del>- Allow `TokenGuard` API token to be sent through as input ([#16766](https://github.com/laravel/framework/pull/16766))
<del>- Added `Collection::isNotEmpty()` ([#16797](https://github.com/laravel/framework/pull/16797))
<del>- Added "evidence" to the list of uncountable words ([#16788](https://github.com/laravel/framework/pull/16788))
<del>- Added `reply_to` to mailer config ([#16810](https://github.com/laravel/framework/pull/16810), [dc2ce4f](https://github.com/laravel/framework/commit/dc2ce4f9efb831a304e1c2674aae1dfd819b9c56))
<del>
<del>### Changed
<del>- Added missing `$useReadPdo` argument to `Connection::selectOne()` ([#16625](https://github.com/laravel/framework/pull/16625))
<del>- Preload some files required by already listed files ([#16648](https://github.com/laravel/framework/pull/16648))
<del>- Clone query for chunking ([53f97a0](https://github.com/laravel/framework/commit/53f97a014da380dc85fb4b0d826475e562d78dcc), [32d0f16](https://github.com/laravel/framework/commit/32d0f164424ab5b4a2bff2ed927812ae49bd8051))
<del>- Return a regular `PDO` object if a persistent connection is requested ([#16702](https://github.com/laravel/framework/pull/16702), [6b413d5](https://github.com/laravel/framework/commit/6b413d5b416c1e0b629a3036e6c3ad84b3b76a6e))
<del>- Global `to` address now also applied for the `cc` and `bcc` options of an email ([#16705](https://github.com/laravel/framework/pull/16705))
<del>- Don't report exceptions inside queue worker signal handler ([#16738](https://github.com/laravel/framework/pull/16738))
<del>- Kill timed out queue worker process ([#16746](https://github.com/laravel/framework/pull/16746))
<del>- Removed unnecessary check in `ScheduleRunCommand::fire()` ([#16752](https://github.com/laravel/framework/pull/16752))
<del>- Only guess the ability's name if no fully qualified class name was given ([#16807](https://github.com/laravel/framework/pull/16807), [f79839e](https://github.com/laravel/framework/commit/f79839e4b72999a67d5503bbb8437547cab87236))
<del>- Remove falsy values from array in `min()` and `max()` on `Collection` ([e2d317e](https://github.com/laravel/framework/commit/e2d317efcebbdf6651d89100c0b5d80a925bb2f1))
<del>
<del>### Fixed
<del>- Added file existence check to `AppNameCommand::replaceIn()` to fix [#16575](https://github.com/laravel/framework/pull/16575) ([#16592](https://github.com/laravel/framework/pull/16592))
<del>- Check for `null` in `seeJsonStructure()` ([#16642](https://github.com/laravel/framework/pull/16642))
<del>- Reverted [#15264](https://github.com/laravel/framework/pull/15264) ([#16660](https://github.com/laravel/framework/pull/16660))
<del>- Fixed misleading credentials exception when `ExceptionHandler` is not bound in container ([#16666](https://github.com/laravel/framework/pull/16666))
<del>- Use `sync` as queue name for Sync Queues ([#16681](https://github.com/laravel/framework/pull/16681))
<del>- Fixed `storedAs()` and `virtualAs()` issue ([#16683](https://github.com/laravel/framework/pull/16683))
<del>- Fixed false-positive `date_format` validation ([#16692](https://github.com/laravel/framework/pull/16692))
<del>- Use translator `trans()` method in `Validator` ([#16778](https://github.com/laravel/framework/pull/16778))
<del>- Fixed runtime error in `RouteServiceProvider` when `Route` facade is not available ([#16775](https://github.com/laravel/framework/pull/16775))
<del>
<del>### Removed
<del>- Removed hard coded prose from scheduled task email subject ([#16790](https://github.com/laravel/framework/pull/16790))
<del>
<del>
<del>## v5.3.26 (2016-11-30)
<del>
<del>### Changed
<del>- Replaced deprecated `DefaultFinder` class ([#16602](https://github.com/laravel/framework/pull/16602))
<del>
<del>### Fixed
<del>- Reverted [#16506](https://github.com/laravel/framework/pull/16506) ([#16607](https://github.com/laravel/framework/pull/16607))
<del>
<del>
<del>## v5.3.25 (2016-11-29)
<del>
<del>### Added
<del>- Added `before_or_equal` and `after_or_equal` validation rules ([#16490](https://github.com/laravel/framework/pull/16490))
<del>- Added fluent builder for `SlackMessageAttachmentField` ([#16535](https://github.com/laravel/framework/pull/16535), [db4879a](https://github.com/laravel/framework/commit/db4879ae84a3a1959729ac2732ae42cfe377314c))
<del>- Added the possibility to set and get file permissions in `Filesystem` ([#16560](https://github.com/laravel/framework/pull/16560))
<del>
<del>### Changed
<del>- Added additional `keyType` check to avoid using an invalid type for eager load constraints ([#16452](https://github.com/laravel/framework/pull/16452))
<del>- Always debug Pusher in `PusherBroadcaster::broadcast()` ([#16493](https://github.com/laravel/framework/pull/16493))
<del>- Don't pluralize "metadata" ([#16518](https://github.com/laravel/framework/pull/16518))
<del>- Always pass a collection to `LengthAwarePaginator` from `paginate()` methods ([#16547](https://github.com/laravel/framework/pull/16547))
<del>- Avoid unexpected connection timeouts when flushing tagged caches on Redis ([#16568](https://github.com/laravel/framework/pull/16568))
<del>- Enabled unicode support to `NexmoSmsChannel` ([#16577](https://github.com/laravel/framework/pull/16577), [3001640](https://github.com/laravel/framework/commit/30016408a6911afba4aa7739d69948d13612ea06))
<del>
<del>### Fixed
<del>- Fixed view compilation bug when using " or " in strings ([#16506](https://github.com/laravel/framework/pull/16506))
<del>
<del>
<del>## v5.3.24 (2016-11-21)
<del>
<del>### Added
<del>- Added `AuthenticateSession` middleware ([fc302a6](https://github.com/laravel/framework/commit/fc302a6667f9dcce53395d01d8e6ba752ea62955))
<del>- Support arrays in `HasOne::withDefault()` ([#16382](https://github.com/laravel/framework/pull/16382))
<del>- Define route basename for resources ([#16352](https://github.com/laravel/framework/pull/16352))
<del>- Added `$fallback` parameter to `Redirector::back()` ([#16426](https://github.com/laravel/framework/pull/16426))
<del>- Added support for footer and markdown in `SlackAttachment` ([#16451](https://github.com/laravel/framework/pull/16451))
<del>- Added password change feedback auth stubs ([#16461](https://github.com/laravel/framework/pull/16461))
<del>- Added `name` to default register route ([#16480](https://github.com/laravel/framework/pull/16480))
<del>- Added `ServiceProvider::loadRoutesFrom()` method ([#16483](https://github.com/laravel/framework/pull/16483))
<del>
<del>### Changed
<del>- Use `getKey()` instead of `$id` in `PusherBroadcaster` ([#16438](https://github.com/laravel/framework/pull/16438))
<del>
<del>### Fixed
<del>- Pass `PheanstalkJob` to Pheanstalk's `delete()` method ([#16415](https://github.com/laravel/framework/pull/16415))
<del>- Don't call PDO callback in `reconnectIfMissingConnection()` until it is needed ([#16422](https://github.com/laravel/framework/pull/16422))
<del>- Don't timeout queue if `--timeout` is set to `0` ([#16465](https://github.com/laravel/framework/pull/16465))
<del>- Respect `--force` option of `queue:work` in maintenance mode ([#16468](https://github.com/laravel/framework/pull/16468))
<del>
<del>
<del>## v5.3.23 (2016-11-14)
<del>
<del>### Added
<del>- Added database slave failover ([#15553](https://github.com/laravel/framework/pull/15553), [ed28c7f](https://github.com/laravel/framework/commit/ed28c7fa11d3754d618606bf8fc2f00690cfff66))
<del>- Added `Arr::shuffle($array)` ([ed28c7f](https://github.com/laravel/framework/commit/ed28c7fa11d3754d618606bf8fc2f00690cfff66))
<del>- Added `prepareForValidation()` method to `FormRequests` ([#16238](https://github.com/laravel/framework/pull/16238))
<del>- Support SparkPost transports options to be set at runtime ([#16254](https://github.com/laravel/framework/pull/16254))
<del>- Support setting `$replyTo` for email notifications ([#16277](https://github.com/laravel/framework/pull/16277))
<del>- Support `url` configuration parameter to generate filesystem disk URL ([#16281](https://github.com/laravel/framework/pull/16281), [dcff158](https://github.com/laravel/framework/commit/dcff158c63093523eadffc34a9ba8c1f8d4e53c0))
<del>- Allow `SerializesModels` to restore models excluded by global scope ([#16301](https://github.com/laravel/framework/pull/16301))
<del>- Allow loading specific columns while eager-loading Eloquent relationships ([#16327](https://github.com/laravel/framework/pull/16327))
<del>- Allow Eloquent `HasOne` relationships to return a "default model" ([#16198](https://github.com/laravel/framework/pull/16198), [9b59f67](https://github.com/laravel/framework/commit/9b59f67daeb63bad11af9b70b4a35c6435240ff7))
<del>- Allow `SlackAttachment` color override ([#16360](https://github.com/laravel/framework/pull/16360))
<del>- Allow chaining factory calls to `define()` and `state()` ([#16389](https://github.com/laravel/framework/pull/16389))
<del>
<del>### Changed
<del>- Dried-up console parser and extract token parsing ([#16197](https://github.com/laravel/framework/pull/16197))
<del>- Support empty array for query builder `orders` property ([#16225](https://github.com/laravel/framework/pull/16225))
<del>- Properly handle filling JSON attributes on Eloquent models ([#16228](https://github.com/laravel/framework/pull/16228))
<del>- Use `forceReconnection()` method in `Mailer` ([#16298](https://github.com/laravel/framework/pull/16298))
<del>- Double-quote MySQL JSON expressions ([#16308](https://github.com/laravel/framework/pull/16308))
<del>- Moved login attempt code to separate method ([#16317](https://github.com/laravel/framework/pull/16317))
<del>- Escape the RegExp delimiter in `Validator::getExplicitKeys()` ([#16309](https://github.com/laravel/framework/pull/16309))
<del>- Use default Slack colors in `SlackMessage` ([#16345](https://github.com/laravel/framework/pull/16345))
<del>- Support presence channels names containing the words `private-` or `presence-` ([#16353](https://github.com/laravel/framework/pull/16353))
<del>- Fail test, instead of throwing an exception when `seeJson()` fails ([#16350](https://github.com/laravel/framework/pull/16350))
<del>- Call `sendPerformed()` for all mail transports ([#16366](https://github.com/laravel/framework/pull/16366))
<del>- Add `X-SES-Message-ID` header in `SesTransport::send()` ([#16366](https://github.com/laravel/framework/pull/16366))
<del>- Throw `BroadcastException` when `PusherBroadcaster::broadcast()` fails ([#16398](https://github.com/laravel/framework/pull/16398))
<del>
<del>### Fixed
<del>- Catch errors when handling a failed job ([#16212](https://github.com/laravel/framework/pull/16212))
<del>- Return array from `Translator::sortReplacements()` ([#16221](https://github.com/laravel/framework/pull/16221))
<del>- Don't use multi-byte functions in `UrlGenerator::to()` ([#16081](https://github.com/laravel/framework/pull/16081))
<del>- Support configuration files as symbolic links ([#16080](https://github.com/laravel/framework/pull/16080))
<del>- Fixed wrapping and escaping in SQL Server `dropIfExists()` ([#16279](https://github.com/laravel/framework/pull/16279))
<del>- Throw `ManuallyFailedException` if `InteractsWithQueue::fail()` is called manually ([#16318](https://github.com/laravel/framework/pull/16318), [a20fa97](https://github.com/laravel/framework/commit/a20fa97445be786f9f5f09e2e9b905a00064b2da))
<del>- Catch `Throwable` in timezone validation ([#16344](https://github.com/laravel/framework/pull/16344))
<del>- Fixed `Auth::onceUsingId()` by reversing the order of retrieving the id in `SessionGuard` ([#16373](https://github.com/laravel/framework/pull/16373))
<del>- Fixed bindings on update statements with advanced joins ([#16368](https://github.com/laravel/framework/pull/16368))
<del>
<del>
<del>## v5.3.22 (2016-11-01)
<del>
<del>### Added
<del>- Added support for carbon-copy in mail notifications ([#16152](https://github.com/laravel/framework/pull/16152))
<del>- Added `-r` shortcut to `make:controller` command ([#16141](https://github.com/laravel/framework/pull/16141))
<del>- Added `HasDatabaseNotifications::readNotifications()` method ([#16164](https://github.com/laravel/framework/pull/16164))
<del>- Added `broadcastOn()` method to allow notifications to be broadcasted to custom channels ([#16170](https://github.com/laravel/framework/pull/16170))
<del>
<del>### Changed
<del>- Avoid extraneous database query when last `chunk()` is partial ([#16180](https://github.com/laravel/framework/pull/16180))
<del>- Return unique middleware stack from `Route::gatherMiddleware()` ([#16185](https://github.com/laravel/framework/pull/16185))
<del>- Return early when `Collection::chunk()` size zero or less ([#16206](https://github.com/laravel/framework/pull/16206), [46ebd7f](https://github.com/laravel/framework/commit/46ebd7fa1f35eeb37af891abfc611f7262c91c29))
<del>
<del>### Fixed
<del>- Bind `double` as `PDO::PARAM_INT` on MySQL connections ([#16069](https://github.com/laravel/framework/pull/16069))
<del>
<del>
<del>## v5.3.21 (2016-10-26)
<del>
<del>### Added
<del>- Added `ResetsPasswords::validationErrorMessages()` method ([#16111](https://github.com/laravel/framework/pull/16111))
<del>
<del>### Changed
<del>- Use `toString()` instead of `(string)` on UUIDs for notification ids ([#16109](https://github.com/laravel/framework/pull/16109))
<del>
<del>### Fixed
<del>- Don't hydrate files in `Validator` ([#16105](https://github.com/laravel/framework/pull/16105))
<del>
<del>### Removed
<del>- Removed `-q` shortcut from `make:listener` command ([#16110](https://github.com/laravel/framework/pull/16110))
<del>
<del>
<del>## v5.3.20 (2016-10-25)
<del>
<del>### Added
<del>- Added `--resource` (or `-r`) option to `make:model` command ([#15993](https://github.com/laravel/framework/pull/15993))
<del>- Support overwriting channel name for broadcast notifications ([#16018](https://github.com/laravel/framework/pull/16018), [4e30db5](https://github.com/laravel/framework/commit/4e30db5fbc556f7925130f9805f2dec47592719e))
<del>- Added `Macroable` trait to `Rule` ([#16028](https://github.com/laravel/framework/pull/16028))
<del>- Added `Session::remember()` helper ([#16041](https://github.com/laravel/framework/pull/16041))
<del>- Added option shorthands to `make:listener` command ([#16038](https://github.com/laravel/framework/pull/16038))
<del>- Added `RegistersUsers::registered()` method ([#16036](https://github.com/laravel/framework/pull/16036))
<del>- Added `ResetsPasswords::rules()` method ([#16060](https://github.com/laravel/framework/pull/16060))
<del>- Added `$page` parameter to `simplePaginate()` in `BelongsToMany` and `HasManyThrough` ([#16075](https://github.com/laravel/framework/pull/16075))
<del>
<del>### Changed
<del>- Catch `dns_get_record()` exceptions in `validateActiveUrl()` ([#15979](https://github.com/laravel/framework/pull/15979))
<del>- Allow reconnect during database transactions ([#15931](https://github.com/laravel/framework/pull/15931))
<del>- Use studly case for controller names generated by `make:model` command ([#15988](https://github.com/laravel/framework/pull/15988))
<del>- Support objects that are castable to strings in `Collection::keyBy()` ([#16001](https://github.com/laravel/framework/pull/16001))
<del>- Switched to using a static object to collect console application bootstrappers that need to run on Artisan starting ([#16012](https://github.com/laravel/framework/pull/16012))
<del>- Return unique middleware stack in `SortedMiddleware::sortMiddleware()` ([#16034](https://github.com/laravel/framework/pull/16034))
<del>- Allow methods inside `@foreach` and `@forelse` expressions ([#16087](https://github.com/laravel/framework/pull/16087))
<del>- Improved Scheduler parameter escaping ([#16088](https://github.com/laravel/framework/pull/16088))
<del>
<del>### Fixed
<del>- Fixed `session_write_close()` on PHP7 ([#15968](https://github.com/laravel/framework/pull/15968))
<del>- Fixed ambiguous id issues when restoring models with eager loaded / joined query ([#15983](https://github.com/laravel/framework/pull/15983))
<del>- Fixed integer and double support in `JsonExpression` ([#16068](https://github.com/laravel/framework/pull/16068))
<del>- Fixed UUIDs when queueing notifications ([18d26df](https://github.com/laravel/framework/commit/18d26df24f1f3b17bd20c7244d9b85d273138d79))
<del>- Fixed empty session issue when the session file is being accessed simultaneously ([#15998](https://github.com/laravel/framework/pull/15998))
<del>
<del>### Removed
<del>- Removed `Requests` import from controller stubs ([#16011](https://github.com/laravel/framework/pull/16011))
<del>- Removed unnecessary validation feedback for password confirmation field ([#16100](https://github.com/laravel/framework/pull/16100))
<del>
<del>
<del>## v5.3.19 (2016-10-17)
<del>
<del>### Added
<del>- Added `--controller` (or `-c`) option to `make:model` command ([#15795](https://github.com/laravel/framework/pull/15795))
<del>- Added object based `dimensions` validation rule ([#15852](https://github.com/laravel/framework/pull/15852))
<del>- Added object based `in` and `not_in` validation rule ([#15923](https://github.com/laravel/framework/pull/15923), [#15951](https://github.com/laravel/framework/pull/15951), [336a807](https://github.com/laravel/framework/commit/336a807ee56de27adcb3f9d34b337300520568ac))
<del>- Added `clear-compiled` command success message ([#15868](https://github.com/laravel/framework/pull/15868))
<del>- Added `SlackMessage::http()` to specify additional `headers` or `proxy` options ([#15882](https://github.com/laravel/framework/pull/15882))
<del>- Added a name to the logout route ([#15889](https://github.com/laravel/framework/pull/15889))
<del>- Added "feedback" to `Pluralizer::uncountable()` ([#15895](https://github.com/laravel/framework/pull/15895))
<del>- Added `FormRequest::withValidator($validator)` hook ([#15918](https://github.com/laravel/framework/pull/15918), [bf8a36a](https://github.com/laravel/framework/commit/bf8a36ac3df03a2c889cbc9aa535e5cf9ff48777))
<del>- Add missing `ClosureCommand::$callback` property ([#15956](https://github.com/laravel/framework/pull/15956))
<del>
<del>### Changed
<del>- Total rewrite of middleware sorting logic ([6b69fb8](https://github.com/laravel/framework/commit/6b69fb81fc7c36e9e129a0ce2e56a824cc907859), [9cc5334](https://github.com/laravel/framework/commit/9cc5334d00824441ccce5e9d2979723e41b2fc05))
<del>- Wrap PostgreSQL database schema changes in a transaction ([#15780](https://github.com/laravel/framework/pull/15780), [#15962](https://github.com/laravel/framework/pull/15962))
<del>- Expect `array` on `Validator::explodeRules()` ([#15838](https://github.com/laravel/framework/pull/15838))
<del>- Return `null` if an empty key was passed to `Model::getAttribute()` ([#15874](https://github.com/laravel/framework/pull/15874))
<del>- Support multiple `LengthAwarePaginator` on a single page with different `$pageName` properties ([#15870](https://github.com/laravel/framework/pull/15870))
<del>- Pass ids to `ModelNotFoundException` ([#15896](https://github.com/laravel/framework/pull/15896))
<del>- Improved database transaction logic ([7a0832b](https://github.com/laravel/framework/commit/7a0832bb44057f1060c96c2e01652aae7c583323))
<del>- Use `name()` method instead of `getName()` ([#15955](https://github.com/laravel/framework/pull/15955))
<del>- Minor syntax improvements ([#15953](https://github.com/laravel/framework/pull/15953), [#15954](https://github.com/laravel/framework/pull/15954), [4e9c9fd](https://github.com/laravel/framework/commit/4e9c9fd98b4dff71f449764e87c52577e2634587))
<del>
<del>### Fixed
<del>- Fixed `migrate:status` using another connection ([#15824](https://github.com/laravel/framework/pull/15824))
<del>- Fixed calling closure based commands ([#15873](https://github.com/laravel/framework/pull/15873))
<del>- Split `SimpleMessage` by all possible EOLs ([#15921](https://github.com/laravel/framework/pull/15921))
<del>- Ensure that the search and the creation/update of Eloquent instances happens on the same connection ([#15958](https://github.com/laravel/framework/pull/15958))
<del>
<del>
<del>## v5.3.18 (2016-10-07)
<del>
<del>### Added
<del>- Added object based `unique` and `exists` validation rules ([#15809](https://github.com/laravel/framework/pull/15809))
<del>
<del>### Changed
<del>- Added primary key to `migrations` table ([#15770](https://github.com/laravel/framework/pull/15770))
<del>- Simplified `route:list` command code ([#15802](https://github.com/laravel/framework/pull/15802), [cb2eb79](https://github.com/laravel/framework/commit/cb2eb7963b29aafe63c87e1d2b1e633ecd0c25b0))
<del>
<del>### Fixed
<del>- Use eloquent collection for proper serialization of [#15789](https://github.com/laravel/framework/pull/15789) ([1c78e00](https://github.com/laravel/framework/commit/1c78e00ef3815e7b0bf710037b52faefb464e97d))
<del>- Reverted [#15722](https://github.com/laravel/framework/pull/15722) ([#15813](https://github.com/laravel/framework/pull/15813))
<del>
<del>
<del>## v5.3.17 (2016-10-06)
<del>
<del>### Added
<del>- Added model factory "states" ([#14241](https://github.com/laravel/framework/pull/14241))
<del>
<del>### Changed
<del>- `Collection::only()` now returns all items if `$keys` is `null` ([#15695](https://github.com/laravel/framework/pull/15695))
<del>
<del>### Fixed
<del>- Added workaround for Memcached 3 on PHP7 when using `many()` ([#15739](https://github.com/laravel/framework/pull/15739))
<del>- Fixed bug in `Validator::hydrateFiles()` when removing the files array ([#15663](https://github.com/laravel/framework/pull/15663))
<del>- Fixed model factory bug when `$amount` is zero ([#15764](https://github.com/laravel/framework/pull/15764), [#15779](https://github.com/laravel/framework/pull/15779))
<del>- Prevent multiple notifications getting sent out when using the `Notification` facade ([#15789](https://github.com/laravel/framework/pull/15789))
<del>
<del>
<del>## v5.3.16 (2016-10-04)
<del>
<del>### Added
<del>- Added "furniture" and "wheat" to `Pluralizer::uncountable()` ([#15703](https://github.com/laravel/framework/pull/15703))
<del>- Allow passing `$keys` to `Model::getAttributes()` ([#15722](https://github.com/laravel/framework/pull/15722))
<del>- Added database blueprint for soft deletes with timezone ([#15737](https://github.com/laravel/framework/pull/15737))
<del>- Added given guards to `AuthenticationException` ([#15745](https://github.com/laravel/framework/pull/15745))
<del>- Added [Seneca](https://en.wikipedia.org/wiki/Seneca_the_Younger) quote to `Inspire` command ([#15747](https://github.com/laravel/framework/pull/15747))
<del>- Added `div#app` to auth layout stub ([08bcbdb](https://github.com/laravel/framework/commit/08bcbdbe70b69330943cc45625b160877b37341a))
<del>- Added PHP 7.1 timeout handler to queue worker ([cc9e1f0](https://github.com/laravel/framework/commit/cc9e1f09683fd23cf8e973e84bf310f7ce1304a2))
<del>
<del>### Changed
<del>- Changed visibility of `Route::getController()` to public ([#15678](https://github.com/laravel/framework/pull/15678))
<del>- Changed notifications `id` column type to `uuid` ([#15719](https://github.com/laravel/framework/pull/15719))
<del>
<del>### Fixed
<del>- Fixed PDO bindings when using `whereHas()` ([#15740](https://github.com/laravel/framework/pull/15740))
<del>
<del>
<del>## v5.3.15 (2016-09-29)
<del>
<del>### Changed
<del>- Use granular notification queue jobs ([#15681](https://github.com/laravel/framework/pull/15681), [3a5e510](https://github.com/laravel/framework/commit/3a5e510af5e92ab2eaa25d728b8c74d9cf8833c2))
<del>- Reverted recent changes to the queue ([d8dc8dc](https://github.com/laravel/framework/commit/d8dc8dc4bde56f63d8b1eacec3f3d4d68cc51894))
<del>
<del>
<del>## v5.3.14 (2016-09-29)
<del>
<del>### Fixed
<del>- Fixed `DaemonCommand` command name ([b681bff](https://github.com/laravel/framework/commit/b681bffc247ebac1fbb4afcec03e2ce12627e0cc))
<del>
<del>
<del>## v5.3.13 (2016-09-29)
<del>
<del>### Added
<del>- Added `serialize()` and `unserialize()` on `RedisStore` ([#15657](https://github.com/laravel/framework/pull/15657))
<del>
<del>### Changed
<del>- Use `$signature` command style on `DaemonCommand` and `WorkCommand` ([#15677](https://github.com/laravel/framework/pull/15677))
<del>
<del>
<del>## v5.3.12 (2016-09-29)
<del>
<del>### Added
<del>- Added support for priority level in mail notifications ([#15651](https://github.com/laravel/framework/pull/15651))
<del>- Added missing `$minutes` property on `CookieSessionHandler` ([#15664](https://github.com/laravel/framework/pull/15664))
<del>
<del>### Changed
<del>- Removed forking and PCNTL requirements while still supporting timeouts ([#15650](https://github.com/laravel/framework/pull/15650))
<del>- Set exception handler first thing in `WorkCommand::runWorker()` ([99994fe](https://github.com/laravel/framework/commit/99994fe23c1215d5a8e798da03947e6a5502b8f9))
<del>
<del>
<del>## v5.3.11 (2016-09-27)
<del>
<del>### Added
<del>- Added `Kernel::setArtisan()` method ([#15531](https://github.com/laravel/framework/pull/15531))
<del>- Added a default method for validation message variable replacing ([#15527](https://github.com/laravel/framework/pull/15527))
<del>- Added support for a schema array in Postgres config ([#15535](https://github.com/laravel/framework/pull/15535))
<del>- Added `SoftDeletes::isForceDeleting()` method ([#15580](https://github.com/laravel/framework/pull/15580))
<del>- Added support for tasks scheduling using command classes instead of signatures ([#15591](https://github.com/laravel/framework/pull/15591))
<del>- Added support for passing array of emails/user-objects to `Mailable::to()` ([#15603](https://github.com/laravel/framework/pull/15603))
<del>- Add missing interface methods in `Registrar` contract ([#15616](https://github.com/laravel/framework/pull/15616))
<del>
<del>### Changed
<del>- Let the queue worker sleep for 1s when app is down for maintenance ([#15520](https://github.com/laravel/framework/pull/15520))
<del>- Improved validator messages for implicit attributes errors ([#15538](https://github.com/laravel/framework/pull/15538))
<del>- Use `Carbon::now()->getTimestamp()` instead of `time()` in various places ([#15544](https://github.com/laravel/framework/pull/15544), [#15545](https://github.com/laravel/framework/pull/15545), [c5984af](https://github.com/laravel/framework/commit/c5984af3757e492c6e79cef161169ea09b5b9c7a), [#15549](https://github.com/laravel/framework/pull/15549))
<del>- Removed redundant condition from `updateOrInsert()` ([#15540](https://github.com/laravel/framework/pull/15540))
<del>- Throw `LogicException` on container alias loop ([#15548](https://github.com/laravel/framework/pull/15548))
<del>- Handle empty `$files` in `Request::duplicate()` ([#15558](https://github.com/laravel/framework/pull/15558))
<del>- Support exact matching of custom validation messages ([#15557](https://github.com/laravel/framework/pull/15557))
<del>
<del>### Fixed
<del>- Decode URL in `Request::segments()` and `Request::is()` ([#15524](https://github.com/laravel/framework/pull/15524))
<del>- Replace only the first instance of the app namespace in Generators ([#15575](https://github.com/laravel/framework/pull/15575))
<del>- Fixed artisan `--env` issue where environment file wasn't loaded ([#15629](https://github.com/laravel/framework/pull/15629))
<del>- Fixed migration with comments using `ANSI_QUOTE` SQL mode ([#15620](https://github.com/laravel/framework/pull/15620))
<del>- Disabled queue worker process forking until it works with AWS SQS ([23c1276](https://github.com/laravel/framework/commit/23c12765557ebc5e3c35ad024d645620f7b907d6))
<del>
<del>
<del>## v5.3.10 (2016-09-20)
<del>
<del>### Added
<del>- Fire `Registered` event when a user registers ([#15401](https://github.com/laravel/framework/pull/15401))
<del>- Added `Container::factory()` method ([#15415](https://github.com/laravel/framework/pull/15415))
<del>- Added `$default` parameter to query/eloquent builder `when()` method ([#15428](https://github.com/laravel/framework/pull/15428), [#15442](https://github.com/laravel/framework/pull/15442))
<del>- Added missing `$notifiable` parameter to `ResetPassword::toMail()` ([#15448](https://github.com/laravel/framework/pull/15448))
<del>
<del>### Changed
<del>- Updated `ServiceProvider` to use `resourcePath()` over `basePath()` ([#15400](https://github.com/laravel/framework/pull/15400))
<del>- Throw `RuntimeException` if `pcntl_fork()` doesn't exists ([#15393](https://github.com/laravel/framework/pull/15393))
<del>- Changed visibility of `Container::getAlias()` to public ([#15444](https://github.com/laravel/framework/pull/15444))
<del>- Changed visibility of `VendorPublishCommand::publishTag()` to protected ([#15461](https://github.com/laravel/framework/pull/15461))
<del>- Changed visibility of `TestCase::afterApplicationCreated()` to public ([#15493](https://github.com/laravel/framework/pull/15493))
<del>- Prevent calling `Model` methods when calling them as attributes ([#15438](https://github.com/laravel/framework/pull/15438))
<del>- Default `$callback` to `null` in eloquent builder `whereHas()` ([#15475](https://github.com/laravel/framework/pull/15475))
<del>- Support newlines in Blade's `@foreach` ([#15485](https://github.com/laravel/framework/pull/15485))
<del>- Try to reconnect if connection is lost during database transaction ([#15511](https://github.com/laravel/framework/pull/15511))
<del>- Renamed `InteractsWithQueue::failed()` to `fail()` ([e1d60e0](https://github.com/laravel/framework/commit/e1d60e0fe120a7898527fb997aa2fb9de263190c))
<del>
<del>### Fixed
<del>- Reverted "Allow passing a `Closure` to `View::share()` [#15312](https://github.com/laravel/framework/pull/15312)" ([#15312](https://github.com/laravel/framework/pull/15312))
<del>- Resolve issues with multi-value select elements ([#15436](https://github.com/laravel/framework/pull/15436))
<del>- Fixed issue with `X-HTTP-METHOD-OVERRIDE` spoofing in `Request` ([#15410](https://github.com/laravel/framework/pull/15410))
<del>
<del>### Removed
<del>- Removed unused `SendsPasswordResetEmails::resetNotifier()` method ([#15446](https://github.com/laravel/framework/pull/15446))
<del>- Removed uninstantiable `Seeder` class ([#15450](https://github.com/laravel/framework/pull/15450))
<del>- Removed unnecessary variable in `AuthenticatesUsers::login()` ([#15507](https://github.com/laravel/framework/pull/15507))
<del>
<del>
<del>## v5.3.9 (2016-09-12)
<del>
<del>### Changed
<del>- Optimized performance of `Str::startsWith()` and `Str::endsWith()` ([#15380](https://github.com/laravel/framework/pull/15380), [#15397](https://github.com/laravel/framework/pull/15397))
<del>
<del>### Fixed
<del>- Fixed queue job without `--tries` option marks jobs failed ([#15370](https://github.com/laravel/framework/pull/15370), [#15390](https://github.com/laravel/framework/pull/15390))
<del>
<del>
<del>## v5.3.8 (2016-09-09)
<del>
<del>### Added
<del>- Added missing `MailableMailer::later()` method ([#15364](https://github.com/laravel/framework/pull/15364))
<del>- Added missing `$queue` parameter on `SyncJob` ([#15368](https://github.com/laravel/framework/pull/15368))
<del>- Added SSL options for PostgreSQL DSN ([#15371](https://github.com/laravel/framework/pull/15371))
<del>- Added ability to disable touching of parent when toggling relation ([#15263](https://github.com/laravel/framework/pull/15263))
<del>- Added username, icon and channel options for Slack Notifications ([#14910](https://github.com/laravel/framework/pull/14910))
<del>
<del>### Changed
<del>- Renamed methods in `NotificationFake` ([69b08f6](https://github.com/laravel/framework/commit/69b08f66fbe70b4df8332a8f2a7557a49fd8c693))
<del>- Minor code improvements ([#15369](https://github.com/laravel/framework/pull/15369))
<del>
<del>### Fixed
<del>- Fixed catchable fatal error introduced [#15250](https://github.com/laravel/framework/pull/15250) ([#15350](https://github.com/laravel/framework/pull/15350))
<del>
<del>
<del>## v5.3.7 (2016-09-08)
<del>
<del>### Added
<del>- Added missing translation for `mimetypes` validation ([#15209](https://github.com/laravel/framework/pull/15209), [#3921](https://github.com/laravel/laravel/pull/3921))
<del>- Added ability to check if between two times when using scheduler ([#15216](https://github.com/laravel/framework/pull/15216), [#15306](https://github.com/laravel/framework/pull/15306))
<del>- Added `X-RateLimit-Reset` header to throttled responses ([#15275](https://github.com/laravel/framework/pull/15275))
<del>- Support aliases on `withCount()` ([#15279](https://github.com/laravel/framework/pull/15279))
<del>- Added `Filesystem::isReadable()` ([#15289](https://github.com/laravel/framework/pull/15289))
<del>- Added `Collection::split()` method ([#15302](https://github.com/laravel/framework/pull/15302))
<del>- Allow passing a `Closure` to `View::share()` ([#15312](https://github.com/laravel/framework/pull/15312))
<del>- Added support for `Mailable` messages in `MailChannel` ([#15318](https://github.com/laravel/framework/pull/15318))
<del>- Added `with*()` syntax to `Mailable` class ([#15316](https://github.com/laravel/framework/pull/15316))
<del>- Added `--path` option for `migrate:rollback/refresh/reset` ([#15251](https://github.com/laravel/framework/pull/15251))
<del>- Allow numeric keys on `morphMap()` ([#15332](https://github.com/laravel/framework/pull/15332))
<del>- Added fakes for bus, events, mail, queue and notifications ([5deab59](https://github.com/laravel/framework/commit/5deab59e89b85e09b2bd1642e4efe55e933805ca))
<del>
<del>### Changed
<del>- Update `Model::save()` to return `true` when no error occurs ([#15236](https://github.com/laravel/framework/pull/15236))
<del>- Optimized performance of `Arr::first()` ([#15213](https://github.com/laravel/framework/pull/15213))
<del>- Swapped `drop()` for `dropIfExists()` in all stubs ([#15230](https://github.com/laravel/framework/pull/15230))
<del>- Allow passing object instance to `class_uses_recursive()` ([#15223](https://github.com/laravel/framework/pull/15223))
<del>- Improved handling of failed file uploads during validation ([#15166](https://github.com/laravel/framework/pull/15166))
<del>- Hide pagination if it does not have multiple pages ([#15246](https://github.com/laravel/framework/pull/15246))
<del>- Cast Pusher message to JSON in `validAuthentiactoinResponse()` ([#15262](https://github.com/laravel/framework/pull/15262))
<del>- Throw exception if queue failed to create payload ([#15284](https://github.com/laravel/framework/pull/15284))
<del>- Call `getUrl()` first in `FilesystemAdapter::url()` ([#15291](https://github.com/laravel/framework/pull/15291))
<del>- Consider local key in `HasManyThrough` relationships ([#15303](https://github.com/laravel/framework/pull/15303))
<del>- Fail faster by checking Route Validators in likely fail order ([#15287](https://github.com/laravel/framework/pull/15287))
<del>- Make the `FilesystemAdapter::delete()` behave like `FileSystem::delete()` ([#15308](https://github.com/laravel/framework/pull/15308))
<del>- Don't call `floor()` in `Collection::median()` ([#15343](https://github.com/laravel/framework/pull/15343))
<del>- Always return number from aggregate method `sum()` ([#15345](https://github.com/laravel/framework/pull/15345))
<del>
<del>### Fixed
<del>- Reverted "Hide empty paginators" [#15125](https://github.com/laravel/framework/pull/15125) ([#15241](https://github.com/laravel/framework/pull/15241))
<del>- Fixed empty `multifile` uploads ([#15250](https://github.com/laravel/framework/pull/15250))
<del>- Fixed regression in `save(touch)` option ([#15264](https://github.com/laravel/framework/pull/15264))
<del>- Fixed lower case model names in policy classes ([15270](https://github.com/laravel/framework/pull/15270))
<del>- Allow models with global scopes to be refreshed ([#15282](https://github.com/laravel/framework/pull/15282))
<del>- Fix `ChannelManager::getDefaultDriver()` implementation ([#15288](https://github.com/laravel/framework/pull/15288))
<del>- Fire `illuminate.queue.looping` event before running daemon ([#15290](https://github.com/laravel/framework/pull/15290))
<del>- Check attempts before firing queue job ([#15319](https://github.com/laravel/framework/pull/15319))
<del>- Fixed `morphTo()` naming inconsistency ([#15334](https://github.com/laravel/framework/pull/15334))
<del>
<del>
<del>## v5.3.6 (2016-09-01)
<del>
<del>### Added
<del>- Added `required` attributes to auth scaffold ([#15087](https://github.com/laravel/framework/pull/15087))
<del>- Support custom recipient(s) in `MailMessage` notifications ([#15100](https://github.com/laravel/framework/pull/15100))
<del>- Support custom greeting in `SimpleMessage` notifications ([#15108](https://github.com/laravel/framework/pull/15108))
<del>- Added `prependLocation()` method to `FileViewFinder` ([#15103](https://github.com/laravel/framework/pull/15103))
<del>- Added fluent email priority setter ([#15178](https://github.com/laravel/framework/pull/15178))
<del>- Added `send()` and `sendNow()` to notification factory contract ([0066b5d](https://github.com/laravel/framework/commit/0066b5da6f009275348ab71904da2376c6c47281))
<del>
<del>### Changed
<del>- Defer resolving of PDO connection until needed ([#15031](https://github.com/laravel/framework/pull/15031))
<del>- Send plain text email along with HTML email notifications ([#15016](https://github.com/laravel/framework/pull/15016), [#15092](https://github.com/laravel/framework/pull/15092), [#15115](https://github.com/laravel/framework/pull/15115))
<del>- Stop further validation if a `required` rule fails ([#15089](https://github.com/laravel/framework/pull/15089))
<del>- Swaps `drop()` for `dropIfExists()` in migration stub ([#15113](https://github.com/laravel/framework/pull/15113))
<del>- The `resource_path()` helper now relies on `Application::resourcePath()` ([#15095](https://github.com/laravel/framework/pull/15095))
<del>- Optimized performance of `Str::random()` ([#15112](https://github.com/laravel/framework/pull/15112))
<del>- Show `app.name` in auth stub ([#15138](https://github.com/laravel/framework/pull/15138))
<del>- Switched from `htmlentities()` to `htmlspecialchars()` in `e()` helper ([#15159](https://github.com/laravel/framework/pull/15159))
<del>- Hide empty paginators ([#15125](https://github.com/laravel/framework/pull/15125))
<del>
<del>### Fixed
<del>- Fixed `migrate:rollback` with `FETCH_ASSOC` enabled ([#15088](https://github.com/laravel/framework/pull/15088))
<del>- Fixes query builder not considering raw expressions in `whereIn()` ([#15078](https://github.com/laravel/framework/pull/15078))
<del>- Fixed notifications serialization mistake in `ChannelManager` ([#15106](https://github.com/laravel/framework/pull/15106))
<del>- Fixed session id collisions ([#15206](https://github.com/laravel/framework/pull/15206))
<del>- Fixed extending cache expiration time issue in `file` cache ([#15164](https://github.com/laravel/framework/pull/15164))
<del>
<del>### Removed
<del>- Removed data transformation in `Response::json()` ([#15137](https://github.com/laravel/framework/pull/15137))
<del>
<del>
<del>## v5.3.4 (2016-08-26)
<del>
<del>### Added
<del>- Added ability to set from address for email notifications ([#15055](https://github.com/laravel/framework/pull/15055))
<del>
<del>### Changed
<del>- Support implicit keys in `MessageBag::get()` ([#15063](https://github.com/laravel/framework/pull/15063))
<del>- Allow passing of closures to `assertViewHas()` ([#15074](https://github.com/laravel/framework/pull/15074))
<del>- Strip protocol from Route group domains parameters ([#15070](https://github.com/laravel/framework/pull/15070))
<del>- Support dot notation as callback in `Arr::sort()` ([#15050](https://github.com/laravel/framework/pull/15050))
<del>- Use Redis database interface instead of implementation ([#15041](https://github.com/laravel/framework/pull/15041))
<del>- Allow closure middleware to be registered from the controller constructor ([#15080](https://github.com/laravel/framework/pull/15080), [abd85c9](https://github.com/laravel/framework/commit/abd85c916df0cc0a6dc55de943a39db8b7eb4e0d))
<del>
<del>### Fixed
<del>- Fixed plural form of Emoji ([#15068](https://github.com/laravel/framework/pull/15068))
<del>
<del>
<del>## v5.3.3 (2016-08-26)
<del>
<del>### Fixed
<del>- Fixed testing of Eloquent model events ([#15052](https://github.com/laravel/framework/pull/15052))
<del>
<del>
<del>## v5.3.2 (2016-08-24)
<del>
<del>### Fixed
<del>- Revert changes to Eloquent `Builder` that breaks `firstOr*` methods ([#15018](https://github.com/laravel/framework/pull/15018))
<del>
<del>
<del>## v5.3.1 (2016-08-24)
<del>
<del>### Changed
<del>- Support unversioned assets in `elixir()` function ([#14987](https://github.com/laravel/framework/pull/14987))
<del>- Changed visibility of `BladeCompiler::stripParentheses()` to `public` ([#14986](https://github.com/laravel/framework/pull/14986))
<del>- Use getter instead of accessing the properties directly in `JoinClause::__construct()` ([#14984](https://github.com/laravel/framework/pull/14984))
<del>- Replaced manual comparator with `asort` in `Collection::sort()` ([#14980](https://github.com/laravel/framework/pull/14980))
<del>- Use `query()` instead of `input()` for key lookup in `TokenGuard::getTokenForRequest()` ([#14985](https://github.com/laravel/framework/pull/14985))
<del>
<del>### Fixed
<del>- Check if exact key exists before assuming the dot notation represents segments in `Arr::has()` ([#14976](https://github.com/laravel/framework/pull/14976))
<del>- Revert aggregate changes in [#14793](https://github.com/laravel/framework/pull/14793) ([#14994](https://github.com/laravel/framework/pull/14994))
<del>- Prevent infinite recursion with closure based console commands ([26eaa35](https://github.com/laravel/framework/commit/26eaa35c0dbd988084e748410a31c8b01fc1993a))
<del>- Fixed `transaction()` method for SqlServer ([f4588f8](https://github.com/laravel/framework/commit/f4588f8851aab1129f77d87b7dc1097c842390db)) | 2 |
Javascript | Javascript | fix spelling error | e17f85cc5b5ebc8be5c5551729549590324d5d64 | <ide><path>src/ngMessages/messages.js
<ide> angular.module('ngMessages', [])
<ide> *
<ide> * @description
<ide> * `ngMessages` is a directive that is designed to show and hide messages based on the state
<del> * of a key/value object that it listens on. The directive itself compliments error message
<add> * of a key/value object that it listens on. The directive itself complements error message
<ide> * reporting with the `ngModel` $error object (which stores a key/value state of validation errors).
<ide> *
<ide> * `ngMessages` manages the state of internal messages within its container element. The internal | 1 |
Javascript | Javascript | add failing test for https2 compatibility | 94963ab39adcf4b346646f9a4bb5cd3dbf09dac6 | <ide><path>test/simple/test-regress-GH-1531.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>if (!process.versions.openssl) {
<add> console.error("Skipping because node compiled without OpenSSL.");
<add> process.exit(0);
<add>}
<add>
<add>var https = require('https');
<add>var assert = require('assert');
<add>var fs = require('fs');
<add>var common = require('../common');
<add>
<add>var options = {
<add> key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
<add> cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
<add>};
<add>
<add>var gotCallback = false;
<add>
<add>var server = https.createServer(options, function(req, res) {
<add> res.writeHead(200);
<add> res.end("hello world\n");
<add>});
<add>
<add>server.listen(common.PORT, function() {
<add> https.get({
<add> path: '/',
<add> port: common.PORT,
<add> agent: false
<add> }, function (res) {
<add> console.error(res.statusCode);
<add> gotCallback = true;
<add> server.close();
<add> }).on('error', function (e) {
<add> console.error(e.message);
<add> process.exit(1);
<add> });
<add>});
<add>
<add>process.on('exit', function() {
<add> assert.ok(gotCallback);
<add>});
<add> | 1 |
Ruby | Ruby | allow enumerate non-git taps | a9b9c5ade798ca8378f9e8bf3d82f6f2b01d8312 | <ide><path>Library/Homebrew/cmd/update.rb
<ide> def update
<ide> # this procedure will be removed in the future if it seems unnecessasry
<ide> rename_taps_dir_if_necessary
<ide>
<del> Tap.each do |tap|
<add> Tap.select(&:git?).each do |tap|
<ide> tap.path.cd do
<ide> updater = Updater.new(tap.path)
<ide>
<ide><path>Library/Homebrew/tap.rb
<ide> def initialize(user, repo)
<ide> # e.g. `https://github.com/user/homebrew-repo`
<ide> def remote
<ide> @remote ||= if installed?
<del> if (@path/".git").exist?
<add> if git?
<ide> @path.cd do
<ide> Utils.popen_read("git", "config", "--get", "remote.origin.url").chomp
<ide> end
<ide> def remote
<ide> end
<ide> end
<ide>
<add> # True if this {Tap} is a git repository.
<add> def git?
<add> (@path/".git").exist?
<add> end
<add>
<ide> def to_s
<ide> name
<ide> end
<ide> def self.each
<ide>
<ide> TAP_DIRECTORY.subdirs.each do |user|
<ide> user.subdirs.each do |repo|
<del> if (repo/".git").directory?
<del> yield new(user.basename.to_s, repo.basename.to_s.sub("homebrew-", ""))
<del> end
<add> yield new(user.basename.to_s, repo.basename.to_s.sub("homebrew-", ""))
<ide> end
<ide> end
<ide> end | 2 |
Ruby | Ruby | change comments to not exceed 80 characters | ee2589723060c31cec874dabc9eade203c445421 | <ide><path>actioncable/lib/rails/generators/channel/templates/application_cable/channel.rb
<del># Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
<add># Be sure to restart your server when you modify this file. Action Cable runs in
<add># a loop that does not support auto reloading.
<ide> module ApplicationCable
<ide> class Channel < ActionCable::Channel::Base
<ide> end
<ide><path>actioncable/lib/rails/generators/channel/templates/application_cable/connection.rb
<del># Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
<add># Be sure to restart your server when you modify this file. Action Cable runs in
<add># a loop that does not support auto reloading.
<ide> module ApplicationCable
<ide> class Connection < ActionCable::Connection::Base
<ide> end | 2 |
Ruby | Ruby | update error names in docs [ci skip] | 96f59306101a6ee252df2a9636ef2569d26924f7 | <ide><path>activestorage/app/models/active_storage/blob/representable.rb
<ide> module ActiveStorage::Blob::Representable
<ide> # This will create a URL for that specific blob with that specific variant, which the ActiveStorage::VariantsController
<ide> # can then produce on-demand.
<ide> #
<del> # Raises ActiveStorage::Blob::InvariableError if ImageMagick cannot transform the blob. To determine whether a blob is
<add> # Raises ActiveStorage::InvariableError if ImageMagick cannot transform the blob. To determine whether a blob is
<ide> # variable, call ActiveStorage::Blob#variable?.
<ide> def variant(transformations)
<ide> if variable?
<ide> def variable?
<ide> #
<ide> # <%= image_tag video.preview(resize: "100x100") %>
<ide> #
<del> # This method raises ActiveStorage::Blob::UnpreviewableError if no previewer accepts the receiving blob. To determine
<add> # This method raises ActiveStorage::UnpreviewableError if no previewer accepts the receiving blob. To determine
<ide> # whether a blob is accepted by any previewer, call ActiveStorage::Blob#previewable?.
<ide> def preview(transformations)
<ide> if previewable?
<ide> def previewable?
<ide> #
<ide> # blob.representation(resize: "100x100").processed.service_url
<ide> #
<del> # Raises ActiveStorage::Blob::UnrepresentableError if the receiving blob is neither variable nor previewable. Call
<add> # Raises ActiveStorage::UnrepresentableError if the receiving blob is neither variable nor previewable. Call
<ide> # ActiveStorage::Blob#representable? to determine whether a blob is representable.
<ide> #
<ide> # See ActiveStorage::Blob#preview and ActiveStorage::Blob#variant for more information. | 1 |
PHP | PHP | remove typehint from generateassociationquery() | 3a226b03c3ca5ea255d2e1ec22bb9bd51fc13ea8 | <ide><path>lib/Cake/Model/Datasource/DboSource.php
<ide> public function buildAssociationQuery(Model $Model, $queryData) {
<ide> public function generateAssociationQuery(Model $Model, $LinkModel, $type, $association, $assocData, &$queryData, $external) {
<ide> $assocData = $this->_scrubQueryData($assocData);
<ide>
<add> if ($LinkModel === null) {
<add> return '';
<add> }
<add>
<ide> if ($external && !empty($assocData['finderQuery'])) {
<ide> return $assocData['finderQuery'];
<ide> } | 1 |
PHP | PHP | add type hinting on $parameters | 27b1d17a420b4556a261c6f7a49115a90edd1018 | <ide><path>src/Illuminate/Container/Container.php
<ide> protected function isCallableWithAtSign($callback)
<ide> * @param array $parameters
<ide> * @return array
<ide> */
<del> protected function getMethodDependencies($callback, $parameters = [])
<add> protected function getMethodDependencies($callback, array $parameters = [])
<ide> {
<ide> $dependencies = [];
<ide>
<ide> protected function callClass($target, array $parameters = [], $defaultMethod = n
<ide> * @param array $parameters
<ide> * @return mixed
<ide> */
<del> public function make($abstract, $parameters = [])
<add> public function make($abstract, array $parameters = [])
<ide> {
<ide> $abstract = $this->getAlias($abstract);
<ide>
<ide> protected function getExtenders($abstract)
<ide> *
<ide> * @throws BindingResolutionException
<ide> */
<del> public function build($concrete, $parameters = [])
<add> public function build($concrete, array $parameters = [])
<ide> {
<ide> // If the concrete type is actually a Closure, we will just execute it and
<ide> // hand back the results of the functions, which allows functions to be
<ide> public function build($concrete, $parameters = [])
<ide> * @param array $primitives
<ide> * @return array
<ide> */
<del> protected function getDependencies($parameters, array $primitives = [])
<add> protected function getDependencies(array $parameters, array $primitives = [])
<ide> {
<ide> $dependencies = [];
<ide>
<ide><path>src/Illuminate/Contracts/Container/Container.php
<ide> public function when($concrete);
<ide> * @param array $parameters
<ide> * @return mixed
<ide> */
<del> public function make($abstract, $parameters = array());
<add> public function make($abstract, array $parameters = []);
<ide>
<ide> /**
<ide> * Call the given Closure / class@method and inject its dependencies.
<ide> public function make($abstract, $parameters = array());
<ide> * @param string|null $defaultMethod
<ide> * @return mixed
<ide> */
<del> public function call($callback, array $parameters = array(), $defaultMethod = null);
<add> public function call($callback, array $parameters = [], $defaultMethod = null);
<ide>
<ide> /**
<ide> * Determine if the given abstract type has been resolved.
<ide><path>src/Illuminate/Foundation/Application.php
<ide> public function registerDeferredProvider($provider, $service = null)
<ide> * @param array $parameters
<ide> * @return mixed
<ide> */
<del> public function make($abstract, $parameters = array())
<add> public function make($abstract, array $parameters = array())
<ide> {
<ide> $abstract = $this->getAlias($abstract);
<ide> | 3 |
Java | Java | add webflux support for smile streaming | 32f6ccece8ba348381b4dcee8e332a89e9e42b29 | <ide><path>spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Decoder.java
<ide>
<ide> import java.io.IOException;
<ide> import java.lang.annotation.Annotation;
<add>import java.util.List;
<ide> import java.util.Map;
<ide>
<ide> import com.fasterxml.jackson.core.JsonFactory;
<ide> public Map<String, Object> getDecodeHints(ResolvableType actualType, ResolvableT
<ide> return getHints(actualType);
<ide> }
<ide>
<add> @Override
<add> public List<MimeType> getDecodableMimeTypes() {
<add> return getMimeTypes();
<add> }
<add>
<add> // Jackson2CodecSupport ...
<add>
<ide> @Override
<ide> protected <A extends Annotation> A getAnnotation(MethodParameter parameter, Class<A> annotType) {
<ide> return parameter.getParameterAnnotation(annotType);
<ide><path>spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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 abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple
<ide>
<ide> protected final List<MediaType> streamingMediaTypes = new ArrayList<>(1);
<ide>
<add> protected boolean streamingLineSeparator = true;
<add>
<ide>
<ide> /**
<ide> * Constructor with a Jackson {@link ObjectMapper} to use.
<ide> public Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory buffe
<ide> else if (this.streamingMediaTypes.stream().anyMatch(mediaType -> mediaType.isCompatibleWith(mimeType))) {
<ide> return Flux.from(inputStream).map(value -> {
<ide> DataBuffer buffer = encodeValue(value, mimeType, bufferFactory, elementType, hints);
<del> buffer.write(new byte[]{'\n'});
<add> if (streamingLineSeparator) {
<add> buffer.write(new byte[]{'\n'});
<add> }
<ide> return buffer;
<ide> });
<ide> }
<ide> protected ObjectWriter customizeWriter(ObjectWriter writer, @Nullable MimeType m
<ide>
<ide> // HttpMessageEncoder...
<ide>
<add> @Override
<add> public List<MimeType> getEncodableMimeTypes() {
<add> return getMimeTypes();
<add> }
<add>
<ide> @Override
<ide> public List<MediaType> getStreamingMediaTypes() {
<ide> return Collections.unmodifiableList(this.streamingMediaTypes);
<ide> public Map<String, Object> getEncodeHints(@Nullable ResolvableType actualType, R
<ide> return (actualType != null ? getHints(actualType) : Collections.emptyMap());
<ide> }
<ide>
<add> // Jackson2CodecSupport ...
<add>
<ide> @Override
<ide> protected <A extends Annotation> A getAnnotation(MethodParameter parameter, Class<A> annotType) {
<ide> return parameter.getMethodAnnotation(annotType);
<ide><path>spring-web/src/main/java/org/springframework/http/codec/json/Jackson2JsonDecoder.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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> package org.springframework.http.codec.json;
<ide>
<del>import java.util.List;
<del>
<ide> import com.fasterxml.jackson.databind.ObjectMapper;
<ide>
<ide> import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
<ide> public Jackson2JsonDecoder(ObjectMapper mapper, MimeType... mimeTypes) {
<ide> super(mapper, mimeTypes);
<ide> }
<ide>
<del>
<del> @Override
<del> public List<MimeType> getDecodableMimeTypes() {
<del> return getMimeTypes();
<del> }
<del>
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/json/Jackson2JsonEncoder.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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> * @see Jackson2JsonDecoder
<ide> */
<ide> public class Jackson2JsonEncoder extends AbstractJackson2Encoder {
<del>
<add>
<ide> @Nullable
<ide> private final PrettyPrinter ssePrettyPrinter;
<ide>
<ide> protected ObjectWriter customizeWriter(ObjectWriter writer, @Nullable MimeType m
<ide> writer.with(this.ssePrettyPrinter) : writer);
<ide> }
<ide>
<del> @Override
<del> public List<MimeType> getEncodableMimeTypes() {
<del> return getMimeTypes();
<del> }
<del>
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/json/Jackson2SmileDecoder.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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> package org.springframework.http.codec.json;
<ide>
<add>import java.nio.charset.StandardCharsets;
<add>import java.util.Arrays;
<ide> import java.util.Collections;
<ide> import java.util.List;
<ide>
<ide> */
<ide> public class Jackson2SmileDecoder extends AbstractJackson2Decoder {
<ide>
<del> private static final MimeType SMILE_MIME_TYPE = new MediaType("application", "x-jackson-smile");
<add> private static final MimeType[] DEFAULT_SMILE_MIME_TYPES = new MimeType[] {
<add> new MimeType("application", "x-jackson-smile", StandardCharsets.UTF_8),
<add> new MimeType("application", "*+x-jackson-smile", StandardCharsets.UTF_8)};
<ide>
<ide>
<ide> public Jackson2SmileDecoder() {
<del> this(Jackson2ObjectMapperBuilder.smile().build(), SMILE_MIME_TYPE);
<add> this(Jackson2ObjectMapperBuilder.smile().build(), DEFAULT_SMILE_MIME_TYPES);
<ide> }
<ide>
<ide> public Jackson2SmileDecoder(ObjectMapper mapper, MimeType... mimeTypes) {
<ide> super(mapper, mimeTypes);
<ide> Assert.isAssignable(SmileFactory.class, mapper.getFactory().getClass());
<ide> }
<ide>
<del> @Override
<del> public List<MimeType> getDecodableMimeTypes() {
<del> return Collections.singletonList(SMILE_MIME_TYPE);
<del> }
<del>
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/json/Jackson2SmileEncoder.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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> package org.springframework.http.codec.json;
<ide>
<add>import java.nio.charset.StandardCharsets;
<ide> import java.util.Collections;
<ide> import java.util.List;
<ide>
<ide> */
<ide> public class Jackson2SmileEncoder extends AbstractJackson2Encoder {
<ide>
<del> private static final MimeType SMILE_MIME_TYPE = new MediaType("application", "x-jackson-smile");
<add> private static final MimeType[] DEFAULT_SMILE_MIME_TYPES = new MimeType[] {
<add> new MimeType("application", "x-jackson-smile", StandardCharsets.UTF_8),
<add> new MimeType("application", "*+x-jackson-smile", StandardCharsets.UTF_8)};
<ide>
<ide>
<ide> public Jackson2SmileEncoder() {
<del> this(Jackson2ObjectMapperBuilder.smile().build(), new MediaType("application", "x-jackson-smile"));
<add> this(Jackson2ObjectMapperBuilder.smile().build(), DEFAULT_SMILE_MIME_TYPES);
<ide> }
<ide>
<ide> public Jackson2SmileEncoder(ObjectMapper mapper, MimeType... mimeTypes) {
<ide> super(mapper, mimeTypes);
<ide> Assert.isAssignable(SmileFactory.class, mapper.getFactory().getClass());
<ide> this.streamingMediaTypes.add(new MediaType("application", "stream+x-jackson-smile"));
<del> }
<del>
<del>
<del> @Override
<del> public List<MimeType> getEncodableMimeTypes() {
<del> return Collections.singletonList(SMILE_MIME_TYPE);
<add> this.streamingLineSeparator = false;
<ide> }
<ide>
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/codec/json/Jackson2Tokenizer.java
<ide> private Flux<TokenBuffer> parseTokenBufferFlux() throws IOException {
<ide>
<ide> while (true) {
<ide> JsonToken token = this.parser.nextToken();
<del> if (token == null || token == JsonToken.NOT_AVAILABLE) {
<add> // SPR-16151: Smile data format uses null to separate documents
<add> if ((token == JsonToken.NOT_AVAILABLE) ||
<add> (token == null && (token = this.parser.nextToken()) == null)) {
<ide> break;
<ide> }
<ide> updateDepth(token);
<ide><path>spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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 static org.junit.Assert.assertTrue;
<ide> import static org.springframework.core.ResolvableType.forClass;
<ide> import static org.springframework.http.MediaType.APPLICATION_JSON;
<add>import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8;
<add>import static org.springframework.http.MediaType.APPLICATION_STREAM_JSON;
<ide> import static org.springframework.http.MediaType.APPLICATION_XML;
<ide> import static org.springframework.http.codec.json.Jackson2JsonDecoder.JSON_VIEW_HINT;
<ide> import static org.springframework.http.codec.json.JacksonViewBean.MyJacksonView1;
<ide> public void canDecode() {
<ide> Jackson2JsonDecoder decoder = new Jackson2JsonDecoder();
<ide>
<ide> assertTrue(decoder.canDecode(forClass(Pojo.class), APPLICATION_JSON));
<add> assertTrue(decoder.canDecode(forClass(Pojo.class), APPLICATION_JSON_UTF8));
<add> assertTrue(decoder.canDecode(forClass(Pojo.class), APPLICATION_STREAM_JSON));
<ide> assertTrue(decoder.canDecode(forClass(Pojo.class), null));
<ide>
<ide> assertFalse(decoder.canDecode(forClass(String.class), null));
<ide> public void decodeToList() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void decodeToFlux() throws Exception {
<add> public void decodeArrayToFlux() throws Exception {
<ide> Flux<DataBuffer> source = Flux.just(stringBuffer(
<ide> "[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\",\"foo\":\"f2\"}]"));
<ide>
<ide> public void decodeToFlux() throws Exception {
<ide> .verifyComplete();
<ide> }
<ide>
<add> @Test
<add> public void decodeStreamToFlux() throws Exception {
<add> Flux<DataBuffer> source = Flux.just(stringBuffer("{\"bar\":\"b1\",\"foo\":\"f1\"}"),
<add> stringBuffer("{\"bar\":\"b2\",\"foo\":\"f2\"}"));
<add>
<add> ResolvableType elementType = forClass(Pojo.class);
<add> Flux<Object> flux = new Jackson2JsonDecoder().decode(source, elementType, APPLICATION_STREAM_JSON,
<add> emptyMap());
<add>
<add> StepVerifier.create(flux)
<add> .expectNext(new Pojo("f1", "b1"))
<add> .expectNext(new Pojo("f2", "b2"))
<add> .verifyComplete();
<add> }
<add>
<ide> @Test
<ide> public void decodeEmptyArrayToFlux() throws Exception {
<ide> Flux<DataBuffer> source = Flux.just(stringBuffer("[]"));
<ide><path>spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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 Jackson2JsonEncoderTests extends AbstractDataBufferAllocatingTestCa
<ide> public void canEncode() {
<ide> ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
<ide> assertTrue(this.encoder.canEncode(pojoType, APPLICATION_JSON));
<add> assertTrue(this.encoder.canEncode(pojoType, APPLICATION_JSON_UTF8));
<add> assertTrue(this.encoder.canEncode(pojoType, APPLICATION_STREAM_JSON));
<ide> assertTrue(this.encoder.canEncode(pojoType, null));
<ide>
<ide> // SPR-15464
<ide><path>spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileDecoderTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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 static org.junit.Assert.assertTrue;
<ide> import static org.springframework.core.ResolvableType.forClass;
<ide> import static org.springframework.http.MediaType.APPLICATION_JSON;
<add>import static org.springframework.http.MediaType.APPLICATION_STREAM_JSON;
<ide>
<ide> /**
<ide> * Unit tests for {@link Jackson2SmileDecoder}.
<ide> public class Jackson2SmileDecoderTests extends AbstractDataBufferAllocatingTestCase {
<ide>
<ide> private final static MimeType SMILE_MIME_TYPE = new MimeType("application", "x-jackson-smile");
<add> private final static MimeType STREAM_SMILE_MIME_TYPE = new MimeType("application", "stream+x-jackson-smile");
<ide>
<ide> private final Jackson2SmileDecoder decoder = new Jackson2SmileDecoder();
<ide>
<ide> @Test
<ide> public void canDecode() {
<ide> assertTrue(decoder.canDecode(forClass(Pojo.class), SMILE_MIME_TYPE));
<add> assertTrue(decoder.canDecode(forClass(Pojo.class), STREAM_SMILE_MIME_TYPE));
<ide> assertTrue(decoder.canDecode(forClass(Pojo.class), null));
<ide>
<ide> assertFalse(decoder.canDecode(forClass(String.class), null));
<ide> public void decodeToList() throws Exception {
<ide> }
<ide>
<ide> @Test
<del> public void decodeToFlux() throws Exception {
<add> public void decodeListToFlux() throws Exception {
<ide> ObjectMapper mapper = Jackson2ObjectMapperBuilder.smile().build();
<ide> List<Pojo> list = asList(new Pojo("f1", "b1"), new Pojo("f2", "b2"));
<ide> byte[] serializedList = mapper.writer().writeValueAsBytes(list);
<ide> public void decodeToFlux() throws Exception {
<ide> .verifyComplete();
<ide> }
<ide>
<add> @Test
<add> public void decodeStreamToFlux() throws Exception {
<add> ObjectMapper mapper = Jackson2ObjectMapperBuilder.smile().build();
<add> List<Pojo> list = asList(new Pojo("f1", "b1"), new Pojo("f2", "b2"));
<add> byte[] serializedList = mapper.writer().writeValueAsBytes(list);
<add> Flux<DataBuffer> source = Flux.just(this.bufferFactory.wrap(serializedList));
<add>
<add> ResolvableType elementType = forClass(Pojo.class);
<add> Flux<Object> flux = decoder.decode(source, elementType, STREAM_SMILE_MIME_TYPE, emptyMap());
<add>
<add> StepVerifier.create(flux)
<add> .expectNext(new Pojo("f1", "b1"))
<add> .expectNext(new Pojo("f2", "b2"))
<add> .verifyComplete();
<add> }
<add>
<ide> }
<ide><path>spring-web/src/test/java/org/springframework/http/codec/json/Jackson2SmileEncoderTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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 Jackson2SmileEncoderTests extends AbstractDataBufferAllocatingTestCase {
<ide>
<ide> private final static MimeType SMILE_MIME_TYPE = new MimeType("application", "x-jackson-smile");
<add> private final static MimeType STREAM_SMILE_MIME_TYPE = new MimeType("application", "stream+x-jackson-smile");
<ide>
<ide> private final Jackson2SmileEncoder encoder = new Jackson2SmileEncoder();
<ide>
<ide> public class Jackson2SmileEncoderTests extends AbstractDataBufferAllocatingTestC
<ide> public void canEncode() {
<ide> ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
<ide> assertTrue(this.encoder.canEncode(pojoType, SMILE_MIME_TYPE));
<add> assertTrue(this.encoder.canEncode(pojoType, STREAM_SMILE_MIME_TYPE));
<ide> assertTrue(this.encoder.canEncode(pojoType, null));
<ide>
<ide> // SPR-15464
<ide> public void encodeAsStream() throws Exception {
<ide> new Pojo("foofoofoo", "barbarbar")
<ide> );
<ide> ResolvableType type = ResolvableType.forClass(Pojo.class);
<del> MediaType mediaType = new MediaType("application", "stream+x-jackson-smile");
<del> Flux<DataBuffer> output = this.encoder.encode(source, this.bufferFactory, type, mediaType, emptyMap());
<add> Flux<DataBuffer> output = this.encoder.encode(source, this.bufferFactory, type, STREAM_SMILE_MIME_TYPE, emptyMap());
<ide>
<ide> ObjectMapper mapper = Jackson2ObjectMapperBuilder.smile().build();
<ide> StepVerifier.create(output)
<add><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JacksonStreamingIntegrationTests.java
<del><path>spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/JsonStreamingIntegrationTests.java
<ide> /*
<del> * Copyright 2002-2017 the original author or authors.
<add> * Copyright 2002-2018 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 org.springframework.context.annotation.AnnotationConfigApplicationContext;
<ide> import org.springframework.context.annotation.Bean;
<ide> import org.springframework.context.annotation.Configuration;
<add>import org.springframework.http.MediaType;
<ide> import org.springframework.http.server.reactive.AbstractHttpHandlerIntegrationTests;
<ide> import org.springframework.http.server.reactive.HttpHandler;
<ide> import org.springframework.web.bind.annotation.RequestMapping;
<ide> /**
<ide> * @author Sebastien Deleuze
<ide> */
<del>public class JsonStreamingIntegrationTests extends AbstractHttpHandlerIntegrationTests {
<add>public class JacksonStreamingIntegrationTests extends AbstractHttpHandlerIntegrationTests {
<ide>
<ide> private AnnotationConfigApplicationContext wac;
<ide>
<ide> public void jsonStreaming() throws Exception {
<ide> .verify();
<ide> }
<ide>
<add> @Test
<add> public void smileStreaming() throws Exception {
<add> Flux<Person> result = this.webClient.get()
<add> .uri("/stream")
<add> .accept(new MediaType("application", "stream+x-jackson-smile"))
<add> .exchange()
<add> .flatMapMany(response -> response.bodyToFlux(Person.class));
<add>
<add> StepVerifier.create(result)
<add> .expectNext(new Person("foo 0"))
<add> .expectNext(new Person("foo 1"))
<add> .thenCancel()
<add> .verify();
<add> }
<add>
<ide> @RestController
<ide> @SuppressWarnings("unused")
<del> static class JsonStreamingController {
<add> static class JacksonStreamingController {
<ide>
<del> @RequestMapping(value = "/stream", produces = APPLICATION_STREAM_JSON_VALUE)
<add> @RequestMapping(value = "/stream", produces = { APPLICATION_STREAM_JSON_VALUE, "application/stream+x-jackson-smile" })
<ide> Flux<Person> person() {
<ide> return Flux.interval(Duration.ofMillis(100)).map(l -> new Person("foo " + l));
<ide> }
<ide> Flux<Person> person() {
<ide> static class TestConfiguration {
<ide>
<ide> @Bean
<del> public JsonStreamingController jsonStreamingController() {
<del> return new JsonStreamingController();
<add> public JacksonStreamingController jsonStreamingController() {
<add> return new JacksonStreamingController();
<ide> }
<ide> }
<ide> | 12 |
Javascript | Javascript | ensure correct key order | 2e32aa86301c098adc80dc44117ba395ff33494b | <ide><path>packages/next/build/webpack/plugins/build-manifest-plugin.js
<ide> import { RawSource } from 'webpack-sources'
<del>import { BUILD_MANIFEST, ROUTE_NAME_REGEX, IS_BUNDLED_PAGE_REGEX, CLIENT_STATIC_FILES_RUNTIME_MAIN } from 'next-server/constants'
<add>import {
<add> BUILD_MANIFEST,
<add> ROUTE_NAME_REGEX,
<add> IS_BUNDLED_PAGE_REGEX,
<add> CLIENT_STATIC_FILES_RUNTIME_MAIN
<add>} from 'next-server/constants'
<ide>
<ide> // This plugin creates a build-manifest.json for all assets that are being output
<ide> // It has a mapping of "entry" filename to real filename. Because the real filename can be hashed in production
<ide> export default class BuildManifestPlugin {
<ide> apply (compiler) {
<del> compiler.hooks.emit.tapAsync('NextJsBuildManifest', (compilation, callback) => {
<del> const { chunks } = compilation
<del> const assetMap = { devFiles: [], pages: {} }
<add> compiler.hooks.emit.tapAsync(
<add> 'NextJsBuildManifest',
<add> (compilation, callback) => {
<add> const { chunks } = compilation
<add> const assetMap = { devFiles: [], pages: {} }
<ide>
<del> const mainJsChunk = chunks.find((c) => c.name === CLIENT_STATIC_FILES_RUNTIME_MAIN)
<del> const mainJsFiles = mainJsChunk && mainJsChunk.files.length > 0 ? mainJsChunk.files.filter((file) => /\.js$/.test(file)) : []
<add> const mainJsChunk = chunks.find(
<add> c => c.name === CLIENT_STATIC_FILES_RUNTIME_MAIN
<add> )
<add> const mainJsFiles =
<add> mainJsChunk && mainJsChunk.files.length > 0
<add> ? mainJsChunk.files.filter(file => /\.js$/.test(file))
<add> : []
<ide>
<del> for (const filePath of Object.keys(compilation.assets)) {
<del> const path = filePath.replace(/\\/g, '/')
<del> if (/^static\/development\/dll\//.test(path)) {
<del> assetMap.devFiles.push(path)
<del> }
<del> }
<del>
<del> // compilation.entrypoints is a Map object, so iterating over it 0 is the key and 1 is the value
<del> for (const [, entrypoint] of compilation.entrypoints.entries()) {
<del> const result = ROUTE_NAME_REGEX.exec(entrypoint.name)
<del> if (!result) {
<del> continue
<add> for (const filePath of Object.keys(compilation.assets)) {
<add> const path = filePath.replace(/\\/g, '/')
<add> if (/^static\/development\/dll\//.test(path)) {
<add> assetMap.devFiles.push(path)
<add> }
<ide> }
<ide>
<del> const pagePath = result[1]
<add> // compilation.entrypoints is a Map object, so iterating over it 0 is the key and 1 is the value
<add> for (const [, entrypoint] of compilation.entrypoints.entries()) {
<add> const result = ROUTE_NAME_REGEX.exec(entrypoint.name)
<add> if (!result) {
<add> continue
<add> }
<ide>
<del> if (!pagePath) {
<del> continue
<del> }
<add> const pagePath = result[1]
<ide>
<del> const filesForEntry = []
<del> for (const chunk of entrypoint.chunks) {
<del> // If there's no name or no files
<del> if (!chunk.name || !chunk.files) {
<add> if (!pagePath) {
<ide> continue
<ide> }
<ide>
<del> for (const file of chunk.files) {
<del> if (/\.map$/.test(file) || /\.hot-update\.js$/.test(file)) {
<add> const filesForEntry = []
<add> for (const chunk of entrypoint.chunks) {
<add> // If there's no name or no files
<add> if (!chunk.name || !chunk.files) {
<ide> continue
<ide> }
<ide>
<del> // Only `.js` and `.css` files are added for now. In the future we can also handle other file types.
<del> if (!/\.js$/.test(file) && !/\.css$/.test(file)) {
<del> continue
<del> }
<add> for (const file of chunk.files) {
<add> if (/\.map$/.test(file) || /\.hot-update\.js$/.test(file)) {
<add> continue
<add> }
<ide>
<del> // The page bundles are manually added to _document.js as they need extra properties
<del> if (IS_BUNDLED_PAGE_REGEX.exec(file)) {
<del> continue
<del> }
<add> // Only `.js` and `.css` files are added for now. In the future we can also handle other file types.
<add> if (!/\.js$/.test(file) && !/\.css$/.test(file)) {
<add> continue
<add> }
<add>
<add> // The page bundles are manually added to _document.js as they need extra properties
<add> if (IS_BUNDLED_PAGE_REGEX.exec(file)) {
<add> continue
<add> }
<ide>
<del> filesForEntry.push(file.replace(/\\/g, '/'))
<add> filesForEntry.push(file.replace(/\\/g, '/'))
<add> }
<ide> }
<del> }
<ide>
<del> assetMap.pages[`/${pagePath.replace(/\\/g, '/')}`] = [...filesForEntry, ...mainJsFiles]
<del> }
<add> assetMap.pages[`/${pagePath.replace(/\\/g, '/')}`] = [
<add> ...filesForEntry,
<add> ...mainJsFiles
<add> ]
<add> }
<ide>
<del> if (typeof assetMap.pages['/index'] !== 'undefined') {
<del> assetMap.pages['/'] = assetMap.pages['/index']
<del> }
<add> if (typeof assetMap.pages['/index'] !== 'undefined') {
<add> assetMap.pages['/'] = assetMap.pages['/index']
<add> }
<ide>
<del> assetMap.pages = Object.keys(assetMap.pages)
<del> .sort()
<del> .reduce((a, c) => Object.assign(a, { [c]: assetMap.pages[c] }), {})
<add> assetMap.pages = Object.keys(assetMap.pages)
<add> .sort()
<add> // eslint-disable-next-line
<add> .reduce((a, c) => ((a[c] = assetMap.pages[c]), a), {})
<ide>
<del> compilation.assets[BUILD_MANIFEST] = new RawSource(JSON.stringify(assetMap, null, 2))
<del> callback()
<del> })
<add> compilation.assets[BUILD_MANIFEST] = new RawSource(
<add> JSON.stringify(assetMap, null, 2)
<add> )
<add> callback()
<add> }
<add> )
<ide> }
<ide> } | 1 |
Go | Go | initialize field with name | da6944ec8747a50941c170186605c8cead517201 | <ide><path>daemon/cluster/executor/container/container.go
<ide> func (c *containerConfig) networkCreateRequest(name string) (clustertypes.Networ
<ide> options.IPAM.Config = append(options.IPAM.Config, c)
<ide> }
<ide>
<del> return clustertypes.NetworkCreateRequest{na.Network.ID, types.NetworkCreateRequest{Name: name, NetworkCreate: options}}, nil
<add> return clustertypes.NetworkCreateRequest{
<add> ID: na.Network.ID,
<add> NetworkCreateRequest: types.NetworkCreateRequest{
<add> Name: name,
<add> NetworkCreate: options,
<add> },
<add> }, nil
<ide> }
<ide>
<ide> func (c containerConfig) eventFilter() filters.Args {
<ide><path>daemon/cluster/executor/container/executor.go
<ide> func (e *executor) Configure(ctx context.Context, node *api.Node) error {
<ide> }
<ide>
<ide> return e.backend.SetupIngress(clustertypes.NetworkCreateRequest{
<del> na.Network.ID,
<del> types.NetworkCreateRequest{
<add> ID: na.Network.ID,
<add> NetworkCreateRequest: types.NetworkCreateRequest{
<ide> Name: na.Network.Spec.Annotations.Name,
<ide> NetworkCreate: options,
<ide> }, | 2 |
Go | Go | add godoc to info.warnings field | 7d63cbfd38d6059bfd56e89820948561fcead628 | <ide><path>api/types/types.go
<ide> type Info struct {
<ide> SecurityOptions []string
<ide> ProductLicense string `json:",omitempty"`
<ide> DefaultAddressPools []NetworkAddressPool `json:",omitempty"`
<del> Warnings []string
<add>
<add> // Warnings contains a slice of warnings that occurred while collecting
<add> // system information. These warnings are intended to be informational
<add> // messages for the user, and are not intended to be parsed / used for
<add> // other purposes, as they do not have a fixed format.
<add> Warnings []string
<ide> }
<ide>
<ide> // KeyValue holds a key/value pair | 1 |
Javascript | Javascript | handle errors on idle sockets | 5a2541de819e4457b05f4eca14d1926869b15be5 | <ide><path>lib/_http_client.js
<ide> function socketErrorListener(err) {
<ide> socket.destroy();
<ide> }
<ide>
<add>function freeSocketErrorListener(err) {
<add> var socket = this;
<add> debug('SOCKET ERROR on FREE socket:', err.message, err.stack);
<add> socket.destroy();
<add> socket.emit('agentRemove');
<add>}
<add>
<ide> function socketOnEnd() {
<ide> var socket = this;
<ide> var req = this._httpMessage;
<ide> function responseOnEnd() {
<ide> }
<ide> socket.removeListener('close', socketCloseListener);
<ide> socket.removeListener('error', socketErrorListener);
<add> socket.once('error', freeSocketErrorListener);
<ide> // Mark this socket as available, AFTER user-added end
<ide> // handlers have a chance to run.
<ide> process.nextTick(emitFreeNT, socket);
<ide> function tickOnSocket(req, socket) {
<ide> }
<ide>
<ide> parser.onIncoming = parserOnIncomingClient;
<add> socket.removeListener('error', freeSocketErrorListener);
<ide> socket.on('error', socketErrorListener);
<ide> socket.on('data', socketOnData);
<ide> socket.on('end', socketOnEnd);
<ide><path>test/parallel/test-http-agent-error-on-idle.js
<add>'use strict';
<add>var common = require('../common');
<add>var assert = require('assert');
<add>var http = require('http');
<add>var Agent = http.Agent;
<add>
<add>var agent = new Agent({
<add> keepAlive: true,
<add>});
<add>
<add>var requestParams = {
<add> host: 'localhost',
<add> port: common.PORT,
<add> agent: agent,
<add> path: '/'
<add>};
<add>
<add>var socketKey = agent.getName(requestParams);
<add>
<add>function get(callback) {
<add> return http.get(requestParams, callback);
<add>}
<add>
<add>var destroy_queue = {};
<add>var server = http.createServer(function(req, res) {
<add> res.end('hello world');
<add>});
<add>
<add>server.listen(common.PORT, function() {
<add> get(function(res) {
<add> assert.equal(res.statusCode, 200);
<add> res.resume();
<add> res.on('end', function() {
<add> process.nextTick(function() {
<add> var freeSockets = agent.freeSockets[socketKey];
<add> assert.equal(freeSockets.length, 1,
<add> 'expect a free socket on ' + socketKey);
<add>
<add> //generate a random error on the free socket
<add> var freeSocket = freeSockets[0];
<add> freeSocket.emit('error', new Error('ECONNRESET: test'));
<add>
<add> get(done);
<add> });
<add> });
<add> });
<add>});
<add>
<add>function done() {
<add> assert.equal(Object.keys(agent.freeSockets).length, 0,
<add> 'expect the freeSockets pool to be empty');
<add>
<add> agent.destroy();
<add> server.close();
<add> process.exit(0);
<add>} | 2 |
Go | Go | remove run from non-running commmands | f5fe3ce34e12f1660ee98cecdbe2c104567d88a6 | <ide><path>buildfile.go
<ide> func (b *buildFile) CmdAdd(args string) error {
<ide> b.config.Cmd = []string{"/bin/sh", "-c", fmt.Sprintf("#(nop) ADD %s in %s", orig, dest)}
<ide>
<ide> // Create the container and start it
<del> c, err := b.builder.Create(b.config)
<add> container, err := b.builder.Create(b.config)
<ide> if err != nil {
<ide> return err
<ide> }
<del> b.tmpContainers[c.ID] = struct{}{}
<add> b.tmpContainers[container.ID] = struct{}{}
<ide>
<del> container := b.runtime.Get(c.ID)
<del> if container == nil {
<del> return fmt.Errorf("Error while creating the container (CmdAdd)")
<del> }
<ide> if err := container.EnsureMounted(); err != nil {
<ide> return err
<ide> }
<ide> func (b *buildFile) CmdAdd(args string) error {
<ide> }
<ide> }
<ide>
<del> if err := b.commit(c.ID, cmd, fmt.Sprintf("ADD %s in %s", orig, dest)); err != nil {
<add> if err := b.commit(container.ID, cmd, fmt.Sprintf("ADD %s in %s", orig, dest)); err != nil {
<ide> return err
<ide> }
<ide> b.config.Cmd = cmd
<ide> func (b *buildFile) run() (string, error) {
<ide> return "", err
<ide> }
<ide> b.tmpContainers[c.ID] = struct{}{}
<add> fmt.Fprintf(b.out, "## %s\n", c.ID)
<ide>
<ide> //start the container
<ide> if err := c.Start(); err != nil {
<ide> func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
<ide> utils.Debugf("[BUILDER] Cache miss")
<ide> }
<ide>
<del> cid, err := b.run()
<add> container, err := b.builder.Create(b.config)
<ide> if err != nil {
<ide> return err
<ide> }
<del> id = cid
<add> b.tmpContainers[container.ID] = struct{}{}
<add> id = container.ID
<add> if err := container.EnsureMounted(); err != nil {
<add> return err
<add> }
<add> defer container.Unmount()
<ide> }
<ide>
<ide> container := b.runtime.Get(id)
<ide> func (b *buildFile) Build(dockerfile, context io.Reader) (string, error) {
<ide> fmt.Fprintf(b.out, "===> %v\n", b.image)
<ide> }
<ide> if b.image != "" {
<del> fmt.Fprintf(b.out, "Build successful.\n===> %s\n", b.image)
<add> fmt.Fprintf(b.out, "Build successful.\n%s\n", b.image)
<ide> return b.image, nil
<ide> }
<ide> return "", fmt.Errorf("An error occured during the build\n") | 1 |
Javascript | Javascript | remove usages of listkey | bc5cb7cd7933da707c02ff0dd993c607ba7d40b3 | <ide><path>Libraries/Lists/VirtualizedListProps.js
<ide> type OptionalProps = {|
<ide> * Styling for internal View for ListHeaderComponent
<ide> */
<ide> ListHeaderComponentStyle?: ViewStyleProp,
<del> /**
<del> * A unique identifier for this list. If there are multiple VirtualizedLists at the same level of
<del> * nesting within another VirtualizedList, this key is necessary for virtualization to
<del> * work properly.
<del> *
<del> * @deprecated no longer used/required
<del> */
<del> listKey?: string,
<ide> /**
<ide> * The maximum number of items to render in each incremental render batch. The more rendered at
<ide> * once, the better the fill rate, but responsiveness may suffer because rendering content may
<ide><path>packages/rn-tester/js/examples/FlatList/FlatList-nested.js
<ide> function OuterItemRenderer({
<ide> <View style={styles.col}>
<ide> <FlatList
<ide> data={items.map(i => index * items.length * 3 + i)}
<del> listKey={`${index}-col1`}
<ide> renderItem={p => (
<ide> <InnerItemRenderer
<ide> item={p.item}
<ide> function OuterItemRenderer({
<ide> <View style={styles.col}>
<ide> <FlatList
<ide> data={items.map(i => index * items.length * 3 + i + items.length)}
<del> listKey={`${index}-col2`}
<ide> renderItem={p => (
<ide> <InnerItemRenderer
<ide> item={p.item} | 2 |
Javascript | Javascript | use a "string_decoder" to parse "keypress" events | 3c91a7ae10f0ccabe4550c77189813f8d95785b0 | <ide><path>lib/readline.js
<ide> exports.Interface = Interface;
<ide> */
<ide>
<ide> function emitKeypressEvents(stream) {
<del> if (stream._emitKeypress) return;
<del> stream._emitKeypress = true;
<add> if (stream._keypressDecoder) return;
<add> var StringDecoder = require('string_decoder').StringDecoder; // lazy load
<add> stream._keypressDecoder = new StringDecoder('utf8');
<ide>
<ide> function onData(b) {
<ide> if (stream.listeners('keypress').length > 0) {
<del> emitKey(stream, b);
<add> var r = stream._keypressDecoder.write(b);
<add> if (r) emitKey(stream, r);
<ide> } else {
<ide> // Nobody's watching anyway
<ide> stream.removeListener('data', onData);
<ide><path>test/simple/test-readline-interface.js
<ide> function FakeInput() {
<ide> inherits(FakeInput, EventEmitter);
<ide> FakeInput.prototype.resume = function() {};
<ide> FakeInput.prototype.pause = function() {};
<add>FakeInput.prototype.write = function() {};
<add>FakeInput.prototype.end = function() {};
<ide>
<del>var fi;
<del>var rli;
<del>var called;
<add>[ true, false ].forEach(function(terminal) {
<add> var fi;
<add> var rli;
<add> var called;
<ide>
<del>// sending a full line
<del>fi = new FakeInput();
<del>rli = new readline.Interface(fi, {});
<del>called = false;
<del>rli.on('line', function(line) {
<del> called = true;
<del> assert.equal(line, 'asdf');
<del>});
<del>fi.emit('data', 'asdf\n');
<del>assert.ok(called);
<add> // sending a full line
<add> fi = new FakeInput();
<add> rli = new readline.Interface({ input: fi, output: fi, terminal: terminal });
<add> called = false;
<add> rli.on('line', function(line) {
<add> called = true;
<add> assert.equal(line, 'asdf');
<add> });
<add> fi.emit('data', 'asdf\n');
<add> assert.ok(called);
<ide>
<del>// sending a blank line
<del>fi = new FakeInput();
<del>rli = new readline.Interface(fi, {});
<del>called = false;
<del>rli.on('line', function(line) {
<del> called = true;
<del> assert.equal(line, '');
<del>});
<del>fi.emit('data', '\n');
<del>assert.ok(called);
<add> // sending a blank line
<add> fi = new FakeInput();
<add> rli = new readline.Interface({ input: fi, output: fi, terminal: terminal });
<add> called = false;
<add> rli.on('line', function(line) {
<add> called = true;
<add> assert.equal(line, '');
<add> });
<add> fi.emit('data', '\n');
<add> assert.ok(called);
<ide>
<del>// sending a single character with no newline
<del>fi = new FakeInput();
<del>rli = new readline.Interface(fi, {});
<del>called = false;
<del>rli.on('line', function(line) {
<del> called = true;
<del>});
<del>fi.emit('data', 'a');
<del>assert.ok(!called);
<del>rli.close();
<add> // sending a single character with no newline
<add> fi = new FakeInput();
<add> rli = new readline.Interface(fi, {});
<add> called = false;
<add> rli.on('line', function(line) {
<add> called = true;
<add> });
<add> fi.emit('data', 'a');
<add> assert.ok(!called);
<add> rli.close();
<ide>
<del>// sending a single character with no newline and then a newline
<del>fi = new FakeInput();
<del>rli = new readline.Interface(fi, {});
<del>called = false;
<del>rli.on('line', function(line) {
<del> called = true;
<del> assert.equal(line, 'a');
<del>});
<del>fi.emit('data', 'a');
<del>assert.ok(!called);
<del>fi.emit('data', '\n');
<del>assert.ok(called);
<del>rli.close();
<add> // sending a single character with no newline and then a newline
<add> fi = new FakeInput();
<add> rli = new readline.Interface({ input: fi, output: fi, terminal: terminal });
<add> called = false;
<add> rli.on('line', function(line) {
<add> called = true;
<add> assert.equal(line, 'a');
<add> });
<add> fi.emit('data', 'a');
<add> assert.ok(!called);
<add> fi.emit('data', '\n');
<add> assert.ok(called);
<add> rli.close();
<ide>
<del>// sending multiple newlines at once
<del>fi = new FakeInput();
<del>rli = new readline.Interface(fi, {});
<del>var expectedLines = ['foo\n', 'bar\n', 'baz\n'];
<del>var callCount = 0;
<del>rli.on('line', function(line) {
<del> assert.equal(line, expectedLines[callCount]);
<del> callCount++;
<del>});
<del>fi.emit('data', expectedLines.join('\n') + '\n');
<del>assert.equal(callCount, expectedLines.length);
<del>rli.close();
<add> // sending multiple newlines at once
<add> fi = new FakeInput();
<add> rli = new readline.Interface({ input: fi, output: fi, terminal: terminal });
<add> var expectedLines = ['foo', 'bar', 'baz'];
<add> var callCount = 0;
<add> rli.on('line', function(line) {
<add> assert.equal(line, expectedLines[callCount]);
<add> callCount++;
<add> });
<add> fi.emit('data', expectedLines.join('\n') + '\n');
<add> assert.equal(callCount, expectedLines.length);
<add> rli.close();
<ide>
<del>// sending multiple newlines at once that does not end with a new line
<del>fi = new FakeInput();
<del>rli = new readline.Interface(fi, {});
<del>var expectedLines = ['foo\n', 'bar\n', 'baz\n', 'bat'];
<del>var callCount = 0;
<del>rli.on('line', function(line) {
<del> assert.equal(line, expectedLines[callCount]);
<del> callCount++;
<del>});
<del>fi.emit('data', expectedLines.join('\n'));
<del>assert.equal(callCount, expectedLines.length - 1);
<del>rli.close();
<add> // sending multiple newlines at once that does not end with a new line
<add> fi = new FakeInput();
<add> rli = new readline.Interface({ input: fi, output: fi, terminal: terminal });
<add> expectedLines = ['foo', 'bar', 'baz', 'bat'];
<add> callCount = 0;
<add> rli.on('line', function(line) {
<add> assert.equal(line, expectedLines[callCount]);
<add> callCount++;
<add> });
<add> fi.emit('data', expectedLines.join('\n'));
<add> assert.equal(callCount, expectedLines.length - 1);
<add> rli.close();
<ide>
<del>// sending a multi-byte utf8 char over multiple writes
<del>var buf = Buffer('☮', 'utf8');
<del>fi = new FakeInput();
<del>rli = new readline.Interface(fi, {});
<del>callCount = 0;
<del>rli.on('line', function(line) {
<del> callCount++;
<del> assert.equal(line, buf.toString('utf8'));
<del>});
<del>[].forEach.call(buf, function(i) {
<del> fi.emit('data', Buffer([i]));
<del>});
<del>assert.equal(callCount, 0);
<del>fi.emit('data', '\n');
<del>assert.equal(callCount, 1);
<del>rli.close();
<add> // sending a multi-byte utf8 char over multiple writes
<add> var buf = Buffer('☮', 'utf8');
<add> fi = new FakeInput();
<add> rli = new readline.Interface({ input: fi, output: fi, terminal: terminal });
<add> callCount = 0;
<add> rli.on('line', function(line) {
<add> callCount++;
<add> assert.equal(line, buf.toString('utf8'));
<add> });
<add> [].forEach.call(buf, function(i) {
<add> fi.emit('data', Buffer([i]));
<add> });
<add> assert.equal(callCount, 0);
<add> fi.emit('data', '\n');
<add> assert.equal(callCount, 1);
<add> rli.close();
<ide>
<del>assert.deepEqual(fi.listeners('end'), []);
<del>assert.deepEqual(fi.listeners('data'), []);
<add> assert.deepEqual(fi.listeners('end'), []);
<add> assert.deepEqual(fi.listeners(terminal ? 'keypress' : 'data'), []);
<add>}); | 2 |
Javascript | Javascript | add support for hooks to reactdomserver | dd019d34db1d8d067637033c36856c8b259cb35b | <ide><path>packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.internal.js
<add>/**
<add> * Copyright (c) 2013-present, Facebook, Inc.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @emails react-core
<add> */
<add>
<add>/* eslint-disable no-func-assign */
<add>
<add>'use strict';
<add>
<add>const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegrationTestUtils');
<add>
<add>let React;
<add>let ReactFeatureFlags;
<add>let ReactDOM;
<add>let ReactDOMServer;
<add>let useState;
<add>let useReducer;
<add>let useEffect;
<add>let useContext;
<add>let useCallback;
<add>let useMemo;
<add>let useRef;
<add>let useAPI;
<add>let useMutationEffect;
<add>let useLayoutEffect;
<add>let forwardRef;
<add>let yieldedValues;
<add>let yieldValue;
<add>let clearYields;
<add>
<add>function initModules() {
<add> // Reset warning cache.
<add> jest.resetModuleRegistry();
<add>
<add> ReactFeatureFlags = require('shared/ReactFeatureFlags');
<add> ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false;
<add> ReactFeatureFlags.enableHooks = true;
<add> React = require('react');
<add> ReactDOM = require('react-dom');
<add> ReactDOMServer = require('react-dom/server');
<add> useState = React.useState;
<add> useReducer = React.useReducer;
<add> useEffect = React.useEffect;
<add> useContext = React.useContext;
<add> useCallback = React.useCallback;
<add> useMemo = React.useMemo;
<add> useRef = React.useRef;
<add> useAPI = React.useAPI;
<add> useMutationEffect = React.useMutationEffect;
<add> useLayoutEffect = React.useLayoutEffect;
<add> forwardRef = React.forwardRef;
<add>
<add> yieldedValues = [];
<add> yieldValue = value => {
<add> yieldedValues.push(value);
<add> };
<add> clearYields = () => {
<add> const ret = yieldedValues;
<add> yieldedValues = [];
<add> return ret;
<add> };
<add>
<add> // Make them available to the helpers.
<add> return {
<add> ReactDOM,
<add> ReactDOMServer,
<add> };
<add>}
<add>
<add>const {
<add> resetModules,
<add> itRenders,
<add> itThrowsWhenRendering,
<add> serverRender,
<add>} = ReactDOMServerIntegrationUtils(initModules);
<add>
<add>describe('ReactDOMServerHooks', () => {
<add> beforeEach(() => {
<add> resetModules();
<add> });
<add>
<add> function Text(props) {
<add> yieldValue(props.text);
<add> return <span>{props.text}</span>;
<add> }
<add>
<add> describe('useState', () => {
<add> itRenders('basic render', async render => {
<add> function Counter(props) {
<add> const [count] = useState(0);
<add> return <span>Count: {count}</span>;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add>
<add> itRenders('lazy state initialization', async render => {
<add> function Counter(props) {
<add> const [count] = useState(() => {
<add> return 0;
<add> });
<add> return <span>Count: {count}</span>;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add>
<add> it('does not trigger a re-renders when updater is invoked outside current render function', async () => {
<add> function UpdateCount({setCount, count, children}) {
<add> if (count < 3) {
<add> setCount(c => c + 1);
<add> }
<add> return <span>{children}</span>;
<add> }
<add> function Counter() {
<add> let [count, setCount] = useState(0);
<add> return (
<add> <div>
<add> <UpdateCount setCount={setCount} count={count}>
<add> Count: {count}
<add> </UpdateCount>
<add> </div>
<add> );
<add> }
<add>
<add> const domNode = await serverRender(<Counter />);
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add>
<add> itThrowsWhenRendering(
<add> 'if used inside a class component',
<add> async render => {
<add> class Counter extends React.Component {
<add> render() {
<add> let [count] = useState(0);
<add> return <Text text={count} />;
<add> }
<add> }
<add>
<add> return render(<Counter />);
<add> },
<add> 'Hooks can only be called inside the body of a functional component.',
<add> );
<add>
<add> itRenders('multiple times when an updater is called', async render => {
<add> function Counter() {
<add> let [count, setCount] = useState(0);
<add> if (count < 12) {
<add> setCount(c => c + 1);
<add> setCount(c => c + 1);
<add> setCount(c => c + 1);
<add> }
<add> return <Text text={'Count: ' + count} />;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add> expect(domNode.textContent).toEqual('Count: 12');
<add> });
<add>
<add> itRenders('until there are no more new updates', async render => {
<add> function Counter() {
<add> let [count, setCount] = useState(0);
<add> if (count < 3) {
<add> setCount(count + 1);
<add> }
<add> return <span>Count: {count}</span>;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add> expect(domNode.textContent).toEqual('Count: 3');
<add> });
<add>
<add> itThrowsWhenRendering(
<add> 'after too many iterations',
<add> async render => {
<add> function Counter() {
<add> let [count, setCount] = useState(0);
<add> setCount(count + 1);
<add> return <span>{count}</span>;
<add> }
<add> return render(<Counter />);
<add> },
<add> 'Too many re-renders. React limits the number of renders to prevent ' +
<add> 'an infinite loop.',
<add> );
<add> });
<add>
<add> describe('useReducer', () => {
<add> itRenders('with initial state', async render => {
<add> function reducer(state, action) {
<add> return action === 'increment' ? state + 1 : state;
<add> }
<add> function Counter() {
<add> let [count] = useReducer(reducer, 0);
<add> yieldValue('Render: ' + count);
<add> return <Text text={count} />;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add>
<add> expect(clearYields()).toEqual(['Render: 0', 0]);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('0');
<add> });
<add>
<add> itRenders('lazy initialization with initialAction', async render => {
<add> function reducer(state, action) {
<add> return action === 'increment' ? state + 1 : state;
<add> }
<add> function Counter() {
<add> let [count] = useReducer(reducer, 0, 'increment');
<add> yieldValue('Render: ' + count);
<add> return <Text text={count} />;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add>
<add> expect(clearYields()).toEqual(['Render: 1', 1]);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('1');
<add> });
<add>
<add> itRenders(
<add> 'multiple times when updates happen during the render phase',
<add> async render => {
<add> function reducer(state, action) {
<add> return action === 'increment' ? state + 1 : state;
<add> }
<add> function Counter() {
<add> let [count, dispatch] = useReducer(reducer, 0);
<add> if (count < 3) {
<add> dispatch('increment');
<add> }
<add> yieldValue('Render: ' + count);
<add> return <Text text={count} />;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add>
<add> expect(clearYields()).toEqual([
<add> 'Render: 0',
<add> 'Render: 1',
<add> 'Render: 2',
<add> 'Render: 3',
<add> 3,
<add> ]);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('3');
<add> },
<add> );
<add>
<add> itRenders(
<add> 'using reducer passed at time of render, not time of dispatch',
<add> async render => {
<add> // This test is a bit contrived but it demonstrates a subtle edge case.
<add>
<add> // Reducer A increments by 1. Reducer B increments by 10.
<add> function reducerA(state, action) {
<add> switch (action) {
<add> case 'increment':
<add> return state + 1;
<add> case 'reset':
<add> return 0;
<add> }
<add> }
<add> function reducerB(state, action) {
<add> switch (action) {
<add> case 'increment':
<add> return state + 10;
<add> case 'reset':
<add> return 0;
<add> }
<add> }
<add>
<add> function Counter() {
<add> let [reducer, setReducer] = useState(() => reducerA);
<add> let [count, dispatch] = useReducer(reducer, 0);
<add> if (count < 20) {
<add> dispatch('increment');
<add> // Swap reducers each time we increment
<add> if (reducer === reducerA) {
<add> setReducer(() => reducerB);
<add> } else {
<add> setReducer(() => reducerA);
<add> }
<add> }
<add> yieldValue('Render: ' + count);
<add> return <Text text={count} />;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add>
<add> expect(clearYields()).toEqual([
<add> // The count should increase by alternating amounts of 10 and 1
<add> // until we reach 21.
<add> 'Render: 0',
<add> 'Render: 10',
<add> 'Render: 11',
<add> 'Render: 21',
<add> 21,
<add> ]);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('21');
<add> },
<add> );
<add> });
<add>
<add> describe('useMemo', () => {
<add> itRenders('basic render', async render => {
<add> function CapitalizedText(props) {
<add> const text = props.text;
<add> const capitalizedText = useMemo(
<add> () => {
<add> yieldValue(`Capitalize '${text}'`);
<add> return text.toUpperCase();
<add> },
<add> [text],
<add> );
<add> return <Text text={capitalizedText} />;
<add> }
<add>
<add> const domNode = await render(<CapitalizedText text="hello" />);
<add> expect(clearYields()).toEqual(["Capitalize 'hello'", 'HELLO']);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('HELLO');
<add> });
<add>
<add> itRenders('if no inputs are provided', async render => {
<add> function LazyCompute(props) {
<add> const computed = useMemo(props.compute);
<add> return <Text text={computed} />;
<add> }
<add>
<add> function computeA() {
<add> yieldValue('compute A');
<add> return 'A';
<add> }
<add>
<add> const domNode = await render(<LazyCompute compute={computeA} />);
<add> expect(clearYields()).toEqual(['compute A', 'A']);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('A');
<add> });
<add>
<add> itRenders(
<add> 'multiple times when updates happen during the render phase',
<add> async render => {
<add> function CapitalizedText(props) {
<add> const [text, setText] = useState(props.text);
<add> const capitalizedText = useMemo(
<add> () => {
<add> yieldValue(`Capitalize '${text}'`);
<add> return text.toUpperCase();
<add> },
<add> [text],
<add> );
<add>
<add> if (text === 'hello') {
<add> setText('hello, world.');
<add> }
<add> return <Text text={capitalizedText} />;
<add> }
<add>
<add> const domNode = await render(<CapitalizedText text="hello" />);
<add> expect(clearYields()).toEqual([
<add> "Capitalize 'hello'",
<add> "Capitalize 'hello, world.'",
<add> 'HELLO, WORLD.',
<add> ]);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('HELLO, WORLD.');
<add> },
<add> );
<add>
<add> itRenders(
<add> 'should only invoke the memoized function when the inputs change',
<add> async render => {
<add> function CapitalizedText(props) {
<add> const [text, setText] = useState(props.text);
<add> const [count, setCount] = useState(0);
<add> const capitalizedText = useMemo(
<add> () => {
<add> yieldValue(`Capitalize '${text}'`);
<add> return text.toUpperCase();
<add> },
<add> [text],
<add> );
<add>
<add> yieldValue(count);
<add>
<add> if (count < 3) {
<add> setCount(count + 1);
<add> }
<add>
<add> if (text === 'hello' && count === 2) {
<add> setText('hello, world.');
<add> }
<add> return <Text text={capitalizedText} />;
<add> }
<add>
<add> const domNode = await render(<CapitalizedText text="hello" />);
<add> expect(clearYields()).toEqual([
<add> "Capitalize 'hello'",
<add> 0,
<add> 1,
<add> 2,
<add> // `capitalizedText` only recomputes when the text has changed
<add> "Capitalize 'hello, world.'",
<add> 3,
<add> 'HELLO, WORLD.',
<add> ]);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('HELLO, WORLD.');
<add> },
<add> );
<add> });
<add>
<add> describe('useRef', () => {
<add> itRenders('basic render', async render => {
<add> function Counter(props) {
<add> const count = useRef(0);
<add> return <span>Count: {count.current}</span>;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add>
<add> itRenders(
<add> 'multiple times when updates happen during the render phase',
<add> async render => {
<add> function Counter(props) {
<add> const [count, setCount] = useState(0);
<add> const ref = useRef(count);
<add>
<add> if (count < 3) {
<add> const newCount = count + 1;
<add>
<add> ref.current = newCount;
<add> setCount(newCount);
<add> }
<add>
<add> yieldValue(count);
<add>
<add> return <span>Count: {ref.current}</span>;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add> expect(clearYields()).toEqual([0, 1, 2, 3]);
<add> expect(domNode.textContent).toEqual('Count: 3');
<add> },
<add> );
<add>
<add> itRenders(
<add> 'always return the same reference through multiple renders',
<add> async render => {
<add> let firstRef = null;
<add> function Counter(props) {
<add> const [count, setCount] = useState(0);
<add> const ref = useRef(count);
<add> if (firstRef === null) {
<add> firstRef = ref;
<add> } else if (firstRef !== ref) {
<add> throw new Error('should never change');
<add> }
<add>
<add> if (count < 3) {
<add> setCount(count + 1);
<add> } else {
<add> firstRef = null;
<add> }
<add>
<add> yieldValue(count);
<add>
<add> return <span>Count: {ref.current}</span>;
<add> }
<add>
<add> const domNode = await render(<Counter />);
<add> expect(clearYields()).toEqual([0, 1, 2, 3]);
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> },
<add> );
<add> });
<add>
<add> describe('useEffect', () => {
<add> itRenders('should ignore effects on the server', async render => {
<add> function Counter(props) {
<add> useEffect(() => {
<add> yieldValue('should not be invoked');
<add> });
<add> return <Text text={'Count: ' + props.count} />;
<add> }
<add> const domNode = await render(<Counter count={0} />);
<add> expect(clearYields()).toEqual(['Count: 0']);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add> });
<add>
<add> describe('useCallback', () => {
<add> itRenders('should ignore callbacks on the server', async render => {
<add> function Counter(props) {
<add> useCallback(() => {
<add> yieldValue('should not be invoked');
<add> });
<add> return <Text text={'Count: ' + props.count} />;
<add> }
<add> const domNode = await render(<Counter count={0} />);
<add> expect(clearYields()).toEqual(['Count: 0']);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add> });
<add>
<add> describe('useAPI', () => {
<add> it('should not be invoked on the server', async () => {
<add> function Counter(props, ref) {
<add> useAPI(ref, () => {
<add> throw new Error('should not be invoked');
<add> });
<add> return <Text text={props.label + ': ' + ref.current} />;
<add> }
<add> Counter = forwardRef(Counter);
<add> const counter = React.createRef();
<add> counter.current = 0;
<add> const domNode = await serverRender(
<add> <Counter label="Count" ref={counter} />,
<add> );
<add> expect(clearYields()).toEqual(['Count: 0']);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add> });
<add>
<add> describe('useMutationEffect', () => {
<add> it('should warn when invoked during render', async () => {
<add> function Counter() {
<add> useMutationEffect(() => {
<add> throw new Error('should not be invoked');
<add> });
<add>
<add> return <Text text="Count: 0" />;
<add> }
<add> const domNode = await serverRender(<Counter />, 1);
<add> expect(clearYields()).toEqual(['Count: 0']);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add> });
<add>
<add> describe('useLayoutEffect', () => {
<add> it('should warn when invoked during render', async () => {
<add> function Counter() {
<add> useLayoutEffect(() => {
<add> throw new Error('should not be invoked');
<add> });
<add>
<add> return <Text text="Count: 0" />;
<add> }
<add> const domNode = await serverRender(<Counter />, 1);
<add> expect(clearYields()).toEqual(['Count: 0']);
<add> expect(domNode.tagName).toEqual('SPAN');
<add> expect(domNode.textContent).toEqual('Count: 0');
<add> });
<add> });
<add>
<add> describe('useContext', () => {
<add> itRenders(
<add> 'can use the same context multiple times in the same function',
<add> async render => {
<add> const Context = React.createContext(
<add> {foo: 0, bar: 0, baz: 0},
<add> (a, b) => {
<add> let result = 0;
<add> if (a.foo !== b.foo) {
<add> result |= 0b001;
<add> }
<add> if (a.bar !== b.bar) {
<add> result |= 0b010;
<add> }
<add> if (a.baz !== b.baz) {
<add> result |= 0b100;
<add> }
<add> return result;
<add> },
<add> );
<add>
<add> function Provider(props) {
<add> return (
<add> <Context.Provider
<add> value={{foo: props.foo, bar: props.bar, baz: props.baz}}>
<add> {props.children}
<add> </Context.Provider>
<add> );
<add> }
<add>
<add> function FooAndBar() {
<add> const {foo} = useContext(Context, 0b001);
<add> const {bar} = useContext(Context, 0b010);
<add> return <Text text={`Foo: ${foo}, Bar: ${bar}`} />;
<add> }
<add>
<add> function Baz() {
<add> const {baz} = useContext(Context, 0b100);
<add> return <Text text={'Baz: ' + baz} />;
<add> }
<add>
<add> class Indirection extends React.Component {
<add> shouldComponentUpdate() {
<add> return false;
<add> }
<add> render() {
<add> return this.props.children;
<add> }
<add> }
<add>
<add> function App(props) {
<add> return (
<add> <div>
<add> <Provider foo={props.foo} bar={props.bar} baz={props.baz}>
<add> <Indirection>
<add> <Indirection>
<add> <FooAndBar />
<add> </Indirection>
<add> <Indirection>
<add> <Baz />
<add> </Indirection>
<add> </Indirection>
<add> </Provider>
<add> </div>
<add> );
<add> }
<add>
<add> const domNode = await render(<App foo={1} bar={3} baz={5} />);
<add> expect(clearYields()).toEqual(['Foo: 1, Bar: 3', 'Baz: 5']);
<add> expect(domNode.childNodes.length).toBe(2);
<add> expect(domNode.firstChild.tagName).toEqual('SPAN');
<add> expect(domNode.firstChild.textContent).toEqual('Foo: 1, Bar: 3');
<add> expect(domNode.lastChild.tagName).toEqual('SPAN');
<add> expect(domNode.lastChild.textContent).toEqual('Baz: 5');
<add> },
<add> );
<add> });
<add>});
<ide><path>packages/react-dom/src/server/ReactPartialRenderer.js
<ide> import {
<ide> createMarkupForRoot,
<ide> } from './DOMMarkupOperations';
<ide> import escapeTextForBrowser from './escapeTextForBrowser';
<add>import {
<add> prepareToUseHooks,
<add> finishHooks,
<add> Dispatcher,
<add>} from './ReactPartialRendererHooks';
<ide> import {
<ide> Namespaces,
<ide> getIntrinsicNamespace,
<ide> let pushCurrentDebugStack = (stack: Array<Frame>) => {};
<ide> let pushElementToDebugStack = (element: ReactElement) => {};
<ide> let popCurrentDebugStack = () => {};
<ide>
<del>let Dispatcher = {
<del> readContext<T>(
<del> context: ReactContext<T>,
<del> observedBits: void | number | boolean,
<del> ): T {
<del> return context._currentValue;
<del> },
<del>};
<del>
<ide> if (__DEV__) {
<ide> ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
<ide>
<ide> function resolve(
<ide> }
<ide> }
<ide> }
<add> const componentIdentity = {};
<add> prepareToUseHooks(componentIdentity);
<ide> inst = Component(element.props, publicContext, updater);
<add> inst = finishHooks(Component, element.props, inst, publicContext);
<add>
<ide> if (inst == null || inst.render == null) {
<ide> child = inst;
<ide> validateRenderResult(child, Component);
<ide> class ReactDOMServerRenderer {
<ide> switch (elementType.$$typeof) {
<ide> case REACT_FORWARD_REF_TYPE: {
<ide> const element: ReactElement = ((nextChild: any): ReactElement);
<del> const nextChildren = toArray(
<del> elementType.render(element.props, element.ref),
<add> let nextChildren;
<add> const componentIdentity = {};
<add> prepareToUseHooks(componentIdentity);
<add> nextChildren = elementType.render(element.props, element.ref);
<add> nextChildren = finishHooks(
<add> elementType.render,
<add> element.props,
<add> nextChildren,
<add> element.ref,
<ide> );
<add> nextChildren = toArray(nextChildren);
<ide> const frame: Frame = {
<ide> type: null,
<ide> domNamespace: parentNamespace,
<ide><path>packages/react-dom/src/server/ReactPartialRendererHooks.js
<add>/**
<add> * Copyright (c) Facebook, Inc. and its affiliates.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @flow
<add> */
<add>import type {ReactContext} from 'shared/ReactTypes';
<add>
<add>import invariant from 'shared/invariant';
<add>import warning from 'shared/warning';
<add>
<add>type BasicStateAction<S> = S | (S => S);
<add>type MaybeCallback<S> = void | null | (S => mixed);
<add>type Dispatch<S, A> = (A, MaybeCallback<S>) => void;
<add>
<add>type Update<S, A> = {
<add> action: A,
<add> next: Update<S, A> | null,
<add>};
<add>
<add>type UpdateQueue<S, A> = {
<add> last: Update<S, A> | null,
<add> dispatch: any,
<add>};
<add>
<add>type Hook = {
<add> memoizedState: any,
<add> queue: UpdateQueue<any, any> | null,
<add> next: Hook | null,
<add>};
<add>
<add>let currentlyRenderingComponent: Object | null = null;
<add>let firstWorkInProgressHook: Hook | null = null;
<add>let workInProgressHook: Hook | null = null;
<add>// Whether the work-in-progress hook is a re-rendered hook
<add>let isReRender: boolean = false;
<add>// Whether an update was scheduled during the currently executing render pass.
<add>let didScheduleRenderPhaseUpdate: boolean = false;
<add>// Lazily created map of render-phase updates
<add>let renderPhaseUpdates: Map<
<add> UpdateQueue<any, any>,
<add> Update<any, any>,
<add>> | null = null;
<add>// Counter to prevent infinite loops.
<add>let numberOfReRenders: number = 0;
<add>const RE_RENDER_LIMIT = 25;
<add>
<add>function resolveCurrentlyRenderingComponent(): Object {
<add> invariant(
<add> currentlyRenderingComponent !== null,
<add> 'Hooks can only be called inside the body of a functional component.',
<add> );
<add> return currentlyRenderingComponent;
<add>}
<add>
<add>function createHook(): Hook {
<add> return {
<add> memoizedState: null,
<add> queue: null,
<add> next: null,
<add> };
<add>}
<add>
<add>function createWorkInProgressHook(): Hook {
<add> if (workInProgressHook === null) {
<add> // This is the first hook in the list
<add> if (firstWorkInProgressHook === null) {
<add> isReRender = false;
<add> firstWorkInProgressHook = workInProgressHook = createHook();
<add> } else {
<add> // There's already a work-in-progress. Reuse it.
<add> isReRender = true;
<add> workInProgressHook = firstWorkInProgressHook;
<add> }
<add> } else {
<add> if (workInProgressHook.next === null) {
<add> isReRender = false;
<add> // Append to the end of the list
<add> workInProgressHook = workInProgressHook.next = createHook();
<add> } else {
<add> // There's already a work-in-progress. Reuse it.
<add> isReRender = true;
<add> workInProgressHook = workInProgressHook.next;
<add> }
<add> }
<add> return workInProgressHook;
<add>}
<add>
<add>export function prepareToUseHooks(componentIdentity: Object): void {
<add> currentlyRenderingComponent = componentIdentity;
<add>
<add> // The following should have already been reset
<add> // didScheduleRenderPhaseUpdate = false;
<add> // firstWorkInProgressHook = null;
<add> // numberOfReRenders = 0;
<add> // renderPhaseUpdates = null;
<add> // workInProgressHook = null;
<add>}
<add>
<add>export function finishHooks(
<add> Component: any,
<add> props: any,
<add> children: any,
<add> refOrContext: any,
<add>): any {
<add> // This must be called after every functional component to prevent hooks from
<add> // being used in classes.
<add>
<add> while (didScheduleRenderPhaseUpdate) {
<add> // Updates were scheduled during the render phase. They are stored in
<add> // the `renderPhaseUpdates` map. Call the component again, reusing the
<add> // work-in-progress hooks and applying the additional updates on top. Keep
<add> // restarting until no more updates are scheduled.
<add> didScheduleRenderPhaseUpdate = false;
<add> numberOfReRenders += 1;
<add>
<add> // Start over from the beginning of the list
<add> workInProgressHook = null;
<add>
<add> children = Component(props, refOrContext);
<add> }
<add> currentlyRenderingComponent = null;
<add> firstWorkInProgressHook = null;
<add> numberOfReRenders = 0;
<add> renderPhaseUpdates = null;
<add> workInProgressHook = null;
<add>
<add> // These were reset above
<add> // currentlyRenderingComponent = null;
<add> // didScheduleRenderPhaseUpdate = false;
<add> // firstWorkInProgressHook = null;
<add> // numberOfReRenders = 0;
<add> // renderPhaseUpdates = null;
<add> // workInProgressHook = null;
<add>
<add> return children;
<add>}
<add>
<add>function useContext<T>(
<add> context: ReactContext<T>,
<add> observedBits: void | number | boolean,
<add>): T {
<add> return context._currentValue;
<add>}
<add>
<add>function basicStateReducer<S>(state: S, action: BasicStateAction<S>): S {
<add> return typeof action === 'function' ? action(state) : action;
<add>}
<add>
<add>export function useState<S>(
<add> initialState: S | (() => S),
<add>): [S, Dispatch<S, BasicStateAction<S>>] {
<add> return useReducer(
<add> basicStateReducer,
<add> // useReducer has a special case to support lazy useState initializers
<add> (initialState: any),
<add> );
<add>}
<add>
<add>export function useReducer<S, A>(
<add> reducer: (S, A) => S,
<add> initialState: S,
<add> initialAction: A | void | null,
<add>): [S, Dispatch<S, A>] {
<add> currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
<add> workInProgressHook = createWorkInProgressHook();
<add> if (isReRender) {
<add> // This is a re-render. Apply the new render phase updates to the previous
<add> // current hook.
<add> const queue: UpdateQueue<S, A> = (workInProgressHook.queue: any);
<add> const dispatch: Dispatch<S, A> = (queue.dispatch: any);
<add> if (renderPhaseUpdates !== null) {
<add> // Render phase updates are stored in a map of queue -> linked list
<add> const firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
<add> if (firstRenderPhaseUpdate !== undefined) {
<add> renderPhaseUpdates.delete(queue);
<add> let newState = workInProgressHook.memoizedState;
<add> let update = firstRenderPhaseUpdate;
<add> do {
<add> // Process this render phase update. We don't have to check the
<add> // priority because it will always be the same as the current
<add> // render's.
<add> const action = update.action;
<add> newState = reducer(newState, action);
<add> update = update.next;
<add> } while (update !== null);
<add>
<add> workInProgressHook.memoizedState = newState;
<add>
<add> return [newState, dispatch];
<add> }
<add> }
<add> return [workInProgressHook.memoizedState, dispatch];
<add> } else {
<add> if (reducer === basicStateReducer) {
<add> // Special case for `useState`.
<add> if (typeof initialState === 'function') {
<add> initialState = initialState();
<add> }
<add> } else if (initialAction !== undefined && initialAction !== null) {
<add> initialState = reducer(initialState, initialAction);
<add> }
<add> workInProgressHook.memoizedState = initialState;
<add> const queue: UpdateQueue<S, A> = (workInProgressHook.queue = {
<add> last: null,
<add> dispatch: null,
<add> });
<add> const dispatch: Dispatch<S, A> = (queue.dispatch = (dispatchAction.bind(
<add> null,
<add> currentlyRenderingComponent,
<add> queue,
<add> ): any));
<add> return [workInProgressHook.memoizedState, dispatch];
<add> }
<add>}
<add>
<add>function useMemo<T>(
<add> nextCreate: () => T,
<add> inputs: Array<mixed> | void | null,
<add>): T {
<add> currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
<add> workInProgressHook = createWorkInProgressHook();
<add>
<add> const nextInputs =
<add> inputs !== undefined && inputs !== null ? inputs : [nextCreate];
<add>
<add> if (
<add> workInProgressHook !== null &&
<add> workInProgressHook.memoizedState !== null
<add> ) {
<add> const prevState = workInProgressHook.memoizedState;
<add> const prevInputs = prevState[1];
<add> if (inputsAreEqual(nextInputs, prevInputs)) {
<add> return prevState[0];
<add> }
<add> }
<add>
<add> const nextValue = nextCreate();
<add> workInProgressHook.memoizedState = [nextValue, nextInputs];
<add> return nextValue;
<add>}
<add>
<add>function useRef<T>(initialValue: T): {current: T} {
<add> currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
<add> workInProgressHook = createWorkInProgressHook();
<add> const previousRef = workInProgressHook.memoizedState;
<add> if (previousRef === null) {
<add> const ref = {current: initialValue};
<add> if (__DEV__) {
<add> Object.seal(ref);
<add> }
<add> workInProgressHook.memoizedState = ref;
<add> return ref;
<add> } else {
<add> return previousRef;
<add> }
<add>}
<add>
<add>function useMutationEffect(
<add> create: () => mixed,
<add> inputs: Array<mixed> | void | null,
<add>) {
<add> warning(
<add> false,
<add> 'useMutationEffect does nothing on the server, because its effect cannot ' +
<add> "be encoded into the server renderer's output format. This will lead " +
<add> 'to a mismatch between the initial, non-hydrated UI and the intended ' +
<add> 'UI. To avoid this, useMutationEffect should only be used in ' +
<add> 'components that render exclusively on the client.',
<add> );
<add>}
<add>
<add>export function useLayoutEffect(
<add> create: () => mixed,
<add> inputs: Array<mixed> | void | null,
<add>) {
<add> warning(
<add> false,
<add> 'useLayoutEffect does nothing on the server, because its effect cannot ' +
<add> "be encoded into the server renderer's output format. This will lead " +
<add> 'to a mismatch between the initial, non-hydrated UI and the intended ' +
<add> 'UI. To avoid this, useLayoutEffect should only be used in ' +
<add> 'components that render exclusively on the client.',
<add> );
<add>}
<add>
<add>function dispatchAction<S, A>(
<add> componentIdentity: Object,
<add> queue: UpdateQueue<S, A>,
<add> action: A,
<add>) {
<add> invariant(
<add> numberOfReRenders < RE_RENDER_LIMIT,
<add> 'Too many re-renders. React limits the number of renders to prevent ' +
<add> 'an infinite loop.',
<add> );
<add>
<add> if (componentIdentity === currentlyRenderingComponent) {
<add> // This is a render phase update. Stash it in a lazily-created map of
<add> // queue -> linked list of updates. After this render pass, we'll restart
<add> // and apply the stashed updates on top of the work-in-progress hook.
<add> didScheduleRenderPhaseUpdate = true;
<add> const update: Update<S, A> = {
<add> action,
<add> next: null,
<add> };
<add> if (renderPhaseUpdates === null) {
<add> renderPhaseUpdates = new Map();
<add> }
<add> const firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
<add> if (firstRenderPhaseUpdate === undefined) {
<add> renderPhaseUpdates.set(queue, update);
<add> } else {
<add> // Append the update to the end of the list.
<add> let lastRenderPhaseUpdate = firstRenderPhaseUpdate;
<add> while (lastRenderPhaseUpdate.next !== null) {
<add> lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
<add> }
<add> lastRenderPhaseUpdate.next = update;
<add> }
<add> } else {
<add> // This means an update has happened after the functional component has
<add> // returned. On the server this is a no-op. In React Fiber, the update
<add> // would be scheduled for a future render.
<add> }
<add>}
<add>
<add>function inputsAreEqual(arr1, arr2) {
<add> // Don't bother comparing lengths because these arrays are always
<add> // passed inline.
<add> for (let i = 0; i < arr1.length; i++) {
<add> // Inlined Object.is polyfill.
<add> // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
<add> const val1 = arr1[i];
<add> const val2 = arr2[i];
<add> if (
<add> (val1 === val2 && (val1 !== 0 || 1 / val1 === 1 / (val2: any))) ||
<add> (val1 !== val1 && val2 !== val2) // eslint-disable-line no-self-compare
<add> ) {
<add> continue;
<add> }
<add> return false;
<add> }
<add> return true;
<add>}
<add>
<add>function noop(): void {}
<add>
<add>export const Dispatcher = {
<add> readContext: useContext,
<add> useContext,
<add> useMemo,
<add> useReducer,
<add> useRef,
<add> useState,
<add> useMutationEffect,
<add> useLayoutEffect,
<add> // useAPI is not run in the server environment
<add> useAPI: noop,
<add> // Callbacks are not run in the server environment.
<add> useCallback: noop,
<add> // Effects are not run in the server environment.
<add> useEffect: noop,
<add>};
<ide><path>packages/react-reconciler/src/ReactFiberHooks.js
<ide> export function useReducer<S, A>(
<ide> ): [S, Dispatch<S, A>] {
<ide> currentlyRenderingFiber = resolveCurrentlyRenderingFiber();
<ide> workInProgressHook = createWorkInProgressHook();
<del> if (isReRender) {
<del> // This is a re-render. Apply the new render phase updates to the previous
<del> // work-in-progress hook.
<del> const queue: UpdateQueue<S, A> = (workInProgressHook.queue: any);
<del> const dispatch: Dispatch<S, A> = (queue.dispatch: any);
<del> if (renderPhaseUpdates !== null) {
<del> // Render phase updates are stored in a map of queue -> linked list
<del> const firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
<del> if (firstRenderPhaseUpdate !== undefined) {
<del> renderPhaseUpdates.delete(queue);
<del> let newState = workInProgressHook.memoizedState;
<del> let update = firstRenderPhaseUpdate;
<del> do {
<del> // Process this render phase update. We don't have to check the
<del> // priority because it will always be the same as the current
<del> // render's.
<del> const action = update.action;
<del> newState = reducer(newState, action);
<del> const callback = update.callback;
<del> if (callback !== null) {
<del> pushCallback(currentlyRenderingFiber, update);
<add> let queue: UpdateQueue<S, A> | null = (workInProgressHook.queue: any);
<add> if (queue !== null) {
<add> // Already have a queue, so this is an update.
<add> if (isReRender) {
<add> // This is a re-render. Apply the new render phase updates to the previous
<add> // work-in-progress hook.
<add> const dispatch: Dispatch<S, A> = (queue.dispatch: any);
<add> if (renderPhaseUpdates !== null) {
<add> // Render phase updates are stored in a map of queue -> linked list
<add> const firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
<add> if (firstRenderPhaseUpdate !== undefined) {
<add> renderPhaseUpdates.delete(queue);
<add> let newState = workInProgressHook.memoizedState;
<add> let update = firstRenderPhaseUpdate;
<add> do {
<add> // Process this render phase update. We don't have to check the
<add> // priority because it will always be the same as the current
<add> // render's.
<add> const action = update.action;
<add> newState = reducer(newState, action);
<add> const callback = update.callback;
<add> if (callback !== null) {
<add> pushCallback(currentlyRenderingFiber, update);
<add> }
<add> update = update.next;
<add> } while (update !== null);
<add>
<add> workInProgressHook.memoizedState = newState;
<add>
<add> // Don't persist the state accumlated from the render phase updates to
<add> // the base state unless the queue is empty.
<add> // TODO: Not sure if this is the desired semantics, but it's what we
<add> // do for gDSFP. I can't remember why.
<add> if (workInProgressHook.baseUpdate === queue.last) {
<add> workInProgressHook.baseState = newState;
<ide> }
<del> update = update.next;
<del> } while (update !== null);
<del>
<del> workInProgressHook.memoizedState = newState;
<ide>
<del> // Don't persist the state accumlated from the render phase updates to
<del> // the base state unless the queue is empty.
<del> // TODO: Not sure if this is the desired semantics, but it's what we
<del> // do for gDSFP. I can't remember why.
<del> if (workInProgressHook.baseUpdate === queue.last) {
<del> workInProgressHook.baseState = newState;
<add> return [newState, dispatch];
<ide> }
<del>
<del> return [newState, dispatch];
<ide> }
<add> return [workInProgressHook.memoizedState, dispatch];
<ide> }
<del> return [workInProgressHook.memoizedState, dispatch];
<del> } else if (currentHook !== null) {
<del> const queue: UpdateQueue<S, A> = (workInProgressHook.queue: any);
<ide>
<ide> // The last update in the entire queue
<ide> const last = queue.last;
<ide> export function useReducer<S, A>(
<ide>
<ide> const dispatch: Dispatch<S, A> = (queue.dispatch: any);
<ide> return [workInProgressHook.memoizedState, dispatch];
<del> } else {
<del> if (reducer === basicStateReducer) {
<del> // Special case for `useState`.
<del> if (typeof initialState === 'function') {
<del> initialState = initialState();
<del> }
<del> } else if (initialAction !== undefined && initialAction !== null) {
<del> initialState = reducer(initialState, initialAction);
<add> }
<add>
<add> // There's no existing queue, so this is the initial render.
<add> if (reducer === basicStateReducer) {
<add> // Special case for `useState`.
<add> if (typeof initialState === 'function') {
<add> initialState = initialState();
<ide> }
<del> workInProgressHook.memoizedState = workInProgressHook.baseState = initialState;
<del> const queue: UpdateQueue<S, A> = (workInProgressHook.queue = {
<del> last: null,
<del> dispatch: null,
<del> });
<del> const dispatch: Dispatch<S, A> = (queue.dispatch = (dispatchAction.bind(
<del> null,
<del> currentlyRenderingFiber,
<del> queue,
<del> ): any));
<del> return [workInProgressHook.memoizedState, dispatch];
<add> } else if (initialAction !== undefined && initialAction !== null) {
<add> initialState = reducer(initialState, initialAction);
<ide> }
<add> workInProgressHook.memoizedState = workInProgressHook.baseState = initialState;
<add> queue = workInProgressHook.queue = {
<add> last: null,
<add> dispatch: null,
<add> };
<add> const dispatch: Dispatch<S, A> = (queue.dispatch = (dispatchAction.bind(
<add> null,
<add> currentlyRenderingFiber,
<add> queue,
<add> ): any));
<add> return [workInProgressHook.memoizedState, dispatch];
<ide> }
<ide>
<ide> function pushCallback(workInProgress: Fiber, update: Update<any, any>): void {
<ide> export function useRef<T>(initialValue: T): {current: T} {
<ide> currentlyRenderingFiber = resolveCurrentlyRenderingFiber();
<ide> workInProgressHook = createWorkInProgressHook();
<ide> let ref;
<del> if (currentHook === null) {
<add>
<add> if (workInProgressHook.memoizedState === null) {
<ide> ref = {current: initialValue};
<ide> if (__DEV__) {
<ide> Object.seal(ref);
<ide> export function useCallback<T>(
<ide> const nextInputs =
<ide> inputs !== undefined && inputs !== null ? inputs : [callback];
<ide>
<del> if (currentHook !== null) {
<del> const prevState = currentHook.memoizedState;
<add> const prevState = workInProgressHook.memoizedState;
<add> if (prevState !== null) {
<ide> const prevInputs = prevState[1];
<ide> if (inputsAreEqual(nextInputs, prevInputs)) {
<ide> return prevState[0];
<ide> }
<ide> }
<del>
<ide> workInProgressHook.memoizedState = [callback, nextInputs];
<ide> return callback;
<ide> }
<ide> export function useMemo<T>(
<ide> const nextInputs =
<ide> inputs !== undefined && inputs !== null ? inputs : [nextCreate];
<ide>
<del> if (currentHook !== null) {
<del> const prevState = currentHook.memoizedState;
<add> const prevState = workInProgressHook.memoizedState;
<add> if (prevState !== null) {
<ide> const prevInputs = prevState[1];
<ide> if (inputsAreEqual(nextInputs, prevInputs)) {
<ide> return prevState[0];
<ide><path>packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
<ide> describe('ReactHooks', () => {
<ide> ReactNoop.render(<LazyCompute compute={computeB} />);
<ide> expect(ReactNoop.flush()).toEqual(['compute B', 'B']);
<ide> });
<add>
<add> it('should not invoke memoized function during re-renders unless inputs change', () => {
<add> function LazyCompute(props) {
<add> const computed = useMemo(() => props.compute(props.input), [
<add> props.input,
<add> ]);
<add> const [count, setCount] = useState(0);
<add> if (count < 3) {
<add> setCount(count + 1);
<add> }
<add> return <Text text={computed} />;
<add> }
<add>
<add> function compute(val) {
<add> ReactNoop.yield('compute ' + val);
<add> return val;
<add> }
<add>
<add> ReactNoop.render(<LazyCompute compute={compute} input="A" />);
<add> expect(ReactNoop.flush()).toEqual(['compute A', 'A']);
<add>
<add> ReactNoop.render(<LazyCompute compute={compute} input="A" />);
<add> expect(ReactNoop.flush()).toEqual(['A']);
<add>
<add> ReactNoop.render(<LazyCompute compute={compute} input="B" />);
<add> expect(ReactNoop.flush()).toEqual(['compute B', 'B']);
<add> });
<ide> });
<ide>
<ide> describe('useRef', () => {
<ide> describe('ReactHooks', () => {
<ide> jest.advanceTimersByTime(20);
<ide> expect(ReactNoop.flush()).toEqual(['ping: 6']);
<ide> });
<add>
<add> it('should return the same ref during re-renders', () => {
<add> function Counter() {
<add> const ref = useRef('val');
<add> const [count, setCount] = useState(0);
<add> const [firstRef] = useState(ref);
<add>
<add> if (firstRef !== ref) {
<add> throw new Error('should never change');
<add> }
<add>
<add> if (count < 3) {
<add> setCount(count + 1);
<add> }
<add>
<add> return <Text text={ref.current} />;
<add> }
<add>
<add> ReactNoop.render(<Counter />);
<add> expect(ReactNoop.flush()).toEqual(['val']);
<add>
<add> ReactNoop.render(<Counter />);
<add> expect(ReactNoop.flush()).toEqual(['val']);
<add> });
<ide> });
<ide>
<ide> describe('progressive enhancement', () => { | 5 |
Text | Text | add blanks lines in docs for clarity | d0737e9ac0bfcbac0e212d157ab305e561eea3ee | <ide><path>docs/tutorials/dockerimages.md
<ide> Let's start with listing the images you have locally on our host. You can
<ide> do this using the `docker images` command like so:
<ide>
<ide> $ docker images
<add>
<ide> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> ubuntu 14.04 1d073211c498 3 days ago 187.9 MB
<ide> busybox latest 2c5ac3f849df 5 days ago 1.113 MB
<ide> can download it using the `docker pull` command. Suppose you'd like to
<ide> download the `centos` image.
<ide>
<ide> $ docker pull centos
<add>
<ide> Pulling repository centos
<ide> b7de3133ff98: Pulling dependent layers
<ide> 5cc9e91966f7: Pulling fs layer
<ide> can run a container from this image and you won't have to wait to
<ide> download the image.
<ide>
<ide> $ docker run -t -i centos /bin/bash
<add>
<ide> bash-4.1#
<ide>
<ide> ## Finding images
<ide> You've identified a suitable image, `training/sinatra`, and now you can download
<ide> The team can now use this image by running their own containers.
<ide>
<ide> $ docker run -t -i training/sinatra /bin/bash
<add>
<ide> root@a8cb6ce02d85:/#
<ide>
<ide> ## Creating our own images
<ide> To update an image you first need to create a container from the image
<ide> you'd like to update.
<ide>
<ide> $ docker run -t -i training/sinatra /bin/bash
<add>
<ide> root@0b2616b0e5a8:/#
<ide>
<ide> > **Note:**
<ide> command.
<ide>
<ide> $ docker commit -m "Added json gem" -a "Kate Smith" \
<ide> 0b2616b0e5a8 ouruser/sinatra:v2
<add>
<ide> 4f177bd27a9ff0f6dc2a830403925b5360bfe0b93d476f7fc3231110e7f71b1c
<ide>
<ide> Here you've used the `docker commit` command. You've specified two flags: `-m`
<ide> You can then look at our new `ouruser/sinatra` image using the `docker images`
<ide> command.
<ide>
<ide> $ docker images
<add>
<ide> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> training/sinatra latest 5bc342fa0b91 10 hours ago 446.7 MB
<ide> ouruser/sinatra v2 3c59e02ddd1a 10 hours ago 446.7 MB
<ide> command.
<ide> To use our new image to create a container you can then:
<ide>
<ide> $ docker run -t -i ouruser/sinatra:v2 /bin/bash
<add>
<ide> root@78e82f680994:/#
<ide>
<ide> ### Building an image from a `Dockerfile`
<ide> tell Docker how to build our image.
<ide> First, create a directory and a `Dockerfile`.
<ide>
<ide> $ mkdir sinatra
<add>
<ide> $ cd sinatra
<add>
<ide> $ touch Dockerfile
<ide>
<ide> If you are using Docker Machine on Windows, you may access your host
<ide> Sinatra gem.
<ide> Now let's take our `Dockerfile` and use the `docker build` command to build an image.
<ide>
<ide> $ docker build -t ouruser/sinatra:v2 .
<add>
<ide> Sending build context to Docker daemon 2.048 kB
<ide> Sending build context to Docker daemon
<ide> Step 1 : FROM ubuntu:14.04
<ide> containers will get removed to clean things up.
<ide> You can then create a container from our new image.
<ide>
<ide> $ docker run -t -i ouruser/sinatra:v2 /bin/bash
<add>
<ide> root@8196968dac35:/#
<ide>
<ide> > **Note:**
<ide> user name, the repository name and the new tag.
<ide> Now, see your new tag using the `docker images` command.
<ide>
<ide> $ docker images ouruser/sinatra
<add>
<ide> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> ouruser/sinatra latest 5db5f8471261 11 hours ago 446.7 MB
<ide> ouruser/sinatra devel 5db5f8471261 11 hours ago 446.7 MB
<ide> unchanged, the digest value is predictable. To list image digest values, use
<ide> the `--digests` flag:
<ide>
<ide> $ docker images --digests | head
<add>
<ide> REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
<ide> ouruser/sinatra latest sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 5db5f8471261 11 hours ago 446.7 MB
<ide>
<ide> allows you to share it with others, either publicly, or push it into [a
<ide> private repository](https://hub.docker.com/account/billing-plans/).
<ide>
<ide> $ docker push ouruser/sinatra
<add>
<ide> The push refers to a repository [ouruser/sinatra] (len: 1)
<ide> Sending image list
<ide> Pushing repository ouruser/sinatra (3 tags)
<ide> containers](usingdocker.md) using the `docker rmi` command.
<ide> Delete the `training/sinatra` image as you don't need it anymore.
<ide>
<ide> $ docker rmi training/sinatra
<add>
<ide> Untagged: training/sinatra:latest
<ide> Deleted: 5bc342fa0b91cabf65246837015197eecfa24b2213ed6a51a8974ae250fedd8d
<ide> Deleted: ed0fffdcdae5eb2c3a55549857a8be7fc8bc4241fb19ad714364cbfd7a56b22f
<ide><path>docs/tutorials/dockerizing.md
<ide> Running an application inside a container takes a single command: `docker run`.
<ide> Let's run a hello world container.
<ide>
<ide> $ docker run ubuntu /bin/echo 'Hello world'
<add>
<ide> Hello world
<ide>
<ide> You just launched your first container!
<ide> the container stops once the command is executed.
<ide> Let's specify a new command to run in the container.
<ide>
<ide> $ docker run -t -i ubuntu /bin/bash
<add>
<ide> root@af8bae53bdd3:/#
<ide>
<ide> In this example:
<ide> command prompt inside it:
<ide> Let's try running some commands inside the container:
<ide>
<ide> root@af8bae53bdd3:/# pwd
<add>
<ide> /
<add>
<ide> root@af8bae53bdd3:/# ls
<add>
<ide> bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
<ide>
<ide> In this example:
<ide> finished, the container stops.
<ide> Let's create a container that runs as a daemon.
<ide>
<ide> $ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
<add>
<ide> 1e5535038e285177d5214659a068137486f96ee5c2e85a4ac52dc83f2ebe4147
<ide>
<ide> In this example:
<ide> The `docker ps` command queries the Docker daemon for information about all the
<ide> about.
<ide>
<ide> $ docker ps
<add>
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide> 1e5535038e28 ubuntu /bin/sh -c 'while tr 2 minutes ago Up 1 minute insane_babbage
<ide>
<ide> command.
<ide> Let's use the container name `insane_babbage`.
<ide>
<ide> $ docker logs insane_babbage
<add>
<ide> hello world
<ide> hello world
<ide> hello world
<ide> Dockerized application!
<ide> Next, run the `docker stop` command to stop our detached container.
<ide>
<ide> $ docker stop insane_babbage
<add>
<ide> insane_babbage
<ide>
<ide> The `docker stop` command tells Docker to politely stop the running
<ide> container and returns the name of the container it stopped.
<ide> Let's check it worked with the `docker ps` command.
<ide>
<ide> $ docker ps
<add>
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide>
<ide> Excellent. Our container is stopped.
<ide><path>docs/tutorials/dockerrepos.md
<ide> interface or by using the command line interface. Searching can find images by i
<ide> name, user name, or description:
<ide>
<ide> $ docker search centos
<add>
<ide> NAME DESCRIPTION STARS OFFICIAL AUTOMATED
<ide> centos The official build of CentOS 1223 [OK]
<ide> tianon/centos CentOS 5 and 6, created using rinse instea... 33
<ide> a user's repository from the image name.
<ide> Once you've found the image you want, you can download it with `docker pull <imagename>`:
<ide>
<ide> $ docker pull centos
<add>
<ide> Using default tag: latest
<ide> latest: Pulling from library/centos
<ide> f1b10cd84249: Pull complete
<ide><path>docs/tutorials/dockervolumes.md
<ide> using the `docker volume create` command.
<ide>
<ide> ```bash
<ide> $ docker volume create -d flocker --name my-named-volume -o size=20GB
<add>
<ide> $ docker run -d -P \
<ide> -v my-named-volume:/opt/webapp \
<ide> --name web training/webapp python app.py
<ide><path>docs/tutorials/networkingcontainers.md
<ide> You name your container by using the `--name` flag, for example launch a new con
<ide> Use the `docker ps` command to check the name:
<ide>
<ide> $ docker ps -l
<add>
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide> aed84ee21bde training/webapp:latest python app.py 12 hours ago Up 2 seconds 0.0.0.0:49154->5000/tcp web
<ide>
<ide> You can also use `docker inspect` with the container's name.
<ide>
<ide> $ docker inspect web
<add>
<ide> [
<del> {
<del> "Id": "3ce51710b34f5d6da95e0a340d32aa2e6cf64857fb8cdb2a6c38f7c56f448143",
<del> "Created": "2015-10-25T22:44:17.854367116Z",
<del> "Path": "python",
<del> "Args": [
<del> "app.py"
<del> ],
<del> "State": {
<del> "Status": "running",
<del> "Running": true,
<del> "Paused": false,
<del> "Restarting": false,
<del> "OOMKilled": false,
<add> {
<add> "Id": "3ce51710b34f5d6da95e0a340d32aa2e6cf64857fb8cdb2a6c38f7c56f448143",
<add> "Created": "2015-10-25T22:44:17.854367116Z",
<add> "Path": "python",
<add> "Args": [
<add> "app.py"
<add> ],
<add> "State": {
<add> "Status": "running",
<add> "Running": true,
<add> "Paused": false,
<add> "Restarting": false,
<add> "OOMKilled": false,
<ide> ...
<ide>
<ide> Container names must be unique. That means you can only call one container
<ide> `web`. If you want to re-use a container name you must delete the old container
<ide> (with `docker rm`) before you can reuse the name with a new container. Go ahead and stop and remove your old `web` container.
<ide>
<ide> $ docker stop web
<add>
<ide> web
<add>
<ide> $ docker rm web
<add>
<ide> web
<ide>
<ide>
<ide> that you can create your own drivers but that is an advanced task.
<ide> Every installation of the Docker Engine automatically includes three default networks. You can list them:
<ide>
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 18a2866682b8 none null
<ide> c288470c46f6 host host
<ide> Every installation of the Docker Engine automatically includes three default net
<ide> The network named `bridge` is a special network. Unless you tell it otherwise, Docker always launches your containers in this network. Try this now:
<ide>
<ide> $ docker run -itd --name=networktest ubuntu
<add>
<ide> 74695c9cea6d9810718fddadc01a727a5dd3ce6a69d09752239736c030599741
<ide>
<ide> Inspecting the network is an easy way to find out the container's IP address.
<ide>
<ide> ```bash
<ide> $ docker network inspect bridge
<add>
<ide> [
<ide> {
<ide> "Name": "bridge",
<ide> Docker Engine natively supports both bridge networks and overlay networks. A bri
<ide> The `-d` flag tells Docker to use the `bridge` driver for the new network. You could have left this flag off as `bridge` is the default value for this flag. Go ahead and list the networks on your machine:
<ide>
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 7b369448dccb bridge bridge
<ide> 615d565d498c my-bridge-network bridge
<ide> The `-d` flag tells Docker to use the `bridge` driver for the new network. You c
<ide> If you inspect the network, you'll find that it has nothing in it.
<ide>
<ide> $ docker network inspect my-bridge-network
<add>
<ide> [
<ide> {
<ide> "Name": "my-bridge-network",
<ide> If you inspect your `my-bridge-network` you'll see it has a container attached.
<ide> You can also inspect your container to see where it is connected:
<ide>
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' db
<add>
<ide> {"my-bridge-network":{"NetworkID":"7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
<ide> "EndpointID":"508b170d56b2ac9e4ef86694b0a76a22dd3df1983404f7321da5649645bf7043","Gateway":"172.18.0.1","IPAddress":"172.18.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}
<ide>
<ide> Now, go ahead and start your by now familiar web application. This time leave of
<ide> Which network is your `web` application running under? Inspect the application and you'll find it is running in the default `bridge` network.
<ide>
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' web
<add>
<ide> {"bridge":{"NetworkID":"7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> "EndpointID":"508b170d56b2ac9e4ef86694b0a76a22dd3df1983404f7321da5649645bf7043","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}
<ide>
<ide> Then, get the IP address of your `web`
<ide>
<ide> $ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' web
<add>
<ide> 172.17.0.2
<ide>
<ide> Now, open a shell to your running `db` container:
<ide>
<ide> $ docker exec -it db bash
<add>
<ide> root@a205f0dd33b2:/# ping 172.17.0.2
<ide> ping 172.17.0.2
<ide> PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.
<ide> Docker networking allows you to attach a container to as many networks as you li
<ide> Open a shell into the `db` application again and try the ping command. This time just use the container name `web` rather than the IP Address.
<ide>
<ide> $ docker exec -it db bash
<add>
<ide> root@a205f0dd33b2:/# ping web
<ide> PING web (172.18.0.3) 56(84) bytes of data.
<ide> 64 bytes from web (172.18.0.3): icmp_seq=1 ttl=64 time=0.095 ms
<ide><path>docs/tutorials/usingdocker.md
<ide> Lastly, you've specified a command for our container to run: `python app.py`. Th
<ide> Now you can see your running container using the `docker ps` command.
<ide>
<ide> $ docker ps -l
<add>
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide> bc533791f3f5 training/webapp:latest python app.py 5 seconds ago Up 2 seconds 0.0.0.0:49155->5000/tcp nostalgic_morse
<ide>
<ide> specify the ID or name of our container and then the port for which we need the
<ide> corresponding public-facing port.
<ide>
<ide> $ docker port nostalgic_morse 5000
<add>
<ide> 0.0.0.0:49155
<ide>
<ide> In this case you've looked up what port is mapped externally to port 5000 inside
<ide> You can also find out a bit more about what's happening with our application and
<ide> use another of the commands you've learned, `docker logs`.
<ide>
<ide> $ docker logs -f nostalgic_morse
<add>
<ide> * Running on http://0.0.0.0:5000/
<ide> 10.0.2.2 - - [23/May/2014 20:16:31] "GET / HTTP/1.1" 200 -
<ide> 10.0.2.2 - - [23/May/2014 20:16:31] "GET /favicon.ico HTTP/1.1" 404 -
<ide> In addition to the container's logs we can also examine the processes
<ide> running inside it using the `docker top` command.
<ide>
<ide> $ docker top nostalgic_morse
<add>
<ide> PID USER COMMAND
<ide> 854 root python app.py
<ide>
<ide> We can also narrow down the information we want to return by requesting a
<ide> specific element, for example to return the container's IP address we would:
<ide>
<ide> $ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nostalgic_morse
<add>
<ide> 172.17.0.5
<ide>
<ide> ## Stopping our web application container
<ide> Okay you've seen web application working. Now you can stop it using the
<ide> `docker stop` command and the name of our container: `nostalgic_morse`.
<ide>
<ide> $ docker stop nostalgic_morse
<add>
<ide> nostalgic_morse
<ide>
<ide> We can now use the `docker ps` command to check if the container has
<ide> can create a new container or restart the old one. Look at
<ide> starting your previous container back up.
<ide>
<ide> $ docker start nostalgic_morse
<add>
<ide> nostalgic_morse
<ide>
<ide> Now quickly run `docker ps -l` again to see the running container is
<ide> Your colleague has let you know that they've now finished with the container
<ide> and won't need it again. Now, you can remove it using the `docker rm` command.
<ide>
<ide> $ docker rm nostalgic_morse
<add>
<ide> Error: Impossible to remove a running container, please stop it first or use -f
<ide> 2014/05/24 08:12:56 Error: failed to remove one or more containers
<ide>
<ide> you from accidentally removing a running container you might need. You can try
<ide> this again by stopping the container first.
<ide>
<ide> $ docker stop nostalgic_morse
<add>
<ide> nostalgic_morse
<add>
<ide> $ docker rm nostalgic_morse
<add>
<ide> nostalgic_morse
<ide>
<ide> And now our container is stopped and deleted.
<ide><path>docs/userguide/eng-image/baseimages.md
<ide> It can be as simple as this to create an Ubuntu base image:
<ide>
<ide> $ sudo debootstrap raring raring > /dev/null
<ide> $ sudo tar -C raring -c . | docker import - raring
<add>
<ide> a29c15f1bf7a
<add>
<ide> $ docker run raring cat /etc/lsb-release
<add>
<ide> DISTRIB_ID=Ubuntu
<ide> DISTRIB_RELEASE=13.04
<ide> DISTRIB_CODENAME=raring
<ide><path>docs/userguide/labels-custom-metadata.md
<ide> on how to query labels set on a container.
<ide> These labels appear as part of the `docker info` output for the daemon:
<ide>
<ide> $ docker -D info
<add>
<ide> Containers: 12
<ide> Running: 5
<ide> Paused: 2
<ide><path>docs/userguide/networking/default_network/binding.md
<ide> when it starts:
<ide>
<ide> ```
<ide> $ sudo iptables -t nat -L -n
<add>
<ide> ...
<ide> Chain POSTROUTING (policy ACCEPT)
<ide> target prot opt source destination
<ide> network stack by examining your NAT tables.
<ide> # is finished setting up a -P forward:
<ide>
<ide> $ iptables -t nat -L -n
<add>
<ide> ...
<ide> Chain DOCKER (2 references)
<ide> target prot opt source destination
<ide><path>docs/userguide/networking/default_network/build-bridges.md
<ide> stopping the service and removing the interface:
<ide> # Stopping Docker and removing docker0
<ide>
<ide> $ sudo service docker stop
<add>
<ide> $ sudo ip link set dev docker0 down
<add>
<ide> $ sudo brctl delbr docker0
<add>
<ide> $ sudo iptables -t nat -F POSTROUTING
<ide> ```
<ide>
<ide> customize `docker0`, but it will be enough to illustrate the technique.
<ide> # Create our own bridge
<ide>
<ide> $ sudo brctl addbr bridge0
<add>
<ide> $ sudo ip addr add 192.168.5.1/24 dev bridge0
<add>
<ide> $ sudo ip link set dev bridge0 up
<ide>
<ide> # Confirming that our bridge is up and running
<ide>
<ide> $ ip addr show bridge0
<add>
<ide> 4: bridge0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state UP group default
<ide> link/ether 66:38:d0:0d:76:18 brd ff:ff:ff:ff:ff:ff
<ide> inet 192.168.5.1/24 scope global bridge0
<ide> $ ip addr show bridge0
<ide> # Tell Docker about it and restart (on Ubuntu)
<ide>
<ide> $ echo 'DOCKER_OPTS="-b=bridge0"' >> /etc/default/docker
<add>
<ide> $ sudo service docker start
<ide>
<ide> # Confirming new outgoing NAT masquerade is set up
<ide>
<ide> $ sudo iptables -t nat -L -n
<add>
<ide> ...
<ide> Chain POSTROUTING (policy ACCEPT)
<ide> target prot opt source destination
<ide><path>docs/userguide/networking/default_network/configure-dns.md
<ide> How can Docker supply each container with a hostname and DNS configuration, with
<ide>
<ide> ```
<ide> $$ mount
<add>
<ide> ...
<ide> /dev/disk/by-uuid/1fec...ebdf on /etc/hostname type ext4 ...
<ide> /dev/disk/by-uuid/1fec...ebdf on /etc/hosts type ext4 ...
<ide><path>docs/userguide/networking/default_network/container-communication.md
<ide> set `--ip-forward=false` and your system's kernel has it enabled, the
<ide> or to turn it on manually:
<ide> ```
<ide> $ sysctl net.ipv4.conf.all.forwarding
<add>
<ide> net.ipv4.conf.all.forwarding = 0
<add>
<ide> $ sysctl net.ipv4.conf.all.forwarding=1
<add>
<ide> $ sysctl net.ipv4.conf.all.forwarding
<add>
<ide> net.ipv4.conf.all.forwarding = 1
<ide> ```
<ide>
<ide> You can run the `iptables` command on your Docker host to see whether the `FORWA
<ide> # When --icc=false, you should see a DROP rule:
<ide>
<ide> $ sudo iptables -L -n
<add>
<ide> ...
<ide> Chain FORWARD (policy ACCEPT)
<ide> target prot opt source destination
<ide> DROP all -- 0.0.0.0/0 0.0.0.0/0
<ide> # the subsequent DROP policy for all other packets:
<ide>
<ide> $ sudo iptables -L -n
<add>
<ide> ...
<ide> Chain FORWARD (policy ACCEPT)
<ide> target prot opt source destination
<ide><path>docs/userguide/networking/default_network/custom-docker0.md
<ide> Once you have one or more containers up and running, you can confirm that Docker
<ide> # Display bridge info
<ide>
<ide> $ sudo brctl show
<add>
<ide> bridge name bridge id STP enabled interfaces
<ide> docker0 8000.3a1d7362b4ee no veth65f9
<ide> vethdda6
<ide> Finally, the `docker0` Ethernet bridge settings are used every time you create a
<ide> $ docker run -i -t --rm base /bin/bash
<ide>
<ide> $$ ip addr show eth0
<add>
<ide> 24: eth0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
<ide> link/ether 32:6f:e0:35:57:91 brd ff:ff:ff:ff:ff:ff
<ide> inet 172.17.0.3/16 scope global eth0
<ide> $$ ip addr show eth0
<ide> valid_lft forever preferred_lft forever
<ide>
<ide> $$ ip route
<add>
<ide> default via 172.17.42.1 dev eth0
<ide> 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.3
<ide>
<ide><path>docs/userguide/networking/default_network/dockerlinks.md
<ide> range* on your Docker host. Next, when `docker ps` was run, you saw that port
<ide> 5000 in the container was bound to port 49155 on the host.
<ide>
<ide> $ docker ps nostalgic_morse
<add>
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide> bc533791f3f5 training/webapp:latest python app.py 5 seconds ago Up 2 seconds 0.0.0.0:49155->5000/tcp nostalgic_morse
<ide>
<ide> configurations. For example, if you've bound the container port to the
<ide> `localhost` on the host machine, then the `docker port` output will reflect that.
<ide>
<ide> $ docker port nostalgic_morse 5000
<add>
<ide> 127.0.0.1:49155
<ide>
<ide> > **Note:**
<ide> name the container `web`. You can see the container's name using the
<ide> `docker ps` command.
<ide>
<ide> $ docker ps -l
<add>
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide> aed84ee21bde training/webapp:latest python app.py 12 hours ago Up 2 seconds 0.0.0.0:49154->5000/tcp web
<ide>
<ide> example as:
<ide> Next, inspect your linked containers with `docker inspect`:
<ide>
<ide> $ docker inspect -f "{{ .HostConfig.Links }}" web
<add>
<ide> [/db:/web/db]
<ide>
<ide> You can see that the `web` container is now linked to the `db` container
<ide> command to list the specified container's environment variables.
<ide>
<ide> ```
<ide> $ docker run --rm --name web2 --link db:db training/webapp env
<add>
<ide> . . .
<ide> DB_NAME=/web2/db
<ide> DB_PORT=tcp://172.17.0.5:5432
<ide> source container to the `/etc/hosts` file. Here's an entry for the `web`
<ide> container:
<ide>
<ide> $ docker run -t -i --rm --link db:webdb training/webapp /bin/bash
<add>
<ide> root@aed84ee21bde:/opt/webapp# cat /etc/hosts
<add>
<ide> 172.17.0.7 aed84ee21bde
<ide> . . .
<ide> 172.17.0.5 webdb 6e5cdeb2d300 db
<ide> also be added in `/etc/hosts` for the linked container's IP address. You can pin
<ide> that host now via any of these entries:
<ide>
<ide> root@aed84ee21bde:/opt/webapp# apt-get install -yqq inetutils-ping
<add>
<ide> root@aed84ee21bde:/opt/webapp# ping webdb
<add>
<ide> PING webdb (172.17.0.5): 48 data bytes
<ide> 56 bytes from 172.17.0.5: icmp_seq=0 ttl=64 time=0.267 ms
<ide> 56 bytes from 172.17.0.5: icmp_seq=1 ttl=64 time=0.250 ms
<ide> will be automatically updated with the source container's new IP address,
<ide> allowing linked communication to continue.
<ide>
<ide> $ docker restart db
<add>
<ide> db
<add>
<ide> $ docker run -t -i --rm --link db:db training/webapp /bin/bash
<add>
<ide> root@aed84ee21bde:/opt/webapp# cat /etc/hosts
<add>
<ide> 172.17.0.7 aed84ee21bde
<ide> . . .
<ide> 172.17.0.9 db
<ide><path>docs/userguide/networking/default_network/ipv6.md
<ide> starting dockerd with `--ip-forward=false`):
<ide>
<ide> ```
<ide> $ ip -6 route add 2001:db8:1::/64 dev docker0
<add>
<ide> $ sysctl net.ipv6.conf.default.forwarding=1
<add>
<ide> $ sysctl net.ipv6.conf.all.forwarding=1
<ide> ```
<ide>
<ide> configure the IPv6 addresses `2001:db8::c000` to `2001:db8::c00f`:
<ide>
<ide> ```
<ide> $ ip -6 addr show
<add>
<ide> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536
<ide> inet6 ::1/128 scope host
<ide> valid_lft forever preferred_lft forever
<ide> device to the container network:
<ide>
<ide> ```
<ide> $ ip -6 route show
<add>
<ide> 2001:db8::c008/125 dev docker0 metric 1
<ide> 2001:db8::/64 dev eth0 proto kernel metric 256
<ide> ```
<ide><path>docs/userguide/networking/dockernetworks.md
<ide> these networks using the `docker network ls` command:
<ide>
<ide> ```
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 7fca4eb8c647 bridge bridge
<ide> 9f904ee27bf5 none null
<ide> the `ifconfig` command on the host.
<ide>
<ide> ```
<ide> $ ifconfig
<add>
<ide> docker0 Link encap:Ethernet HWaddr 02:42:47:bc:3a:eb
<ide> inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
<ide> inet6 addr: fe80::42:47ff:febc:3aeb/64 Scope:Link
<ide> command returns information about a network:
<ide>
<ide> ```
<ide> $ docker network inspect bridge
<add>
<ide> [
<ide> {
<ide> "Name": "bridge",
<ide> The `docker run` command automatically adds new containers to this network.
<ide>
<ide> ```
<ide> $ docker run -itd --name=container1 busybox
<add>
<ide> 3386a527aa08b37ea9232cbcace2d2458d49f44bb05a6b775fba7ddd40d8f92c
<ide>
<ide> $ docker run -itd --name=container2 busybox
<add>
<ide> 94447ca479852d29aeddca75c28f7104df3c3196d7b6d83061879e339946805c
<ide> ```
<ide>
<ide> Inspecting the `bridge` network again after starting two containers shows both newly launched containers in the network. Their ids show up in the "Containers" section of `docker network inspect`:
<ide>
<ide> ```
<ide> $ docker network inspect bridge
<add>
<ide> {[
<ide> {
<ide> "Name": "bridge",
<ide> Then use `ping` for about 3 seconds to test the connectivity of the containers o
<ide>
<ide> ```
<ide> root@0cb243cd1293:/# ping -w3 172.17.0.3
<add>
<ide> PING 172.17.0.3 (172.17.0.3): 56 data bytes
<ide> 64 bytes from 172.17.0.3: seq=0 ttl=64 time=0.096 ms
<ide> 64 bytes from 172.17.0.3: seq=1 ttl=64 time=0.080 ms
<ide> Finally, use the `cat` command to check the `container1` network configuration:
<ide>
<ide> ```
<ide> root@0cb243cd1293:/# cat /etc/hosts
<add>
<ide> 172.17.0.2 3386a527aa08
<ide> 127.0.0.1 localhost
<ide> ::1 localhost ip6-localhost ip6-loopback
<ide> To detach from a `container1` and leave it running use `CTRL-p CTRL-q`.Then, att
<ide> $ docker attach container2
<ide>
<ide> root@0cb243cd1293:/# ifconfig
<add>
<ide> eth0 Link encap:Ethernet HWaddr 02:42:AC:11:00:03
<ide> inet addr:172.17.0.3 Bcast:0.0.0.0 Mask:255.255.0.0
<ide> inet6 addr: fe80::42:acff:fe11:3/64 Scope:Link
<ide> lo Link encap:Local Loopback
<ide> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
<ide>
<ide> root@0cb243cd1293:/# ping -w3 172.17.0.2
<add>
<ide> PING 172.17.0.2 (172.17.0.2): 56 data bytes
<ide> 64 bytes from 172.17.0.2: seq=0 ttl=64 time=0.067 ms
<ide> 64 bytes from 172.17.0.2: seq=1 ttl=64 time=0.075 ms
<ide> $ docker network create --driver bridge isolated_nw
<ide> 1196a4c5af43a21ae38ef34515b6af19236a3fc48122cf585e3f3054d509679b
<ide>
<ide> $ docker network inspect isolated_nw
<add>
<ide> [
<ide> {
<ide> "Name": "isolated_nw",
<ide> $ docker network inspect isolated_nw
<ide> ]
<ide>
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 9f904ee27bf5 none null
<ide> cf03ee007fb4 host host
<ide> After you create the network, you can launch containers on it using the `docker
<ide>
<ide> ```
<ide> $ docker run --net=isolated_nw -itd --name=container3 busybox
<add>
<ide> 8c1a0a5be480921d669a073393ade66a3fc49933f08bcc5515b37b8144f6d47c
<ide>
<ide> $ docker network inspect isolated_nw
<ide><path>docs/userguide/networking/get-started-overlay.md
<ide> key-value stores. This example uses Consul.
<ide> 5. Run the `docker ps` command to see the `consul` container.
<ide>
<ide> $ docker ps
<add>
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide> 4d51392253b3 progrium/consul "/bin/start -server -" 25 minutes ago Up 25 minutes 53/tcp, 53/udp, 8300-8302/tcp, 0.0.0.0:8500->8500/tcp, 8400/tcp, 8301-8302/udp admiring_panini
<ide>
<ide> that machine options that are needed by the `overlay` network driver.
<ide> 3. List your machines to confirm they are all up and running.
<ide>
<ide> $ docker-machine ls
<add>
<ide> NAME ACTIVE DRIVER STATE URL SWARM
<ide> default - virtualbox Running tcp://192.168.99.100:2376
<ide> mh-keystore * virtualbox Running tcp://192.168.99.103:2376
<ide> To create an overlay network
<ide> 2. Use the `docker info` command to view the Swarm.
<ide>
<ide> $ docker info
<add>
<ide> Containers: 3
<ide> Images: 2
<ide> Role: primary
<ide> To create an overlay network
<ide> 4. Check that the network is running:
<ide>
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 412c2496d0eb mhs-demo1/host host
<ide> dd51763e6dd2 mhs-demo0/bridge bridge
<ide> To create an overlay network
<ide> 5. Switch to each Swarm agent in turn and list the networks.
<ide>
<ide> $ eval $(docker-machine env mhs-demo0)
<add>
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 6b07d0be843f my-net overlay
<ide> dd51763e6dd2 bridge bridge
<ide> b4234109bd9b none null
<ide> 1aeead6dd890 host host
<add>
<ide> $ eval $(docker-machine env mhs-demo1)
<add>
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> d0bb78cbe7bd bridge bridge
<ide> 1c0eb8f69ebb none null
<ide> Once your network is created, you can start a container on any of the hosts and
<ide> 4. Run a BusyBox instance on the `mhs-demo1` instance and get the contents of the Nginx server's home page.
<ide>
<ide> $ docker run -it --rm --net=my-net --env="constraint:node==mhs-demo1" busybox wget -O- http://web
<add>
<ide> Unable to find image 'busybox:latest' locally
<ide> latest: Pulling from library/busybox
<ide> ab2b8a86ca6c: Pull complete
<ide> to have external connectivity outside of their cluster.
<ide> 2. View the `docker_gwbridge` network, by listing the networks.
<ide>
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 6b07d0be843f my-net overlay
<ide> dd51763e6dd2 bridge bridge
<ide> to have external connectivity outside of their cluster.
<ide> 3. Repeat steps 1 and 2 on the Swarm master.
<ide>
<ide> $ eval $(docker-machine env mhs-demo0)
<add>
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 6b07d0be843f my-net overlay
<ide> d0bb78cbe7bd bridge bridge
<ide> to have external connectivity outside of their cluster.
<ide> 2. Check the Nginx container's network interfaces.
<ide>
<ide> $ docker exec web ip addr
<add>
<ide> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
<ide> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
<ide> inet 127.0.0.1/8 scope host lo
<ide><path>docs/userguide/networking/work-with-networks.md
<ide> bridge network for you.
<ide>
<ide> ```bash
<ide> $ docker network create simple-network
<add>
<ide> 69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a
<add>
<ide> $ docker network inspect simple-network
<ide> [
<ide> {
<ide> For example, now let's use `-o` or `--opt` options to specify an IP address bind
<ide>
<ide> ```bash
<ide> $ docker network create -o "com.docker.network.bridge.host_binding_ipv4"="172.23.0.1" my-network
<add>
<ide> b1a086897963e6a2e7fc6868962e55e746bee8ad0c97b54a5831054b5f62672a
<add>
<ide> $ docker network inspect my-network
<add>
<ide> [
<ide> {
<ide> "Name": "my-network",
<ide> $ docker network inspect my-network
<ide> }
<ide> }
<ide> ]
<add>
<ide> $ docker run -d -P --name redis --net my-network redis
<add>
<ide> bafb0c808c53104b2c90346f284bda33a69beadcab4fc83ab8f2c5a4410cd129
<add>
<ide> $ docker ps
<add>
<ide> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
<ide> bafb0c808c53 redis "/entrypoint.sh redis" 4 seconds ago Up 3 seconds 172.23.0.1:32770->6379/tcp redis
<ide> ```
<ide> Create two containers for this example:
<ide>
<ide> ```bash
<ide> $ docker run -itd --name=container1 busybox
<add>
<ide> 18c062ef45ac0c026ee48a83afa39d25635ee5f02b58de4abc8f467bcaa28731
<ide>
<ide> $ docker run -itd --name=container2 busybox
<add>
<ide> 498eaaaf328e1018042c04b2de04036fc04719a6e39a097a4f4866043a2c2152
<ide> ```
<ide>
<ide> Then create an isolated, `bridge` network to test with.
<ide>
<ide> ```bash
<ide> $ docker network create -d bridge --subnet 172.25.0.0/16 isolated_nw
<add>
<ide> 06a62f1c73c4e3107c0f555b7a5f163309827bfbbf999840166065a8f35455a8
<ide> ```
<ide>
<ide> the connection:
<ide>
<ide> ```
<ide> $ docker network connect isolated_nw container2
<add>
<ide> $ docker network inspect isolated_nw
<add>
<ide> [
<ide> {
<ide> "Name": "isolated_nw",
<ide> the network on launch using the `docker run` command's `--net` option:
<ide>
<ide> ```bash
<ide> $ docker run --net=isolated_nw --ip=172.25.3.3 -itd --name=container3 busybox
<add>
<ide> 467a7863c3f0277ef8e661b38427737f28099b61fa55622d6c30fb288d88c551
<ide> ```
<ide>
<ide> Now, inspect the network resources used by `container3`.
<ide>
<ide> ```bash
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' container3
<add>
<ide> {"isolated_nw":{"IPAMConfig":{"IPv4Address":"172.25.3.3"},"NetworkID":"1196a4c5af43a21ae38ef34515b6af19236a3fc48122cf585e3f3054d509679b",
<ide> "EndpointID":"dffc7ec2915af58cc827d995e6ebdc897342be0420123277103c40ae35579103","Gateway":"172.25.0.1","IPAddress":"172.25.3.3","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:19:03:03"}}
<ide> ```
<ide> Repeat this command for `container2`. If you have Python installed, you can pretty print the output.
<ide>
<ide> ```bash
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | python -m json.tool
<add>
<ide> {
<ide> "bridge": {
<ide> "NetworkID":"7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> same network and cannot communicate. Test, this now by attaching to
<ide>
<ide> ```bash
<ide> $ docker attach container3
<add>
<ide> / # ping 172.17.0.2
<ide> PING 172.17.0.2 (172.17.0.2): 56 data bytes
<ide> ^C
<ide> for other containers in the same network.
<ide>
<ide> ```bash
<ide> $ docker run --net=isolated_nw -itd --name=container4 --link container5:c5 busybox
<add>
<ide> 01b5df970834b77a9eadbaff39051f237957bd35c4c56f11193e0594cfd5117c
<ide> ```
<ide>
<ide> c4.
<ide>
<ide> ```bash
<ide> $ docker run --net=isolated_nw -itd --name=container5 --link container4:c4 busybox
<add>
<ide> 72eccf2208336f31e9e33ba327734125af00d1e1d2657878e2ee8154fbb23c7a
<ide> ```
<ide>
<ide> container name and its alias c5 and `container5` will be able to reach
<ide>
<ide> ```bash
<ide> $ docker attach container4
<add>
<ide> / # ping -w 4 c5
<ide> PING c5 (172.25.0.5): 56 data bytes
<ide> 64 bytes from 172.25.0.5: seq=0 ttl=64 time=0.070 ms
<ide> round-trip min/avg/max = 0.070/0.081/0.097 ms
<ide>
<ide> ```bash
<ide> $ docker attach container5
<add>
<ide> / # ping -w 4 c4
<ide> PING c4 (172.25.0.4): 56 data bytes
<ide> 64 bytes from 172.25.0.4: seq=0 ttl=64 time=0.065 ms
<ide> with a network alias.
<ide>
<ide> ```bash
<ide> $ docker run --net=isolated_nw -itd --name=container6 --net-alias app busybox
<add>
<ide> 8ebe6767c1e0361f27433090060b33200aac054a68476c3be87ef4005eb1df17
<ide> ```
<ide>
<ide> ```bash
<ide> $ docker attach container4
<add>
<ide> / # ping -w 4 app
<ide> PING app (172.25.0.6): 56 data bytes
<ide> 64 bytes from 172.25.0.6: seq=0 ttl=64 time=0.070 ms
<ide> network-scoped alias within the same network. For example, let's launch
<ide>
<ide> ```bash
<ide> $ docker run --net=isolated_nw -itd --name=container7 --net-alias app busybox
<add>
<ide> 3138c678c123b8799f4c7cc6a0cecc595acbdfa8bf81f621834103cd4f504554
<ide> ```
<ide>
<ide> verify that `container7` is resolving the `app` alias.
<ide>
<ide> ```bash
<ide> $ docker attach container4
<add>
<ide> / # ping -w 4 app
<ide> PING app (172.25.0.6): 56 data bytes
<ide> 64 bytes from 172.25.0.6: seq=0 ttl=64 time=0.070 ms
<ide> round-trip min/avg/max = 0.070/0.081/0.097 ms
<ide> $ docker stop container6
<ide>
<ide> $ docker attach container4
<add>
<ide> / # ping -w 4 app
<ide> PING app (172.25.0.7): 56 data bytes
<ide> 64 bytes from 172.25.0.7: seq=0 ttl=64 time=0.095 ms
<ide> disconnect` command.
<ide> $ docker network disconnect isolated_nw container2
<ide>
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | python -m json.tool
<add>
<ide> {
<ide> "bridge": {
<ide> "NetworkID":"7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
<ide> $ docker inspect --format='{{json .NetworkSettings.Networks}}' container2 | pyt
<ide>
<ide>
<ide> $ docker network inspect isolated_nw
<add>
<ide> [
<ide> {
<ide> "Name": "isolated_nw",
<ide> be connected to the network.
<ide>
<ide> ```bash
<ide> $ docker run -d --name redis_db --net multihost redis
<add>
<ide> ERROR: Cannot start container bc0b19c089978f7845633027aa3435624ca3d12dd4f4f764b61eac4c0610f32e: container already connected to network multihost
<ide>
<ide> $ docker rm -f redis_db
<add>
<ide> $ docker network disconnect -f multihost redis_db
<ide>
<ide> $ docker run -d --name redis_db --net multihost redis
<add>
<ide> 7d986da974aeea5e9f7aca7e510bdb216d58682faa83a9040c2f2adc0544795a
<ide> ```
<ide>
<ide> $ docker network disconnect isolated_nw container3
<ide>
<ide> ```bash
<ide> docker network inspect isolated_nw
<add>
<ide> [
<ide> {
<ide> "Name": "isolated_nw",
<ide> List all your networks to verify the `isolated_nw` was removed:
<ide>
<ide> ```bash
<ide> $ docker network ls
<add>
<ide> NETWORK ID NAME DRIVER
<ide> 72314fa53006 host host
<ide> f7ab26d71dbd bridge bridge
<ide><path>docs/userguide/storagedriver/aufs-driver.md
<ide> You can only use the AUFS storage driver on Linux systems with AUFS installed.
<ide> Use the following command to determine if your system supports AUFS.
<ide>
<ide> $ grep aufs /proc/filesystems
<add>
<ide> nodev aufs
<ide>
<ide> This output indicates the system supports AUFS. Once you've verified your
<ide> Once your daemon is running, verify the storage driver with the `docker info`
<ide> command.
<ide>
<ide> $ sudo docker info
<add>
<ide> Containers: 1
<ide> Images: 4
<ide> Storage Driver: aufs
<ide> stacked below it in the union mount. Remember, these directory names do no map
<ide> to image layer IDs with Docker 1.10 and higher.
<ide>
<ide> $ cat /var/lib/docker/aufs/layers/91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c
<add>
<ide> d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82
<ide> c22013c8472965aa5b62559f2b540cd440716ef149756e7b958a1b2aba421e87
<ide> d3a1f33e8a5a513092f01bb7eb1c2abf4d711e5105390a3fe1ae2248cfde1391
<ide><path>docs/userguide/storagedriver/btrfs-driver.md
<ide> commands. The example below shows a truncated output of an `ls -l` command an
<ide> image layer:
<ide>
<ide> $ ls -l /var/lib/docker/btrfs/subvolumes/0a17decee4139b0de68478f149cc16346f5e711c5ae3bb969895f22dd6723751/
<add>
<ide> total 0
<ide> drwxr-xr-x 1 root root 1372 Oct 9 08:39 bin
<ide> drwxr-xr-x 1 root root 0 Apr 10 2014 boot
<ide> Assuming your system meets the prerequisites, do the following:
<ide> 1. Install the "btrfs-tools" package.
<ide>
<ide> $ sudo apt-get install btrfs-tools
<add>
<ide> Reading package lists... Done
<ide> Building dependency tree
<ide> <output truncated>
<ide> multiple devices to the `mkfs.btrfs` command creates a pool across all of those
<ide> devices. Here you create a pool with a single device at `/dev/xvdb`.
<ide>
<ide> $ sudo mkfs.btrfs -f /dev/xvdb
<add>
<ide> WARNING! - Btrfs v3.12 IS EXPERIMENTAL
<ide> WARNING! - see http://btrfs.wiki.kernel.org before using
<ide>
<ide> multiple devices to the `mkfs.btrfs` command creates a pool across all of those
<ide> a. Obtain the Btrfs filesystem's UUID.
<ide>
<ide> $ sudo blkid /dev/xvdb
<add>
<ide> /dev/xvdb: UUID="a0ed851e-158b-4120-8416-c9b072c8cf47" UUID_SUB="c3927a64-4454-4eef-95c2-a7d44ac0cf27" TYPE="btrfs"
<ide>
<ide> b. Create an `/etc/fstab` entry to automatically mount `/var/lib/docker`
<ide> remember to substitute the UUID value with the value obtained from the previous
<ide> 5. Mount the new filesystem and verify the operation.
<ide>
<ide> $ sudo mount -a
<add>
<ide> $ mount
<add>
<ide> /dev/xvda1 on / type ext4 (rw,discard)
<ide> <output truncated>
<ide> /dev/xvdb on /var/lib/docker type btrfs (rw)
<ide> should automatically load with the `btrfs` storage driver.
<ide> 1. Start the Docker daemon.
<ide>
<ide> $ sudo service docker start
<add>
<ide> docker start/running, process 2315
<ide>
<ide> The procedure for starting the Docker daemon may differ depending on the
<ide> daemon` at startup, or adding it to the `DOCKER_OPTS` line to the Docker config
<ide> 2. Verify the storage driver with the `docker info` command.
<ide>
<ide> $ sudo docker info
<add>
<ide> Containers: 0
<ide> Images: 0
<ide> Storage Driver: btrfs
<ide><path>docs/userguide/storagedriver/device-mapper-driver.md
<ide> You can detect the mode by viewing the `docker info` command:
<ide>
<ide> ```bash
<ide> $ sudo docker info
<add>
<ide> Containers: 0
<ide> Images: 0
<ide> Storage Driver: devicemapper
<ide> the specifics of the existing configuration use `docker info`:
<ide>
<ide> ```bash
<ide> $ sudo docker info
<add>
<ide> Containers: 0
<ide> Running: 0
<ide> Paused: 0
<ide> The `Data Space` values show that the pool is 100GB total. This example extends
<ide>
<ide> ```bash
<ide> $ sudo ls -lh /var/lib/docker/devicemapper/devicemapper/
<add>
<ide> total 1175492
<ide> -rw------- 1 root root 100G Mar 30 05:22 data
<ide> -rw------- 1 root root 2.0G Mar 31 11:17 metadata
<ide> The `Data Space` values show that the pool is 100GB total. This example extends
<ide>
<ide> ```bash
<ide> $ sudo ls -lh /var/lib/docker/devicemapper/devicemapper/
<add>
<ide> total 1.2G
<ide> -rw------- 1 root root 200G Apr 14 08:47 data
<ide> -rw------- 1 root root 2.0G Apr 19 13:27 metadata
<ide> The `Data Space` values show that the pool is 100GB total. This example extends
<ide>
<ide> ```bash
<ide> $ sudo blockdev --getsize64 /dev/loop0
<add>
<ide> 107374182400
<add>
<ide> $ sudo losetup -c /dev/loop0
<add>
<ide> $ sudo blockdev --getsize64 /dev/loop0
<add>
<ide> 214748364800
<ide> ```
<ide>
<ide> The `Data Space` values show that the pool is 100GB total. This example extends
<ide>
<ide> ```bash
<ide> $ sudo dmsetup status | grep pool
<add>
<ide> docker-8:1-123141-pool: 0 209715200 thin-pool 91
<ide> 422/524288 18338/1638400 - rw discard_passdown queue_if_no_space -
<ide> ```
<ide> The `Data Space` values show that the pool is 100GB total. This example extends
<ide>
<ide> ```bash
<ide> $ sudo dmsetup table docker-8:1-123141-pool
<add>
<ide> 0 209715200 thin-pool 7:1 7:0 128 32768 1 skip_block_zeroing
<ide> ```
<ide>
<ide> disk partition.
<ide>
<ide> ```bash
<ide> $ sudo vgextend vg-docker /dev/sdh1
<add>
<ide> Volume group "vg-docker" successfully extended
<ide> ```
<ide>
<ide> disk partition.
<ide>
<ide> ```bash
<ide> $ sudo lvextend -l+100%FREE -n vg-docker/data
<add>
<ide> Extending logical volume data to 200 GiB
<ide> Logical volume data successfully resized
<ide> ```
<ide> disk partition.
<ide>
<ide> ```bash
<ide> $ sudo dmsetup status | grep pool
<add>
<ide> docker-253:17-1835016-pool: 0 96460800 thin-pool 51593 6270/1048576 701943/753600 - rw no_discard_passdown queue_if_no_space
<ide> ```
<ide>
<ide> disk partition.
<ide>
<ide> ```bash
<ide> $ sudo dmsetup table docker-253:17-1835016-pool
<add>
<ide> 0 96460800 thin-pool 252:0 252:1 128 32768 1 skip_block_zeroing
<ide> ```
<ide>
<ide> disk partition.
<ide>
<ide> ```bash
<ide> $ sudo blockdev --getsize64 /dev/vg-docker/data
<add>
<ide> 264132100096
<ide> ```
<ide>
<ide><path>docs/userguide/storagedriver/imagesandcontainers.md
<ide> single 8GB general purpose SSD EBS volume. The Docker data directory
<ide> (`/var/lib/docker`) was consuming 2GB of space.
<ide>
<ide> $ docker images
<add>
<ide> REPOSITORY TAG IMAGE ID CREATED SIZE
<ide> jenkins latest 285c9f0f9d3d 17 hours ago 708.5 MB
<ide> mysql latest d39c3fa09ced 8 days ago 360.3 MB
<ide> single 8GB general purpose SSD EBS volume. The Docker data directory
<ide> ubuntu 15.04 c8be1ac8145a 7 weeks ago 131.3 MB
<ide>
<ide> $ sudo du -hs /var/lib/docker
<add>
<ide> 2.0G /var/lib/docker
<ide>
<ide> $ time docker run --rm -v /var/lib/docker:/var/lib/docker docker/v1.10-migrator
<add>
<ide> Unable to find image 'docker/v1.10-migrator:latest' locally
<ide> latest: Pulling from docker/v1.10-migrator
<ide> ed1f33c5883d: Pull complete
<ide> images with `docker pull` and `docker push`. The command below pulls the
<ide> `ubuntu:15.04` Docker image from Docker Hub.
<ide>
<ide> $ docker pull ubuntu:15.04
<add>
<ide> 15.04: Pulling from library/ubuntu
<ide> 1ba8ac955b97: Pull complete
<ide> f157c4e5ede7: Pull complete
<ide> image being pulled from Docker Hub, followed by a directory listing on a host
<ide> running version 1.9.1 of the Docker Engine.
<ide>
<ide> $ docker pull ubuntu:15.04
<add>
<ide> 15.04: Pulling from library/ubuntu
<ide> 47984b517ca9: Pull complete
<ide> df6e891a3ea9: Pull complete
<ide> running version 1.9.1 of the Docker Engine.
<ide> Status: Downloaded newer image for ubuntu:15.04
<ide>
<ide> $ ls /var/lib/docker/aufs/layers
<add>
<ide> 47984b517ca9ca0312aced5c9698753ffa964c2015f2a5f18e5efa9848cf30e2
<ide> c8be1ac8145a6e59a55667f573883749ad66eaeef92b4df17e5ea1260e2d7356
<ide> df6e891a3ea9cdce2a388a2cf1b1711629557454fd120abd5be6d32329a0e0ac
<ide> command.
<ide> command:
<ide>
<ide> $ docker build -t changed-ubuntu .
<add>
<ide> Sending build context to Docker daemon 2.048 kB
<ide> Step 1 : FROM ubuntu:15.04
<ide> ---> 3f7bcee56709
<ide> Let's see what happens if we spin up 5 containers based on our `changed-ubuntu`
<ide> 5 times.
<ide>
<ide> $ docker run -dit changed-ubuntu bash
<add>
<ide> 75bab0d54f3cf193cfdc3a86483466363f442fba30859f7dcd1b816b6ede82d4
<add>
<ide> $ docker run -dit changed-ubuntu bash
<add>
<ide> 9280e777d109e2eb4b13ab211553516124a3d4d4280a0edfc7abf75c59024d47
<add>
<ide> $ docker run -dit changed-ubuntu bash
<add>
<ide> a651680bd6c2ef64902e154eeb8a064b85c9abf08ac46f922ad8dfc11bb5cd8a
<add>
<ide> $ docker run -dit changed-ubuntu bash
<add>
<ide> 8eb24b3b2d246f225b24f2fca39625aaad71689c392a7b552b78baf264647373
<add>
<ide> $ docker run -dit changed-ubuntu bash
<add>
<ide> 0ad25d06bdf6fca0dedc38301b2aff7478b3e1ce3d1acd676573bba57cb1cfef
<ide>
<ide> This launches 5 containers based on the `changed-ubuntu` image. As each
<ide> creating each container.
<ide> 3. List the contents of the local storage area.
<ide>
<ide> $ sudo ls /var/lib/docker/containers
<add>
<ide> 0ad25d06bdf6fca0dedc38301b2aff7478b3e1ce3d1acd676573bba57cb1cfef
<ide> 9280e777d109e2eb4b13ab211553516124a3d4d4280a0edfc7abf75c59024d47
<ide> 75bab0d54f3cf193cfdc3a86483466363f442fba30859f7dcd1b816b6ede82d4
<ide><path>docs/userguide/storagedriver/overlayfs-driver.md
<ide> The following `docker pull` command shows a Docker host with downloading a
<ide> Docker image comprising five layers.
<ide>
<ide> $ sudo docker pull ubuntu
<add>
<ide> Using default tag: latest
<ide> latest: Pulling from library/ubuntu
<ide>
<ide> layer IDs do not match the directory names in `/var/lib/docker/overlay`. This
<ide> is normal behavior in Docker 1.10 and later.
<ide>
<ide> $ ls -l /var/lib/docker/overlay/
<add>
<ide> total 20
<ide> drwx------ 3 root root 4096 Jun 20 16:11 38f3ed2eac129654acef11c32670b534670c3a06e483fce313d72e3e0a15baa8
<ide> drwx------ 3 root root 4096 Jun 20 16:11 55f1e14c361b90570df46371b20ce6d480c434981cbda5fd68c6ff61aa0a5358
<ide> hard links to the data that is shared with lower layers. This allows for
<ide> efficient use of disk space.
<ide>
<ide> $ ls -i /var/lib/docker/overlay/38f3ed2eac129654acef11c32670b534670c3a06e483fce313d72e3e0a15baa8/root/bin/ls
<add>
<ide> 19793696 /var/lib/docker/overlay/38f3ed2eac129654acef11c32670b534670c3a06e483fce313d72e3e0a15baa8/root/bin/ls
<add>
<ide> $ ls -i /var/lib/docker/overlay/55f1e14c361b90570df46371b20ce6d480c434981cbda5fd68c6ff61aa0a5358/root/bin/ls
<add>
<ide> 19793696 /var/lib/docker/overlay/55f1e14c361b90570df46371b20ce6d480c434981cbda5fd68c6ff61aa0a5358/root/bin/ls
<ide>
<ide> Containers also exist on-disk in the Docker host's filesystem under
<ide> container using the `ls -l` command, you find the following file and
<ide> directories.
<ide>
<ide> $ ls -l /var/lib/docker/overlay/<directory-of-running-container>
<add>
<ide> total 16
<ide> -rw-r--r-- 1 root root 64 Jun 20 16:39 lower-id
<ide> drwxr-xr-x 1 root root 4096 Jun 20 16:39 merged
<ide> file contains the ID of the top layer of the image the container is based on.
<ide> This is used by OverlayFS as the "lowerdir".
<ide>
<ide> $ cat /var/lib/docker/overlay/ec444863a55a9f1ca2df72223d459c5d940a721b2288ff86a3f27be28b53be6c/lower-id
<add>
<ide> 55f1e14c361b90570df46371b20ce6d480c434981cbda5fd68c6ff61aa0a5358
<ide>
<ide> The "upper" directory is the containers read-write layer. Any changes made to
<ide> You can verify all of these constructs from the output of the `mount` command.
<ide> (Ellipses and line breaks are used in the output below to enhance readability.)
<ide>
<ide> $ mount | grep overlay
<add>
<ide> overlay on /var/lib/docker/overlay/ec444863a55a.../merged
<ide> type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay/55f1e14c361b.../root,
<ide> upperdir=/var/lib/docker/overlay/ec444863a55a.../upper,
<ide> After downloading a five-layer image using `docker pull ubuntu`, you can see
<ide> six directories under `/var/lib/docker/overlay2`.
<ide>
<ide> $ ls -l /var/lib/docker/overlay2
<add>
<ide> total 24
<ide> drwx------ 5 root root 4096 Jun 20 07:36 223c2864175491657d238e2664251df13b63adb8d050924fd1bfcdb278b866f7
<ide> drwx------ 3 root root 4096 Jun 20 07:36 3a36935c9df35472229c57f4a27105a136f5e4dbef0f87905b2e506e494e348b
<ide> shortened identifiers are used for avoid hitting the page size limitation on
<ide> mount arguments.
<ide>
<ide> $ ls -l /var/lib/docker/overlay2/l
<add>
<ide> total 20
<ide> lrwxrwxrwx 1 root root 72 Jun 20 07:36 6Y5IM2XC7TSNIJZZFLJCS6I4I4 -> ../3a36935c9df35472229c57f4a27105a136f5e4dbef0f87905b2e506e494e348b/diff
<ide> lrwxrwxrwx 1 root root 72 Jun 20 07:36 B3WWEFKBG3PLLV737KZFIASSW7 -> ../4e9fa83caff3e8f4cc83693fa407a4a9fac9573deaf481506c102d484dd1e6a1/diff
<ide> The lowerest layer contains the "link" file which contains the name of the short
<ide> identifier, and the "diff" directory which contains the contents.
<ide>
<ide> $ ls /var/lib/docker/overlay2/3a36935c9df35472229c57f4a27105a136f5e4dbef0f87905b2e506e494e348b/
<add>
<ide> diff link
<add>
<ide> $ cat /var/lib/docker/overlay2/3a36935c9df35472229c57f4a27105a136f5e4dbef0f87905b2e506e494e348b/link
<add>
<ide> 6Y5IM2XC7TSNIJZZFLJCS6I4I4
<add>
<ide> $ ls /var/lib/docker/overlay2/3a36935c9df35472229c57f4a27105a136f5e4dbef0f87905b2e506e494e348b/diff
<add>
<ide> bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
<ide>
<ide> The second layer contains the "lower" file for denoting the layer composition,
<ide> and the "diff" directory for the layer contents. It also contains the "merged" and
<ide> the "work" directories.
<ide>
<ide> $ ls /var/lib/docker/overlay2/223c2864175491657d238e2664251df13b63adb8d050924fd1bfcdb278b866f7
<add>
<ide> diff link lower merged work
<add>
<ide> $ cat /var/lib/docker/overlay2/223c2864175491657d238e2664251df13b63adb8d050924fd1bfcdb278b866f7/lower
<add>
<ide> l/6Y5IM2XC7TSNIJZZFLJCS6I4I4
<add>
<ide> $ ls /var/lib/docker/overlay2/223c2864175491657d238e2664251df13b63adb8d050924fd1bfcdb278b866f7/diff/
<add>
<ide> etc sbin usr var
<ide>
<ide> A directory for running container have similar files and directories as well.
<ide> Note that the lower list is separated by ':', and ordered from highest layer to lower.
<ide>
<ide> $ ls -l /var/lib/docker/overlay/<directory-of-running-container>
<add>
<ide> $ cat /var/lib/docker/overlay/<directory-of-running-container>/lower
<add>
<ide> l/DJA75GUWHWG7EWICFYX54FIOVT:l/B3WWEFKBG3PLLV737KZFIASSW7:l/JEYMODZYFCZFYSDABYXD5MF6YO:l/UL2MW33MSE3Q5VYIKBRN4ZAGQP:l/NFYKDW6APBCCUCTOUSYDH4DXAT:l/6Y5IM2XC7TSNIJZZFLJCS6I4I4
<ide>
<ide> The result of `mount` is as follows:
<ide>
<ide> $ mount | grep overlay
<add>
<ide> overlay on /var/lib/docker/overlay2/9186877cdf386d0a3b016149cf30c208f326dca307529e646afce5b3f83f5304/merged
<ide> type overlay (rw,relatime,
<ide> lowerdir=l/DJA75GUWHWG7EWICFYX54FIOVT:l/B3WWEFKBG3PLLV737KZFIASSW7:l/JEYMODZYFCZFYSDABYXD5MF6YO:l/UL2MW33MSE3Q5VYIKBRN4ZAGQP:l/NFYKDW6APBCCUCTOUSYDH4DXAT:l/6Y5IM2XC7TSNIJZZFLJCS6I4I4,
<ide> OverlayFS. The procedure assumes that the Docker daemon is in a stopped state.
<ide> 2. Verify your kernel version and that the overlay kernel module is loaded.
<ide>
<ide> $ uname -r
<add>
<ide> 3.19.0-21-generic
<ide>
<ide> $ lsmod | grep overlay
<add>
<ide> overlay
<ide>
<ide> 3. Start the Docker daemon with the `overlay`/`overlay2` storage driver.
<ide>
<ide> $ dockerd --storage-driver=overlay &
<add>
<ide> [1] 29403
<ide> root@ip-10-0-0-174:/home/ubuntu# INFO[0000] Listening for HTTP on unix (/var/run/docker.sock)
<ide> INFO[0000] Option DefaultDriver: bridge
<ide> OverlayFS. The procedure assumes that the Docker daemon is in a stopped state.
<ide> 4. Verify that the daemon is using the `overlay`/`overlay2` storage driver
<ide>
<ide> $ docker info
<add>
<ide> Containers: 0
<ide> Images: 0
<ide> Storage Driver: overlay
<ide><path>docs/userguide/storagedriver/selectadriver.md
<ide> To find out which storage driver is set on the daemon, you use the
<ide> `docker info` command:
<ide>
<ide> $ docker info
<add>
<ide> Containers: 0
<ide> Images: 0
<ide> Storage Driver: overlay
<ide> The following command shows how to start the Docker daemon with the
<ide> $ dockerd --storage-driver=devicemapper &
<ide>
<ide> $ docker info
<add>
<ide> Containers: 0
<ide> Images: 0
<ide> Storage Driver: devicemapper
<ide><path>docs/userguide/storagedriver/zfs-driver.md
<ide> you should substitute your own values throughout the procedure.
<ide> 2. Install the `zfs` package.
<ide>
<ide> $ sudo apt-get install -y zfs
<add>
<ide> Reading package lists... Done
<ide> Building dependency tree
<ide> <output truncated>
<ide>
<ide> 3. Verify that the `zfs` module is loaded correctly.
<ide>
<ide> $ lsmod | grep zfs
<add>
<ide> zfs 2813952 3
<ide> zunicode 331776 1 zfs
<ide> zcommon 57344 1 zfs
<ide> you should substitute your own values throughout the procedure.
<ide> This is required for the `add-apt-repository` command.
<ide>
<ide> $ sudo apt-get install -y software-properties-common
<add>
<ide> Reading package lists... Done
<ide> Building dependency tree
<ide> <output truncated>
<ide>
<ide> 2. Add the `zfs-native` package archive.
<ide>
<ide> $ sudo add-apt-repository ppa:zfs-native/stable
<add>
<ide> The native ZFS filesystem for Linux. Install the ubuntu-zfs package.
<ide> <output truncated>
<ide> gpg: key F6B0FC61: public key "Launchpad PPA for Native ZFS for Linux" imported
<ide> you should substitute your own values throughout the procedure.
<ide> archives.
<ide>
<ide> $ sudo apt-get update
<add>
<ide> Ign http://us-west-2.ec2.archive.ubuntu.com trusty InRelease
<ide> Get:1 http://us-west-2.ec2.archive.ubuntu.com trusty-updates InRelease [64.4 kB]
<ide> <output truncated>
<ide> archives.
<ide> 4. Install the `ubuntu-zfs` package.
<ide>
<ide> $ sudo apt-get install -y ubuntu-zfs
<add>
<ide> Reading package lists... Done
<ide> Building dependency tree
<ide> <output truncated>
<ide> archives.
<ide> 6. Verify that it loaded correctly.
<ide>
<ide> $ lsmod | grep zfs
<add>
<ide> zfs 2768247 0
<ide> zunicode 331170 1 zfs
<ide> zcommon 55411 1 zfs
<ide> Once ZFS is installed and loaded, you're ready to configure ZFS for Docker.
<ide> 2. Check that the `zpool` exists.
<ide>
<ide> $ sudo zfs list
<add>
<ide> NAME USED AVAIL REFER MOUNTPOINT
<ide> zpool-docker 55K 3.84G 19K /zpool-docker
<ide>
<ide> Once ZFS is installed and loaded, you're ready to configure ZFS for Docker.
<ide> 4. Check that the previous step worked.
<ide>
<ide> $ sudo zfs list -t all
<add>
<ide> NAME USED AVAIL REFER MOUNTPOINT
<ide> zpool-docker 93.5K 3.84G 19K /zpool-docker
<ide> zpool-docker/docker 19K 3.84G 19K /var/lib/docker
<ide> Once ZFS is installed and loaded, you're ready to configure ZFS for Docker.
<ide> 5. Start the Docker daemon.
<ide>
<ide> $ sudo service docker start
<add>
<ide> docker start/running, process 2315
<ide>
<ide> The procedure for starting the Docker daemon may differ depending on the
<ide> Once ZFS is installed and loaded, you're ready to configure ZFS for Docker.
<ide> 6. Verify that the daemon is using the `zfs` storage driver.
<ide>
<ide> $ sudo docker info
<add>
<ide> Containers: 0
<ide> Images: 0
<ide> Storage Driver: zfs | 25 |
Go | Go | copy inslice() to those parts that use it | 5c154cfac89305f7ca9446854e56700e8a660f93 | <ide><path>daemon/caps/utils_unix.go
<ide> import (
<ide> "fmt"
<ide> "strings"
<ide>
<del> "github.com/docker/docker/pkg/stringutils"
<ide> "github.com/syndtr/gocapability/capability"
<ide> )
<ide>
<ide> func GetAllCapabilities() []string {
<ide> return output
<ide> }
<ide>
<add>// inSlice tests whether a string is contained in a slice of strings or not.
<add>// Comparison is case insensitive
<add>func inSlice(slice []string, s string) bool {
<add> for _, ss := range slice {
<add> if strings.ToLower(s) == strings.ToLower(ss) {
<add> return true
<add> }
<add> }
<add> return false
<add>}
<add>
<ide> // TweakCapabilities can tweak capabilities by adding or dropping capabilities
<ide> // based on the basics capabilities.
<ide> func TweakCapabilities(basics, adds, drops []string) ([]string, error) {
<ide> func TweakCapabilities(basics, adds, drops []string) ([]string, error) {
<ide> continue
<ide> }
<ide>
<del> if !stringutils.InSlice(allCaps, "CAP_"+cap) {
<add> if !inSlice(allCaps, "CAP_"+cap) {
<ide> return nil, fmt.Errorf("Unknown capability drop: %q", cap)
<ide> }
<ide> }
<ide>
<ide> // handle --cap-add=all
<del> if stringutils.InSlice(adds, "all") {
<add> if inSlice(adds, "all") {
<ide> basics = allCaps
<ide> }
<ide>
<del> if !stringutils.InSlice(drops, "all") {
<add> if !inSlice(drops, "all") {
<ide> for _, cap := range basics {
<ide> // skip `all` already handled above
<ide> if strings.ToLower(cap) == "all" {
<ide> continue
<ide> }
<ide>
<ide> // if we don't drop `all`, add back all the non-dropped caps
<del> if !stringutils.InSlice(drops, cap[4:]) {
<add> if !inSlice(drops, cap[4:]) {
<ide> newCaps = append(newCaps, strings.ToUpper(cap))
<ide> }
<ide> }
<ide> func TweakCapabilities(basics, adds, drops []string) ([]string, error) {
<ide>
<ide> cap = "CAP_" + cap
<ide>
<del> if !stringutils.InSlice(allCaps, cap) {
<add> if !inSlice(allCaps, cap) {
<ide> return nil, fmt.Errorf("Unknown capability to add: %q", cap)
<ide> }
<ide>
<ide> // add cap if not already in the list
<del> if !stringutils.InSlice(newCaps, cap) {
<add> if !inSlice(newCaps, cap) {
<ide> newCaps = append(newCaps, strings.ToUpper(cap))
<ide> }
<ide> }
<ide><path>daemon/oci_linux.go
<ide> import (
<ide> "github.com/docker/docker/oci"
<ide> "github.com/docker/docker/pkg/idtools"
<ide> "github.com/docker/docker/pkg/mount"
<del> "github.com/docker/docker/pkg/stringutils"
<ide> "github.com/docker/docker/volume"
<ide> "github.com/opencontainers/runc/libcontainer/apparmor"
<ide> "github.com/opencontainers/runc/libcontainer/cgroups"
<ide> var (
<ide> }
<ide> )
<ide>
<add>// inSlice tests whether a string is contained in a slice of strings or not.
<add>// Comparison is case sensitive
<add>func inSlice(slice []string, s string) bool {
<add> for _, ss := range slice {
<add> if s == ss {
<add> return true
<add> }
<add> }
<add> return false
<add>}
<add>
<ide> func setMounts(daemon *Daemon, s *specs.Spec, c *container.Container, mounts []container.Mount) error {
<ide> userMounts := make(map[string]struct{})
<ide> for _, m := range mounts {
<ide> func setMounts(daemon *Daemon, s *specs.Spec, c *container.Container, mounts []c
<ide> continue
<ide> }
<ide> if _, ok := userMounts[m.Destination]; !ok {
<del> if !stringutils.InSlice(m.Options, "ro") {
<add> if !inSlice(m.Options, "ro") {
<ide> s.Mounts[i].Options = append(s.Mounts[i].Options, "ro")
<ide> }
<ide> }
<ide><path>integration-cli/docker_api_inspect_test.go
<ide> import (
<ide> "github.com/docker/docker/api/types/versions/v1p20"
<ide> "github.com/docker/docker/client"
<ide> "github.com/docker/docker/integration-cli/checker"
<del> "github.com/docker/docker/pkg/stringutils"
<ide> "github.com/go-check/check"
<add> "github.com/stretchr/testify/assert"
<ide> )
<ide>
<ide> func (s *DockerSuite) TestInspectAPIContainerResponse(c *check.C) {
<ide> func (s *DockerSuite) TestInspectAPIImageResponse(c *check.C) {
<ide> c.Assert(err, checker.IsNil)
<ide>
<ide> c.Assert(imageJSON.RepoTags, checker.HasLen, 2)
<del> c.Assert(stringutils.InSlice(imageJSON.RepoTags, "busybox:latest"), checker.Equals, true)
<del> c.Assert(stringutils.InSlice(imageJSON.RepoTags, "busybox:mytag"), checker.Equals, true)
<add> assert.Contains(c, imageJSON.RepoTags, "busybox:latest")
<add> assert.Contains(c, imageJSON.RepoTags, "busybox:mytag")
<ide> }
<ide>
<ide> // #17131, #17139, #17173
<ide><path>integration-cli/docker_cli_by_digest_test.go
<ide> import (
<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"
<del> "github.com/docker/docker/pkg/stringutils"
<ide> "github.com/go-check/check"
<ide> "github.com/opencontainers/go-digest"
<add> "github.com/stretchr/testify/assert"
<ide> )
<ide>
<ide> var (
<ide> func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *check.C) {
<ide> c.Assert(err, checker.IsNil)
<ide> c.Assert(imageJSON, checker.HasLen, 1)
<ide> c.Assert(imageJSON[0].RepoDigests, checker.HasLen, 1)
<del> c.Assert(stringutils.InSlice(imageJSON[0].RepoDigests, imageReference), checker.Equals, true)
<add> assert.Contains(c, imageJSON[0].RepoDigests, imageReference)
<ide> }
<ide>
<ide> func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c *check.C) {
<ide><path>pkg/stringutils/stringutils.go
<ide> func Truncate(s string, maxlen int) string {
<ide> return string(r[:maxlen])
<ide> }
<ide>
<del>// InSlice tests whether a string is contained in a slice of strings or not.
<del>// Comparison is case insensitive
<del>func InSlice(slice []string, s string) bool {
<del> for _, ss := range slice {
<del> if strings.ToLower(s) == strings.ToLower(ss) {
<del> return true
<del> }
<del> }
<del> return false
<del>}
<del>
<ide> func quote(word string, buf *bytes.Buffer) {
<ide> // Bail out early for "simple" strings
<ide> if word != "" && !strings.ContainsAny(word, "\\'\"`${[|&;<>()~*?! \t\n") {
<ide><path>pkg/stringutils/stringutils_test.go
<ide> func TestTruncate(t *testing.T) {
<ide> }
<ide> }
<ide>
<del>func TestInSlice(t *testing.T) {
<del> slice := []string{"t🐳st", "in", "slice"}
<del>
<del> test := InSlice(slice, "t🐳st")
<del> if !test {
<del> t.Fatalf("Expected string t🐳st to be in slice")
<del> }
<del> test = InSlice(slice, "SLICE")
<del> if !test {
<del> t.Fatalf("Expected string SLICE to be in slice")
<del> }
<del> test = InSlice(slice, "notinslice")
<del> if test {
<del> t.Fatalf("Expected string notinslice not to be in slice")
<del> }
<del>}
<del>
<ide> func TestShellQuoteArgumentsEmpty(t *testing.T) {
<ide> actual := ShellQuoteArguments([]string{})
<ide> expected := ""
<ide><path>profiles/seccomp/seccomp.go
<ide> import (
<ide> "fmt"
<ide>
<ide> "github.com/docker/docker/api/types"
<del> "github.com/docker/docker/pkg/stringutils"
<ide> "github.com/opencontainers/runtime-spec/specs-go"
<ide> libseccomp "github.com/seccomp/libseccomp-golang"
<ide> )
<ide> var nativeToSeccomp = map[string]types.Arch{
<ide> "s390x": types.ArchS390X,
<ide> }
<ide>
<add>// inSlice tests whether a string is contained in a slice of strings or not.
<add>// Comparison is case sensitive
<add>func inSlice(slice []string, s string) bool {
<add> for _, ss := range slice {
<add> if s == ss {
<add> return true
<add> }
<add> }
<add> return false
<add>}
<add>
<ide> func setupSeccomp(config *types.Seccomp, rs *specs.Spec) (*specs.LinuxSeccomp, error) {
<ide> if config == nil {
<ide> return nil, nil
<ide> Loop:
<ide> // Loop through all syscall blocks and convert them to libcontainer format after filtering them
<ide> for _, call := range config.Syscalls {
<ide> if len(call.Excludes.Arches) > 0 {
<del> if stringutils.InSlice(call.Excludes.Arches, arch) {
<add> if inSlice(call.Excludes.Arches, arch) {
<ide> continue Loop
<ide> }
<ide> }
<ide> if len(call.Excludes.Caps) > 0 {
<ide> for _, c := range call.Excludes.Caps {
<del> if stringutils.InSlice(rs.Process.Capabilities.Effective, c) {
<add> if inSlice(rs.Process.Capabilities.Effective, c) {
<ide> continue Loop
<ide> }
<ide> }
<ide> }
<ide> if len(call.Includes.Arches) > 0 {
<del> if !stringutils.InSlice(call.Includes.Arches, arch) {
<add> if !inSlice(call.Includes.Arches, arch) {
<ide> continue Loop
<ide> }
<ide> }
<ide> if len(call.Includes.Caps) > 0 {
<ide> for _, c := range call.Includes.Caps {
<del> if !stringutils.InSlice(rs.Process.Capabilities.Effective, c) {
<add> if !inSlice(rs.Process.Capabilities.Effective, c) {
<ide> continue Loop
<ide> }
<ide> } | 7 |
Ruby | Ruby | remove unused variable | b9774a594339d5ac92503d91d180d88ec1faf436 | <ide><path>activerecord/test/cases/associations/has_many_associations_test.rb
<ide> def test_anonymous_has_many
<ide>
<ide> def test_has_many_build_with_options
<ide> college = College.create(name: 'UFMT')
<del> student = Student.create(active: true, college_id: college.id, name: 'Sarah')
<add> Student.create(active: true, college_id: college.id, name: 'Sarah')
<ide>
<ide> assert_equal college.students, Student.where(active: true, college_id: college.id)
<ide> end | 1 |
Javascript | Javascript | follow symbol naming convention | d30354859cb58a5ceaa77fd286a551b932236382 | <ide><path>lib/_http_client.js
<ide> const Agent = require('_http_agent');
<ide> const { Buffer } = require('buffer');
<ide> const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
<ide> const { URL, urlToOptions, searchParamsSymbol } = require('internal/url');
<del>const { outHeadersKey, ondrain } = require('internal/http');
<add>const { kOutHeaders, ondrain } = require('internal/http');
<ide> const { connResetException, codes } = require('internal/errors');
<ide> const {
<ide> ERR_HTTP_HEADERS_SENT,
<ide> function ClientRequest(input, options, cb) {
<ide> }
<ide>
<ide> this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
<del> this[outHeadersKey]);
<add> this[kOutHeaders]);
<ide> }
<ide> } else {
<ide> this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
<ide> ClientRequest.prototype._implicitHeader = function _implicitHeader() {
<ide> throw new ERR_HTTP_HEADERS_SENT('render');
<ide> }
<ide> this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n',
<del> this[outHeadersKey]);
<add> this[kOutHeaders]);
<ide> };
<ide>
<ide> ClientRequest.prototype.abort = function abort() {
<ide><path>lib/_http_outgoing.js
<ide> const { getDefaultHighWaterMark } = require('internal/streams/state');
<ide> const assert = require('internal/assert');
<ide> const Stream = require('stream');
<ide> const internalUtil = require('internal/util');
<del>const { outHeadersKey, utcDate } = require('internal/http');
<add>const { kOutHeaders, utcDate } = require('internal/http');
<ide> const { Buffer } = require('buffer');
<ide> const common = require('_http_common');
<ide> const checkIsHttpToken = common._checkIsHttpToken;
<ide> function OutgoingMessage() {
<ide> this.socket = null;
<ide> this.connection = null;
<ide> this._header = null;
<del> this[outHeadersKey] = null;
<add> this[kOutHeaders] = null;
<ide>
<ide> this._onPendingData = noopPendingOutput;
<ide> }
<ide> Object.defineProperty(OutgoingMessage.prototype, '_headers', {
<ide> }, 'OutgoingMessage.prototype._headers is deprecated', 'DEP0066'),
<ide> set: internalUtil.deprecate(function(val) {
<ide> if (val == null) {
<del> this[outHeadersKey] = null;
<add> this[kOutHeaders] = null;
<ide> } else if (typeof val === 'object') {
<del> const headers = this[outHeadersKey] = Object.create(null);
<add> const headers = this[kOutHeaders] = Object.create(null);
<ide> const keys = Object.keys(val);
<ide> for (var i = 0; i < keys.length; ++i) {
<ide> const name = keys[i];
<ide> Object.defineProperty(OutgoingMessage.prototype, '_headers', {
<ide>
<ide> Object.defineProperty(OutgoingMessage.prototype, '_headerNames', {
<ide> get: internalUtil.deprecate(function() {
<del> const headers = this[outHeadersKey];
<add> const headers = this[kOutHeaders];
<ide> if (headers !== null) {
<ide> const out = Object.create(null);
<ide> const keys = Object.keys(headers);
<ide> Object.defineProperty(OutgoingMessage.prototype, '_headerNames', {
<ide> }, 'OutgoingMessage.prototype._headerNames is deprecated', 'DEP0066'),
<ide> set: internalUtil.deprecate(function(val) {
<ide> if (typeof val === 'object' && val !== null) {
<del> const headers = this[outHeadersKey];
<add> const headers = this[kOutHeaders];
<ide> if (!headers)
<ide> return;
<ide> const keys = Object.keys(val);
<ide> OutgoingMessage.prototype._renderHeaders = function _renderHeaders() {
<ide> throw new ERR_HTTP_HEADERS_SENT('render');
<ide> }
<ide>
<del> const headersMap = this[outHeadersKey];
<add> const headersMap = this[kOutHeaders];
<ide> const headers = {};
<ide>
<ide> if (headersMap !== null) {
<ide> function _storeHeader(firstLine, headers) {
<ide> };
<ide>
<ide> if (headers) {
<del> if (headers === this[outHeadersKey]) {
<add> if (headers === this[kOutHeaders]) {
<ide> for (const key in headers) {
<ide> const entry = headers[key];
<ide> processHeader(this, state, entry[0], entry[1], false);
<ide> OutgoingMessage.prototype.setHeader = function setHeader(name, value) {
<ide> validateHeaderName(name);
<ide> validateHeaderValue(name, value);
<ide>
<del> let headers = this[outHeadersKey];
<add> let headers = this[kOutHeaders];
<ide> if (headers === null)
<del> this[outHeadersKey] = headers = Object.create(null);
<add> this[kOutHeaders] = headers = Object.create(null);
<ide>
<ide> headers[name.toLowerCase()] = [name, value];
<ide> };
<ide> OutgoingMessage.prototype.setHeader = function setHeader(name, value) {
<ide> OutgoingMessage.prototype.getHeader = function getHeader(name) {
<ide> validateString(name, 'name');
<ide>
<del> const headers = this[outHeadersKey];
<add> const headers = this[kOutHeaders];
<ide> if (headers === null)
<ide> return;
<ide>
<ide> OutgoingMessage.prototype.getHeader = function getHeader(name) {
<ide>
<ide> // Returns an array of the names of the current outgoing headers.
<ide> OutgoingMessage.prototype.getHeaderNames = function getHeaderNames() {
<del> return this[outHeadersKey] !== null ? Object.keys(this[outHeadersKey]) : [];
<add> return this[kOutHeaders] !== null ? Object.keys(this[kOutHeaders]) : [];
<ide> };
<ide>
<ide>
<ide> // Returns a shallow copy of the current outgoing headers.
<ide> OutgoingMessage.prototype.getHeaders = function getHeaders() {
<del> const headers = this[outHeadersKey];
<add> const headers = this[kOutHeaders];
<ide> const ret = Object.create(null);
<ide> if (headers) {
<ide> const keys = Object.keys(headers);
<ide> OutgoingMessage.prototype.getHeaders = function getHeaders() {
<ide>
<ide> OutgoingMessage.prototype.hasHeader = function hasHeader(name) {
<ide> validateString(name, 'name');
<del> return this[outHeadersKey] !== null &&
<del> !!this[outHeadersKey][name.toLowerCase()];
<add> return this[kOutHeaders] !== null &&
<add> !!this[kOutHeaders][name.toLowerCase()];
<ide> };
<ide>
<ide>
<ide> OutgoingMessage.prototype.removeHeader = function removeHeader(name) {
<ide> break;
<ide> }
<ide>
<del> if (this[outHeadersKey] !== null) {
<del> delete this[outHeadersKey][key];
<add> if (this[kOutHeaders] !== null) {
<add> delete this[kOutHeaders][key];
<ide> }
<ide> };
<ide>
<ide><path>lib/_http_server.js
<ide> const {
<ide> } = require('_http_common');
<ide> const { OutgoingMessage } = require('_http_outgoing');
<ide> const {
<del> outHeadersKey,
<add> kOutHeaders,
<ide> ondrain,
<ide> nowDate,
<ide> emitStatistics
<ide> function writeHead(statusCode, reason, obj) {
<ide> this.statusCode = statusCode;
<ide>
<ide> var headers;
<del> if (this[outHeadersKey]) {
<add> if (this[kOutHeaders]) {
<ide> // Slow-case: when progressive API and header fields are passed.
<ide> var k;
<ide> if (obj) {
<ide> function writeHead(statusCode, reason, obj) {
<ide> throw new ERR_HTTP_HEADERS_SENT('render');
<ide> }
<ide> // Only progressive api is used
<del> headers = this[outHeadersKey];
<add> headers = this[kOutHeaders];
<ide> } else {
<ide> // Only writeHead() called
<ide> headers = obj;
<ide><path>lib/internal/http.js
<ide> function emitStatistics(statistics) {
<ide> }
<ide>
<ide> module.exports = {
<del> outHeadersKey: Symbol('outHeadersKey'),
<add> kOutHeaders: Symbol('kOutHeaders'),
<ide> ondrain,
<ide> nowDate,
<ide> utcDate,
<ide><path>test/parallel/test-http-correct-hostname.js
<ide> const common = require('../common');
<ide> const assert = require('assert');
<ide>
<del>const { outHeadersKey } = require('internal/http');
<add>const { kOutHeaders } = require('internal/http');
<ide>
<ide> const http = require('http');
<ide> const modules = { http };
<ide> Object.keys(modules).forEach((module) => {
<ide> `${module}.request should not connect to ${module}://example.com%60x.example.com`
<ide> );
<ide> const req = modules[module].request(`${module}://example.com%60x.example.com`, doNotCall);
<del> assert.deepStrictEqual(req[outHeadersKey].host, [
<add> assert.deepStrictEqual(req[kOutHeaders].host, [
<ide> 'Host',
<ide> 'example.com`x.example.com',
<ide> ]);
<ide><path>test/parallel/test-http-outgoing-internal-headers.js
<ide> const common = require('../common');
<ide> const assert = require('assert');
<ide>
<del>const { outHeadersKey } = require('internal/http');
<add>const { kOutHeaders } = require('internal/http');
<ide> const { OutgoingMessage } = require('http');
<ide>
<ide> const warn = 'OutgoingMessage.prototype._headers is deprecated';
<ide> common.expectWarning('DeprecationWarning', warn, 'DEP0066');
<ide> };
<ide>
<ide> assert.deepStrictEqual(
<del> Object.entries(outgoingMessage[outHeadersKey]),
<add> Object.entries(outgoingMessage[kOutHeaders]),
<ide> Object.entries({
<ide> host: ['host', 'risingstack.com'],
<ide> origin: ['Origin', 'localhost']
<ide><path>test/parallel/test-http-outgoing-renderHeaders.js
<ide> const common = require('../common');
<ide> const assert = require('assert');
<ide>
<del>const outHeadersKey = require('internal/http').outHeadersKey;
<add>const kOutHeaders = require('internal/http').kOutHeaders;
<ide> const http = require('http');
<ide> const OutgoingMessage = http.OutgoingMessage;
<ide>
<ide> const OutgoingMessage = http.OutgoingMessage;
<ide>
<ide> {
<ide> const outgoingMessage = new OutgoingMessage();
<del> outgoingMessage[outHeadersKey] = null;
<add> outgoingMessage[kOutHeaders] = null;
<ide> const result = outgoingMessage._renderHeaders();
<ide> assert.deepStrictEqual(result, {});
<ide> }
<ide>
<ide>
<ide> {
<ide> const outgoingMessage = new OutgoingMessage();
<del> outgoingMessage[outHeadersKey] = {};
<add> outgoingMessage[kOutHeaders] = {};
<ide> const result = outgoingMessage._renderHeaders();
<ide> assert.deepStrictEqual(result, {});
<ide> }
<ide>
<ide> {
<ide> const outgoingMessage = new OutgoingMessage();
<del> outgoingMessage[outHeadersKey] = {
<add> outgoingMessage[kOutHeaders] = {
<ide> host: ['host', 'nodejs.org'],
<ide> origin: ['Origin', 'localhost']
<ide> }; | 7 |
Python | Python | change misleading description of m_mul | 634203bbdc1d9a2cf6fbdfdec6c78dbfcddd6b76 | <ide><path>keras/optimizer_v2/learning_rate_schedule.py
<ide> class CosineDecayRestarts(LearningRateSchedule):
<ide> The learning rate multiplier first decays
<ide> from 1 to `alpha` for `first_decay_steps` steps. Then, a warm
<ide> restart is performed. Each new warm restart runs for `t_mul` times more
<del> steps and with `m_mul` times smaller initial learning rate.
<add> steps and with `m_mul` times larger initial learning rate.
<ide>
<ide> Example usage:
<ide> ```python
<ide> def __init__(
<ide> first_decay_steps: A scalar `int32` or `int64` `Tensor` or a Python
<ide> number. Number of steps to decay over.
<ide> t_mul: A scalar `float32` or `float64` `Tensor` or a Python number.
<del> Used to derive the number of iterations in the i-th period
<add> Used to derive the number of iterations in the i-th period.
<ide> m_mul: A scalar `float32` or `float64` `Tensor` or a Python number.
<del> Used to derive the initial learning rate of the i-th period:
<add> Used to derive the initial learning rate of the i-th period.
<ide> alpha: A scalar `float32` or `float64` Tensor or a Python number.
<ide> Minimum learning rate value as a fraction of the initial_learning_rate.
<ide> name: String. Optional name of the operation. Defaults to 'SGDRDecay'. | 1 |
PHP | PHP | create authorizesresources trait | 80bb82a6398d51fe9b132ef450c268d78e95c165 | <ide><path>src/Illuminate/Foundation/Auth/Access/AuthorizesResources.php
<add><?php
<add>
<add>namespace Illuminate\Foundation\Auth\Access;
<add>
<add>use Illuminate\Routing\ControllerMiddlewareOptions;
<add>
<add>trait AuthorizesResources
<add>{
<add> /**
<add> * Authorize a resource action.
<add> *
<add> * @param string $name
<add> * @param string $model
<add> * @param array $options
<add> * @param \Illuminate\Http\Request|null $request
<add> * @return \Illuminate\Routing\ControllerMiddlewareOptions
<add> */
<add> public function authorizeResource($name, $model, array $options = [], $request = null)
<add> {
<add> $action = with($request ?: request())->route()->getActionName();
<add>
<add> $method = array_last(explode('@', $action));
<add>
<add> $map = [
<add> 'index' => 'view', 'create' => 'create', 'store' => 'create', 'show' => 'view',
<add> 'edit' => 'update', 'update' => 'update', 'delete' => 'delete',
<add> ];
<add>
<add> if (property_exists($this, 'abilityMap')) {
<add> $map = array_merge($map, $this->abilityMap);
<add> }
<add>
<add> if (! in_array($method, array_keys($map))) {
<add> return new ControllerMiddlewareOptions($options);
<add> }
<add>
<add> $model = in_array($method, ['index', 'create', 'store']) ? $model : $name;
<add>
<add> return $this->middleware("can:{$map[$method]},{$model}", $options);
<add> }
<add>} | 1 |
Ruby | Ruby | accept tap as a non-flagged argument | 0552dcff62f23017457ad4d1c76f7c8936d2a40a | <ide><path>Library/Homebrew/dev-cmd/extract.rb
<del>#: * `extract` [`--force`] <formula> `--tap=`<tap> [`--version=`<version>]:
<add>#: * `extract` [`--force`] <formula> <tap> [`--version=`<version>]:
<ide> #: Looks through repository history to find the <version> of <formula> and
<ide> #: creates a copy in <tap>/Formula/<formula>@<version>.rb. If the tap is
<ide> #: not installed yet, attempts to install/clone the tap before continuing.
<del>#: A tap must be passed through `--tap` in order for `extract` to work.
<ide> #:
<ide> #: If `--force` is passed, the file at the destination will be overwritten
<ide> #: if it already exists. Otherwise, existing files will be preserved. | 1 |
Python | Python | remove loss from some flax models docs & examples | 525dbbf84a0d2933686281c513689da9794b7dd1 | <ide><path>src/transformers/models/clip/modeling_flax_clip.py
<ide> pixel_values (`numpy.ndarray` of shape `(batch_size, num_channels, height, width)`):
<ide> Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
<ide> [`CLIPFeatureExtractor`]. See [`CLIPFeatureExtractor.__call__`] for details.
<del> return_loss (`bool`, *optional*):
<del> Whether or not to return the contrastive loss.
<ide> output_attentions (`bool`, *optional*):
<ide> Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
<ide> tensors for more detail.
<ide><path>src/transformers/models/vision_text_dual_encoder/modeling_flax_vision_text_dual_encoder.py
<ide> def from_vision_text_pretrained(
<ide> ... input_ids=inputs.input_ids,
<ide> ... attention_mask=inputs.attention_mask,
<ide> ... pixel_values=inputs.pixel_values,
<del> ... return_loss=True,
<ide> ... )
<del> >>> loss, logits_per_image = outputs.loss, outputs.logits_per_imag # this is the image-text similarity score
<add> >>> logits_per_image = outputs.logits_per_image # this is the image-text similarity score
<ide>
<ide> >>> # save and load from pretrained
<ide> >>> model.save_pretrained("vit-bert") | 2 |
Ruby | Ruby | remove reference to homebrew/homebrew | 732e0aa689b9a7f9a63c0a99472a9512a14ac291 | <ide><path>Library/Homebrew/formula.rb
<ide> def mirror(val)
<ide> #
<ide> # If you maintain your own repository, you can add your own bottle links.
<ide> # https://docs.brew.sh/Bottles.html
<del> # You can ignore this block entirely if submitting to Homebrew/Homebrew, It'll be
<del> # handled for you by the Brew Test Bot.
<add> # You can ignore this block entirely if submitting to Homebrew/homebrew-core.
<add> # It'll be handled for you by the Brew Test Bot.
<ide> #
<ide> # <pre>bottle do
<ide> # root_url "https://example.com" # Optional root to calculate bottle URLs | 1 |
Javascript | Javascript | remove extra server context argument | 7e8a020a4aa8a24e5f0c0ce06b25e485d2888f57 | <ide><path>packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js
<ide> function renderToPipeableStream(
<ide> model: ReactModel,
<ide> webpackMap: BundlerConfig,
<ide> options?: Options,
<del> context?: Array<[string, ServerContextJSONValue]>,
<ide> ): PipeableStream {
<ide> const request = createRequest(
<ide> model, | 1 |
Python | Python | update the docstring for keras.dtensor components | 275a0707c066bd90501e3fb3a0c26b1b676c06d3 | <ide><path>keras/dtensor/layout_map.py
<ide> def get_current_layout_map():
<ide>
<ide> @keras_export('keras.dtensor.experimental.LayoutMap', v1=[])
<ide> class LayoutMap(collections.abc.MutableMapping):
<add> """A dict-like object that maps string to `Layout` instances.
<ide>
<del> def __init__(self, mesh=None):
<del> """A dict like object that maps between string name and dtensor.Layout.
<add> `LayoutMap` uses a string as key and a `Layout` as value. There is a behavior
<add> difference between a normal Python dict and this class. The string key will be
<add> treated as a regex when retrieving the value. See the docstring of
<add> `get` for more details.
<ide>
<del> Note that this class might behave differently than a normal dict, eg, it
<del> will treat the all the existing keys as a regex to map against input key.
<add> See below for a usage example. You can define the naming schema
<add> of the `Layout`, and then retrieve the corresponding `Layout` instance.
<ide>
<del> Args:
<del> mesh: An optional dtensor.Mesh that is used to provide all replicated
<del> layout as default when there isn't a layout is found based on the
<del> mapping.
<del> """
<add> To use the `LayoutMap` with a `Model`, please see the docstring of
<add> `tf.keras.dtensor.experimental.layout_map_scope`.
<add>
<add> ```python
<add> map = LayoutMap(mesh=None)
<add> map['.*dense.*kernel'] = layout_2d
<add> map['.*dense.*bias'] = layout_1d
<add> map['.*conv2d.*kernel'] = layout_4d
<add> map['.*conv2d.*bias'] = layout_1d
<add>
<add> layout_1 = map['dense_1.kernel'] # layout_1 == layout_2d
<add> layout_2 = map['dense_1.bias'] # layout_2 == layout_1d
<add> layout_3 = map['dense_2.kernel'] # layout_3 == layout_2d
<add> layout_4 = map['dense_2.bias'] # layout_4 == layout_1d
<add> layout_5 = map['my_model/conv2d_123/kernel'] # layout_5 == layout_4d
<add> layout_6 = map['my_model/conv2d_123/bias'] # layout_6 == layout_1d
<add> ```
<add>
<add> Args:
<add> mesh: An optional `Mesh` that can be used to create all replicated
<add> layout as default when there isn't a layout found based on the input
<add> string query.
<add> """
<add>
<add> def __init__(self, mesh=None):
<ide> self._layout_map = collections.OrderedDict()
<ide> self._default_mesh = mesh
<ide>
<ide> def __iter__(self):
<ide> return iter(self._layout_map)
<ide>
<ide> def get_default_mesh(self):
<add> """Return the default `Mesh` set at instance creation.
<add>
<add> The `Mesh` can be used to create default replicated `Layout` when there
<add> isn't a match of the input string query.
<add> """
<ide> return self._default_mesh
<ide>
<ide>
<add>LayoutMap.get.__doc__ = LayoutMap.__getitem__.__doc__
<add>
<add>
<ide> @keras_export('keras.dtensor.experimental.layout_map_scope', v1=[])
<ide> @contextlib.contextmanager
<ide> def layout_map_scope(layout_map):
<ide><path>keras/dtensor/optimizers.py
<ide> import tensorflow.compat.v2 as tf
<ide>
<ide> from tensorflow.python.util.tf_export import keras_export # pylint: disable=g-direct-tensorflow-import
<add>from tensorflow.tools.docs import doc_controls
<ide>
<ide>
<ide> # pylint: disable=protected-access,missing-class-docstring
<ide> def add_variable_from_reference(self,
<ide> dtype=model_variable.dtype,
<ide> trainable=False)
<ide>
<add> @doc_controls.do_not_generate_docs
<ide> def aggregate_gradients(self, grads_and_vars):
<ide> # Hide the aggregate_gradients from Optimizer.aggregate_gradients
<ide> raise NotImplementedError( | 2 |
Ruby | Ruby | fix syntax warning | b38498d9dc72f3be61465d72f180e2c024832748 | <ide><path>Library/Homebrew/cmd/outdated.rb
<ide> def outdated_brews(formulae)
<ide> end
<ide> end
<ide>
<del> f.rack.subdirs.each do |dir|
<del> keg = Keg.new dir
<add> f.rack.subdirs.each do |keg_dir|
<add> keg = Keg.new keg_dir
<ide> version = keg.version
<ide> all_versions << version
<ide> older_version = f.pkg_version <= version | 1 |
Java | Java | use lambda expressions for lazy instantiation | f8340838b32ab4ae002dd720025073c16fa01c65 | <ide><path>spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/DefaultJCacheOperationSource.java
<ide> public void afterSingletonsInstantiated() {
<ide>
<ide> @Override
<ide> protected <T> T getBean(Class<T> type) {
<del> Assert.state(this.beanFactory != null, "BeanFactory required for resolution of [" + type + "]");
<add> Assert.state(this.beanFactory != null, () -> "BeanFactory required for resolution of [" + type + "]");
<ide> try {
<ide> return this.beanFactory.getBean(type);
<ide> }
<ide><path>spring-context/src/main/java/org/springframework/cache/support/NoOpCacheManager.java
<ide> public class NoOpCacheManager implements CacheManager {
<ide> public Cache getCache(String name) {
<ide> Cache cache = this.caches.get(name);
<ide> if (cache == null) {
<del> this.caches.putIfAbsent(name, new NoOpCache(name));
<add> this.caches.computeIfAbsent(name, key -> new NoOpCache(name));
<ide> synchronized (this.cacheNames) {
<ide> this.cacheNames.add(name);
<ide> }
<ide><path>spring-test/src/main/java/org/springframework/test/web/servlet/DefaultMvcResult.java
<ide> public Object getAsyncResult(long timeToWait) {
<ide> " was not set during the specified timeToWait=" + timeToWait);
<ide> }
<ide> Object result = this.asyncResult.get();
<del> Assert.state(result != RESULT_NONE, "Async result for handler [" + this.handler + "] was not set");
<add> Assert.state(result != RESULT_NONE, () -> "Async result for handler [" + this.handler + "] was not set");
<ide> return this.asyncResult.get();
<ide> }
<ide>
<ide><path>spring-web/src/main/java/org/springframework/web/server/ServerWebExchange.java
<ide> default <T> T getAttribute(String name) {
<ide> @SuppressWarnings("unchecked")
<ide> default <T> T getRequiredAttribute(String name) {
<ide> T value = getAttribute(name);
<del> Assert.notNull(value, "Required attribute '" + name + "' is missing.");
<add> Assert.notNull(value, () -> "Required attribute '" + name + "' is missing.");
<ide> return value;
<ide> }
<ide>
<ide><path>spring-web/src/main/java/org/springframework/web/server/WebSession.java
<ide> default <T> T getAttribute(String name) {
<ide> @SuppressWarnings("unchecked")
<ide> default <T> T getRequiredAttribute(String name) {
<ide> T value = getAttribute(name);
<del> Assert.notNull(value, "Required attribute '" + name + "' is missing.");
<add> Assert.notNull(value, () -> "Required attribute '" + name + "' is missing.");
<ide> return value;
<ide> }
<ide>
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFilterFunctions.java
<ide> private static ExchangeFilterFunction basicAuthenticationInternal(
<ide> return ExchangeFilterFunction.ofRequestProcessor(request ->
<ide> credentialsFunction.apply(request)
<ide> .map(credentials -> Mono.just(insertAuthorizationHeader(request, credentials)))
<del> .orElse(Mono.just(request)));
<add> .orElseGet(() -> Mono.just(request)));
<ide> }
<ide>
<ide> private static void checkIllegalCharacters(String username, String password) {
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelInitializer.java
<ide> private String getAttributeName(MethodParameter param) {
<ide> .ofNullable(AnnotatedElementUtils.findMergedAnnotation(param.getAnnotatedElement(), ModelAttribute.class))
<ide> .filter(ann -> StringUtils.hasText(ann.value()))
<ide> .map(ModelAttribute::value)
<del> .orElse(Conventions.getVariableNameForParameter(param));
<add> .orElseGet(() -> Conventions.getVariableNameForParameter(param));
<ide> }
<ide>
<ide> /** Find {@code @ModelAttribute} arguments also listed as {@code @SessionAttributes}. */
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/view/RedirectView.java
<ide> protected StringBuilder expandTargetUrlTemplate(String targetUrl,
<ide> while (found) {
<ide> String name = matcher.group(1);
<ide> Object value = (model.containsKey(name) ? model.get(name) : uriVariables.get(name));
<del> Assert.notNull(value, "No value for URI variable '" + name + "'");
<add> Assert.notNull(value, () -> "No value for URI variable '" + name + "'");
<ide> result.append(targetUrl.substring(endLastMatch, matcher.start()));
<ide> result.append(encodeUriVariable(value.toString()));
<ide> endLastMatch = matcher.end();
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java
<ide> private String getNameForReturnValue(MethodParameter returnType) {
<ide> return Optional.ofNullable(returnType.getMethodAnnotation(ModelAttribute.class))
<ide> .filter(ann -> StringUtils.hasText(ann.value()))
<ide> .map(ModelAttribute::value)
<del> .orElse(Conventions.getVariableNameForParameter(returnType));
<add> .orElseGet(() -> Conventions.getVariableNameForParameter(returnType));
<ide> }
<ide>
<ide> private void updateBindingContext(BindingContext context, ServerWebExchange exchange) {
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandler.java
<ide> public ResponseBodyEmitter handleValue(Object returnValue, MethodParameter retur
<ide>
<ide> Assert.notNull(returnValue, "Expected return value");
<ide> ReactiveAdapter adapter = this.reactiveRegistry.getAdapter(returnValue.getClass());
<del> Assert.state(adapter != null, "Unexpected return value: " + returnValue);
<add> Assert.state(adapter != null, () -> "Unexpected return value: " + returnValue);
<ide>
<ide> ResolvableType elementType = ResolvableType.forMethodParameter(returnType).getGeneric();
<ide> Class<?> elementClass = elementType.toClass();
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java
<ide> public BeanDefinition parse(Element element, ParserContext context) {
<ide> List<String> paths = Arrays.asList(StringUtils.tokenizeToStringArray(pathAttribute, ","));
<ide> for (String path : paths) {
<ide> path = path.trim();
<del> Assert.state(StringUtils.hasText(path), "Invalid <stomp-endpoint> path attribute: " + pathAttribute);
<add> Assert.state(StringUtils.hasText(path), () -> "Invalid <stomp-endpoint> path attribute: " + pathAttribute);
<ide> if (DomUtils.getChildElementByTagName(endpointElem, "sockjs") != null) {
<ide> path = path.endsWith("/") ? path + "**" : path + "/**";
<ide> } | 11 |
Python | Python | fix strings for python 3k | 9445a3d284c5cbc756fee1e6c313a114e937ddea | <ide><path>numpy/lib/tests/test_io.py
<ide> def test_structure_unpack(self):
<ide> assert_(a.dtype.str == '|S1')
<ide> assert_(b.dtype.str == '<i4')
<ide> assert_(c.dtype.str == '<f4')
<del> assert_array_equal(a, np.array(['M', 'F']))
<add> assert_array_equal(a, np.array([asbytes('M'), asbytes('F')]))
<ide> assert_array_equal(b, np.array([21, 35]))
<ide> assert_array_equal(c, np.array([ 72., 58.]))
<ide> | 1 |
PHP | PHP | remove useless property. | 30fd0cf229358d09b7029e3fe69abf58a6b02b7e | <ide><path>src/Illuminate/Console/Scheduling/CallbackEvent.php
<ide>
<ide> class CallbackEvent extends Event
<ide> {
<del> /**
<del> * The cache store implementation.
<del> *
<del> * @var \Illuminate\Contracts\Cache\Repository
<del> */
<del> protected $cache;
<del>
<ide> /**
<ide> * The callback to call.
<ide> * | 1 |
PHP | PHP | remove broken code | 970c9ed70b053aec7d69487a825577ed6f0329d1 | <ide><path>src/Illuminate/Auth/RequestGuard.php
<ide> public function validate(array $credentials = [])
<ide> */
<ide> public function setRequest(Request $request)
<ide> {
<del> if ($this->request !== $request) {
<del> $this->user = null;
<del> }
<del>
<ide> $this->request = $request;
<ide>
<ide> return $this; | 1 |
Ruby | Ruby | remove more on --force or --prune | e49a0434014464488de356550ffaa6028666faf5 | <ide><path>Library/Homebrew/cmd/cleanup.rb
<ide> def cleanup
<ide>
<ide> def cleanup_logs
<ide> return unless HOMEBREW_LOGS.directory?
<del> time = Time.now - 2 * 7 * 24 * 60 * 60 # two weeks
<add> prune = ARGV.value "prune"
<add> if prune
<add> time = Time.now - 60 * 60 * 24 * prune.to_i
<add> else
<add> time = Time.now - 60 * 60 * 24 * 7 * 2 # two weeks
<add> end
<ide> HOMEBREW_LOGS.subdirs.each do |dir|
<del> cleanup_path(dir) { dir.rmtree } if dir.mtime < time
<add> cleanup_path(dir) { dir.rmtree } if ARGV.force? || (dir.mtime < time)
<ide> end
<ide> end
<ide>
<ide> def cleanup_cache
<ide> return unless HOMEBREW_CACHE.directory?
<ide> prune = ARGV.value "prune"
<ide> time = Time.now - 60 * 60 * 24 * prune.to_i
<del> HOMEBREW_CACHE.children.select(&:file?).each do |file|
<del> next cleanup_path(file) { file.unlink } if prune && file.mtime < time
<add> HOMEBREW_CACHE.children.each do |path|
<add> if ARGV.force? || (prune && path.mtime < time)
<add> if path.file?
<add> cleanup_path(path) { path.unlink }
<add> elsif path.directory? && path.to_s.include?("--")
<add> cleanup_path(path) { path.rmdir }
<add> end
<add> next
<add> end
<add>
<add> next unless path.file?
<add> file = path
<ide>
<ide> if Pathname::BOTTLE_EXTNAME_RX === file.to_s
<ide> version = bottle_resolve_version(file) rescue file.version | 1 |
Javascript | Javascript | add comments and clean up a bit | 9a7a6b93bdc7bf8e037d5ec71a6d4b40519dc0f1 | <ide><path>lib/optimize/CommonsChunkPlugin.js
<ide> The available options are:
<ide> };
<ide> }
<ide>
<del> getCommonChunks(allChunks, compilation) {
<del> const asyncOrNoSelectedChunk = this.selectedChunks === false || this.async;
<add> getCommonChunks(allChunks, compilation, chunkNames, selectedChunks, async) {
<add> const asyncOrNoSelectedChunk = selectedChunks === false || async;
<ide>
<ide> // we have specified chunk names
<del> if(this.chunkNames) {
<add> if(chunkNames) {
<ide> // map chunks by chunkName for quick access
<ide> const optimizedChunkMap = allChunks.reduce((map, chunk) => {
<ide> map.set(chunk.name, chunk);
<ide> The available options are:
<ide>
<ide> // Ensure we have a chunk per specified chunk name.
<ide> // Reuse existing chunks if possible
<del> return this.chunkNames.map(chunkName => {
<add> return chunkNames.map(chunkName => {
<ide> if(optimizedChunkMap.has(chunkName)) {
<ide> return optimizedChunkMap.get(chunkName);
<ide> }
<ide> The available options are:
<ide> return;
<ide> }
<ide>
<add> // what is this?
<ide> return allChunks.filter((chunk) => {
<ide> const found = commonChunks.indexOf(chunk);
<ide> if(found >= currentIndex) return false;
<ide> The available options are:
<ide> }
<ide> }
<ide>
<del> connectUsedChunkAndCommonChunk(usedChunks, commonChunk) {
<add> addCommonChunkAsParentOfAffectedChunks(usedChunks, commonChunk) {
<ide> for(let chunk of usedChunks) {
<ide> // set commonChunk as new sole parent
<ide> chunk.parents = [commonChunk];
<ide> The available options are:
<ide> if(compilation[ident]) return;
<ide> compilation[ident] = true;
<ide>
<del> const commonChunks = this.getCommonChunks(chunks, compilation);
<add> /**
<add> * Creates a list of common chunks based on the options.
<add> * The list is made up of preexisting or newly created chunks.
<add> * - If chunk has the name as specified in the chunkNames it is put in the list
<add> * - If no chunk with the name as given in chunkNames exists a new chunk is created and added to the list
<add> */
<add> const commonChunks = this.getCommonChunks(chunks, compilation, this.chunkNames, this.selectedChunks, this.async);
<ide>
<add> // iterate over all our new chunks
<ide> commonChunks.forEach((commonChunk, idx) => {
<add> // get chunks that are actually used
<add> // TODO: clarify what that means
<ide> const usedChunks = this.getUsedChunks(compilation, chunks, commonChunk, commonChunks, idx, this.selectedChunks, this.async);
<add>
<ide> // bail as this is an erronous state
<ide> if(!usedChunks) {
<ide> return;
<ide> }
<ide>
<add> // If we are async create an async chunk now
<add> // override the "commonChunk" with the newly created async one and use it as commonChunk from now on
<ide> let asyncChunk;
<ide> if(asyncOption) {
<ide> asyncChunk = this.createAsyncChunk(compilation, this.async, commonChunk);
<ide> commonChunk.addChunk(asyncChunk);
<ide> commonChunk = asyncChunk;
<ide> }
<add>
<add> // get all modules that suffice the filter e.g. are used at least in "n" chunks
<add> // TODO: what does "really used modules mean here"?
<ide> const reallyUsedModules = this.getReallyUsedModules(minChunks, usedChunks, commonChunk);
<ide>
<del> // check if the extracted modules would be big enough to be extraced
<add> // If the minSize option is set check if the size extracted from the chunk is reached
<add> // else bail out here.
<add> // As all modules/commons are interlinked with each other, common modules would be extracted
<add> // if we reach this mark at a later common chunk. (quirky I guess).
<ide> if(minSize) {
<ide> const modulesSize = this.getModulesSize(reallyUsedModules);
<ide> // if too small, bail
<ide> if(modulesSize < minSize)
<ide> return;
<ide> }
<ide>
<add> // Remove modules that are moved to commons chunk from their original chunks
<add> // return all chunks that are affected by having modules removed - we need them later (apparently)
<ide> const reallyUsedChunks = this.removeModulesFromUsedChunksAndReturnUsedChunks(reallyUsedModules, usedChunks);
<ide>
<add> // connect all extracted modules with the common chunk
<ide> this.connectModulesWithCommonChunk(commonChunk, reallyUsedModules);
<ide>
<ide> // set filenameTemplate for chunk
<ide> if(filenameTemplate)
<ide> commonChunk.filenameTemplate = filenameTemplate;
<ide>
<add> // if we are async connect the blocks of the "reallyUsedChunk" - the ones that had modules removed -
<add> // with the commonChunk and get the origins for the asyncChunk (remember "asyncChunk === commonChunk" at this moment).
<add> // bail out
<ide> if(asyncOption) {
<ide> this.connectChunkBlocksWithCommonChunk(reallyUsedChunks, commonChunk);
<ide> asyncChunk.origins = this.getAsyncChunkOrigin(reallyUsedChunks);
<ide> return;
<ide> }
<ide>
<del> this.connectUsedChunkAndCommonChunk(usedChunks, commonChunk);
<add> // we are not in "async" mode
<add> // connect used chunks with commonChunk - shouldnt this be reallyUsedChunks here?
<add> this.addCommonChunkAsParentOfAffectedChunks(usedChunks, commonChunk);
<ide> });
<ide> return true;
<ide> }); | 1 |
Javascript | Javascript | add createtypes function | 4ef15109cd495561b5fbd4b151666ed64b5b615e | <ide><path>common/app/redux/types.js
<del>const types = [
<add>import createTypes from '../utils/create-types';
<add>
<add>export default createTypes([
<ide> 'updateTitle',
<ide>
<ide> 'fetchUser',
<ide> const types = [
<ide> 'handleError',
<ide> // used to hit the server
<ide> 'hardGoTo'
<del>];
<del>
<del>export default types
<del> // make into object with signature { type: nameSpace[type] };
<del> .reduce((types, type) => ({ ...types, [type]: `app.${type}` }), {});
<add>], 'app');
<ide><path>common/app/routes/Hikes/redux/types.js
<del>const types = [
<add>import createTypes from '../../../utils/create-types';
<add>
<add>export default createTypes([
<ide> 'fetchHikes',
<ide> 'fetchHikesCompleted',
<ide> 'resetHike',
<ide> const types = [
<ide>
<ide> 'hikeCompleted',
<ide> 'goToNextHike'
<del>];
<del>
<del>export default types.reduce((types, type) => {
<del> types[type] = `videos.${type}`;
<del> return types;
<del>}, {});
<add>], 'videos');
<ide><path>common/app/routes/Jobs/redux/types.js
<del>const types = [
<add>import createTypes from '../../../utils/create-types';
<add>
<add>export default createTypes([
<ide> 'fetchJobs',
<ide> 'fetchJobsCompleted',
<ide>
<ide> const types = [
<ide> 'updatePromo',
<ide> 'applyPromo',
<ide> 'applyPromoCompleted'
<del>];
<del>
<del>export default types.reduce((types, type) => {
<del> types[type] = `jobs.${type}`;
<del> return types;
<del>}, {});
<add>], 'jobs');
<ide><path>common/app/utils/create-types.js
<add>// createTypes(types: String[], prefix: String) => Object
<add>export default function createTypes(types = [], prefix = '') {
<add> if (!Array.isArray(types) || typeof prefix !== 'string') {
<add> return {};
<add> }
<add> return types.reduce((types, type) => {
<add> types[type] = prefix + '.' + type;
<add> return types;
<add> }, {});
<add>} | 4 |
Javascript | Javascript | use expectserror in test-debug-agent.js | ca37ec084a59ab20ab19882b77033bebf85ae555 | <ide><path>test/parallel/test-debug-agent.js
<ide> 'use strict';
<del>require('../common');
<add>const common = require('../common');
<ide> const assert = require('assert');
<ide> const debug = require('_debug_agent');
<ide>
<ide> assert.throws(
<ide> () => { debug.start(); },
<del> function(err) {
<del> return (err instanceof assert.AssertionError &&
<del> err.message === 'Debugger agent running without bindings!');
<del> }
<add> common.expectsError(
<add> undefined,
<add> assert.AssertionError,
<add> 'Debugger agent running without bindings!'
<add> )
<ide> ); | 1 |
Javascript | Javascript | use extra duration precision for rounding | 902b3db221b92909d2ab24d2edf7ef1bdab15911 | <ide><path>src/lib/duration/create.js
<ide> import { Duration, isDuration } from './constructor';
<ide> import toInt from '../utils/to-int';
<add>import absRound from '../utils/abs-round';
<ide> import hasOwnProp from '../utils/has-own-prop';
<ide> import { DATE, HOUR, MINUTE, SECOND, MILLISECOND } from '../units/constants';
<ide> import { cloneWithOffset } from '../units/offset';
<ide> export function createDuration (input, key) {
<ide> sign = (match[1] === '-') ? -1 : 1;
<ide> duration = {
<ide> y : 0,
<del> d : toInt(match[DATE]) * sign,
<del> h : toInt(match[HOUR]) * sign,
<del> m : toInt(match[MINUTE]) * sign,
<del> s : toInt(match[SECOND]) * sign,
<del> ms : toInt(match[MILLISECOND] * 1000) * sign // the millisecond decimal point is included in the match
<add> d : toInt(match[DATE]) * sign,
<add> h : toInt(match[HOUR]) * sign,
<add> m : toInt(match[MINUTE]) * sign,
<add> s : toInt(match[SECOND]) * sign,
<add> ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
<ide> };
<ide> } else if (!!(match = isoRegex.exec(input))) {
<ide> sign = (match[1] === '-') ? -1 : 1;
<ide><path>src/test/moment/duration.js
<ide> test('instatiation from serialized C# TimeSpan with days', function (assert) {
<ide> assert.equal(moment.duration('1.02:03:04.9999999').days(), 1, '1 day');
<ide> assert.equal(moment.duration('1.02:03:04.9999999').hours(), 2, '2 hours');
<ide> assert.equal(moment.duration('1.02:03:04.9999999').minutes(), 3, '3 minutes');
<del> assert.equal(moment.duration('1.02:03:04.9999999').seconds(), 4, '4 seconds');
<del> assert.equal(moment.duration('1.02:03:04.9999999').milliseconds(), 999, '999 milliseconds');
<add> assert.equal(moment.duration('1.02:03:04.9999999').seconds(), 5, '5 seconds');
<add> assert.equal(moment.duration('1.02:03:04.9999999').milliseconds(), 0, '0 milliseconds');
<ide>
<ide> assert.equal(moment.duration('1 02:03:04.9999999').years(), 0, '0 years');
<ide> assert.equal(moment.duration('1 02:03:04.9999999').days(), 1, '1 day');
<ide> assert.equal(moment.duration('1 02:03:04.9999999').hours(), 2, '2 hours');
<ide> assert.equal(moment.duration('1 02:03:04.9999999').minutes(), 3, '3 minutes');
<del> assert.equal(moment.duration('1 02:03:04.9999999').seconds(), 4, '4 seconds');
<del> assert.equal(moment.duration('1 02:03:04.9999999').milliseconds(), 999, '999 milliseconds');
<add> assert.equal(moment.duration('1 02:03:04.9999999').seconds(), 5, '5 seconds');
<add> assert.equal(moment.duration('1 02:03:04.9999999').milliseconds(), 0, '0 milliseconds');
<ide> });
<ide>
<ide> test('instatiation from serialized C# TimeSpan without days', function (assert) {
<ide> assert.equal(moment.duration('01:02:03.9999999').years(), 0, '0 years');
<ide> assert.equal(moment.duration('01:02:03.9999999').days(), 0, '0 days');
<ide> assert.equal(moment.duration('01:02:03.9999999').hours(), 1, '1 hour');
<ide> assert.equal(moment.duration('01:02:03.9999999').minutes(), 2, '2 minutes');
<del> assert.equal(moment.duration('01:02:03.9999999').seconds(), 3, '3 seconds');
<del> assert.equal(moment.duration('01:02:03.9999999').milliseconds(), 999, '999 milliseconds');
<add> assert.equal(moment.duration('01:02:03.9999999').seconds(), 4, '4 seconds');
<add> assert.equal(moment.duration('01:02:03.9999999').milliseconds(), 0, '0 milliseconds');
<ide>
<del> assert.equal(moment.duration('23:59:59.9999999').days(), 0, '0 days');
<del> assert.equal(moment.duration('23:59:59.9999999').hours(), 23, '23 hours');
<add> assert.equal(moment.duration('23:59:59.9999999').days(), 1, '1 days');
<add> assert.equal(moment.duration('23:59:59.9999999').hours(), 0, '0 hours');
<add> assert.equal(moment.duration('23:59:59.9999999').minutes(), 0, '0 minutes');
<add> assert.equal(moment.duration('23:59:59.9999999').seconds(), 0, '0 seconds');
<add> assert.equal(moment.duration('23:59:59.9999999').milliseconds(), 0, '0 milliseconds');
<ide>
<del> assert.equal(moment.duration('500:59:59.9999999').days(), 20, '500 hours overflows to 20 days');
<del> assert.equal(moment.duration('500:59:59.9999999').hours(), 20, '500 hours overflows to 20 hours');
<add> assert.equal(moment.duration('500:59:59.8888888').days(), 20, '500 hours overflows to 20 days');
<add> assert.equal(moment.duration('500:59:59.8888888').hours(), 20, '500 hours overflows to 20 hours');
<ide> });
<ide>
<ide> test('instatiation from serialized C# TimeSpan without days or milliseconds', function (assert) {
<ide> test('instantiation from serialized C# TimeSpan with low millisecond precision',
<ide> assert.equal(moment.duration('00:00:15.').milliseconds(), 0, '0 milliseconds');
<ide> });
<ide>
<add>test('instantiation from serialized C# TimeSpan with high millisecond precision', function (assert) {
<add> assert.equal(moment.duration('00:00:15.7200000').seconds(), 15, '15 seconds');
<add> assert.equal(moment.duration('00:00:15.7200000').milliseconds(), 720, '720 milliseconds');
<add>
<add> assert.equal(moment.duration('00:00:15.7209999').seconds(), 15, '15 seconds');
<add> assert.equal(moment.duration('00:00:15.7209999').milliseconds(), 721, '721 milliseconds');
<add>
<add> assert.equal(moment.duration('00:00:15.7205000').seconds(), 15, '15 seconds');
<add> assert.equal(moment.duration('00:00:15.7205000').milliseconds(), 721, '721 milliseconds');
<add>
<add> assert.equal(moment.duration('-00:00:15.7205000').seconds(), -15, '15 seconds');
<add> assert.equal(moment.duration('-00:00:15.7205000').milliseconds(), -721, '721 milliseconds');
<add>});
<add>
<ide> test('instatiation from serialized C# TimeSpan maxValue', function (assert) {
<ide> var d = moment.duration('10675199.02:48:05.4775807');
<ide>
<ide> test('instatiation from serialized C# TimeSpan maxValue', function (assert) {
<ide> assert.equal(d.hours(), 2, '2 hours');
<ide> assert.equal(d.minutes(), 48, '48 minutes');
<ide> assert.equal(d.seconds(), 5, '5 seconds');
<del> assert.equal(d.milliseconds(), 477, '477 milliseconds');
<add> assert.equal(d.milliseconds(), 478, '478 milliseconds');
<ide> });
<ide>
<ide> test('instatiation from serialized C# TimeSpan minValue', function (assert) {
<ide> test('instatiation from serialized C# TimeSpan minValue', function (assert) {
<ide> assert.equal(d.hours(), -2, '2 hours');
<ide> assert.equal(d.minutes(), -48, '48 minutes');
<ide> assert.equal(d.seconds(), -5, '5 seconds');
<del> assert.equal(d.milliseconds(), -477, '477 milliseconds');
<add> assert.equal(d.milliseconds(), -478, '478 milliseconds');
<ide> });
<ide>
<ide> test('instantiation from ISO 8601 duration', function (assert) { | 2 |
Text | Text | clarify our stance on mixing backbone & redux | dcb43261f3a4a20621f807fc370303084cc12e37 | <ide><path>docs/recipes/MigratingToRedux.md
<ide> Your process will look like this:
<ide>
<ide> ## From Backbone
<ide>
<del>Backbone's model layer is way too different compared with Redux one, so one possible option is to rewrite your app's model layer from scratch.
<del>Or you can use [backbone-redux](https://github.com/redbooth/backbone-redux) that will help you with migrating and/or using Backbone and Redux together.
<add>Backbone’s model layer is quite different from Redux, so we don’t suggest to mix them. If possible, it is best that you rewrite your app’s model layer from scratch instead of connecting Backbone to Redux. However, if a rewrite is not feasible, you may use [backbone-redux](https://github.com/redbooth/backbone-redux) to migrate gradually, and keep the Redux store in sync with Backbone models and collections. | 1 |
Ruby | Ruby | remove depreciated assertion to eliminate warning | 65d592842af7bc28f7d11f286a941ae59ad1abb5 | <ide><path>activesupport/test/hash_with_indifferent_access_test.rb
<ide> def test_default_proc
<ide> def test_double_conversion_with_nil_key
<ide> h = { nil => "defined" }.with_indifferent_access.with_indifferent_access
<ide>
<del> assert_equal nil, h[:undefined_key]
<add> assert_nil h[:undefined_key]
<ide> end
<ide>
<ide> def test_assorted_keys_not_stringified | 1 |
Python | Python | update documentation on decoder sequence indexing. | eee1a0ed2293be17bfe671a698d60da399317ba3 | <ide><path>examples/lstm_seq2seq.py
<ide> for t, char in enumerate(input_text):
<ide> encoder_input_data[i, t, input_token_index[char]] = 1.
<ide> for t, char in enumerate(target_text):
<del> # decoder_target_data is ahead of decoder_target_data by one timestep
<add> # decoder_target_data is ahead of decoder_input_data by one timestep
<ide> decoder_input_data[i, t, target_token_index[char]] = 1.
<ide> if t > 0:
<ide> # decoder_target_data will be ahead by one timestep | 1 |
Java | Java | add possible matches for field access | 2ab34373d17c251b0ee89d4fa4537998164413c6 | <ide><path>spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java
<ide> protected DirectFieldAccessor newNestedPropertyAccessor(Object object, String ne
<ide>
<ide> @Override
<ide> protected NotWritablePropertyException createNotWritablePropertyException(String propertyName) {
<add> PropertyMatches matches = PropertyMatches.forField(propertyName, getRootClass());
<ide> throw new NotWritablePropertyException(
<del> getRootClass(), getNestedPath() + propertyName, "Field does not exist",
<del> new String[0]);
<add> getRootClass(), getNestedPath() + propertyName,
<add> matches.buildErrorMessage(), matches.getPossibleMatches());
<ide> }
<ide>
<ide>
<ide><path>spring-beans/src/main/java/org/springframework/beans/PropertyMatches.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> package org.springframework.beans;
<ide>
<ide> import java.beans.PropertyDescriptor;
<add>import java.lang.reflect.Field;
<ide> import java.util.ArrayList;
<ide> import java.util.Collections;
<ide> import java.util.List;
<ide>
<ide> import org.springframework.util.ObjectUtils;
<add>import org.springframework.util.ReflectionUtils;
<ide> import org.springframework.util.StringUtils;
<ide>
<ide> /**
<ide> * @author Alef Arendsen
<ide> * @author Arjen Poutsma
<ide> * @author Juergen Hoeller
<add> * @author Stephane Nicoll
<ide> * @since 2.0
<ide> * @see #forProperty(String, Class)
<ide> */
<del>final class PropertyMatches {
<add>abstract class PropertyMatches {
<ide>
<ide> //---------------------------------------------------------------------
<ide> // Static section
<ide> public static PropertyMatches forProperty(String propertyName, Class<?> beanClas
<ide> * @param maxDistance the maximum property distance allowed for matches
<ide> */
<ide> public static PropertyMatches forProperty(String propertyName, Class<?> beanClass, int maxDistance) {
<del> return new PropertyMatches(propertyName, beanClass, maxDistance);
<add> return new BeanPropertyMatches(propertyName, beanClass, maxDistance);
<add> }
<add>
<add> /**
<add> * Create PropertyMatches for the given field property.
<add> * @param propertyName the name of the field to find possible matches for
<add> * @param beanClass the bean class to search for matches
<add> */
<add> public static PropertyMatches forField(String propertyName, Class<?> beanClass) {
<add> return forField(propertyName, beanClass, DEFAULT_MAX_DISTANCE);
<add> }
<add>
<add> /**
<add> * Create PropertyMatches for the given field property.
<add> * @param propertyName the name of the field to find possible matches for
<add> * @param beanClass the bean class to search for matches
<add> * @param maxDistance the maximum property distance allowed for matches
<add> */
<add> public static PropertyMatches forField(String propertyName, Class<?> beanClass, int maxDistance) {
<add> return new FieldPropertyMatches(propertyName, beanClass, maxDistance);
<ide> }
<ide>
<ide>
<ide> public static PropertyMatches forProperty(String propertyName, Class<?> beanClas
<ide>
<ide>
<ide> /**
<del> * Create a new PropertyMatches instance for the given property.
<add> * Create a new PropertyMatches instance for the given property and possible matches.
<ide> */
<del> private PropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) {
<add> private PropertyMatches(String propertyName, String[] possibleMatches) {
<ide> this.propertyName = propertyName;
<del> this.possibleMatches = calculateMatches(BeanUtils.getPropertyDescriptors(beanClass), maxDistance);
<add> this.possibleMatches = possibleMatches;
<ide> }
<ide>
<add> /**
<add> * Return the name of the requested property.
<add> */
<add> public String getPropertyName() {
<add> return propertyName;
<add> }
<ide>
<ide> /**
<ide> * Return the calculated possible matches.
<ide> public String[] getPossibleMatches() {
<ide> * Build an error message for the given invalid property name,
<ide> * indicating the possible property matches.
<ide> */
<del> public String buildErrorMessage() {
<del> StringBuilder msg = new StringBuilder();
<del> msg.append("Bean property '");
<del> msg.append(this.propertyName);
<del> msg.append("' is not writable or has an invalid setter method. ");
<del>
<del> if (ObjectUtils.isEmpty(this.possibleMatches)) {
<del> msg.append("Does the parameter type of the setter match the return type of the getter?");
<del> }
<del> else {
<del> msg.append("Did you mean ");
<del> for (int i = 0; i < this.possibleMatches.length; i++) {
<del> msg.append('\'');
<del> msg.append(this.possibleMatches[i]);
<del> if (i < this.possibleMatches.length - 2) {
<del> msg.append("', ");
<del> }
<del> else if (i == this.possibleMatches.length - 2){
<del> msg.append("', or ");
<del> }
<del> }
<del> msg.append("'?");
<del> }
<del> return msg.toString();
<del> }
<del>
<del>
<del> /**
<del> * Generate possible property alternatives for the given property and
<del> * class. Internally uses the {@code getStringDistance} method, which
<del> * in turn uses the Levenshtein algorithm to determine the distance between
<del> * two Strings.
<del> * @param propertyDescriptors the JavaBeans property descriptors to search
<del> * @param maxDistance the maximum distance to accept
<del> */
<del> private String[] calculateMatches(PropertyDescriptor[] propertyDescriptors, int maxDistance) {
<del> List<String> candidates = new ArrayList<String>();
<del> for (PropertyDescriptor pd : propertyDescriptors) {
<del> if (pd.getWriteMethod() != null) {
<del> String possibleAlternative = pd.getName();
<del> if (calculateStringDistance(this.propertyName, possibleAlternative) <= maxDistance) {
<del> candidates.add(possibleAlternative);
<del> }
<del> }
<del> }
<del> Collections.sort(candidates);
<del> return StringUtils.toStringArray(candidates);
<del> }
<add> public abstract String buildErrorMessage();
<ide>
<ide> /**
<ide> * Calculate the distance between the given two Strings
<ide> private String[] calculateMatches(PropertyDescriptor[] propertyDescriptors, int
<ide> * @param s2 the second String
<ide> * @return the distance value
<ide> */
<del> private int calculateStringDistance(String s1, String s2) {
<add> private static int calculateStringDistance(String s1, String s2) {
<ide> if (s1.length() == 0) {
<ide> return s2.length();
<ide> }
<ide> private int calculateStringDistance(String s1, String s2) {
<ide> return d[s1.length()][s2.length()];
<ide> }
<ide>
<add> private static class BeanPropertyMatches extends PropertyMatches {
<add>
<add> private BeanPropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) {
<add> super(propertyName, calculateMatches(propertyName,
<add> BeanUtils.getPropertyDescriptors(beanClass), maxDistance));
<add> }
<add>
<add> /**
<add> * Generate possible property alternatives for the given property and
<add> * class. Internally uses the {@code getStringDistance} method, which
<add> * in turn uses the Levenshtein algorithm to determine the distance between
<add> * two Strings.
<add> * @param propertyDescriptors the JavaBeans property descriptors to search
<add> * @param maxDistance the maximum distance to accept
<add> */
<add> private static String[] calculateMatches(String propertyName, PropertyDescriptor[] propertyDescriptors, int maxDistance) {
<add> List<String> candidates = new ArrayList<String>();
<add> for (PropertyDescriptor pd : propertyDescriptors) {
<add> if (pd.getWriteMethod() != null) {
<add> String possibleAlternative = pd.getName();
<add> if (calculateStringDistance(propertyName, possibleAlternative) <= maxDistance) {
<add> candidates.add(possibleAlternative);
<add> }
<add> }
<add> }
<add> Collections.sort(candidates);
<add> return StringUtils.toStringArray(candidates);
<add> }
<add>
<add>
<add> @Override
<add> public String buildErrorMessage() {
<add> String propertyName = getPropertyName();
<add> String[] possibleMatches = getPossibleMatches();
<add> StringBuilder msg = new StringBuilder();
<add> msg.append("Bean property '");
<add> msg.append(propertyName);
<add> msg.append("' is not writable or has an invalid setter method. ");
<add>
<add> if (ObjectUtils.isEmpty(possibleMatches)) {
<add> msg.append("Does the parameter type of the setter match the return type of the getter?");
<add> }
<add> else {
<add> msg.append("Did you mean ");
<add> for (int i = 0; i < possibleMatches.length; i++) {
<add> msg.append('\'');
<add> msg.append(possibleMatches[i]);
<add> if (i < possibleMatches.length - 2) {
<add> msg.append("', ");
<add> }
<add> else if (i == possibleMatches.length - 2) {
<add> msg.append("', or ");
<add> }
<add> }
<add> msg.append("'?");
<add> }
<add> return msg.toString();
<add> }
<add>
<add> }
<add>
<add> private static class FieldPropertyMatches extends PropertyMatches {
<add>
<add> private FieldPropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) {
<add> super(propertyName, calculateMatches(propertyName, beanClass, maxDistance));
<add> }
<add>
<add> private static String[] calculateMatches(final String propertyName, Class<?> beanClass, final int maxDistance) {
<add> final List<String> candidates = new ArrayList<String>();
<add> ReflectionUtils.doWithFields(beanClass, new ReflectionUtils.FieldCallback() {
<add> @Override
<add> public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
<add> String possibleAlternative = field.getName();
<add> if (calculateStringDistance(propertyName, possibleAlternative) <= maxDistance) {
<add> candidates.add(possibleAlternative);
<add> }
<add> }
<add> });
<add> Collections.sort(candidates);
<add> return StringUtils.toStringArray(candidates);
<add> }
<add>
<add>
<add> @Override
<add> public String buildErrorMessage() {
<add> String propertyName = getPropertyName();
<add> String[] possibleMatches = getPossibleMatches();
<add> StringBuilder msg = new StringBuilder();
<add> msg.append("Bean property '");
<add> msg.append(propertyName);
<add> msg.append("' has no matching field. ");
<add>
<add> if (!ObjectUtils.isEmpty(possibleMatches)) {
<add> msg.append("Did you mean ");
<add> for (int i = 0; i < possibleMatches.length; i++) {
<add> msg.append('\'');
<add> msg.append(possibleMatches[i]);
<add> if (i < possibleMatches.length - 2) {
<add> msg.append("', ");
<add> }
<add> else if (i == possibleMatches.length - 2) {
<add> msg.append("', or ");
<add> }
<add> }
<add> msg.append("'?");
<add> }
<add> return msg.toString();
<add> }
<add>
<add> }
<add>
<ide> }
<ide><path>spring-beans/src/test/java/org/springframework/beans/AbstractConfigurablePropertyAccessorTests.java
<ide> public void setUnknownProperty() {
<ide> Simple target = new Simple("John", 2);
<ide> AbstractPropertyAccessor accessor = createAccessor(target);
<ide>
<add> try {
<add> accessor.setPropertyValue("name1", "value");
<add> fail("Should have failed to set an unknown property.");
<add> }
<add> catch (NotWritablePropertyException e) {
<add> assertEquals(Simple.class, e.getBeanClass());
<add> assertEquals("name1", e.getPropertyName());
<add> assertEquals("Invalid number of possible matches", 1, e.getPossibleMatches().length);
<add> assertEquals("name", e.getPossibleMatches()[0]);
<add> }
<add> }
<add>
<add> @Test
<add> public void setUnknownPropertyWithPossibleMatches() {
<add> Simple target = new Simple("John", 2);
<add> AbstractPropertyAccessor accessor = createAccessor(target);
<add>
<ide> try {
<ide> accessor.setPropertyValue("foo", "value");
<ide> fail("Should have failed to set an unknown property.");
<ide><path>spring-beans/src/test/java/org/springframework/beans/PropertyMatchesTests.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.beans;
<add>
<add>import org.junit.Test;
<add>
<add>import static org.hamcrest.Matchers.*;
<add>import static org.junit.Assert.*;
<add>
<add>/**
<add> * Tests for {@link PropertyMatches}.
<add> *
<add> * @author Stephane Nicoll
<add> */
<add>public class PropertyMatchesTests {
<add>
<add> @Test
<add> public void simpleBeanPropertyTypo() {
<add> PropertyMatches matches = PropertyMatches.forProperty("naem", SampleBeanProperties.class);
<add> assertThat(matches.getPossibleMatches(), hasItemInArray("name"));
<add> }
<add>
<add> @Test
<add> public void complexBeanPropertyTypo() {
<add> PropertyMatches matches = PropertyMatches.forProperty("desriptn", SampleBeanProperties.class);
<add> assertThat(matches.getPossibleMatches(), emptyArray());
<add> }
<add>
<add> @Test
<add> public void unknownBeanProperty() {
<add> PropertyMatches matches = PropertyMatches.forProperty("unknown", SampleBeanProperties.class);
<add> assertThat(matches.getPossibleMatches(), emptyArray());
<add> }
<add>
<add> @Test
<add> public void severalMatchesBeanProperty() {
<add> PropertyMatches matches = PropertyMatches.forProperty("counter", SampleBeanProperties.class);
<add> assertThat(matches.getPossibleMatches(), hasItemInArray("counter1"));
<add> assertThat(matches.getPossibleMatches(), hasItemInArray("counter2"));
<add> assertThat(matches.getPossibleMatches(), hasItemInArray("counter3"));
<add> }
<add>
<add> @Test
<add> public void simpleBeanPropertyErrorMessage() {
<add> PropertyMatches matches = PropertyMatches.forProperty("naem", SampleBeanProperties.class);
<add> String msg = matches.buildErrorMessage();
<add> assertThat(msg, containsString("naem"));
<add> assertThat(msg, containsString("name"));
<add> assertThat(msg, containsString("setter"));
<add> assertThat(msg, not(containsString("field")));
<add> }
<add>
<add> @Test
<add> public void complexBeanPropertyErrorMessage() {
<add> PropertyMatches matches = PropertyMatches.forProperty("counter", SampleBeanProperties.class);
<add> String msg = matches.buildErrorMessage();
<add> assertThat(msg, containsString("counter"));
<add> assertThat(msg, containsString("counter1"));
<add> assertThat(msg, containsString("counter2"));
<add> assertThat(msg, containsString("counter3"));
<add> }
<add>
<add> @Test
<add> public void simpleFieldPropertyTypo() {
<add> PropertyMatches matches = PropertyMatches.forField("naem", SampleFieldProperties.class);
<add> assertThat(matches.getPossibleMatches(), hasItemInArray("name"));
<add> }
<add>
<add> @Test
<add> public void complexFieldPropertyTypo() {
<add> PropertyMatches matches = PropertyMatches.forField("desriptn", SampleFieldProperties.class);
<add> assertThat(matches.getPossibleMatches(), emptyArray());
<add> }
<add>
<add> @Test
<add> public void unknownFieldProperty() {
<add> PropertyMatches matches = PropertyMatches.forField("unknown", SampleFieldProperties.class);
<add> assertThat(matches.getPossibleMatches(), emptyArray());
<add> }
<add>
<add> @Test
<add> public void severalMatchesFieldProperty() {
<add> PropertyMatches matches = PropertyMatches.forField("counter", SampleFieldProperties.class);
<add> assertThat(matches.getPossibleMatches(), hasItemInArray("counter1"));
<add> assertThat(matches.getPossibleMatches(), hasItemInArray("counter2"));
<add> assertThat(matches.getPossibleMatches(), hasItemInArray("counter3"));
<add> }
<add>
<add> @Test
<add> public void simpleFieldPropertyErrorMessage() {
<add> PropertyMatches matches = PropertyMatches.forField("naem", SampleFieldProperties.class);
<add> String msg = matches.buildErrorMessage();
<add> assertThat(msg, containsString("naem"));
<add> assertThat(msg, containsString("name"));
<add> assertThat(msg, containsString("field"));
<add> assertThat(msg, not(containsString("setter")));
<add> }
<add>
<add> @Test
<add> public void complexFieldPropertyErrorMessage() {
<add> PropertyMatches matches = PropertyMatches.forField("counter", SampleFieldProperties.class);
<add> String msg = matches.buildErrorMessage();
<add> assertThat(msg, containsString("counter"));
<add> assertThat(msg, containsString("counter1"));
<add> assertThat(msg, containsString("counter2"));
<add> assertThat(msg, containsString("counter3"));
<add> }
<add>
<add>
<add> private static class SampleBeanProperties {
<add>
<add> private String name;
<add>
<add> private String description;
<add>
<add> private int counter1;
<add>
<add> private int counter2;
<add>
<add> private int counter3;
<add>
<add> public String getName() {
<add> return name;
<add> }
<add>
<add> public void setName(String name) {
<add> this.name = name;
<add> }
<add>
<add> public String getDescription() {
<add> return description;
<add> }
<add>
<add> public void setDescription(String description) {
<add> this.description = description;
<add> }
<add>
<add> public int getCounter1() {
<add> return counter1;
<add> }
<add>
<add> public void setCounter1(int counter1) {
<add> this.counter1 = counter1;
<add> }
<add>
<add> public int getCounter2() {
<add> return counter2;
<add> }
<add>
<add> public void setCounter2(int counter2) {
<add> this.counter2 = counter2;
<add> }
<add>
<add> public int getCounter3() {
<add> return counter3;
<add> }
<add>
<add> public void setCounter3(int counter3) {
<add> this.counter3 = counter3;
<add> }
<add> }
<add>
<add>
<add> private static class SampleFieldProperties {
<add>
<add> private String name;
<add>
<add> private String description;
<add>
<add> private int counter1;
<add>
<add> private int counter2;
<add>
<add> private int counter3;
<add>
<add> }
<add>
<add>} | 4 |
Python | Python | set many explicitly from mixins. refs #564 | 55fd64663167ce4447565ecba7170f8eccc1fdf0 | <ide><path>rest_framework/generics.py
<ide> class Meta:
<ide> return serializer_class
<ide>
<ide> def get_serializer(self, instance=None, data=None,
<del> files=None, partial=False):
<add> files=None, partial=False, many=False):
<ide> """
<ide> Return the serializer instance that should be used for validating and
<ide> deserializing input, and for serializing output.
<ide> """
<ide> serializer_class = self.get_serializer_class()
<ide> context = self.get_serializer_context()
<ide> return serializer_class(instance, data=data, files=files,
<del> partial=partial, context=context)
<add> many=many, partial=partial, context=context)
<ide>
<ide>
<ide> class MultipleObjectAPIView(MultipleObjectMixin, GenericAPIView):
<ide><path>rest_framework/mixins.py
<ide> def list(self, request, *args, **kwargs):
<ide> paginator, page, queryset, is_paginated = packed
<ide> serializer = self.get_pagination_serializer(page)
<ide> else:
<del> serializer = self.get_serializer(self.object_list)
<add> serializer = self.get_serializer(self.object_list, many=True)
<ide>
<ide> return Response(serializer.data)
<ide> | 2 |
PHP | PHP | change htmlentities to urlencode for link | 8eae68bde0ed5ba98d291d5afabc4e79abbbd9af | <ide><path>laravel/html.php
<ide> public static function decode($value)
<ide> */
<ide> public static function script($url, $attributes = array())
<ide> {
<del> $url = static::entities(URL::to_asset($url));
<add> $url = urlencode(URL::to_asset($url));
<ide>
<ide> return '<script src="'.$url.'"'.static::attributes($attributes).'></script>'.PHP_EOL;
<ide> }
<ide> public static function style($url, $attributes = array())
<ide>
<ide> $attributes = $attributes + $defaults;
<ide>
<del> $url = static::entities(URL::to_asset($url));
<add> $url = urlencode(URL::to_asset($url));
<ide>
<ide> return '<link href="'.$url.'"'.static::attributes($attributes).'>'.PHP_EOL;
<ide> }
<ide> public static function span($value, $attributes = array())
<ide> */
<ide> public static function link($url, $title, $attributes = array(), $https = false)
<ide> {
<del> $url = static::entities(URL::to($url, $https));
<add> $url = urlencode(URL::to($url, $https));
<ide>
<ide> return '<a href="'.$url.'"'.static::attributes($attributes).'>'.static::entities($title).'</a>';
<ide> }
<ide> public static function link_to_secure($url, $title, $attributes = array())
<ide> */
<ide> public static function link_to_asset($url, $title, $attributes = array(), $https = null)
<ide> {
<del> $url = static::entities(URL::to_asset($url, $https));
<add> $url = urlencode(URL::to_asset($url, $https));
<ide>
<ide> return '<a href="'.$url.'"'.static::attributes($attributes).'>'.static::entities($title).'</a>';
<ide> }
<ide> public static function image($url, $alt = '', $attributes = array())
<ide> {
<ide> $attributes['alt'] = $alt;
<ide>
<del> return '<img src="'.static::entities(URL::to_asset($url)).'"'.static::attributes($attributes).'>';
<add> return '<img src="'.urlencode(URL::to_asset($url)).'"'.static::attributes($attributes).'>';
<ide> }
<ide>
<ide> /** | 1 |
Python | Python | fix broken sla mechanism | 604a37eee50715db345c5a7afed085c9afe8530d | <ide><path>airflow/jobs/scheduler_job.py
<ide> def manage_slas(self, dag: DAG, session: Session = None) -> None:
<ide> We are assuming that the scheduler runs often, so we only check for
<ide> tasks that should have succeeded in the past hour.
<ide> """
<add> self.log.info("Running SLA Checks for %s", dag.dag_id)
<ide> if not any(isinstance(ti.sla, timedelta) for ti in dag.tasks):
<ide> self.log.info("Skipping SLA check for %s because no tasks in DAG have SLAs", dag)
<ide> return
<ide> def execute_callbacks(
<ide> :param session: DB session.
<ide> """
<ide> for request in callback_requests:
<add> self.log.debug("Processing Callback Request: %s", request)
<ide> try:
<ide> if isinstance(request, TaskCallbackRequest):
<ide> self._execute_task_callbacks(dagbag, request)
<ide><path>airflow/serialization/serialized_objects.py
<ide> def deserialize_operator(cls, encoded_op: Dict[str, Any]) -> BaseOperator:
<ide> v = set(v)
<ide> elif k == "subdag":
<ide> v = SerializedDAG.deserialize_dag(v)
<del> elif k in {"retry_delay", "execution_timeout"}:
<add> elif k in {"retry_delay", "execution_timeout", "sla"}:
<ide> v = cls._deserialize_timedelta(v)
<ide> elif k in encoded_op["template_fields"]:
<ide> pass
<ide><path>tests/jobs/test_scheduler_job.py
<ide> def test_send_sla_callbacks_to_processor_sla_with_task_slas(self):
<ide> dag = DAG(dag_id=dag_id, start_date=DEFAULT_DATE, schedule_interval='@daily')
<ide> DummyOperator(task_id='task1', dag=dag, sla=timedelta(seconds=60))
<ide>
<add> # Used Serialized DAG as Serialized DAG is used in Scheduler
<add> dag = SerializedDAG.from_json(SerializedDAG.to_json(dag))
<add>
<ide> with patch.object(settings, "CHECK_SLAS", True):
<ide> scheduler_job = SchedulerJob(subdir=os.devnull)
<ide> mock_agent = mock.MagicMock()
<ide><path>tests/serialization/test_dag_serialization.py
<ide> "depends_on_past": False,
<ide> "retries": 1,
<ide> "retry_delay": {"__type": "timedelta", "__var": 300.0},
<add> "sla": {"__type": "timedelta", "__var": 100.0},
<ide> },
<ide> },
<ide> "start_date": 1564617600.0,
<ide> "owner": "airflow",
<ide> "retries": 1,
<ide> "retry_delay": 300.0,
<add> "sla": 100.0,
<ide> "_downstream_task_ids": [],
<ide> "_inlets": [],
<ide> "_is_dummy": False,
<ide> "task_id": "custom_task",
<ide> "retries": 1,
<ide> "retry_delay": 300.0,
<add> "sla": 100.0,
<ide> "_downstream_task_ids": [],
<ide> "_inlets": [],
<ide> "_is_dummy": False,
<ide> def make_simple_dag():
<ide> "retries": 1,
<ide> "retry_delay": timedelta(minutes=5),
<ide> "depends_on_past": False,
<add> "sla": timedelta(seconds=100),
<ide> },
<ide> start_date=datetime(2019, 8, 1),
<ide> is_paused_upon_creation=False, | 4 |
Text | Text | add gpg fingerprint for cjihrig | a3c1b9720e517038ea7bf08fd658c07f0de74c33 | <ide><path>README.md
<ide> information about the governance of the io.js project, see
<ide> * **Jeremiah Senkpiel** <fishrock123@rocketmail.com> ([@fishrock123](https://github.com/fishrock123))
<ide> - Release GPG key: FD3A5288F042B6850C66B31F09FE44734EB7990E
<ide> * **Colin Ihrig** <cjihrig@gmail.com> ([@cjihrig](https://github.com/cjihrig))
<add> - Release GPG key: 94AE36675C464D64BAFA68DD7434390BDBE9B9C5
<ide> * **Alexis Campailla** <orangemocha@nodejs.org> ([@orangemocha](https://github.com/orangemocha))
<ide> * **Julien Gilli** <jgilli@nodejs.org> ([@misterdjules](https://github.com/misterdjules))
<ide> * **James M Snell** <jasnell@gmail.com> ([@jasnell](https://github.com/jasnell)) | 1 |
Javascript | Javascript | use relative imports in ember-debug | 890db01442b8a1f7753947399d13e3a7fe0933d0 | <ide><path>packages/ember-debug/lib/deprecate.js
<ide> import Logger from 'ember-console';
<ide>
<ide> import { ENV } from 'ember-environment';
<ide>
<del>import { registerHandler as genericRegisterHandler, invoke } from 'ember-debug/handlers';
<add>import { registerHandler as genericRegisterHandler, invoke } from './handlers';
<ide>
<ide> export function registerHandler(handler) {
<ide> genericRegisterHandler('deprecate', handler);
<ide><path>packages/ember-debug/lib/index.js
<ide> import Logger from 'ember-console';
<ide> import { environment } from 'ember-environment';
<ide> import _deprecate, {
<ide> registerHandler as registerDeprecationHandler
<del>} from 'ember-debug/deprecate';
<add>} from './deprecate';
<ide> import _warn, {
<ide> registerHandler as registerWarnHandler
<del>} from 'ember-debug/warn';
<add>} from './warn';
<ide>
<ide> /**
<ide> @module ember
<ide><path>packages/ember-debug/lib/warn.js
<ide> import Logger from 'ember-console';
<ide> import { deprecate } from 'ember-metal/debug';
<del>import { registerHandler as genericRegisterHandler, invoke } from 'ember-debug/handlers';
<add>import { registerHandler as genericRegisterHandler, invoke } from './handlers';
<ide>
<ide> export function registerHandler(handler) {
<ide> genericRegisterHandler('warn', handler); | 3 |
PHP | PHP | add negative asserts | d3de877a0b40be49c2d5dcc55192caab8ee9c7a0 | <ide><path>tests/Fixture/AssertHtmlTestCase.php
<ide> use Cake\TestSuite\TestCase;
<ide>
<ide> /**
<del> * This class helps in indirectly testing the functionalities of CakeTestCase::assertHtml
<add> * This class helps in indirectly testing the functionalities of TestCase::assertHtml
<ide> *
<ide> */
<ide> class AssertHtmlTestCase extends TestCase {
<ide><path>tests/Fixture/AssertIntegrationTestCase.php
<add><?php
<add>namespace Cake\Test\Fixture;
<add>
<add>use Cake\Network\Response;
<add>use Cake\TestSuite\IntegrationTestCase;
<add>
<add>/**
<add> * This class helps in indirectly testing the functionalities of IntegrationTestCase
<add> *
<add> */
<add>class AssertIntegrationTestCase extends IntegrationTestCase {
<add>
<add>/**
<add> * testBadAssertNoRedirect
<add> *
<add> * @return void
<add> */
<add> public function testBadAssertNoRedirect() {
<add> $this->_response = new Response();
<add> $this->_response->header('Location', 'http://localhost/tasks/index');
<add>
<add> $this->assertNoRedirect();
<add> }
<add>
<add>}
<ide><path>tests/TestCase/TestSuite/IntegrationTestCaseTest.php
<ide> use Cake\Routing\DispatcherFactory;
<ide> use Cake\Routing\Router;
<ide> use Cake\TestSuite\IntegrationTestCase;
<add>use Cake\Test\Fixture\AssertIntegrationTestCase;
<ide>
<ide> /**
<ide> * Self test of the IntegrationTestCase
<ide> public function testAssertNoRedirect() {
<ide> $this->assertNoRedirect();
<ide> }
<ide>
<add>/**
<add> * Test the location header assertion.
<add> *
<add> * @return void
<add> */
<add> public function testAssertNoRedirectFail() {
<add> $test = new AssertIntegrationTestCase('testBadAssertNoRedirect');
<add> $result = $test->run();
<add> ob_start();
<add> $this->assertFalse($result->wasSuccessful());
<add> $this->assertEquals(1, $result->failureCount());
<add> }
<add>
<ide> /**
<ide> * Test the header assertion.
<ide> * | 3 |
Javascript | Javascript | fix failing ember.checkbox test on jquery master | 3b8987626fc2516dc324a8ccb5fc8a6013bac2dc | <ide><path>packages/ember-handlebars/tests/controls/checkbox_test.js
<del>var get = Ember.get, set = Ember.set, checkboxView, dispatcher;
<add>var get = Ember.get, set = Ember.set,
<add> isInternetExplorer = window.navigator.userAgent.match(/msie/i),
<add> checkboxView, dispatcher;
<ide>
<ide> module("Ember.Checkbox", {
<ide> setup: function() {
<ide> test("checking the checkbox updates the value", function() {
<ide>
<ide> // Can't find a way to programatically trigger a checkbox in IE and have it generate the
<ide> // same events as if a user actually clicks.
<del> if (!Ember.$.browser.msie) {
<add> if (!isInternetExplorer) {
<ide> checkboxView.$()[0].click();
<ide> } else {
<ide> checkboxView.$().trigger('click'); | 1 |
Ruby | Ruby | add more documentation | f5cc07dfea3ebc965287ceda828c63f2811fe062 | <ide><path>Library/Homebrew/cleaner.rb
<ide> # * removes .la files
<ide> # * removes empty directories
<ide> # * sets permissions on executables
<add># * removes unresolved symlinks
<ide> class Cleaner
<ide>
<ide> # Create a cleaner for the given formula
<ide> def clean
<ide>
<ide> private
<ide>
<add> # Removes any empty directories in the formula's prefix subtree
<add> # Keeps any empty directions projected by skip_clean
<ide> def prune
<ide> dirs = []
<ide> symlinks = []
<ide> def prune
<ide> end
<ide> end
<ide>
<add> # Remove directories opposite from traversal, so that a subtree with no
<add> # actual files gets removed correctly.
<ide> dirs.reverse_each do |d|
<ide> if d.children.empty?
<ide> puts "rmdir: #{d} (empty)" if ARGV.verbose?
<ide> d.rmdir
<ide> end
<ide> end
<ide>
<add> # Remove unresolved symlinks
<ide> symlinks.reverse_each do |s|
<ide> s.unlink unless s.resolved_path_exists?
<ide> end | 1 |
Javascript | Javascript | avoid additional validation for buffers | 0a937280d8353b86051b02206811974a658a47d5 | <ide><path>benchmark/streams/writable-manywrites.js
<add>'use strict';
<add>
<add>const common = require('../common');
<add>const Writable = require('stream').Writable;
<add>
<add>const bench = common.createBenchmark(main, {
<add> n: [2e6]
<add>});
<add>
<add>function main(conf) {
<add> const n = +conf.n;
<add> const b = Buffer.allocUnsafe(1024);
<add> const s = new Writable();
<add> s._write = function(chunk, encoding, cb) {
<add> cb();
<add> };
<add>
<add> bench.start();
<add> for (var k = 0; k < n; ++k) {
<add> s.write(b);
<add> }
<add> bench.end(n);
<add>}
<ide><path>lib/_stream_writable.js
<ide> function writeAfterEnd(stream, cb) {
<ide> process.nextTick(cb, er);
<ide> }
<ide>
<del>// If we get something that is not a buffer, string, null, or undefined,
<del>// and we're not in objectMode, then that's an error.
<del>// Otherwise stream chunks are all considered to be of length=1, and the
<del>// watermarks determine how many objects to keep in the buffer, rather than
<del>// how many bytes or characters.
<add>// Checks that a user-supplied chunk is valid, especially for the particular
<add>// mode the stream is in. Currently this means that `null` is never accepted
<add>// and undefined/non-string values are only allowed in object mode.
<ide> function validChunk(stream, state, chunk, cb) {
<ide> var valid = true;
<ide> var er = false;
<del> // Always throw error if a null is written
<del> // if we are not in object mode then throw
<del> // if it is not a buffer, string, or undefined.
<add>
<ide> if (chunk === null) {
<ide> er = new TypeError('May not write null values to stream');
<del> } else if (!(chunk instanceof Buffer) &&
<del> typeof chunk !== 'string' &&
<del> chunk !== undefined &&
<del> !state.objectMode) {
<add> } else if (typeof chunk !== 'string' &&
<add> chunk !== undefined &&
<add> !state.objectMode) {
<ide> er = new TypeError('Invalid non-string/buffer chunk');
<ide> }
<ide> if (er) {
<ide> function validChunk(stream, state, chunk, cb) {
<ide> Writable.prototype.write = function(chunk, encoding, cb) {
<ide> var state = this._writableState;
<ide> var ret = false;
<add> var isBuf = (chunk instanceof Buffer);
<ide>
<ide> if (typeof encoding === 'function') {
<ide> cb = encoding;
<ide> encoding = null;
<ide> }
<ide>
<del> if (chunk instanceof Buffer)
<add> if (isBuf)
<ide> encoding = 'buffer';
<ide> else if (!encoding)
<ide> encoding = state.defaultEncoding;
<ide> Writable.prototype.write = function(chunk, encoding, cb) {
<ide>
<ide> if (state.ended)
<ide> writeAfterEnd(this, cb);
<del> else if (validChunk(this, state, chunk, cb)) {
<add> else if (isBuf || validChunk(this, state, chunk, cb)) {
<ide> state.pendingcb++;
<del> ret = writeOrBuffer(this, state, chunk, encoding, cb);
<add> ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
<ide> }
<ide>
<ide> return ret;
<ide> function decodeChunk(state, chunk, encoding) {
<ide> // if we're already writing something, then just put this
<ide> // in the queue, and wait our turn. Otherwise, call _write
<ide> // If we return false, then we need a drain event, so set that flag.
<del>function writeOrBuffer(stream, state, chunk, encoding, cb) {
<del> chunk = decodeChunk(state, chunk, encoding);
<del>
<del> if (chunk instanceof Buffer)
<del> encoding = 'buffer';
<add>function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
<add> if (!isBuf) {
<add> chunk = decodeChunk(state, chunk, encoding);
<add> if (chunk instanceof Buffer)
<add> encoding = 'buffer';
<add> }
<ide> var len = state.objectMode ? 1 : chunk.length;
<ide>
<ide> state.length += len; | 2 |
PHP | PHP | remove a cast | f3389fe52661420f316ede0777fd07144db93b76 | <ide><path>src/Routing/Route/Route.php
<ide> protected function normalizeAndValidateMethods($methods)
<ide> {
<ide> $methods = is_array($methods)
<ide> ? array_map('strtoupper', $methods)
<del> : strtoupper($methods);
<add> : [strtoupper($methods)];
<ide>
<del> $diff = array_diff((array)$methods, static::VALID_METHODS);
<add> $diff = array_diff($methods, static::VALID_METHODS);
<ide> if ($diff !== []) {
<ide> throw new InvalidArgumentException(
<ide> sprintf('Invalid HTTP method received. `%s` is invalid.', implode(', ', $diff)) | 1 |
Javascript | Javascript | add displayname to reacttransitiongroup + friends | 734a34525779a349b25b2b7072f2a99f223c8308 | <ide><path>src/addons/transitions/ReactCSSTransitionGroup.js
<ide> var ReactTransitionGroup = require('ReactTransitionGroup');
<ide> var ReactCSSTransitionGroupChild = require('ReactCSSTransitionGroupChild');
<ide>
<ide> var ReactCSSTransitionGroup = React.createClass({
<add> displayName: 'ReactCSSTransitionGroup',
<add>
<ide> propTypes: {
<ide> transitionName: React.PropTypes.string.isRequired,
<ide> transitionEnter: React.PropTypes.bool,
<ide><path>src/addons/transitions/ReactCSSTransitionGroupChild.js
<ide> if (__DEV__) {
<ide> }
<ide>
<ide> var ReactCSSTransitionGroupChild = React.createClass({
<add> displayName: 'ReactCSSTransitionGroupChild',
<add>
<ide> transition: function(animationType, finishCallback) {
<ide> var node = this.getDOMNode();
<ide> var className = this.props.name + '-' + animationType;
<ide><path>src/addons/transitions/ReactTransitionGroup.js
<ide> var emptyFunction = require('emptyFunction');
<ide> var merge = require('merge');
<ide>
<ide> var ReactTransitionGroup = React.createClass({
<add> displayName: 'ReactTransitionGroup',
<ide>
<ide> propTypes: {
<ide> component: React.PropTypes.func, | 3 |
Ruby | Ruby | change merge to merge! | bd674fd4e58387c331a7608bbfd48a690471c556 | <ide><path>activesupport/lib/active_support/callbacks.rb
<ide> def initialize(name, config)
<ide> @config = {
<ide> :terminator => "false",
<ide> :scope => [ :kind ]
<del> }.merge(config)
<add> }.merge!(config)
<ide> end
<ide>
<ide> def compile
<ide><path>activesupport/lib/active_support/hash_with_indifferent_access.rb
<ide> def self.new_from_hash_copying_default(hash)
<ide> end
<ide>
<ide> def self.[](*args)
<del> new.merge(Hash[*args])
<add> new.merge!(Hash[*args])
<ide> end
<ide>
<ide> alias_method :regular_writer, :[]= unless method_defined?(:regular_writer) | 2 |
Text | Text | update description of stern-brocot challenge | a5840f57a4225212d773e481d5440dd535362cb4 | <ide><path>curriculum/challenges/english/10-coding-interview-prep/rosetta-code/stern-brocot-sequence.md
<ide> For this task, the Stern-Brocot sequence is to be generated by an algorithm simi
<ide>
<ide> # --instructions--
<ide>
<del>Create a function that returns the $ n^{th} $ member of the sequence using the method outlined above.
<add>Create a function that returns the position in the Stern-Brocot sequence at which $ n $ is first encountered, where the sequence is generated with the method outlined above. Note that this sequence uses 1 based indexing.
<ide>
<ide> # --hints--
<ide> | 1 |
Javascript | Javascript | remove extraneous condition | 470377bbdb1874eec247a082ce418b0d26c43af6 | <ide><path>packages/react-dom/src/shared/ReactControlledValuePropTypes.js
<ide> if (__DEV__) {
<ide> const propTypes = {
<ide> value: function(props, propName, componentName) {
<ide> if (
<del> !(propName in props) ||
<ide> hasReadOnlyValue[props.type] ||
<ide> props.onChange ||
<ide> props.readOnly ||
<ide> if (__DEV__) {
<ide> },
<ide> checked: function(props, propName, componentName) {
<ide> if (
<del> !(propName in props) ||
<ide> props.onChange ||
<ide> props.readOnly ||
<ide> props.disabled || | 1 |
Text | Text | update tutorial with reference to autobinding docs | f329099831b2cfafffc5fedf8f27497697ba4bff | <ide><path>docs/docs/tutorial.md
<ide> var CommentForm = React.createClass({
<ide>
<ide> React attaches event handlers to components using a camelCase naming convention. We attach `onChange` handlers to the two `<input>` elements. Now, as the user enters text into the `<input>` fields, the attached `onChange` callbacks are fired and the `state` of the component is modified. Subsequently, the rendered value of the `input` element will be updated to reflect the current component `state`.
<ide>
<add>(The astute reader may be surprised that these event handlers work as described, given that the method references are not explicitly bound to `this`. `React.createClass(...)` [automatically binds](/react/docs/interactivity-and-dynamic-uis.html#under-the-hood-autobinding-and-event-delegation) each method to its component instance, obviating the need for explicit binding.)
<add>
<ide> #### Submitting the form
<ide>
<ide> Let's make the form interactive. When the user submits the form, we should clear it, submit a request to the server, and refresh the list of comments. To start, let's listen for the form's submit event and clear it. | 1 |
PHP | PHP | refine the code & add related test case | cd6fea1d6e293a518433c69bcfaacaca3f39babd | <ide><path>src/Illuminate/Pagination/Paginator.php
<ide> protected function calculateCurrentAndLastPages()
<ide> }
<ide> else
<ide> {
<del> $this->lastPage = (int) ceil($this->total / $this->perPage);
<del> $this->lastPage = ($this->lastPage > 0) ? $this->lastPage : 1;
<add> $this->lastPage = max((int) ceil($this->total / $this->perPage), 1);
<ide>
<ide> $this->currentPage = $this->calculateCurrentPage($this->lastPage);
<ide> }
<ide><path>tests/Pagination/PaginationPaginatorTest.php
<ide> public function testPaginationContextIsSetupCorrectly()
<ide> $this->assertEquals(1, $p->getCurrentPage());
<ide> }
<ide>
<add> public function testPaginationContextIsSetupCorrectlyWithEmptyItems()
<add> {
<add> $p = new Paginator($factory = m::mock('Illuminate\Pagination\Factory'), array(), 0, 2);
<add> $factory->shouldReceive('getCurrentPage')->once()->andReturn(1);
<add> $p->setupPaginationContext();
<add>
<add> $this->assertEquals(1, $p->getLastPage());
<add> $this->assertEquals(1, $p->getCurrentPage());
<add> }
<add>
<ide>
<ide> public function testSimplePagination()
<ide> { | 2 |
Javascript | Javascript | reset profiler timer correctly after errors | 9faf389e79c647d7792e631f3d8e9a9ce1a70625 | <ide><path>packages/react-noop-renderer/src/createReactNoop.js
<ide> function createReactNoop(reconciler: Function, useMutation: boolean) {
<ide>
<ide> let instanceCounter = 0;
<ide> let failInBeginPhase = false;
<add> let failInCompletePhase = false;
<ide>
<ide> function appendChild(
<ide> parentInstance: Instance | Container,
<ide> function createReactNoop(reconciler: Function, useMutation: boolean) {
<ide> },
<ide>
<ide> createInstance(type: string, props: Props): Instance {
<add> if (failInCompletePhase) {
<add> throw new Error('Error in host config.');
<add> }
<ide> const inst = {
<ide> id: instanceCounter++,
<ide> type: type,
<ide> function createReactNoop(reconciler: Function, useMutation: boolean) {
<ide> console.log(...bufferedLog);
<ide> },
<ide>
<del> simulateErrorInHostConfig(fn: () => void) {
<add> simulateErrorInHostConfigDuringBeginPhase(fn: () => void) {
<ide> failInBeginPhase = true;
<ide> try {
<ide> fn();
<ide> } finally {
<ide> failInBeginPhase = false;
<ide> }
<ide> },
<add>
<add> simulateErrorInHostConfigDuringCompletePhase(fn: () => void) {
<add> failInCompletePhase = true;
<add> try {
<add> fn();
<add> } finally {
<add> failInCompletePhase = false;
<add> }
<add> },
<add>
<add> flushWithoutCommitting(
<add> expectedFlush: Array<mixed>,
<add> rootID: string = DEFAULT_ROOT_ID,
<add> ) {
<add> const root: any = roots.get(rootID);
<add> const batch = {
<add> _defer: true,
<add> _expirationTime: 1,
<add> _onComplete: () => {
<add> root.firstBatch = null;
<add> },
<add> _next: null,
<add> };
<add> root.firstBatch = batch;
<add> const actual = ReactNoop.flush();
<add> expect(actual).toEqual(expectedFlush);
<add> return (expectedCommit: Array<mixed>) => {
<add> batch._defer = false;
<add> NoopRenderer.flushRoot(root, 1);
<add> expect(yieldedValues).toEqual(expectedCommit);
<add> };
<add> },
<add>
<add> getRoot(rootID: string = DEFAULT_ROOT_ID) {
<add> return roots.get(rootID);
<add> },
<ide> };
<ide>
<ide> return ReactNoop;
<ide><path>packages/react-reconciler/src/ReactFiberCompleteWork.js
<ide> function completeWork(
<ide> ): Fiber | null {
<ide> const newProps = workInProgress.pendingProps;
<ide>
<del> if (enableProfilerTimer) {
<del> if (workInProgress.mode & ProfileMode) {
<del> recordElapsedActualRenderTime(workInProgress);
<del> }
<del> }
<del>
<ide> switch (workInProgress.tag) {
<ide> case FunctionalComponent:
<del> return null;
<add> break;
<ide> case ClassComponent: {
<ide> // We are leaving this subtree, so pop context if any.
<ide> popLegacyContextProvider(workInProgress);
<del> return null;
<add> break;
<ide> }
<ide> case HostRoot: {
<ide> popHostContainer(workInProgress);
<ide> function completeWork(
<ide> workInProgress.effectTag &= ~Placement;
<ide> }
<ide> updateHostContainer(workInProgress);
<del> return null;
<add> break;
<ide> }
<ide> case HostComponent: {
<ide> popHostContext(workInProgress);
<ide> function completeWork(
<ide> 'caused by a bug in React. Please file an issue.',
<ide> );
<ide> // This can happen when we abort work.
<del> return null;
<add> break;
<ide> }
<ide>
<ide> const currentHostContext = getHostContext();
<ide> function completeWork(
<ide> markRef(workInProgress);
<ide> }
<ide> }
<del> return null;
<add> break;
<ide> }
<ide> case HostText: {
<ide> let newText = newProps;
<ide> function completeWork(
<ide> 'caused by a bug in React. Please file an issue.',
<ide> );
<ide> // This can happen when we abort work.
<del> return null;
<ide> }
<ide> const rootContainerInstance = getRootHostContainer();
<ide> const currentHostContext = getHostContext();
<ide> function completeWork(
<ide> );
<ide> }
<ide> }
<del> return null;
<add> break;
<ide> }
<ide> case ForwardRef:
<del> return null;
<add> break;
<ide> case PlaceholderComponent:
<del> return null;
<add> break;
<ide> case Fragment:
<del> return null;
<add> break;
<ide> case Mode:
<del> return null;
<add> break;
<ide> case Profiler:
<del> return null;
<add> break;
<ide> case HostPortal:
<ide> popHostContainer(workInProgress);
<ide> updateHostContainer(workInProgress);
<del> return null;
<add> break;
<ide> case ContextProvider:
<ide> // Pop provider fiber
<ide> popProvider(workInProgress);
<del> return null;
<add> break;
<ide> case ContextConsumer:
<del> return null;
<add> break;
<ide> // Error cases
<ide> case IndeterminateComponent:
<ide> invariant(
<ide> function completeWork(
<ide> 'React. Please file an issue.',
<ide> );
<ide> }
<add>
<add> if (enableProfilerTimer) {
<add> if (workInProgress.mode & ProfileMode) {
<add> // Don't record elapsed time unless the "complete" phase has succeeded.
<add> // Certain renderers may error during this phase (i.e. ReactNative View/Text nesting validation).
<add> // If an error occurs, we'll mark the time while unwinding.
<add> // This simplifies the unwinding logic and ensures consistency.
<add> recordElapsedActualRenderTime(workInProgress);
<add> }
<add> }
<add>
<add> return null;
<ide> }
<ide>
<ide> export {completeWork};
<ide><path>packages/react-reconciler/src/ReactFiberScheduler.js
<ide> import {
<ide> recordCommitTime,
<ide> recordElapsedActualRenderTime,
<ide> recordElapsedBaseRenderTimeIfRunning,
<del> resetActualRenderTimer,
<add> resetActualRenderTimerStackAfterFatalErrorInDev,
<ide> resumeActualRenderTimerIfPaused,
<ide> startBaseRenderTimer,
<ide> stopBaseRenderTimerIfRunning,
<ide> function resetStack() {
<ide> if (nextUnitOfWork !== null) {
<ide> let interruptedWork = nextUnitOfWork.return;
<ide> while (interruptedWork !== null) {
<add> if (enableProfilerTimer) {
<add> if (interruptedWork.mode & ProfileMode) {
<add> // Resume in case we're picking up on work that was paused.
<add> resumeActualRenderTimerIfPaused(false);
<add> }
<add> }
<ide> unwindInterruptedWork(interruptedWork);
<ide> interruptedWork = interruptedWork.return;
<ide> }
<ide> function commitRoot(root: FiberRoot, finishedWork: Fiber): void {
<ide>
<ide> if (enableProfilerTimer) {
<ide> if (__DEV__) {
<del> checkActualRenderTimeStackEmpty();
<add> if (nextRoot === null) {
<add> // Only check this stack once we're done processing async work.
<add> // This prevents a false positive that occurs after a batched commit,
<add> // If there was in-progress async work before the commit.
<add> checkActualRenderTimeStackEmpty();
<add> }
<ide> }
<del> resetActualRenderTimer();
<ide> }
<ide>
<ide> isCommitting = false;
<ide> function renderRoot(
<ide> // There was a fatal error.
<ide> if (__DEV__) {
<ide> resetStackAfterFatalErrorInDev();
<add>
<add> // Reset the DEV fiber stack in case we're profiling roots.
<add> // (We do this for profiling bulds when DevTools is detected.)
<add> resetActualRenderTimerStackAfterFatalErrorInDev();
<ide> }
<ide> // `nextRoot` points to the in-progress root. A non-null value indicates
<ide> // that we're in the middle of an async render. Set it to null to indicate
<ide> function performWork(minExpirationTime: ExpirationTime, dl: Deadline | null) {
<ide> findHighestPriorityRoot();
<ide>
<ide> if (enableProfilerTimer) {
<del> resumeActualRenderTimerIfPaused();
<add> resumeActualRenderTimerIfPaused(minExpirationTime === Sync);
<ide> }
<ide>
<ide> if (deadline !== null) {
<ide> function flushRoot(root: FiberRoot, expirationTime: ExpirationTime) {
<ide> performWorkOnRoot(root, expirationTime, true);
<ide> // Flush any sync work that was scheduled by lifecycles
<ide> performSyncWork();
<del> finishRendering();
<add> pauseActualRenderTimerIfRunning();
<ide> }
<ide>
<ide> function finishRendering() {
<ide><path>packages/react-reconciler/src/ReactFiberUnwindWork.js
<ide> import {
<ide> popTopLevelContextObject as popTopLevelLegacyContextObject,
<ide> } from './ReactFiberContext';
<ide> import {popProvider} from './ReactFiberNewContext';
<del>import {
<del> resumeActualRenderTimerIfPaused,
<del> recordElapsedActualRenderTime,
<del>} from './ReactProfilerTimer';
<add>import {recordElapsedActualRenderTime} from './ReactProfilerTimer';
<ide> import {
<ide> renderDidSuspend,
<ide> renderDidError,
<ide> function unwindWork(
<ide> function unwindInterruptedWork(interruptedWork: Fiber) {
<ide> if (enableProfilerTimer) {
<ide> if (interruptedWork.mode & ProfileMode) {
<del> // Resume in case we're picking up on work that was paused.
<del> resumeActualRenderTimerIfPaused();
<ide> recordElapsedActualRenderTime(interruptedWork);
<ide> }
<ide> }
<ide><path>packages/react-reconciler/src/ReactProfilerTimer.js
<ide> export type ProfilerTimer = {
<ide> markActualRenderTimeStarted(fiber: Fiber): void,
<ide> pauseActualRenderTimerIfRunning(): void,
<ide> recordElapsedActualRenderTime(fiber: Fiber): void,
<del> resetActualRenderTimer(): void,
<del> resumeActualRenderTimerIfPaused(): void,
<add> resumeActualRenderTimerIfPaused(isProcessingBatchCommit: boolean): void,
<ide> recordCommitTime(): void,
<ide> recordElapsedBaseRenderTimeIfRunning(fiber: Fiber): void,
<add> resetActualRenderTimerStackAfterFatalErrorInDev(): void,
<ide> startBaseRenderTimer(): void,
<ide> stopBaseRenderTimerIfRunning(): void,
<ide> };
<ide> if (__DEV__) {
<ide> fiberStack = [];
<ide> }
<ide>
<add>let syncCommitStartTime: number = 0;
<ide> let timerPausedAt: number = 0;
<ide> let totalElapsedPauseTime: number = 0;
<ide>
<ide> function pauseActualRenderTimerIfRunning(): void {
<ide> if (timerPausedAt === 0) {
<ide> timerPausedAt = now();
<ide> }
<add> if (syncCommitStartTime > 0) {
<add> // Don't count the time spent processing sycn work,
<add> // Against yielded async work that will be resumed later.
<add> totalElapsedPauseTime += now() - syncCommitStartTime;
<add> syncCommitStartTime = 0;
<add> } else {
<add> totalElapsedPauseTime = 0;
<add> }
<ide> }
<ide>
<ide> function recordElapsedActualRenderTime(fiber: Fiber): void {
<ide> function recordElapsedActualRenderTime(fiber: Fiber): void {
<ide> now() - totalElapsedPauseTime - ((fiber.actualDuration: any): number);
<ide> }
<ide>
<del>function resetActualRenderTimer(): void {
<add>function resumeActualRenderTimerIfPaused(isProcessingSyncWork: boolean): void {
<ide> if (!enableProfilerTimer) {
<ide> return;
<ide> }
<del> totalElapsedPauseTime = 0;
<add> if (isProcessingSyncWork && syncCommitStartTime === 0) {
<add> syncCommitStartTime = now();
<add> }
<add> if (timerPausedAt > 0) {
<add> totalElapsedPauseTime += now() - timerPausedAt;
<add> timerPausedAt = 0;
<add> }
<ide> }
<ide>
<del>function resumeActualRenderTimerIfPaused(): void {
<add>function resetActualRenderTimerStackAfterFatalErrorInDev(): void {
<ide> if (!enableProfilerTimer) {
<ide> return;
<ide> }
<del> if (timerPausedAt > 0) {
<del> totalElapsedPauseTime += now() - timerPausedAt;
<del> timerPausedAt = 0;
<add> if (__DEV__) {
<add> fiberStack.length = 0;
<ide> }
<ide> }
<ide>
<ide> export {
<ide> pauseActualRenderTimerIfRunning,
<ide> recordCommitTime,
<ide> recordElapsedActualRenderTime,
<del> resetActualRenderTimer,
<add> resetActualRenderTimerStackAfterFatalErrorInDev,
<ide> resumeActualRenderTimerIfPaused,
<ide> recordElapsedBaseRenderTimeIfRunning,
<ide> startBaseRenderTimer,
<ide><path>packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js
<ide> describe('ReactIncrementalErrorHandling', () => {
<ide> });
<ide>
<ide> it('handles error thrown by host config while working on failed root', () => {
<del> ReactNoop.simulateErrorInHostConfig(() => {
<add> ReactNoop.simulateErrorInHostConfigDuringBeginPhase(() => {
<ide> ReactNoop.render(<span />);
<ide> expect(() => ReactNoop.flush()).toThrow('Error in host config.');
<ide> });
<ide><path>packages/react-reconciler/src/__tests__/ReactIncrementalErrorReplay-test.js
<ide> describe('ReactIncrementalErrorReplay', () => {
<ide> ReactNoop = require('react-noop-renderer');
<ide> });
<ide>
<del> function div(...children) {
<del> children = children.map(c => (typeof c === 'string' ? {text: c} : c));
<del> return {type: 'div', children, prop: undefined};
<del> }
<del>
<del> function span(prop) {
<del> return {type: 'span', children: [], prop};
<del> }
<del>
<ide> it('should fail gracefully on error in the host environment', () => {
<del> ReactNoop.simulateErrorInHostConfig(() => {
<add> ReactNoop.simulateErrorInHostConfigDuringBeginPhase(() => {
<ide> ReactNoop.render(<span />);
<ide> expect(() => ReactNoop.flush()).toThrow('Error in host config.');
<ide> });
<ide><path>packages/react/src/__tests__/ReactProfiler-test.internal.js
<ide>
<ide> let React;
<ide> let ReactFeatureFlags;
<add>let ReactNoop;
<ide> let ReactTestRenderer;
<ide>
<ide> function loadModules({
<ide> enableProfilerTimer = true,
<ide> replayFailedUnitOfWorkWithInvokeGuardedCallback = false,
<add> useNoopRenderer = false,
<ide> } = {}) {
<ide> ReactFeatureFlags = require('shared/ReactFeatureFlags');
<ide> ReactFeatureFlags.debugRenderPhaseSideEffects = false;
<ide> function loadModules({
<ide> ReactFeatureFlags.enableGetDerivedStateFromCatch = true;
<ide> ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = replayFailedUnitOfWorkWithInvokeGuardedCallback;
<ide> React = require('react');
<del> ReactTestRenderer = require('react-test-renderer');
<add>
<add> if (useNoopRenderer) {
<add> ReactNoop = require('react-noop-renderer');
<add> } else {
<add> ReactTestRenderer = require('react-test-renderer');
<add> }
<ide> }
<ide>
<add>const mockDevToolsForTest = () => {
<add> jest.mock('react-reconciler/src/ReactFiberDevToolsHook', () => ({
<add> injectInternals: () => {},
<add> isDevToolsPresent: true,
<add> }));
<add>};
<add>
<ide> describe('Profiler', () => {
<ide> describe('works in profiling and non-profiling bundles', () => {
<ide> [true, false].forEach(flagEnabled => {
<ide> describe('Profiler', () => {
<ide> <AdvanceTime />
<ide> <AdvanceTime />
<ide> <AdvanceTime />
<add> <AdvanceTime />
<add> <AdvanceTime />
<ide> </div>,
<ide> );
<ide>
<del> // Should be called twice: once to compute the update expiration time,
<del> // and once to record the commit time.
<add> // Should be called two times:
<add> // 1. To mark the start (resuming) of work
<add> // 2. To compute the update expiration time,
<add> // 3. To record the commit time.
<ide> // No additional calls from ProfilerTimer are expected.
<del> expect(mockNow).toHaveBeenCalledTimes(2);
<add> expect(mockNow).toHaveBeenCalledTimes(3);
<ide> });
<ide>
<ide> it('logs render times for both mount and update', () => {
<ide> describe('Profiler', () => {
<ide> // commit time
<ide> expect(mountCall[5]).toBe(flagEnabled && __DEV__ ? 54 : 44);
<ide> });
<add>
<add> it('should reset the fiber stack correct after a "complete" phase error', () => {
<add> jest.resetModules();
<add>
<add> loadModules({
<add> useNoopRenderer: true,
<add> replayFailedUnitOfWorkWithInvokeGuardedCallback: flagEnabled,
<add> });
<add>
<add> // Simulate a renderer error during the "complete" phase.
<add> // This mimics behavior like React Native's View/Text nesting validation.
<add> ReactNoop.simulateErrorInHostConfigDuringCompletePhase(() => {
<add> ReactNoop.render(
<add> <React.unstable_Profiler id="profiler" onRender={jest.fn()}>
<add> <span>hi</span>
<add> </React.unstable_Profiler>,
<add> );
<add> expect(ReactNoop.flush).toThrow('Error in host config.');
<add> });
<add>
<add> // So long as the profiler timer's fiber stack is reset correctly,
<add> // Subsequent renders should not error.
<add> ReactNoop.render(
<add> <React.unstable_Profiler id="profiler" onRender={jest.fn()}>
<add> <span>hi</span>
<add> </React.unstable_Profiler>,
<add> );
<add> ReactNoop.flush();
<add> });
<ide> });
<ide> });
<ide> });
<ide> describe('Profiler', () => {
<ide> expect(updateCall[4]).toBe(27); // start time
<ide> });
<ide> });
<add>
<add> it('should handle interleaved async yields and batched commits', () => {
<add> jest.resetModules();
<add> mockDevToolsForTest();
<add> loadModules({useNoopRenderer: true});
<add>
<add> const Child = ({duration, id}) => {
<add> ReactNoop.advanceTime(duration);
<add> ReactNoop.yield(`Child:render:${id}`);
<add> return null;
<add> };
<add>
<add> class Parent extends React.Component {
<add> componentDidMount() {
<add> ReactNoop.yield(`Parent:componentDidMount:${this.props.id}`);
<add> }
<add> render() {
<add> const {duration, id} = this.props;
<add> return (
<add> <React.Fragment>
<add> <Child duration={duration} id={id} />
<add> <Child duration={duration} id={id} />
<add> </React.Fragment>
<add> );
<add> }
<add> }
<add>
<add> ReactNoop.advanceTime(50);
<add>
<add> ReactNoop.renderToRootWithID(<Parent duration={3} id="one" />, 'one');
<add>
<add> // Process up to the <Parent> component, but yield before committing.
<add> // This ensures that the profiler timer still has paused fibers.
<add> const commitFirstRender = ReactNoop.flushWithoutCommitting(
<add> ['Child:render:one', 'Child:render:one'],
<add> 'one',
<add> );
<add>
<add> expect(ReactNoop.getRoot('one').current.actualDuration).toBe(0);
<add>
<add> ReactNoop.advanceTime(100);
<add>
<add> // Process some async work, but yield before committing it.
<add> ReactNoop.renderToRootWithID(<Parent duration={7} id="two" />, 'two');
<add> ReactNoop.flushThrough(['Child:render:two']);
<add>
<add> ReactNoop.advanceTime(150);
<add>
<add> // Commit the previously paused, batched work.
<add> commitFirstRender(['Parent:componentDidMount:one']);
<add>
<add> expect(ReactNoop.getRoot('one').current.actualDuration).toBe(6);
<add> expect(ReactNoop.getRoot('two').current.actualDuration).toBe(0);
<add>
<add> ReactNoop.advanceTime(200);
<add>
<add> ReactNoop.flush();
<add>
<add> expect(ReactNoop.getRoot('two').current.actualDuration).toBe(14);
<add> });
<ide> });
<ide><path>packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js
<ide> describe('ReactProfiler DevTools integration', () => {
<ide> // The updated 6ms for the component that does.
<ide> expect(rendered.root.findByType(App)._currentFiber().treeBaseTime).toBe(15);
<ide> });
<add>
<add> it('should reset the fiber stack correctly after an error when profiling host roots', () => {
<add> advanceTimeBy(20);
<add>
<add> const rendered = ReactTestRenderer.create(
<add> <div>
<add> <AdvanceTime byAmount={2} />
<add> </div>,
<add> );
<add>
<add> advanceTimeBy(20);
<add>
<add> expect(() => {
<add> rendered.update(
<add> <div ref="this-will-cause-an-error">
<add> <AdvanceTime byAmount={3} />
<add> </div>,
<add> );
<add> }).toThrow();
<add>
<add> advanceTimeBy(20);
<add>
<add> // But this should render correctly, if the profiler's fiber stack has been reset.
<add> rendered.update(
<add> <div>
<add> <AdvanceTime byAmount={7} />
<add> </div>,
<add> );
<add>
<add> // Measure unobservable timing required by the DevTools profiler.
<add> // At this point, the base time should include only the most recent (not failed) render.
<add> // It should not include time spent on the initial render,
<add> // Or time that elapsed between any of the above renders.
<add> expect(rendered.root.findByType('div')._currentFiber().treeBaseTime).toBe(
<add> 7,
<add> );
<add> });
<ide> }); | 9 |
PHP | PHP | apply prefix to foreign key's "on" attribute, too | 7ead1796d08efe02fb2d5874affa06193c572c23 | <ide><path>laravel/database/schema/grammars/grammar.php
<ide> public function foreign(Table $table, Fluent $command)
<ide> // command is being executed and the referenced table are wrapped.
<ide> $table = $this->wrap($table);
<ide>
<del> $on = $this->wrap($command->on);
<add> $on = $this->wrap_table($command->on);
<ide>
<ide> // Next we need to columnize both the command table's columns as well as
<ide> // the columns referenced by the foreign key. We'll cast the referenced | 1 |
Ruby | Ruby | restore argv even when irb.setup raises | d547102253d21f11e2ab772c282f96945928c1fa | <ide><path>Library/Homebrew/debrew/irb.rb
<ide> module IRB
<ide> def IRB.start_within(binding)
<ide> unless @setup_done
<ide> # make IRB ignore our command line arguments
<del> saved_args = ARGV.shift(ARGV.size)
<del> IRB.setup(nil)
<del> ARGV.concat(saved_args)
<add> begin
<add> saved_args = ARGV.shift(ARGV.size)
<add> IRB.setup(nil)
<add> ensure
<add> ARGV.replace(saved_args)
<add> end
<ide> @setup_done = true
<ide> end
<ide> | 1 |
Python | Python | fix some misspellings | 12332f4a242c8263f93f126e17241d3221f319ea | <ide><path>glances/core/glances_processes.py
<ide> def __init__(self, cache_timeout=60):
<ide> self.processcount = {
<ide> 'total': 0, 'running': 0, 'sleeping': 0, 'thread': 0}
<ide>
<del> # Tag to enable/disable the processes stats (to reduce the Glances CPU comsumption)
<add> # Tag to enable/disable the processes stats (to reduce the Glances CPU consumption)
<ide> # Default is to enable the processes stats
<ide> self.disable_tag = False
<ide>
<ide><path>glances/core/glances_standalone.py
<ide> def __init__(self, config=None, args=None):
<ide>
<ide> # If process extended stats is disabled by user
<ide> if not args.enable_process_extended:
<del> logger.info(_("Extended stats for top process is disabled (default behavor)"))
<add> logger.info(_("Extended stats for top process are disabled (default behavior)"))
<ide> glances_processes.disable_extended()
<ide> else:
<del> logger.debug(_("Extended stats for top process is enabled"))
<add> logger.debug(_("Extended stats for top process are enabled"))
<ide> glances_processes.enable_extended()
<ide>
<ide> # Manage optionnal process filter | 2 |
PHP | PHP | fix eventtest testbuildcommand on windows | dcf6f41c49d47b8edc90bc0249766be1a409b954 | <ide><path>tests/Console/Scheduling/EventTest.php
<ide> public function tearDown()
<ide>
<ide> public function testBuildCommand()
<ide> {
<del> $quote = (DIRECTORY_SEPARATOR == '\\') ? '"' : "'";
<add> $isWindows = DIRECTORY_SEPARATOR == '\\';
<add> $quote = ($isWindows) ? '"' : "'";
<ide>
<ide> $event = new Event(m::mock('Illuminate\Console\Scheduling\Mutex'), 'php -i');
<ide>
<del> $defaultOutput = (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null';
<add> $defaultOutput = ($isWindows) ? 'NUL' : '/dev/null';
<ide> $this->assertSame("php -i > {$quote}{$defaultOutput}{$quote} 2>&1", $event->buildCommand());
<ide>
<del> $quote = (DIRECTORY_SEPARATOR == '\\') ? '"' : "'";
<del>
<ide> $event = new Event(m::mock('Illuminate\Console\Scheduling\Mutex'), 'php -i');
<ide> $event->runInBackground();
<ide>
<del> $defaultOutput = (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null';
<del> $this->assertSame("(php -i > {$quote}{$defaultOutput}{$quote} 2>&1 ; '".PHP_BINARY."' artisan schedule:finish \"framework/schedule-c65b1c374c37056e0c57fccb0c08d724ce6f5043\") > {$quote}{$defaultOutput}{$quote} 2>&1 &", $event->buildCommand());
<add> $commandSeparator = ($isWindows ? '&' : ';');
<add> $scheduleId = '"framework'.DIRECTORY_SEPARATOR.'schedule-c65b1c374c37056e0c57fccb0c08d724ce6f5043"';
<add> $this->assertSame("(php -i > {$quote}{$defaultOutput}{$quote} 2>&1 {$commandSeparator} {$quote}".PHP_BINARY."{$quote} artisan schedule:finish {$scheduleId}) > {$quote}{$defaultOutput}{$quote} 2>&1 &", $event->buildCommand());
<ide> }
<ide>
<ide> public function testBuildCommandSendOutputTo()
<ide><path>tests/Database/DatabaseMigrationRefreshCommandTest.php
<ide> public function testRefreshCommandCallsCommandsWithProperArguments()
<ide> $console->shouldReceive('find')->with('migrate:reset')->andReturn($resetCommand);
<ide> $console->shouldReceive('find')->with('migrate')->andReturn($migrateCommand);
<ide>
<del> $resetCommand->shouldReceive('run')->with(new InputMatcher("--database --path --force 'migrate:reset'"), m::any());
<add> $quote = DIRECTORY_SEPARATOR == '\\' ? '"' : "'";
<add> $resetCommand->shouldReceive('run')->with(new InputMatcher("--database --path --force {$quote}migrate:reset{$quote}"), m::any());
<ide> $migrateCommand->shouldReceive('run')->with(new InputMatcher('--database --path --force migrate'), m::any());
<ide>
<ide> $this->runCommand($command);
<ide> public function testRefreshCommandCallsCommandsWithStep()
<ide> $console->shouldReceive('find')->with('migrate:rollback')->andReturn($rollbackCommand);
<ide> $console->shouldReceive('find')->with('migrate')->andReturn($migrateCommand);
<ide>
<del> $rollbackCommand->shouldReceive('run')->with(new InputMatcher("--database --path --step=2 --force 'migrate:rollback'"), m::any());
<add> $quote = DIRECTORY_SEPARATOR == '\\' ? '"' : "'";
<add> $rollbackCommand->shouldReceive('run')->with(new InputMatcher("--database --path --step=2 --force {$quote}migrate:rollback{$quote}"), m::any());
<ide> $migrateCommand->shouldReceive('run')->with(new InputMatcher('--database --path --force migrate'), m::any());
<ide>
<ide> $this->runCommand($command, ['--step' => 2]);
<ide><path>tests/Database/DatabaseMigrationResetCommandTest.php
<ide> public function testResetCommandCallsMigratorWithProperArguments()
<ide> $migrator->shouldReceive('paths')->once()->andReturn([]);
<ide> $migrator->shouldReceive('setConnection')->once()->with(null);
<ide> $migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
<del> $migrator->shouldReceive('reset')->once()->with([__DIR__.'/migrations'], false);
<add> $migrator->shouldReceive('reset')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], false);
<ide> $migrator->shouldReceive('getNotes')->andReturn([]);
<ide>
<ide> $this->runCommand($command);
<ide> public function testResetCommandCanBePretended()
<ide> $migrator->shouldReceive('paths')->once()->andReturn([]);
<ide> $migrator->shouldReceive('setConnection')->once()->with('foo');
<ide> $migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
<del> $migrator->shouldReceive('reset')->once()->with([__DIR__.'/migrations'], true);
<add> $migrator->shouldReceive('reset')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], true);
<ide> $migrator->shouldReceive('getNotes')->andReturn([]);
<ide>
<ide> $this->runCommand($command, ['--pretend' => true, '--database' => 'foo']);
<ide><path>tests/Database/DatabaseMigrationRollbackCommandTest.php
<ide> public function testRollbackCommandCallsMigratorWithProperArguments()
<ide> $command->setLaravel($app);
<ide> $migrator->shouldReceive('paths')->once()->andReturn([]);
<ide> $migrator->shouldReceive('setConnection')->once()->with(null);
<del> $migrator->shouldReceive('rollback')->once()->with([__DIR__.'/migrations'], ['pretend' => false, 'step' => 0]);
<add> $migrator->shouldReceive('rollback')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], ['pretend' => false, 'step' => 0]);
<ide> $migrator->shouldReceive('getNotes')->andReturn([]);
<ide>
<ide> $this->runCommand($command);
<ide> public function testRollbackCommandCallsMigratorWithStepOption()
<ide> $command->setLaravel($app);
<ide> $migrator->shouldReceive('paths')->once()->andReturn([]);
<ide> $migrator->shouldReceive('setConnection')->once()->with(null);
<del> $migrator->shouldReceive('rollback')->once()->with([__DIR__.'/migrations'], ['pretend' => false, 'step' => 2]);
<add> $migrator->shouldReceive('rollback')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], ['pretend' => false, 'step' => 2]);
<ide> $migrator->shouldReceive('getNotes')->andReturn([]);
<ide>
<ide> $this->runCommand($command, ['--step' => 2]);
<ide> public function testRollbackCommandCanBePretended()
<ide> $command->setLaravel($app);
<ide> $migrator->shouldReceive('paths')->once()->andReturn([]);
<ide> $migrator->shouldReceive('setConnection')->once()->with('foo');
<del> $migrator->shouldReceive('rollback')->once()->with([__DIR__.'/migrations'], true);
<add> $migrator->shouldReceive('rollback')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], true);
<ide> $migrator->shouldReceive('getNotes')->andReturn([]);
<ide>
<ide> $this->runCommand($command, ['--pretend' => true, '--database' => 'foo']);
<ide> public function testRollbackCommandCanBePretendedWithStepOption()
<ide> $command->setLaravel($app);
<ide> $migrator->shouldReceive('paths')->once()->andReturn([]);
<ide> $migrator->shouldReceive('setConnection')->once()->with('foo');
<del> $migrator->shouldReceive('rollback')->once()->with([__DIR__.'/migrations'], ['pretend' => true, 'step' => 2]);
<add> $migrator->shouldReceive('rollback')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], ['pretend' => true, 'step' => 2]);
<ide> $migrator->shouldReceive('getNotes')->andReturn([]);
<ide>
<ide> $this->runCommand($command, ['--pretend' => true, '--database' => 'foo', '--step' => 2]);
<ide><path>tests/Filesystem/FilesystemAdapterTest.php
<ide> public function testPath()
<ide> {
<ide> $this->filesystem->write('file.txt', 'Hello World');
<ide> $filesystemAdapter = new FilesystemAdapter($this->filesystem);
<del> $this->assertEquals($this->tempDir.'/file.txt', $filesystemAdapter->path('file.txt'));
<add> $this->assertEquals($this->tempDir.DIRECTORY_SEPARATOR.'file.txt', $filesystemAdapter->path('file.txt'));
<ide> }
<ide>
<ide> public function testGet()
<ide> public function testPrepend()
<ide> file_put_contents($this->tempDir.'/file.txt', 'World');
<ide> $filesystemAdapter = new FilesystemAdapter($this->filesystem);
<ide> $filesystemAdapter->prepend('file.txt', 'Hello ');
<del> $this->assertStringEqualsFile($this->tempDir.'/file.txt', "Hello \nWorld");
<add> $this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello '.PHP_EOL.'World');
<ide> }
<ide>
<ide> public function testAppend()
<ide> {
<ide> file_put_contents($this->tempDir.'/file.txt', 'Hello ');
<ide> $filesystemAdapter = new FilesystemAdapter($this->filesystem);
<ide> $filesystemAdapter->append('file.txt', 'Moon');
<del> $this->assertStringEqualsFile($this->tempDir.'/file.txt', "Hello \nMoon");
<add> $this->assertStringEqualsFile($this->tempDir.'/file.txt', 'Hello '.PHP_EOL.'Moon');
<ide> }
<ide>
<ide> public function testDelete()
<ide><path>tests/Filesystem/FilesystemTest.php
<ide> public function testSetChmod()
<ide> $files = new Filesystem;
<ide> $files->chmod($this->tempDir.'/file.txt', 0755);
<ide> $filePermission = substr(sprintf('%o', fileperms($this->tempDir.'/file.txt')), -4);
<del> $this->assertEquals('0755', $filePermission);
<add> $expectedPermissions = DIRECTORY_SEPARATOR == '\\' ? '0666' : '0755';
<add> $this->assertEquals($expectedPermissions, $filePermission);
<ide> }
<ide>
<ide> public function testGetChmod()
<ide> public function testGetChmod()
<ide> chmod($this->tempDir.'/file.txt', 0755);
<ide>
<ide> $files = new Filesystem;
<del> $filePermisson = $files->chmod($this->tempDir.'/file.txt');
<del> $this->assertEquals('0755', $filePermisson);
<add> $filePermission = $files->chmod($this->tempDir.'/file.txt');
<add> $expectedPermissions = DIRECTORY_SEPARATOR == '\\' ? '0666' : '0755';
<add> $this->assertEquals($expectedPermissions, $filePermission);
<ide> }
<ide>
<ide> public function testDeleteRemovesFiles() | 6 |
Python | Python | use english instead of model | 7939c6388656e1abb932b2deb1af90928c297aa2 | <ide><path>spacy/tests/regression/test_issue4903.py
<ide> from __future__ import unicode_literals
<ide>
<ide> import spacy
<add>from spacy.lang.en import English
<ide> from spacy.tokens import Span, Doc
<ide>
<ide>
<ide> def _get_my_ext(span):
<ide>
<ide> def test_issue4903():
<ide> # ensures that this runs correctly and doesn't hang or crash on Windows / macOS
<del> nlp = spacy.load("en_core_web_sm")
<add> nlp = English()
<ide> custom_component = CustomPipe()
<del> nlp.add_pipe(custom_component, after="parser")
<add> nlp.add_pipe(nlp.create_pipe("sentencizer"))
<add> nlp.add_pipe(custom_component, after="sentencizer")
<ide>
<ide> text = ["I like bananas.", "Do you like them?", "No, I prefer wasabi."]
<ide> docs = list(nlp.pipe(text, n_process=2)) | 1 |
Mixed | Javascript | enable foreground ripple | 6d175f2c257fe1acb1c36b15bc97bdb77560885c | <ide><path>Libraries/Components/Touchable/TouchableNativeFeedback.android.js
<ide> */
<ide> 'use strict';
<ide>
<add>var Platform = require('Platform');
<ide> var PropTypes = require('react/lib/ReactPropTypes');
<ide> var React = require('React');
<ide> var ReactNative = require('react/lib/ReactNative');
<ide> var backgroundPropType = PropTypes.oneOfType([
<ide> var TouchableView = requireNativeComponent('RCTView', null, {
<ide> nativeOnly: {
<ide> nativeBackgroundAndroid: backgroundPropType,
<add> nativeForegroundAndroid: backgroundPropType,
<ide> }
<ide> });
<ide>
<ide> var TouchableNativeFeedback = React.createClass({
<ide> * methods to generate that dictionary.
<ide> */
<ide> background: backgroundPropType,
<add>
<add> /**
<add> * Set to true to add the ripple effect to the foreground of the view, instead of the
<add> * background. This is useful if one of your child views has a background of its own, or you're
<add> * e.g. displaying images, and you don't want the ripple to be covered by them.
<add> *
<add> * Check TouchableNativeFeedback.canUseNativeForeground() first, as this is only available on
<add> * Android 6.0 and above. If you try to use this on older versions you will get a warning and
<add> * fallback to background.
<add> */
<add> useForeground: PropTypes.bool,
<ide> },
<ide>
<ide> statics: {
<ide> var TouchableNativeFeedback = React.createClass({
<ide> Ripple: function(color: string, borderless: boolean) {
<ide> return {type: 'RippleAndroid', color: processColor(color), borderless: borderless};
<ide> },
<add>
<add> canUseNativeForeground: function() {
<add> return Platform.OS === 'android' && Platform.Version >= 23;
<add> }
<ide> },
<ide>
<ide> mixins: [Touchable.Mixin],
<ide> var TouchableNativeFeedback = React.createClass({
<ide> }
<ide> children.push(Touchable.renderDebugView({color: 'brown', hitSlop: this.props.hitSlop}));
<ide> }
<add> if (this.props.useForeground && !TouchableNativeFeedback.canUseNativeForeground()) {
<add> console.warn(
<add> 'Requested foreground ripple, but it is not available on this version of Android. ' +
<add> 'Consider calling TouchableNativeFeedback.canUseNativeForeground() and using a different ' +
<add> 'Touchable if the result is false.');
<add> }
<add> const drawableProp =
<add> this.props.useForeground && TouchableNativeFeedback.canUseNativeForeground()
<add> ? 'nativeForegroundAndroid'
<add> : 'nativeBackgroundAndroid';
<ide> var childProps = {
<ide> ...child.props,
<del> nativeBackgroundAndroid: this.props.background,
<add> [drawableProp]: this.props.background,
<ide> accessible: this.props.accessible !== false,
<ide> accessibilityLabel: this.props.accessibilityLabel,
<ide> accessibilityComponentType: this.props.accessibilityComponentType,
<ide><path>Libraries/Components/View/View.js
<ide> const View = React.createClass({
<ide> const RCTView = requireNativeComponent('RCTView', View, {
<ide> nativeOnly: {
<ide> nativeBackgroundAndroid: true,
<add> nativeForegroundAndroid: true,
<ide> }
<ide> });
<ide>
<ide><path>ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java
<ide> import java.util.Locale;
<ide> import java.util.Map;
<ide>
<add>import android.annotation.TargetApi;
<ide> import android.graphics.Rect;
<ide> import android.os.Build;
<ide> import android.view.View;
<ide> public void setNativeBackground(ReactViewGroup view, @Nullable ReadableMap bg) {
<ide> null : ReactDrawableHelper.createDrawableFromJSDescription(view.getContext(), bg));
<ide> }
<ide>
<add> @TargetApi(Build.VERSION_CODES.M)
<add> @ReactProp(name = "nativeForegroundAndroid")
<add> public void setNativeForeground(ReactViewGroup view, @Nullable ReadableMap fg) {
<add> view.setForeground(fg == null
<add> ? null
<add> : ReactDrawableHelper.createDrawableFromJSDescription(view.getContext(), fg));
<add> }
<add>
<ide> @ReactProp(name = com.facebook.react.uimanager.ReactClippingViewGroupHelper.PROP_REMOVE_CLIPPED_SUBVIEWS)
<ide> public void setRemoveClippedSubviews(ReactViewGroup view, boolean removeClippedSubviews) {
<ide> view.setRemoveClippedSubviews(removeClippedSubviews); | 3 |
PHP | PHP | fix table ordering | 4ab4b1dd2c8f726f46150d2a1b040097da13eadc | <ide><path>tests/TestCase/TestSuite/Schema/test_schema.php
<ide> declare(strict_types=1);
<ide>
<ide> return [
<add> [
<add> 'table' => 'schema_generator_comment',
<add> 'columns' => [
<add> 'id' => ['type' => 'integer'],
<add> 'title' => ['type' => 'string', 'null' => true],
<add> ],
<add> ],
<ide> [
<ide> 'table' => 'schema_generator',
<ide> 'columns' => [
<ide> ],
<ide> ],
<ide> ],
<del> [
<del> 'table' => 'schema_generator_comment',
<del> 'columns' => [
<del> 'id' => ['type' => 'integer'],
<del> 'title' => ['type' => 'string', 'null' => true],
<del> ],
<del> ],
<ide> ]; | 1 |
Go | Go | extract helper method for volume linking | 84f78d9cad4162ddfc1bccbe55402050123cb1c5 | <ide><path>container.go
<ide> func (container *Container) Start() (err error) {
<ide> }
<ide>
<ide> // Apply volumes from another container if requested
<del> if container.Config.VolumesFrom != "" {
<del> containerSpecs := strings.Split(container.Config.VolumesFrom, ",")
<del> for _, containerSpec := range containerSpecs {
<del> mountRW := true
<del> specParts := strings.SplitN(containerSpec, ":", 2)
<del> switch len(specParts) {
<del> case 0:
<del> return fmt.Errorf("Malformed volumes-from specification: %s", container.Config.VolumesFrom)
<del> case 2:
<del> switch specParts[1] {
<del> case "ro":
<del> mountRW = false
<del> case "rw": // mountRW is already true
<del> default:
<del> return fmt.Errorf("Malformed volumes-from speficication: %s", containerSpec)
<del> }
<del> }
<del> c := container.runtime.Get(specParts[0])
<del> if c == nil {
<del> return fmt.Errorf("Container %s not found. Impossible to mount its volumes", container.ID)
<del> }
<del> for volPath, id := range c.Volumes {
<del> if _, exists := container.Volumes[volPath]; exists {
<del> continue
<del> }
<del> if err := os.MkdirAll(path.Join(container.RootfsPath(), volPath), 0755); err != nil {
<del> return err
<del> }
<del> container.Volumes[volPath] = id
<del> if isRW, exists := c.VolumesRW[volPath]; exists {
<del> container.VolumesRW[volPath] = isRW && mountRW
<del> }
<del> }
<del>
<del> }
<del> }
<add> container.joinVolumes()
<ide>
<ide> volumesDriver := container.runtime.volumes.driver
<ide> // Create the requested volumes if they don't exist
<ide> func (container *Container) Start() (err error) {
<ide> return ErrContainerStart
<ide> }
<ide>
<add>func (container *Container) joinVolumes() error {
<add> if container.Config.VolumesFrom != "" {
<add> containerSpecs := strings.Split(container.Config.VolumesFrom, ",")
<add> for _, containerSpec := range containerSpecs {
<add> mountRW := true
<add> specParts := strings.SplitN(containerSpec, ":", 2)
<add> switch len(specParts) {
<add> case 0:
<add> return fmt.Errorf("Malformed volumes-from specification: %s", container.Config.VolumesFrom)
<add> case 2:
<add> switch specParts[1] {
<add> case "ro":
<add> mountRW = false
<add> case "rw": // mountRW is already true
<add> default:
<add> return fmt.Errorf("Malformed volumes-from speficication: %s", containerSpec)
<add> }
<add> }
<add> c := container.runtime.Get(specParts[0])
<add> if c == nil {
<add> return fmt.Errorf("Container %s not found. Impossible to mount its volumes", container.ID)
<add> }
<add> for volPath, id := range c.Volumes {
<add> if _, exists := container.Volumes[volPath]; exists {
<add> continue
<add> }
<add> if err := os.MkdirAll(path.Join(container.RootfsPath(), volPath), 0755); err != nil {
<add> return err
<add> }
<add> container.Volumes[volPath] = id
<add> if isRW, exists := c.VolumesRW[volPath]; exists {
<add> container.VolumesRW[volPath] = isRW && mountRW
<add> }
<add> }
<add>
<add> }
<add> }
<add>}
<add>
<ide> func (container *Container) Run() error {
<ide> if err := container.Start(); err != nil {
<ide> return err | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.