uploadcare-rails 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +5 -5
  2. data/Rakefile +5 -16
  3. data/lib/generators/templates/uploadcare_config_template.erb +138 -0
  4. data/lib/generators/uploadcare_config_generator.rb +7 -4
  5. data/lib/uploadcare/errors/type_error.rb +7 -0
  6. data/lib/uploadcare/rails/action_view/uploadcare_include_tags.rb +48 -0
  7. data/lib/uploadcare/rails/action_view/uploadcare_uploader_tags.rb +57 -0
  8. data/lib/uploadcare/rails/active_record/mount_uploadcare_file.rb +62 -0
  9. data/lib/uploadcare/rails/active_record/mount_uploadcare_file_group.rb +58 -0
  10. data/lib/uploadcare/rails/api/rest/base.rb +14 -0
  11. data/lib/uploadcare/rails/api/rest/conversion_api.rb +42 -0
  12. data/lib/uploadcare/rails/api/rest/file_api.rb +69 -0
  13. data/lib/uploadcare/rails/api/rest/group_api.rb +48 -0
  14. data/lib/uploadcare/rails/api/rest/project_api.rb +27 -0
  15. data/lib/uploadcare/rails/api/rest/webhook_api.rb +45 -0
  16. data/lib/uploadcare/rails/api/upload/base.rb +13 -0
  17. data/lib/uploadcare/rails/api/upload/upload_api.rb +53 -0
  18. data/lib/uploadcare/rails/configuration.rb +57 -0
  19. data/lib/uploadcare/rails/engine.rb +13 -17
  20. data/lib/uploadcare/rails/jobs/delete_file_job.rb +14 -0
  21. data/lib/uploadcare/rails/jobs/store_file_job.rb +14 -0
  22. data/lib/uploadcare/rails/jobs/store_group_job.rb +14 -0
  23. data/lib/uploadcare/rails/objects/concerns/loadable.rb +46 -0
  24. data/lib/uploadcare/rails/objects/file.rb +40 -20
  25. data/lib/uploadcare/rails/objects/group.rb +51 -57
  26. data/lib/uploadcare/rails/services/files_count_extractor.rb +14 -0
  27. data/lib/uploadcare/rails/services/id_extractor.rb +15 -0
  28. data/lib/uploadcare/rails/transformations/image_transformations.rb +45 -0
  29. data/lib/uploadcare/rails/version.rb +3 -1
  30. data/lib/uploadcare/rails.rb +10 -0
  31. data/lib/uploadcare-rails.rb +27 -16
  32. data/spec/fixtures/kitten.jpeg +0 -0
  33. data/spec/fixtures/vcr_cassettes/conversion_api_convert_document.yml +62 -0
  34. data/spec/fixtures/vcr_cassettes/conversion_api_convert_document_with_error.yml +62 -0
  35. data/spec/fixtures/vcr_cassettes/conversion_api_convert_video.yml +62 -0
  36. data/spec/fixtures/vcr_cassettes/conversion_api_convert_video_with_error.yml +62 -0
  37. data/spec/fixtures/vcr_cassettes/conversion_api_get_document_conversion_status.yml +59 -0
  38. data/spec/fixtures/vcr_cassettes/conversion_api_get_video_conversion_status.yml +59 -0
  39. data/spec/fixtures/vcr_cassettes/file_api_copy_file.yml +60 -0
  40. data/spec/fixtures/vcr_cassettes/file_api_delete_file.yml +58 -0
  41. data/spec/fixtures/vcr_cassettes/file_api_delete_files.yml +58 -0
  42. data/spec/fixtures/vcr_cassettes/file_api_get_file.yml +58 -0
  43. data/spec/fixtures/vcr_cassettes/file_api_get_files.yml +61 -0
  44. data/spec/fixtures/vcr_cassettes/file_api_load_file.yml +57 -0
  45. data/spec/fixtures/vcr_cassettes/file_api_store_file.yml +58 -0
  46. data/spec/fixtures/vcr_cassettes/file_api_store_files.yml +57 -0
  47. data/spec/fixtures/vcr_cassettes/group_api_create_group.yml +57 -0
  48. data/spec/fixtures/vcr_cassettes/group_api_get_group.yml +52 -0
  49. data/spec/fixtures/vcr_cassettes/group_api_get_groups.yml +57 -0
  50. data/spec/fixtures/vcr_cassettes/group_api_store_group.yml +57 -0
  51. data/spec/fixtures/vcr_cassettes/project_api_get_project.yml +59 -0
  52. data/spec/fixtures/vcr_cassettes/upload_upload_many_files.yml +55 -0
  53. data/spec/fixtures/vcr_cassettes/upload_upload_one_file.yml +105 -0
  54. data/spec/fixtures/vcr_cassettes/upload_upload_one_file_from_cdn.yml +111 -0
  55. data/spec/fixtures/vcr_cassettes/webhook_api_create_webhook.yml +59 -0
  56. data/spec/fixtures/vcr_cassettes/webhook_api_delete_webhook.yml +57 -0
  57. data/spec/fixtures/vcr_cassettes/webhook_api_get_webhooks.yml +59 -0
  58. data/spec/fixtures/vcr_cassettes/webhook_api_update_webhook.yml +59 -0
  59. data/spec/generators/uploadcare_config_generator_spec.rb +18 -26
  60. data/spec/spec_helper.rb +17 -69
  61. data/spec/support/generators.rb +8 -5
  62. data/spec/support/vcr.rb +14 -0
  63. data/spec/tmp/config/initializers/uploadcare.rb +138 -0
  64. data/spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb +40 -0
  65. data/spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb +46 -0
  66. data/spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb +33 -0
  67. data/spec/uploadcare/rails/active_record/mount_uploadcare_group_spec.rb +32 -0
  68. data/spec/uploadcare/rails/api/rest/conversion_api_spec.rb +110 -0
  69. data/spec/uploadcare/rails/api/rest/file_api_spec.rb +85 -0
  70. data/spec/uploadcare/rails/api/rest/group_api_spec.rb +61 -0
  71. data/spec/uploadcare/rails/api/rest/project_api_spec.rb +33 -0
  72. data/spec/uploadcare/rails/api/rest/webhook_api_spec.rb +59 -0
  73. data/spec/uploadcare/rails/api/upload/upload_api_spec.rb +82 -0
  74. data/spec/uploadcare/rails/jobs/delete_file_job_spec.rb +15 -0
  75. data/spec/uploadcare/rails/jobs/store_file_job_spec.rb +15 -0
  76. data/spec/uploadcare/rails/jobs/store_group_job_spec.rb +15 -0
  77. data/spec/uploadcare/rails/objects/file_spec.rb +77 -0
  78. data/spec/uploadcare/rails/objects/group_spec.rb +87 -0
  79. data/spec/uploadcare/rails/services/id_extractor_spec.rb +26 -0
  80. data/spec/uploadcare/rails/transformations/image_transformations_spec.rb +120 -0
  81. data/spec/uploadcare/rails_spec.rb +7 -0
  82. metadata +129 -351
  83. data/config/initializers/uploadcare.rb +0 -26
  84. data/config/uploadcare_defaults.yml +0 -12
  85. data/lib/generators/templates/uploadcare_config_template.yml +0 -67
  86. data/lib/tasks/uploadcare_rails_tasks.rake +0 -4
  87. data/lib/uploadcare/rails/action_view/include_tags.rb +0 -47
  88. data/lib/uploadcare/rails/action_view/uploader_tags.rb +0 -76
  89. data/lib/uploadcare/rails/active_record/has_file.rb +0 -92
  90. data/lib/uploadcare/rails/active_record/has_group.rb +0 -89
  91. data/lib/uploadcare/rails/active_record/has_object.rb +0 -9
  92. data/lib/uploadcare/rails/formtastic/formtastic.rb +0 -73
  93. data/lib/uploadcare/rails/operations.rb +0 -57
  94. data/lib/uploadcare/rails/settings.rb +0 -81
  95. data/lib/uploadcare/rails/simple_form/simple_form.rb +0 -63
  96. data/spec/caching/file_caching_spec.rb +0 -26
  97. data/spec/caching/group_caching_spec.rb +0 -40
  98. data/spec/dummy/README.rdoc +0 -28
  99. data/spec/dummy/Rakefile +0 -6
  100. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  101. data/spec/dummy/app/assets/javascripts/post_with_collections.js +0 -2
  102. data/spec/dummy/app/assets/javascripts/posts.js +0 -2
  103. data/spec/dummy/app/assets/javascripts/posts_with_collection_and_files.js +0 -2
  104. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  105. data/spec/dummy/app/assets/stylesheets/post_with_collections.css +0 -4
  106. data/spec/dummy/app/assets/stylesheets/posts.css +0 -4
  107. data/spec/dummy/app/assets/stylesheets/posts_with_collection_and_files.css +0 -4
  108. data/spec/dummy/app/assets/stylesheets/scaffold.css +0 -56
  109. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  110. data/spec/dummy/app/controllers/post_with_collections_controller.rb +0 -58
  111. data/spec/dummy/app/controllers/posts_controller.rb +0 -58
  112. data/spec/dummy/app/controllers/posts_with_collection_and_files_controller.rb +0 -58
  113. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  114. data/spec/dummy/app/helpers/post_with_collections_helper.rb +0 -2
  115. data/spec/dummy/app/helpers/posts_helper.rb +0 -2
  116. data/spec/dummy/app/helpers/posts_with_collection_and_files_helper.rb +0 -2
  117. data/spec/dummy/app/models/post.rb +0 -4
  118. data/spec/dummy/app/models/post_with_collection.rb +0 -4
  119. data/spec/dummy/app/models/posts_with_collection_and_file.rb +0 -4
  120. data/spec/dummy/app/views/layouts/application.html.erb +0 -16
  121. data/spec/dummy/app/views/post_with_collections/_form.html.erb +0 -25
  122. data/spec/dummy/app/views/post_with_collections/edit.html.erb +0 -6
  123. data/spec/dummy/app/views/post_with_collections/index.html.erb +0 -29
  124. data/spec/dummy/app/views/post_with_collections/new.html.erb +0 -5
  125. data/spec/dummy/app/views/post_with_collections/show.html.erb +0 -14
  126. data/spec/dummy/app/views/post_with_collections/show.json.jbuilder +0 -1
  127. data/spec/dummy/app/views/posts/_form.html.erb +0 -31
  128. data/spec/dummy/app/views/posts/edit.html.erb +0 -6
  129. data/spec/dummy/app/views/posts/index.html.erb +0 -37
  130. data/spec/dummy/app/views/posts/new.html.erb +0 -5
  131. data/spec/dummy/app/views/posts/post.json.builder +0 -1
  132. data/spec/dummy/app/views/posts/show.html.erb +0 -15
  133. data/spec/dummy/app/views/posts_with_collection_and_files/_form.html.erb +0 -27
  134. data/spec/dummy/app/views/posts_with_collection_and_files/edit.html.erb +0 -6
  135. data/spec/dummy/app/views/posts_with_collection_and_files/index.html.erb +0 -25
  136. data/spec/dummy/app/views/posts_with_collection_and_files/new.html.erb +0 -5
  137. data/spec/dummy/app/views/posts_with_collection_and_files/show.html.erb +0 -4
  138. data/spec/dummy/app/views/posts_with_collection_and_files/show.json.jbuilder +0 -1
  139. data/spec/dummy/bin/bundle +0 -3
  140. data/spec/dummy/bin/rails +0 -4
  141. data/spec/dummy/bin/rake +0 -4
  142. data/spec/dummy/config/application.rb +0 -23
  143. data/spec/dummy/config/boot.rb +0 -4
  144. data/spec/dummy/config/database.yml +0 -25
  145. data/spec/dummy/config/environment.rb +0 -5
  146. data/spec/dummy/config/environments/development.rb +0 -29
  147. data/spec/dummy/config/environments/production.rb +0 -80
  148. data/spec/dummy/config/environments/test.rb +0 -36
  149. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  150. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  151. data/spec/dummy/config/initializers/formtastic.rb +0 -111
  152. data/spec/dummy/config/initializers/inflections.rb +0 -16
  153. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  154. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  155. data/spec/dummy/config/initializers/session_store.rb +0 -3
  156. data/spec/dummy/config/initializers/simple_form.rb +0 -167
  157. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  158. data/spec/dummy/config/locales/en.yml +0 -23
  159. data/spec/dummy/config/locales/simple_form.en.yml +0 -31
  160. data/spec/dummy/config/routes.rb +0 -63
  161. data/spec/dummy/config/uploadcare.yml +0 -64
  162. data/spec/dummy/config.ru +0 -4
  163. data/spec/dummy/db/migrate/20171012001801_create_tables.rb +0 -27
  164. data/spec/dummy/db/migrate/20181001132710_add_other_file_to_post.rb +0 -8
  165. data/spec/dummy/db/migrate/20181001141434_add_other_file_to_post_with_collections.rb +0 -8
  166. data/spec/dummy/db/schema.rb +0 -39
  167. data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +0 -13
  168. data/spec/dummy/public/404.html +0 -58
  169. data/spec/dummy/public/422.html +0 -58
  170. data/spec/dummy/public/500.html +0 -57
  171. data/spec/dummy/public/favicon.ico +0 -0
  172. data/spec/helpers/form_helpers_has_file_spec.rb +0 -30
  173. data/spec/helpers/form_helpers_has_group_spec.rb +0 -30
  174. data/spec/helpers/form_helpers_spec.rb +0 -33
  175. data/spec/helpers/formtastic_spec.rb +0 -25
  176. data/spec/helpers/include_tags_spec.rb +0 -54
  177. data/spec/helpers/simple_form_spec.rb +0 -25
  178. data/spec/helpers/uploader_tags_spec.rb +0 -21
  179. data/spec/models/has_both_file_and_group_spec.rb +0 -43
  180. data/spec/models/has_file_spec.rb +0 -46
  181. data/spec/models/has_group_spec.rb +0 -57
  182. data/spec/models/has_several_files_spec.rb +0 -55
  183. data/spec/models/has_several_groups_spec.rb +0 -62
  184. data/spec/objects/file_spec.rb +0 -27
  185. data/spec/objects/group_spec.rb +0 -51
  186. data/spec/operations_spec.rb +0 -28
  187. data/spec/uploadcare/rails/settings_spec.rb +0 -136
  188. data/spec/uploadcare_rails_settings_spec.rb +0 -56
  189. data/spec/view.png +0 -0
  190. data/spec/view2.jpg +0 -0
