Commit Graph

244 Commits

Author SHA1 Message Date
George Claghorn
05b7b80bca Add missing require 2018-01-22 17:15:55 -05:00
George Claghorn
cf1c48478d Cope with videos with undefined display aspect ratios 2018-01-20 14:47:09 -05:00
George Claghorn
9b0c74e878 Use helper method 2018-01-19 18:46:59 -05:00
George Claghorn
2450fc24e3 Preserve display aspect ratio for videos with rectangular samples 2018-01-19 10:47:34 -05:00
Matthew Draper
c046143408 Revert "Merge pull request #31434 from olivierlacan/boot-feedback"
This reverts commit edc54fd2068bc21f0d381228e55d97e32f508923, reversing
changes made to a5922f132f4d163e2c7f770427087f5268c18def.

As discussed, this is not an appropriate place to make assumptions about
ARGV, or to write to stdout: config/boot.rb is a library and is required
by other applictions, with which we have no right to interfere.
2018-01-19 01:28:49 +10:30
eileencodes
a2827ec981 Refactor migration to move migrations paths to connection
Rails has some support for multiple databases but it can be hard to
handle migrations with those. The easiest way to implement multiple
databases is to contain migrations into their own folder ("db/migrate"
for the primary db and "db/seconddb_migrate" for the second db). Without
this you would need to write code that allowed you to switch connections
in migrations. I can tell you from experience that is not a fun way to
implement multiple databases.

This refactoring is a pre-requisite for implementing other features
related to parallel testing and improved handling for multiple
databases.

The refactoring here moves the class methods from the `Migrator` class
into it's own new class `MigrationContext`. The goal was to move the
`migrations_paths` method off of the `Migrator` class and onto the
connection. This allows users to do the following in their
`database.yml`:

```
development:
  adapter: mysql2
  username: root
  password:

development_seconddb:
  adapter: mysql2
  username: root
  password:
  migrations_paths: "db/second_db_migrate"
```

Migrations for the `seconddb` can now be store in the
`db/second_db_migrate` directory. Migrations for the primary database
are stored in `db/migrate`".

The refactoring here drastically reduces the internal API for migrations
since we don't need to pass `migrations_paths` around to every single
method. Additionally this change does not require any Rails applications
to make changes unless they want to use the new public API. All of the
class methods from the `Migrator` class were `nodoc`'d except for the
`migrations_paths` and `migrations_path` getter/setters respectively.
2018-01-18 08:55:03 -05:00
George Claghorn
6fb3ac1536 Provide a sensible default host 2018-01-16 20:32:02 -05:00
George Claghorn
c2ba530c43
Extract content types from blob data 2018-01-15 13:06:17 -05:00
George Claghorn
2c08446e0c Instrument image transformation 2018-01-10 21:50:14 -05:00
George Claghorn
c69c7b3690 Instrument preview image drawing 2018-01-10 21:48:53 -05:00
George Claghorn
96f5930610 Update error names in docs [ci skip] 2018-01-10 12:37:07 -05:00
Ryuta Kamizono
7e78d2cc94 Add missing # frozen_string_literal: true 2018-01-11 02:33:41 +09:00
George Claghorn
3320e80b93 Correct comment [ci skip] 2018-01-10 12:15:30 -05:00
George Claghorn
d4cdd4a05f Extract Analyzable and Representable concerns 2018-01-10 12:12:04 -05:00
kami-zh
9431529011 Change Active Storage destroy callbacks
There is concern that only blob are deleted depending on
the `before_destroy` definition order which throws abort.
2018-01-09 22:47:02 +09:00
Javan Makhmali
f17137b0a1 Rebuild activestorage.js
To pick up 21417e02e906f6b64f013aafefdc0cb8ea8b5e74
2018-01-08 17:13:18 -05:00
Javan Makhmali
21417e02e9 Work around Firefox's refusal to dispatch events on disabled elements. Fixes #31393
Brought to you by a 12 year old Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=329509
2018-01-08 17:07:32 -05:00
George Claghorn
93e6a0ec55 Fix attaching blobs to optimistically-locked records
Explicitly declare inverse associations so ActiveStorage::Attachment touches the original record instance.

Closes #31542.
2018-01-08 14:34:03 -05:00
Rosa Gutierrez
8f52d93576
Allow overriding filename in Blob#service_url
This is useful when we have several representations for the same
underlying file, each one with a different name, and we need to provide
a custom download URL based on that name and not that of the underlying
file.
2018-01-08 15:44:14 +01:00
George Claghorn
a736e82170 Document automatic width-height swapping [ci skip] 2018-01-07 10:04:14 -05:00
George Claghorn
19185c4dea Remove redundant sentences [ci skip] 2018-01-07 09:56:45 -05:00
George Claghorn
1223782598 Tweak engine for readability 2018-01-07 09:02:22 -05:00
Rosa Gutierrez
d40284b1a4
Force content disposition to attachment for specific content types
In this way we avoid HTML, XML, SVG and other files that can be rendered
by the browser to be served inline by default. Depending on the origin
from where these files are served, this might lead to XSS
vulnerabilities, and in the best case, to more realistic phishing
attacks and open redirects.

We force it rather than falling back to it when other disposition is not
provided. Otherwise it would be possible for someone to force inline
just by passing `disposition=inline` in the URL.

