Commit Graph

55 Commits

Author SHA1 Message Date
Anton Khamets
7c89948c41 Extend image_tag to accept ActiveStorage Attachments and Variants (#30084)
* Extend image_tag to accept ActiveStorage's Attachments and Variants

* Flip resolve_image_source around

* Add tests for the new use-cases of image_tag

* Remove the higher-level test

* Update image_tag documentation

* Add error states into the test suite

* Re-raise polymorhic_url's NoMethodError as ArgumentError

* delegate_missing_to will raise DelegationError instead of NoMethodError
2017-08-07 09:38:51 -05:00
bogdanvlviv
ee0378b638
Active Storage to 5.2.0.alpha inside activestorage/package.json
Follow #30083
2017-08-06 17:23:07 +00:00
Vipul A M
1fe55e94b7 Pass over Active Storage readme [ci skip] (#30086) 2017-08-06 13:44:45 +05:30
David Heinemeier Hansson
616f3611d5 Merge branch 'master' into ast-module 2017-08-05 09:11:02 -05:00
David Heinemeier Hansson
6df24c693e Merge pull request #30068 from kamipo/user_start_with_than_regexp
Use `content_type.start_with?("...")` than `content_type =~ /^.../`
2017-08-05 09:07:38 -05:00
David Heinemeier Hansson
b360f07bd2 Merge pull request #30081 from y-yagi/fix_ruby_warnings
Fix ruby warnings
2017-08-05 09:07:07 -05:00
David Heinemeier Hansson
ea5c99dce1 Merge pull request #30080 from georgeclaghorn/active-storage-secret-key-base
Active Storage: check for `app.secrets.secret_key_base`, not `app.config.secret_key_base`
2017-08-05 09:06:32 -05:00
David Heinemeier Hansson
1c96ca2d44 Merge pull request #30083 from koic/change_gem_version_of_active_storage_to_5_2_0
Change gem version of Active Storage to 5.2.0.alpha
2017-08-05 09:05:25 -05:00
George Claghorn
1ab1f87596 Check for app.secrets.secret_key_base, not app.config.secret_key_base
By default, apps only have the former set.
2017-08-05 10:03:53 -04:00
dixpac
2b9e04b6f9 Remove unecesarry exception variable 2017-08-05 14:05:18 +02:00
Koichi ITO
10a7ae39c6 Change gem version of Active Storage to 5.2.0.alpha 2017-08-05 14:24:31 +09:00
yuuji.yaginuma
46db463d06 Fix ruby warnings
This fixes following warnings:

```
test/models/variant_test.rb:11: warning: ambiguous first argument; put parentheses or a space even after `/' operator
lib/active_storage/attached/macros.rb:63: warning: instance variable @active_storage_attached_highlights not initialized
lib/active_storage/attached/macros.rb:25: warning: instance variable @active_storage_attached_avatar not initialized
```
2017-08-05 12:22:39 +09:00
claudiob
bb7599a6c8 module ActiveStorage, not ActiveStorage::Class
The reasons for this commit are:

- uniformity with the other Rails libraries
- (possibly) behave better with respect to autoloading
- fix the index in the generated documentation

Before this commit, run `rake rdoc` generates this left sidebar
(ActiveStorage entries are indexed twice, both inside and outside the module):

<img width="308" alt="before" src="https://user-images.githubusercontent.com/10076/28939523-7c087dec-7846-11e7-9289-38ed4a2930cd.png">

After this commit, run `rake rdoc` generates this left sidebar:
(ActiveStorage entries are only indexed inside the module):

<img width="303" alt="after" src="https://user-images.githubusercontent.com/10076/28939524-7c090be0-7846-11e7-8ee5-29dfecae548e.png">
2017-08-04 16:40:10 -07:00
yuuji.yaginuma
70d0e53db7 Fix repository URL [ci skip]
changed `rails/activestorage` to `rails/rails`.
2017-08-05 08:25:29 +09:00
Ryuta Kamizono
6768390a42 Use content_type.start_with?("...") than content_type =~ /^.../
`start_with?` is a little faster than regexp for prefix matching by a
fixed string.
2017-08-05 08:10:13 +09:00
Dino Maric
3179f089be Rename Azure to AzureStorage (#30057) 2017-08-04 17:57:02 -05:00
Claudio B
b9f0eb24ed Fix tests for AWS buckets that include a . (#30059)
If an AWS bucket name includes a `.` (e.g. `bucket.name`), then the canonical
URL for an object will start with "https://s3.amazonaws.com/bucket.name/"
and not with "https://bucket.name.s3.amazonaws.com/".

The URL tests have now been separated into two separate asserts, to ensure
that both the "s3.amazonaws.com" and the "bucket.name" components are included,
but not specifically in that order.
2017-08-04 17:56:14 -05:00
Rafael Mendonça França
77be872819 Do not change the entire codebase style only because of active_storage
We are already removing the braces around hash parameters in the last
argument in other places so we should not change the entire codebase
because of two places.
2017-08-03 17:45:58 -04:00
Rafael Mendonça França
b76f4e47e8 Fix all rubocop violations 2017-08-03 17:32:59 -04:00
Rafael França
66e5bf9d07 Merge pull request #30061 from claudiob/ast-rubocop
Make Rubocop happy about ActiveStorage
2017-08-03 17:24:45 -04:00
Rafael Mendonça França
5bfff1de54 We need to require the top file before individual one 2017-08-03 17:02:43 -04:00
Rafael Mendonça França
f601a01b2c Do not eager load ActiveRecord::Base
Everything inside the app directory of a engine is autoload/eager loaded automatically so we don't need to require them.
2017-08-03 16:57:48 -04:00
Rafael Mendonça França
da44e858ca There is no reason to single line methods here
I know those methods are unlikely to change but having one line method
is hard to read and also hard to modify.
2017-08-03 15:23:28 -04:00
claudiob
9d636c9e2f Make Rubocop happier about ActiveStorage
Running `rubocop activestorage` before this commit resulted in 20 offenses.
This commit only fixes:

- Trailing whitespace detected
- Space inside } missing
- Put one space between the method name and the first argument.

The other offenses are left since they are intentional according to
@georgeclaghorn (https://github.com/rails/rails/pull/30061#issuecomment-319999190)
2017-08-03 11:43:08 -07:00
David Heinemeier Hansson
624b6c210f Can't initialize a message verifier without a key base 2017-08-03 10:01:35 -05:00
Mike Gunderloy
c5ae4e52e3 Tweak requires
Omit azure-core (it's required by azure-storage), remove require:false to match other points.
2017-08-02 20:47:58 -05:00
Mike Gunderloy
d4f0b10319 Use release azure-core gem 2017-08-02 20:32:09 -05:00
Mike Gunderloy
0f2d3fb6da Update README.md 2017-08-02 19:55:10 -05:00
Mike Gunderloy
8aa742ff52 Add Azure gems to README 2017-08-02 18:29:51 -05:00
Ryuta Kamizono
815d1abf39 Fix Style/StringLiterals violations for Active Storage
```
% be rubocop -a --only Style/StringLiterals activestorage
Inspecting 74 files
........................................CCCCCCCCCC.C........CC.......C.C..

(snip)

74 files inspected, 31 offenses detected, 31 offenses corrected
```
2017-08-03 03:13:11 +09:00
Rolandas Barysas
b334ac80cf Add Azure to the available services list 2017-08-02 10:28:51 +03:00
Bryan Lim
f927de6fef Add Azure to readme
previously https://github.com/rails/activestorage/pull/86
2017-08-02 09:57:19 +08:00
David Heinemeier Hansson
ff3dad07ba Skip if credentials aren't provided 2017-08-01 17:22:20 -05:00
David Heinemeier Hansson
4f8be04f4e Fix dummy app for inclusion in Rails 2017-08-01 17:22:10 -05:00
David Heinemeier Hansson
13882d0067 Remove circular dependency 2017-08-01 17:12:57 -05:00
David Heinemeier Hansson
1ea49d68ff Follow same format as action_cable 2017-08-01 16:50:53 -05:00
David Heinemeier Hansson
b807b5b7e8 Cut down on installation advice 2017-08-01 16:28:05 -05:00
David Heinemeier Hansson
c622e532fc Drop README terms no longer relevant 2017-08-01 16:26:13 -05:00
David Heinemeier Hansson
e98eceb076 Rely on top-level files 2017-08-01 16:23:37 -05:00
Guillermo Iguaran
d66fadeb67 Merge pull request #30030 from claudiob/only-disk
Let ActiveStorage tests pass only for Disk
2017-08-01 13:05:23 -05:00
claudiob
98bb99ef61 Don't depend on HTTParty
"httparty" is only added in #30020 to write two tests to make PUT requests
against S3 and GCS.

The same requests can be made with net/http, removing a dependency from the Gemfile.
2017-08-01 10:56:39 -07:00
claudiob
8b20789cfc Let ActiveStorage tests pass only for Disk
If you have a "service/configurations.yml" file, but every single line is
commented out, then an error occurs when running tests:

```
git:active-storage-import~/code/rails/activestorage$ rake
~/code/rails/activestorage/test/test_helper.rb:17:in `<top (required)>': undefined method `deep_symbolize_keys' for false:FalseClass (NoMethodError)
	from ~/code/rails/activestorage/test/controllers/direct_uploads_controller_test.rb:1:in `require'
```

The reason is that `YAML.load(..an empty file content..)` simply returns `false`, and not `{}`.

This PR fixes this behavior so tests can also run when no remote service
is available.
2017-08-01 09:06:39 -07:00
David Heinemeier Hansson
a9cb1968b6 Setup travis to be able to run CI tests against S3 2017-07-31 17:51:16 -05:00
David Heinemeier Hansson
ba12811db2 Move the direct_upload: true convenience option from the activestorage helper into actionview 2017-07-31 16:23:37 -05:00
David Heinemeier Hansson
5beb87c7b1 Move to new storage.yml location 2017-07-31 16:18:39 -05:00
David Heinemeier Hansson
bb69b3e047 Directory and config installation now done by app_generator 2017-07-31 16:12:39 -05:00
David Heinemeier Hansson
9d1268375c Fix gitignore to be relative 2017-07-31 15:59:04 -05:00
David Heinemeier Hansson
a1a363a8aa Follow form from actioncable 2017-07-31 15:57:56 -05:00
David Heinemeier Hansson
90a8e0698d Use config/storage.yml as part of the skeleton and loading 2017-07-31 15:57:37 -05:00
David Heinemeier Hansson
54663f55ef Resolve gemspec typo 2017-07-31 15:55:55 -05:00