@@ -1,25 +0,0 @@
1
- <h1>Listing posts_with_collection_and_files</h1>
2
-
3
- <table>
4
- <thead>
5
- <tr>
6
- <th></th>
7
- <th></th>
8
- <th></th>
9
- </tr>
10
- </thead>
11
-
12
- <tbody>
13
- <% @posts_with_collection_and_files.each do |posts_with_collection_and_file| %>
14
- <tr>
15
- <td><%= link_to 'Show', posts_with_collection_and_file %></td>
16
- <td><%= link_to 'Edit', edit_posts_with_collection_and_file_path(posts_with_collection_and_file) %></td>
17
- <td><%= link_to 'Destroy', posts_with_collection_and_file, method: :delete, data: { confirm: 'Are you sure?' } %></td>
18
- </tr>
19
- <% end %>
20
- </tbody>
21
- </table>
22
-
23
- <br>
24
-
25
- <%= link_to 'New Posts with collection and file', new_posts_with_collection_and_file_path %>
@@ -1,5 +0,0 @@
1
- <h1>New posts_with_collection_and_file</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Back', posts_with_collection_and_files_path %>
@@ -1,4 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <%= link_to 'Edit', edit_posts_with_collection_and_file_path(@posts_with_collection_and_file) %> |
4
- <%= link_to 'Back', posts_with_collection_and_files_path %>
@@ -1 +0,0 @@
1
- json.extract! @post, :id, :title, :file, :group, :created_at, :updated_at
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
data/spec/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
data/spec/dummy/bin/rake DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,23 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- Bundler.require(*Rails.groups)
6
- require "uploadcare-rails"
7
-
8
- module Dummy
9
- class Application < Rails::Application
10
- # Settings in config/environments/* take precedence over those specified here.
11
- # Application configuration should go into files in config/initializers
12
- # -- all .rb files in that directory are automatically loaded.
13
-
14
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
- # config.time_zone = 'Central Time (US & Canada)'
17
-
18
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
- # config.i18n.default_locale = :de
21
- end
22
- end
23
-
@@ -1,4 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Dummy::Application.initialize!
@@ -1,29 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
- config.eager_load = false
11
-
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send.
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger.
20
- config.active_support.deprecation = :log
21
-
22
- # Raise an error on page load if there are pending migrations
23
- config.active_record.migration_error = :page_load
24
-
25
- # Debug mode disables concatenation and preprocessing of assets.
26
- # This option may cause significant delays in view rendering with a large
27
- # number of complex assets.
28
- config.assets.debug = true
29
- end
@@ -1,80 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # Code is not reloaded between requests.
5
- config.cache_classes = true
6
-
7
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
9
- # and those relying on copy on write to perform better.
10
- # Rake tasks automatically ignore this option for performance.
11
- config.eager_load = true
12
-
13
- # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_files = false
24
-
25
- # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
27
- # config.assets.css_compressor = :sass
28
-
29
- # Do not fallback to assets pipeline if a precompiled asset is missed.
30
- config.assets.compile = false
31
-
32
- # Generate digests for assets URLs.
33
- config.assets.digest = true
34
-
35
- # Version of your assets, change this if you want to expire all your assets.
36
- config.assets.version = '1.0'
37
-
38
- # Specifies the header that your server uses for sending files.
39
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
-
42
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
- # config.force_ssl = true
44
-
45
- # Set to :debug to see everything in the log.
46
- config.log_level = :info
47
-
48
- # Prepend all log lines with the following tags.
49
- # config.log_tags = [ :subdomain, :uuid ]
50
-
51
- # Use a different logger for distributed setups.
52
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
-
54
- # Use a different cache store in production.
55
- # config.cache_store = :mem_cache_store
56
-
57
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
- # config.action_controller.asset_host = "http://assets.example.com"
59
-
60
- # Precompile additional assets.
61
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
- # config.assets.precompile += %w( search.js )
63
-
64
- # Ignore bad email addresses and do not raise email delivery errors.
65
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
- # config.action_mailer.raise_delivery_errors = false
67
-
68
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
- # the I18n.default_locale when a translation can not be found).
70
- config.i18n.fallbacks = true
71
-
72
- # Send deprecation notices to registered listeners.
73
- config.active_support.deprecation = :notify
74
-
75
- # Disable automatic flushing of the log to improve performance.
76
- # config.autoflush_log = false
77
-
78
- # Use default logging formatter so that PID and timestamp are not suppressed.
79
- config.log_formatter = ::Logger::Formatter.new
80
- end
@@ -1,36 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = "public, max-age=3600"
18
-
19
- # Show full error reports and disable caching.
20
- config.consider_all_requests_local = true
21
- config.action_controller.perform_caching = false
22
-
23
- # Raise exceptions instead of rendering exception templates.
24
- config.action_dispatch.show_exceptions = false
25
-
26
- # Disable request forgery protection in test environment.
27
- config.action_controller.allow_forgery_protection = false
28
-
29
- # Tell Action Mailer not to deliver emails to the real world.
30
- # The :test delivery method accumulates sent emails in the
31
- # ActionMailer::Base.deliveries array.
32
- config.action_mailer.delivery_method = :test
33
-
34
- # Print deprecation notices to the stderr.
35
- config.active_support.deprecation = :stderr
36
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]
@@ -1,111 +0,0 @@
1
- # encoding: utf-8
2
- require "formtastic"
3
-
4
- # Set the default text field size when input is a string. Default is nil.
5
- # Formtastic::FormBuilder.default_text_field_size = 50
6
-
7
- # Set the default text area height when input is a text. Default is 20.
8
- # Formtastic::FormBuilder.default_text_area_height = 5
9
-
10
- # Set the default text area width when input is a text. Default is nil.
11
- # Formtastic::FormBuilder.default_text_area_width = 50
12
-
13
- # Should all fields be considered "required" by default?
14
- # Defaults to true.
15
- # Formtastic::FormBuilder.all_fields_required_by_default = true
16
-
17
- # Should select fields have a blank option/prompt by default?
18
- # Defaults to true.
19
- # Formtastic::FormBuilder.include_blank_for_select_by_default = true
20
-
21
- # Set the string that will be appended to the labels/fieldsets which are required
22
- # It accepts string or procs and the default is a localized version of
23
- # '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
24
- # in your locale, it will replace the abbr title properly. But if you don't want to use
25
- # abbr tag, you can simply give a string as below
26
- # Formtastic::FormBuilder.required_string = "(required)"
27
-
28
- # Set the string that will be appended to the labels/fieldsets which are optional
29
- # Defaults to an empty string ("") and also accepts procs (see required_string above)
30
- # Formtastic::FormBuilder.optional_string = "(optional)"
31
-
32
- # Set the way inline errors will be displayed.
33
- # Defaults to :sentence, valid options are :sentence, :list, :first and :none
34
- # Formtastic::FormBuilder.inline_errors = :sentence
35
- # Formtastic uses the following classes as default for hints, inline_errors and error list
36
-
37
- # If you override the class here, please ensure to override it in your stylesheets as well
38
- # Formtastic::FormBuilder.default_hint_class = "inline-hints"
39
- # Formtastic::FormBuilder.default_inline_error_class = "inline-errors"
40
- # Formtastic::FormBuilder.default_error_list_class = "errors"
41
-
42
- # Set the method to call on label text to transform or format it for human-friendly
43
- # reading when formtastic is used without object. Defaults to :humanize.
44
- # Formtastic::FormBuilder.label_str_method = :humanize
45
-
46
- # Set the array of methods to try calling on parent objects in :select and :radio inputs
47
- # for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
48
- # that is found on the object will be used.
49
- # Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
50
- # Formtastic::FormBuilder.collection_label_methods = [
51
- # "to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
52
-
53
- # Specifies if labels/hints for input fields automatically be looked up using I18n.
54
- # Default value: true. Overridden for specific fields by setting value to true,
55
- # i.e. :label => true, or :hint => true (or opposite depending on initialized value)
56
- # Formtastic::FormBuilder.i18n_lookups_by_default = false
57
-
58
- # Specifies if I18n lookups of the default I18n Localizer should be cached to improve performance.
59
- # Defaults to true.
60
- # Formtastic::FormBuilder.i18n_cache_lookups = false
61
-
62
- # Specifies the class to use for localization lookups. You can create your own
63
- # class and use it instead by subclassing Formtastic::Localizer (which is the default).
64
- # Formtastic::FormBuilder.i18n_localizer = MyOwnLocalizer
65
-
66
- # You can add custom inputs or override parts of Formtastic by subclassing Formtastic::FormBuilder and
67
- # specifying that class here. Defaults to Formtastic::FormBuilder.
68
- # Formtastic::Helpers::FormHelper.builder = MyCustomBuilder
69
-
70
- # All formtastic forms have a class that indicates that they are just that. You
71
- # can change it to any class you want.
72
- # Formtastic::Helpers::FormHelper.default_form_class = 'formtastic'
73
-
74
- # Formtastic will infer a class name from the model, array, string ot symbol you pass to the
75
- # form builder. You can customize the way that class is presented by overriding
76
- # this proc.
77
- # Formtastic::Helpers::FormHelper.default_form_model_class_proc = proc { |model_class_name| model_class_name }
78
-
79
- # Allows to set a custom field_error_proc wrapper. By default this wrapper
80
- # is disabled since `formtastic` already adds an error class to the LI tag
81
- # containing the input.
82
- # Formtastic::Helpers::FormHelper.formtastic_field_error_proc = proc { |html_tag, instance_tag| html_tag }
83
-
84
- # You can opt-in to Formtastic's use of the HTML5 `required` attribute on `<input>`, `<select>`
85
- # and `<textarea>` tags by setting this to true (defaults to false).
86
- # Formtastic::FormBuilder.use_required_attribute = false
87
-
88
- # You can opt-in to new HTML5 browser validations (for things like email and url inputs) by setting
89
- # this to true. Doing so will add a `novalidate` attribute to the `<form>` tag.
90
- # See http://diveintohtml5.org/forms.html#validation for more info.
91
- # Formtastic::FormBuilder.perform_browser_validations = true
92
-
93
- # By creating custom input class finder, you can change how input classes are looked up.
94
- # For example you can make it to search for TextInputFilter instead of TextInput.
95
- # See # TODO: add link # for more information
96
- # NOTE: this behavior will be default from Formtastic 4.0
97
- Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
98
-
99
- # Define custom namespaces in which to look up your Input classes. Default is
100
- # to look up in the global scope and in Formtastic::Inputs.
101
- # Formtastic::FormBuilder.input_namespaces = [ ::Object, ::MyInputsModule, ::Formtastic::Inputs ]
102
-
103
- # By creating custom action class finder, you can change how action classes are looked up.
104
- # For example you can make it to search for MyButtonAction instead of ButtonAction.
105
- # See # TODO: add link # for more information
106
- # NOTE: this behavior will be default from Formtastic 4.0
107
- Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder
108
-
109
- # Define custom namespaces in which to look up your Action classes. Default is
110
- # to look up in the global scope and in Formtastic::Actions.
111
- # Formtastic::FormBuilder.action_namespaces = [ ::Object, ::MyActionsModule, ::Formtastic::Actions ]
@@ -1,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,12 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure your secret_key_base is kept private
11
- # if you're sharing your code publicly.
12
- Dummy::Application.config.secret_key_base = 'e9cc66eda006b0dbc31fda62cbc513e20fbd55f110eabf1dfc843ebd79759e2028edf86654f5c6a6100a60b7c96c9c5a7d46293da22dfd24db2726880313f1a7'
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
@@ -1,167 +0,0 @@
1
- require "simple_form"
2
- # Use this setup block to configure all options available in SimpleForm.
3
- SimpleForm.setup do |config|
4
- # Wrappers are used by the form builder to generate a
5
- # complete input. You can remove any component from the
6
- # wrapper, change the order or even add your own to the
7
- # stack. The options given below are used to wrap the
8
- # whole input.
9
- config.wrappers :default, class: :input,
10
- hint_class: :field_with_hint, error_class: :field_with_errors do |b|
11
- ## Extensions enabled by default
12
- # Any of these extensions can be disabled for a
13
- # given input by passing: `f.input EXTENSION_NAME => false`.
14
- # You can make any of these extensions optional by
15
- # renaming `b.use` to `b.optional`.
16
-
17
- # Determines whether to use HTML5 (:email, :url, ...)
18
- # and required attributes
19
- b.use :html5
20
-
21
- # Calculates placeholders automatically from I18n
22
- # You can also pass a string as f.input placeholder: "Placeholder"
23
- b.use :placeholder
24
-
25
- ## Optional extensions
26
- # They are disabled unless you pass `f.input EXTENSION_NAME => true`
27
- # to the input. If so, they will retrieve the values from the model
28
- # if any exists. If you want to enable any of those
29
- # extensions by default, you can change `b.optional` to `b.use`.
30
-
31
- # Calculates maxlength from length validations for string inputs
32
- b.optional :maxlength
33
-
34
- # Calculates pattern from format validations for string inputs
35
- b.optional :pattern
36
-
37
- # Calculates min and max from length validations for numeric inputs
38
- b.optional :min_max
39
-
40
- # Calculates readonly automatically from readonly attributes
41
- b.optional :readonly
42
-
43
- ## Inputs
44
- b.use :label_input
45
- b.use :hint, wrap_with: { tag: :span, class: :hint }
46
- b.use :error, wrap_with: { tag: :span, class: :error }
47
-
48
- ## full_messages_for
49
- # If you want to display the full error message for the attribute, you can
50
- # use the component :full_error, like:
51
- #
52
- # b.use :full_error, wrap_with: { tag: :span, class: :error }
53
- end
54
-
55
- # The default wrapper to be used by the FormBuilder.
56
- config.default_wrapper = :default
57
-
58
- # Define the way to render check boxes / radio buttons with labels.
59
- # Defaults to :nested for bootstrap config.
60
- # inline: input + label
61
- # nested: label > input
62
- config.boolean_style = :nested
63
-
64
- # Default class for buttons
65
- config.button_class = 'btn'
66
-
67
- # Method used to tidy up errors. Specify any Rails Array method.
68
- # :first lists the first message for each field.
69
- # Use :to_sentence to list all errors for each field.
70
- # config.error_method = :first
71
-
72
- # Default tag used for error notification helper.
73
- config.error_notification_tag = :div
74
-
75
- # CSS class to add for error notification helper.
76
- config.error_notification_class = 'error_notification'
77
-
78
- # ID to add for error notification helper.
79
- # config.error_notification_id = nil
80
-
81
- # Series of attempts to detect a default label method for collection.
82
- # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
83
-
84
- # Series of attempts to detect a default value method for collection.
85
- # config.collection_value_methods = [ :id, :to_s ]
86
-
87
- # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
88
- # config.collection_wrapper_tag = nil
89
-
90
- # You can define the class to use on all collection wrappers. Defaulting to none.
91
- # config.collection_wrapper_class = nil
92
-
93
- # You can wrap each item in a collection of radio/check boxes with a tag,
94
- # defaulting to :span. Please note that when using :boolean_style = :nested,
95
- # SimpleForm will force this option to be a label.
96
- # config.item_wrapper_tag = :span
97
-
98
- # You can define a class to use in all item wrappers. Defaulting to none.
99
- # config.item_wrapper_class = nil
100
-
101
- # How the label text should be generated altogether with the required text.
102
- # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
103
-
104
- # You can define the class to use on all labels. Default is nil.
105
- # config.label_class = nil
106
-
107
- # You can define the default class to be used on forms. Can be overriden
108
- # with `html: { :class }`. Defaulting to none.
109
- # config.default_form_class = nil
110
-
111
- # You can define which elements should obtain additional classes
112
- # config.generate_additional_classes_for = [:wrapper, :label, :input]
113
-
114
- # Whether attributes are required by default (or not). Default is true.
115
- # config.required_by_default = true
116
-
117
- # Tell browsers whether to use the native HTML5 validations (novalidate form option).
118
- # These validations are enabled in SimpleForm's internal config but disabled by default
119
- # in this configuration, which is recommended due to some quirks from different browsers.
120
- # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
121
- # change this configuration to true.
122
- config.browser_validations = false
123
-
124
- # Collection of methods to detect if a file type was given.
125
- # config.file_methods = [ :mounted_as, :file?, :public_filename ]
126
-
127
- # Custom mappings for input types. This should be a hash containing a regexp
128
- # to match as key, and the input type that will be used when the field name
129
- # matches the regexp as value.
130
- # config.input_mappings = { /count/ => :integer }
131
-
132
- # Custom wrappers for input types. This should be a hash containing an input
133
- # type as key and the wrapper that will be used for all inputs with specified type.
134
- # config.wrapper_mappings = { string: :prepend }
135
-
136
- # Namespaces where SimpleForm should look for custom input classes that
137
- # override default inputs.
138
- # config.custom_inputs_namespaces << "CustomInputs"
139
-
140
- # Default priority for time_zone inputs.
141
- # config.time_zone_priority = nil
142
-
143
- # Default priority for country inputs.
144
- # config.country_priority = nil
145
-
146
- # When false, do not use translations for labels.
147
- # config.translate_labels = true
148
-
149
- # Automatically discover new inputs in Rails' autoload path.
150
- # config.inputs_discovery = true
151
-
152
- # Cache SimpleForm inputs discovery
153
- # config.cache_discovery = !Rails.env.development?
154
-
155
- # Default class for inputs
156
- # config.input_class = nil
157
-
158
- # Define the default class of the input wrapper of the boolean input.
159
- config.boolean_label_class = 'checkbox'
160
-
161
- # Defines if the default input wrapper class should be included in radio
162
- # collection wrappers.
163
- # config.include_default_input_wrapper_class = true
164
-
165
- # Defines which i18n scope will be used in Simple Form.
166
- # config.i18n_scope = 'simple_form'
167
- end
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
- end
10
-
11
- # To enable root element in JSON for ActiveRecord objects.
12
- # ActiveSupport.on_load(:active_record) do
13
- # self.include_root_in_json = true
14
- # end
@@ -1,23 +0,0 @@
1
- # Files in the config/locales directory are used for internationalization
2
- # and are automatically loaded by Rails. If you want to use locales other
3
- # than English, add the necessary files in this directory.
4
- #
5
- # To use the locales, use `I18n.t`:
6
- #
7
- # I18n.t 'hello'
8
- #
9
- # In views, this is aliased to just `t`:
10
- #
11
- # <%= t('hello') %>
12
- #
13
- # To use a different locale, set it with `I18n.locale`:
14
- #
15
- # I18n.locale = :es
16
- #
17
- # This would use the information in config/locales/es.yml.
18
- #
19
- # To learn more, please read the Rails Internationalization guide
20
- # available at http://guides.rubyonrails.org/i18n.html.
21
-
22
- en:
23
- hello: "Hello world"