The list of content types to be served as attachments is configurable.
2018-01-05 16:32:32 +01:00
George Claghorn
a72473f032 Configure previewer/analyzer command paths centrally 2018-01-03 22:01:31 -05:00
George Claghorn
dbff1cee55 Exclude ActiveStorage::SetBlob from API docs [ci skip] 2018-01-02 22:49:18 -05:00
George Claghorn
921b877c2f Restore support for the -layers transformation 2018-01-02 07:20:23 -05:00
Arun Agrawal
15b3275a29
Merge pull request #31606 from yhirano55/bump_license_years_for_2018
Bump license years for 2018
2017-12-31 23:55:45 +05:30
George Claghorn
609dbb84c3 Expose ActiveStorage::Analyzer#logger in API docs [ci skip]
Clarify that it's public API and may be used in third-party analyzers.
2017-12-31 13:16:21 -05:00
George Claghorn
a470317b2c Expose ActiveStorage::Previewer#logger in API docs [ci skip]
Clarify that it's public API intended for use by third-party previewers. It shouldn't be removed without deprecation even though it isn't used by the built-in previewers.
2017-12-31 13:08:36 -05:00
George Claghorn
11995d6fd5 Suppress noise from drawing command invocations 2017-12-31 13:02:15 -05:00
George Claghorn
316d87e412 Append extension to tempfile name
Fixes analyzing an SVG image without an XML declaration. ImageMagick occasionally looks to the extension when it can't discern the type of an image file from its contents.

References #31356.
2017-12-31 10:36:58 -05:00
Yoshiyuki Hirano
b20354afcc Bump license years for 2018 2017-12-31 22:36:55 +09:00
Dorian Marié
6f035067e4 prevent shadowing outer variables 2017-12-25 22:47:55 +01:00
Javan Makhmali
1a5bf01fe0 Active Storage: Fix direct uploads in IE 11
Fixes #31531
Closes #31540
2017-12-23 11:21:54 -05:00
Eileen M. Uchitelle
57b70bb6eb
Merge pull request #31538 from yhirano55/add_cloud_service_links_to_readme_in_active_storage
Add cloud service's links to README of Active Storage [ci skip]
2017-12-22 15:26:58 -05:00
Robert Glaser
7a3a991f6d Add support for combined MiniMagick transformations 2017-12-22 16:44:34 +01:00
Yoshiyuki Hirano
c1d7df2538 Add cloud service's links to README of Active Storage [ci skip] 2017-12-22 06:40:24 +09:00
Rafael França
7d0607094c
Merge pull request #31537 from yhirano55/pass_options_to_rails_blob_url
Pass options to rails_blob_url
2017-12-21 16:00:10 -05:00
Yoshiyuki Hirano
835e27289a Pass options to rails_blob_url 2017-12-22 05:28:23 +09:00
Yoshiyuki Hirano
d8c49d88f6 [ci skip] Remove needless from doc for ActiveStorage::Variant 2017-12-22 05:04:25 +09:00
George Claghorn
2df99f8bc5 Delete MiniMagick tempfile when transformation fails 2017-12-18 22:01:48 -05:00
George Claghorn
a6eb2a27c3 Ensure MiniMagick tempfiles are properly unlinked after image transformation 2017-12-18 13:14:26 -05:00
George Claghorn
95117a2ce2 Convert non-web image (e.g. PSD) variants to PNG 2017-12-18 07:49:24 -05:00
George Claghorn
7b1dfac291 Update ActiveStorage::Blob#transformation docs [ci skip] 2017-12-16 19:41:43 -05:00
George Claghorn
af0caadb8d Handle invalid signed blob IDs gracefully 2017-12-15 19:26:53 -05:00
George Claghorn
311af752cf Restrict variants to variable image blobs 2017-12-15 10:45:00 -05:00
Jeffrey Guenther
1c5358e472 Merge branch 'master' into activestorage-guide 2017-12-14 19:03:28 -08:00
Sean Griffin
edc54fd206
Merge pull request #31434 from olivierlacan/boot-feedback
Provide instant feedback when booting Rails
2017-12-14 16:49:02 -07:00
Ryuta Kamizono
245c1dafa8 Enable Layout/LeadingCommentSpace to not allow cosmetic changes in the future
Follow up of #31432.
2017-12-14 17:30:54 +09:00
Olivier Lacan
acc03bb695 Provide instant feedback when booting Rails
I've noticed during pair/mob programming sessions with peers that
despite the speed boosts provided by Bootsnap and Spring, there is a
noticeable latency between firing a bin/rails server command and any
feedback being provided to the console. Depending on the size of the
application this lack of feedback can make it seem like something is
wrong when Rails is simply busy initializing.

This change may seem gratuitous but by just printing one line to STDOUT
we're giving a clear signal to the Rails user that their command has
been received and that Rails is indeed booting. It almost imperciptibly
makes Rails feel more responsive.

Sure the code doesn't look very fancy but there's no other appropriate
place I could think of putting it than boot.rb.

Compare these two GIFs of booting without and with this change:

Before:
![Without Boot Feedback](https://user-images.githubusercontent.com/65950/33964140-721041fc-e025-11e7-9b25-9d839ce92977.gif)

After:
![With Boot Feedback](https://user-images.githubusercontent.com/65950/33964151-79e12f86-e025-11e7-93e9-7a75c70d408f.gif)
2017-12-13 20:50:27 -05:00