kt-paperclip 7.2.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +24 -56
  4. data/lib/generators/paperclip/paperclip_generator.rb +3 -1
  5. data/lib/kt-paperclip.rb +2 -0
  6. data/lib/paperclip/attachment.rb +49 -30
  7. data/lib/paperclip/attachment_registry.rb +2 -0
  8. data/lib/paperclip/callbacks.rb +7 -4
  9. data/lib/paperclip/commands/imagemagick/geometry_parser.rb +63 -0
  10. data/lib/paperclip/commands/imagemagick/version_detector.rb +41 -0
  11. data/lib/paperclip/commands/imagemagick.rb +44 -0
  12. data/lib/paperclip/commands/runner.rb +38 -0
  13. data/lib/paperclip/commands/unix_file.rb +28 -0
  14. data/lib/paperclip/content_type_detector.rb +31 -32
  15. data/lib/paperclip/errors.rb +2 -0
  16. data/lib/paperclip/file_command_content_type_detector.rb +11 -12
  17. data/lib/paperclip/filename_cleaner.rb +2 -0
  18. data/lib/paperclip/geometry.rb +22 -7
  19. data/lib/paperclip/geometry_detector_factory.rb +11 -31
  20. data/lib/paperclip/geometry_parser_factory.rb +13 -17
  21. data/lib/paperclip/glue.rb +2 -0
  22. data/lib/paperclip/has_attached_file.rb +2 -0
  23. data/lib/paperclip/helpers.rb +5 -25
  24. data/lib/paperclip/interpolations/plural_cache.rb +2 -0
  25. data/lib/paperclip/interpolations.rb +2 -0
  26. data/lib/paperclip/io_adapters/abstract_adapter.rb +3 -1
  27. data/lib/paperclip/io_adapters/attachment_adapter.rb +11 -0
  28. data/lib/paperclip/io_adapters/data_uri_adapter.rb +2 -0
  29. data/lib/paperclip/io_adapters/empty_string_adapter.rb +2 -0
  30. data/lib/paperclip/io_adapters/file_adapter.rb +2 -0
  31. data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +2 -0
  32. data/lib/paperclip/io_adapters/identity_adapter.rb +2 -0
  33. data/lib/paperclip/io_adapters/nil_adapter.rb +2 -0
  34. data/lib/paperclip/io_adapters/registry.rb +2 -0
  35. data/lib/paperclip/io_adapters/stringio_adapter.rb +2 -0
  36. data/lib/paperclip/io_adapters/uploaded_file_adapter.rb +2 -0
  37. data/lib/paperclip/io_adapters/uri_adapter.rb +5 -13
  38. data/lib/paperclip/locales/fr.yml +18 -0
  39. data/lib/paperclip/locales/gd.yml +1 -1
  40. data/lib/paperclip/logger.rb +2 -0
  41. data/lib/paperclip/matchers/have_attached_file_matcher.rb +2 -0
  42. data/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +5 -3
  43. data/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +2 -0
  44. data/lib/paperclip/matchers/validate_attachment_size_matcher.rb +2 -0
  45. data/lib/paperclip/matchers.rb +2 -0
  46. data/lib/paperclip/media_type_spoof_detector.rb +3 -10
  47. data/lib/paperclip/missing_attachment_styles.rb +2 -0
  48. data/lib/paperclip/processor.rb +6 -19
  49. data/lib/paperclip/processor_helpers.rb +2 -0
  50. data/lib/paperclip/rails_environment.rb +2 -0
  51. data/lib/paperclip/railtie.rb +2 -0
  52. data/lib/paperclip/schema.rb +6 -4
  53. data/lib/paperclip/storage/filesystem.rb +2 -0
  54. data/lib/paperclip/storage/fog.rb +13 -4
  55. data/lib/paperclip/storage/s3.rb +27 -5
  56. data/lib/paperclip/storage.rb +2 -0
  57. data/lib/paperclip/style.rb +2 -0
  58. data/lib/paperclip/tempfile.rb +2 -0
  59. data/lib/paperclip/tempfile_factory.rb +2 -0
  60. data/lib/paperclip/thumbnail.rb +9 -10
  61. data/lib/paperclip/url_generator.rb +2 -0
  62. data/lib/paperclip/validators/attachment_content_type_validator.rb +2 -0
  63. data/lib/paperclip/validators/attachment_file_name_validator.rb +2 -0
  64. data/lib/paperclip/validators/attachment_file_type_ignorance_validator.rb +2 -0
  65. data/lib/paperclip/validators/attachment_presence_validator.rb +2 -0
  66. data/lib/paperclip/validators/attachment_size_validator.rb +2 -0
  67. data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +2 -0
  68. data/lib/paperclip/validators.rb +2 -0
  69. data/lib/paperclip/version.rb +3 -1
  70. data/lib/paperclip.rb +25 -4
  71. data/lib/tasks/paperclip.rake +9 -4
  72. data/shoulda_macros/paperclip.rb +2 -0
  73. metadata +19 -538
  74. data/.codeclimate.yml +0 -17
  75. data/.github/FUNDING.yml +0 -3
  76. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  77. data/.github/ISSUE_TEMPLATE/custom.md +0 -10
  78. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  79. data/.gitignore +0 -19
  80. data/.hound.yml +0 -3
  81. data/.rubocop.yml +0 -1061
  82. data/.travis.yml +0 -45
  83. data/Appraisals +0 -30
  84. data/CONTRIBUTING.md +0 -85
  85. data/Gemfile +0 -19
  86. data/NEWS +0 -554
  87. data/RELEASING.md +0 -17
  88. data/Rakefile +0 -52
  89. data/UPGRADING +0 -17
  90. data/features/basic_integration.feature +0 -85
  91. data/features/migration.feature +0 -29
  92. data/features/rake_tasks.feature +0 -62
  93. data/features/step_definitions/attachment_steps.rb +0 -120
  94. data/features/step_definitions/html_steps.rb +0 -15
  95. data/features/step_definitions/rails_steps.rb +0 -257
  96. data/features/step_definitions/s3_steps.rb +0 -14
  97. data/features/step_definitions/web_steps.rb +0 -106
  98. data/features/support/env.rb +0 -12
  99. data/features/support/fakeweb.rb +0 -11
  100. data/features/support/file_helpers.rb +0 -34
  101. data/features/support/fixtures/boot_config.txt +0 -15
  102. data/features/support/fixtures/gemfile.txt +0 -5
  103. data/features/support/fixtures/preinitializer.txt +0 -20
  104. data/features/support/paths.rb +0 -28
  105. data/features/support/rails.rb +0 -39
  106. data/features/support/selectors.rb +0 -19
  107. data/gemfiles/4.2.gemfile +0 -20
  108. data/gemfiles/5.0.gemfile +0 -20
  109. data/gemfiles/5.1.gemfile +0 -20
  110. data/gemfiles/5.2.gemfile +0 -20
  111. data/gemfiles/6.0.gemfile +0 -20
  112. data/gemfiles/6.1.gemfile +0 -21
  113. data/gemfiles/7.0.gemfile +0 -21
  114. data/paperclip.gemspec +0 -50
  115. data/spec/database.yml +0 -4
  116. data/spec/paperclip/attachment_definitions_spec.rb +0 -13
  117. data/spec/paperclip/attachment_processing_spec.rb +0 -79
  118. data/spec/paperclip/attachment_registry_spec.rb +0 -158
  119. data/spec/paperclip/attachment_spec.rb +0 -1590
  120. data/spec/paperclip/content_type_detector_spec.rb +0 -54
  121. data/spec/paperclip/file_command_content_type_detector_spec.rb +0 -40
  122. data/spec/paperclip/filename_cleaner_spec.rb +0 -13
  123. data/spec/paperclip/geometry_detector_spec.rb +0 -47
  124. data/spec/paperclip/geometry_parser_spec.rb +0 -73
  125. data/spec/paperclip/geometry_spec.rb +0 -267
  126. data/spec/paperclip/glue_spec.rb +0 -63
  127. data/spec/paperclip/has_attached_file_spec.rb +0 -78
  128. data/spec/paperclip/integration_spec.rb +0 -702
  129. data/spec/paperclip/interpolations_spec.rb +0 -270
  130. data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +0 -160
  131. data/spec/paperclip/io_adapters/attachment_adapter_spec.rb +0 -140
  132. data/spec/paperclip/io_adapters/data_uri_adapter_spec.rb +0 -88
  133. data/spec/paperclip/io_adapters/empty_string_adapter_spec.rb +0 -17
  134. data/spec/paperclip/io_adapters/file_adapter_spec.rb +0 -131
  135. data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +0 -142
  136. data/spec/paperclip/io_adapters/identity_adapter_spec.rb +0 -8
  137. data/spec/paperclip/io_adapters/nil_adapter_spec.rb +0 -25
  138. data/spec/paperclip/io_adapters/registry_spec.rb +0 -35
  139. data/spec/paperclip/io_adapters/stringio_adapter_spec.rb +0 -64
  140. data/spec/paperclip/io_adapters/uploaded_file_adapter_spec.rb +0 -146
  141. data/spec/paperclip/io_adapters/uri_adapter_spec.rb +0 -231
  142. data/spec/paperclip/matchers/have_attached_file_matcher_spec.rb +0 -19
  143. data/spec/paperclip/matchers/validate_attachment_content_type_matcher_spec.rb +0 -108
  144. data/spec/paperclip/matchers/validate_attachment_presence_matcher_spec.rb +0 -69
  145. data/spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb +0 -88
  146. data/spec/paperclip/media_type_spoof_detector_spec.rb +0 -126
  147. data/spec/paperclip/meta_class_spec.rb +0 -30
  148. data/spec/paperclip/paperclip_missing_attachment_styles_spec.rb +0 -88
  149. data/spec/paperclip/paperclip_spec.rb +0 -196
  150. data/spec/paperclip/plural_cache_spec.rb +0 -37
  151. data/spec/paperclip/processor_helpers_spec.rb +0 -57
  152. data/spec/paperclip/processor_spec.rb +0 -26
  153. data/spec/paperclip/rails_environment_spec.rb +0 -30
  154. data/spec/paperclip/rake_spec.rb +0 -103
  155. data/spec/paperclip/schema_spec.rb +0 -252
  156. data/spec/paperclip/storage/filesystem_spec.rb +0 -102
  157. data/spec/paperclip/storage/fog_spec.rb +0 -606
  158. data/spec/paperclip/storage/s3_live_spec.rb +0 -188
  159. data/spec/paperclip/storage/s3_spec.rb +0 -1878
  160. data/spec/paperclip/style_spec.rb +0 -251
  161. data/spec/paperclip/tempfile_factory_spec.rb +0 -33
  162. data/spec/paperclip/tempfile_spec.rb +0 -35
  163. data/spec/paperclip/thumbnail_spec.rb +0 -504
  164. data/spec/paperclip/url_generator_spec.rb +0 -231
  165. data/spec/paperclip/validators/attachment_content_type_validator_spec.rb +0 -410
  166. data/spec/paperclip/validators/attachment_file_name_validator_spec.rb +0 -249
  167. data/spec/paperclip/validators/attachment_presence_validator_spec.rb +0 -85
  168. data/spec/paperclip/validators/attachment_size_validator_spec.rb +0 -325
  169. data/spec/paperclip/validators/media_type_spoof_detection_validator_spec.rb +0 -48
  170. data/spec/paperclip/validators_spec.rb +0 -179
  171. data/spec/spec_helper.rb +0 -46
  172. data/spec/support/assertions.rb +0 -84
  173. data/spec/support/fake_model.rb +0 -24
  174. data/spec/support/fake_rails.rb +0 -12
  175. data/spec/support/fixtures/12k.png +0 -0
  176. data/spec/support/fixtures/50x50.png +0 -0
  177. data/spec/support/fixtures/5k.png +0 -0
  178. data/spec/support/fixtures/animated +0 -0
  179. data/spec/support/fixtures/animated.gif +0 -0
  180. data/spec/support/fixtures/animated.unknown +0 -0
  181. data/spec/support/fixtures/aws_s3.yml +0 -13
  182. data/spec/support/fixtures/bad.png +0 -1
  183. data/spec/support/fixtures/empty.html +0 -1
  184. data/spec/support/fixtures/empty.xlsx +0 -0
  185. data/spec/support/fixtures/fog.yml +0 -8
  186. data/spec/support/fixtures/rotated.jpg +0 -0
  187. data/spec/support/fixtures/s3.yml +0 -8
  188. data/spec/support/fixtures/sample.xlsm +0 -0
  189. data/spec/support/fixtures/spaced file.jpg +0 -0
  190. data/spec/support/fixtures/spaced file.png +0 -0
  191. data/spec/support/fixtures/text.txt +0 -1
  192. data/spec/support/fixtures/twopage.pdf +0 -0
  193. data/spec/support/fixtures/uppercase.PNG +0 -0
  194. data/spec/support/matchers/accept.rb +0 -5
  195. data/spec/support/matchers/exist.rb +0 -5
  196. data/spec/support/matchers/have_column.rb +0 -23
  197. data/spec/support/mock_attachment.rb +0 -24
  198. data/spec/support/mock_interpolator.rb +0 -24
  199. data/spec/support/mock_url_generator_builder.rb +0 -26
  200. data/spec/support/model_reconstruction.rb +0 -72
  201. data/spec/support/reporting.rb +0 -11
  202. data/spec/support/test_data.rb +0 -13
  203. data/spec/support/version_helper.rb +0 -9
@@ -1,106 +0,0 @@
1
- # TL;DR: YOU SHOULD DELETE THIS FILE
2
- #
3
- # This file was generated by Cucumber-Rails and is only here to get you a head start
4
- # These step definitions are thin wrappers around the Capybara/Webrat API that lets you
5
- # visit pages, interact with widgets and make assertions about page content.
6
- #
7
- # If you use these step definitions as basis for your features you will quickly end up
8
- # with features that are:
9
- #
10
- # * Hard to maintain
11
- # * Verbose to read
12
- #
13
- # A much better approach is to write your own higher level step definitions, following
14
- # the advice in the following blog posts:
15
- #
16
- # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
17
- # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
18
- # * http://elabs.se/blog/15-you-re-cuking-it-wrong
19
- #
20
-
21
- require "uri"
22
- require "cgi"
23
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
24
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
25
-
26
- module WithinHelpers
27
- def with_scope(locator)
28
- locator ? within(*selector_for(locator)) { yield } : yield
29
- end
30
- end
31
- World(WithinHelpers)
32
-
33
- # Single-line step scoper
34
- When /^(.*) within (.*[^:])$/ do |step, parent|
35
- with_scope(parent) { When step }
36
- end
37
-
38
- # Multi-line step scoper
39
- When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string|
40
- with_scope(parent) { When "#{step}:", table_or_string }
41
- end
42
-
43
- Given /^(?:|I )am on (.+)$/ do |page_name|
44
- visit path_to(page_name)
45
- end
46
-
47
- When /^(?:|I )go to (.+)$/ do |page_name|
48
- visit path_to(page_name)
49
- end
50
-
51
- When /^(?:|I )press "([^"]*)"$/ do |button|
52
- click_button(button)
53
- end
54
-
55
- When /^(?:|I )follow "([^"]*)"$/ do |link|
56
- click_link(link)
57
- end
58
-
59
- When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
60
- fill_in(field, with: value)
61
- end
62
-
63
- When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
64
- fill_in(field, with: value)
65
- end
66
-
67
- # Use this to fill in an entire form with data from a table. Example:
68
- #
69
- # When I fill in the following:
70
- # | Account Number | 5002 |
71
- # | Expiry date | 2009-11-01 |
72
- # | Note | Nice guy |
73
- # | Wants Email? | |
74
- #
75
- # TODO: Add support for checkbox, select og option
76
- # based on naming conventions.
77
- #
78
- When /^(?:|I )fill in the following:$/ do |fields|
79
- fields.rows_hash.each do |name, value|
80
- When %{I fill in "#{name}" with "#{value}"}
81
- end
82
- end
83
-
84
- When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
85
- select(value, from: field)
86
- end
87
-
88
- When /^(?:|I )check "([^"]*)"$/ do |field|
89
- check(field)
90
- end
91
-
92
- When /^(?:|I )uncheck "([^"]*)"$/ do |field|
93
- uncheck(field)
94
- end
95
-
96
- When /^(?:|I )choose "([^"]*)"$/ do |field|
97
- choose(field)
98
- end
99
-
100
- When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
101
- attach_file(field, File.expand_path(path))
102
- end
103
-
104
- Then /^(?:|I )should see "([^"]*)"$/ do |text|
105
- expect(page).to have_content(text)
106
- end
@@ -1,12 +0,0 @@
1
- require "aruba/cucumber"
2
- require "capybara/cucumber"
3
- require "rspec/matchers"
4
-
5
- $CUCUMBER = 1
6
-
7
- World(RSpec::Matchers)
8
-
9
- Before do
10
- aruba.config.command_launcher = ENV.fetch("DEBUG", nil) ? :debug : :spawn
11
- @aruba_timeout_seconds = 120
12
- end
@@ -1,11 +0,0 @@
1
- require "fake_web"
2
-
3
- FakeWeb.allow_net_connect = false
4
-
5
- module FakeWeb
6
- class StubSocket
7
- def read_timeout=(_ignored); end
8
-
9
- def continue_timeout=(_ignored); end
10
- end
11
- end
@@ -1,34 +0,0 @@
1
- module FileHelpers
2
- def append_to(path, contents)
3
- cd(".") do
4
- File.open(path, "a") do |file|
5
- file.puts
6
- file.puts contents
7
- end
8
- end
9
- end
10
-
11
- def append_to_gemfile(contents)
12
- append_to("Gemfile", contents)
13
- end
14
-
15
- def comment_out_gem_in_gemfile(gemname)
16
- cd(".") do
17
- gemfile = File.read("Gemfile")
18
- gemfile.sub!(/^(\s*)(gem\s*['"]#{gemname})/, "\\1# \\2")
19
- File.open("Gemfile", "w") { |file| file.write(gemfile) }
20
- end
21
- end
22
-
23
- def read_from_web(url)
24
- file = if url.match %r{^https?://}
25
- Net::HTTP.get(URI.parse(url))
26
- else
27
- visit(url)
28
- page.source
29
- end
30
- file.force_encoding("UTF-8") if file.respond_to?(:force_encoding)
31
- end
32
- end
33
-
34
- World(FileHelpers)
@@ -1,15 +0,0 @@
1
- class Rails::Boot
2
- def run
3
- load_initializer
4
-
5
- Rails::Initializer.class_eval do
6
- def load_gems
7
- @bundler_loaded ||= Bundler.require :default, Rails.env
8
- end
9
- end
10
-
11
- Rails::Initializer.run(:set_load_path)
12
- end
13
- end
14
-
15
- Rails.boot!
@@ -1,5 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "rails", "RAILS_VERSION"
4
- gem "rdoc"
5
- gem "sqlite3", "1.3.8"
@@ -1,20 +0,0 @@
1
- begin
2
- require "rubygems"
3
- require "bundler"
4
- rescue LoadError
5
- raise "Could not load the bundler gem. Install it with `gem install bundler`."
6
- end
7
-
8
- if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
9
- raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
10
- "Run `gem install bundler` to upgrade."
11
- end
12
-
13
- begin
14
- # Set up load paths for all bundled gems
15
- ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
16
- Bundler.setup
17
- rescue Bundler::GemNotFound
18
- raise RuntimeError, "Bundler couldn't find some gems." +
19
- "Did you run `bundle install`?"
20
- end
@@ -1,28 +0,0 @@
1
- module NavigationHelpers
2
- # Maps a name to a path. Used by the
3
- #
4
- # When /^I go to (.+)$/ do |page_name|
5
- #
6
- # step definition in web_steps.rb
7
- #
8
- def path_to(page_name)
9
- case page_name
10
-
11
- when /the home\s?page/
12
- "/"
13
- when /the new user page/
14
- "/users/new"
15
- else
16
- begin
17
- page_name =~ /the (.*) page/
18
- path_components = $1.split(/\s+/)
19
- send(path_components.push("path").join("_").to_sym)
20
- rescue Object
21
- raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
22
- "Now, go and add a mapping in #{__FILE__}"
23
- end
24
- end
25
- end
26
- end
27
-
28
- World(NavigationHelpers)
@@ -1,39 +0,0 @@
1
- PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..", "..")).freeze
2
- APP_NAME = "testapp"
3
- BUNDLE_ENV_VARS = %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE).freeze
4
- ORIGINAL_BUNDLE_VARS = Hash[ENV.select { |key, _value| BUNDLE_ENV_VARS.include?(key) }]
5
-
6
- ENV["RAILS_ENV"] = "test"
7
-
8
- Before do
9
- gemfile = ENV["BUNDLE_GEMFILE"].to_s
10
- ENV["BUNDLE_GEMFILE"] = File.join(Dir.pwd, gemfile) unless gemfile.start_with?(Dir.pwd)
11
- @framework_version = nil
12
- end
13
-
14
- After do
15
- ORIGINAL_BUNDLE_VARS.each_pair do |key, value|
16
- ENV[key] = value
17
- end
18
- end
19
-
20
- When /^I reset Bundler environment variable$/ do
21
- BUNDLE_ENV_VARS.each do |key|
22
- ENV[key] = nil
23
- end
24
- end
25
-
26
- module RailsCommandHelpers
27
- def framework_version?(version_string)
28
- framework_version =~ /^#{version_string}/
29
- end
30
-
31
- def framework_version
32
- @framework_version ||= `rails -v`[/^Rails (.+)$/, 1]
33
- end
34
-
35
- def framework_major_version
36
- framework_version.split(".").first.to_i
37
- end
38
- end
39
- World(RailsCommandHelpers)
@@ -1,19 +0,0 @@
1
- module HtmlSelectorsHelpers
2
- # Maps a name to a selector. Used primarily by the
3
- #
4
- # When /^(.+) within (.+)$/ do |step, scope|
5
- #
6
- # step definitions in web_steps.rb
7
- #
8
- def selector_for(locator)
9
- case locator
10
- when "the page"
11
- "html > body"
12
- else
13
- raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
14
- "Now, go and add a mapping in #{__FILE__}"
15
- end
16
- end
17
- end
18
-
19
- World(HtmlSelectorsHelpers)
data/gemfiles/4.2.gemfile DELETED
@@ -1,20 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "sqlite3", "~> 1.3.8", platforms: :ruby
7
- gem "rails", "~> 4.2.0"
8
-
9
- group :development, :test do
10
- gem "activerecord-import"
11
- gem "bootsnap", require: false
12
- gem "builder"
13
- gem "listen", "~> 3.0.8"
14
- gem "rspec"
15
- gem "rubocop", require: false
16
- gem "rubocop-rails"
17
- gem "sprockets", "3.7.2"
18
- end
19
-
20
- gemspec path: "../"
data/gemfiles/5.0.gemfile DELETED
@@ -1,20 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "sqlite3", "~> 1.3.8", platforms: :ruby
7
- gem "rails", "~> 5.0.0"
8
-
9
- group :development, :test do
10
- gem "activerecord-import"
11
- gem "bootsnap", require: false
12
- gem "builder"
13
- gem "listen", "~> 3.0.8"
14
- gem "rspec"
15
- gem "rubocop", require: false
16
- gem "rubocop-rails"
17
- gem "sprockets", "3.7.2"
18
- end
19
-
20
- gemspec path: "../"
data/gemfiles/5.1.gemfile DELETED
@@ -1,20 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "sqlite3", "~> 1.3.8", platforms: :ruby
7
- gem "rails", "~> 5.1.0"
8
-
9
- group :development, :test do
10
- gem "activerecord-import"
11
- gem "bootsnap", require: false
12
- gem "builder"
13
- gem "listen", "~> 3.0.8"
14
- gem "rspec"
15
- gem "rubocop", require: false
16
- gem "rubocop-rails"
17
- gem "sprockets", "3.7.2"
18
- end
19
-
20
- gemspec path: "../"
data/gemfiles/5.2.gemfile DELETED
@@ -1,20 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "sqlite3", "~> 1.3.8", platforms: :ruby
7
- gem "rails", "~> 5.2.0"
8
-
9
- group :development, :test do
10
- gem "activerecord-import"
11
- gem "bootsnap", require: false
12
- gem "builder"
13
- gem "listen", "~> 3.0.8"
14
- gem "rspec"
15
- gem "rubocop", require: false
16
- gem "rubocop-rails"
17
- gem "sprockets", "3.7.2"
18
- end
19
-
20
- gemspec path: "../"
data/gemfiles/6.0.gemfile DELETED
@@ -1,20 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "sqlite3", "~> 1.4", platforms: :ruby
7
- gem "rails", "~> 6.0.0"
8
-
9
- group :development, :test do
10
- gem "activerecord-import"
11
- gem "bootsnap", require: false
12
- gem "builder"
13
- gem "listen", "~> 3.0.8"
14
- gem "rspec"
15
- gem "rubocop", require: false
16
- gem "rubocop-rails"
17
- gem "sprockets", "3.7.2"
18
- end
19
-
20
- gemspec path: "../"
data/gemfiles/6.1.gemfile DELETED
@@ -1,21 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "sqlite3", "~> 1.4", platforms: :ruby
7
- gem "aruba", "~> 1.0", ">= 1.0.4"
8
- gem "rails", "~> 6.1", ">= 6.1.1"
9
-
10
- group :development, :test do
11
- gem "activerecord-import"
12
- gem "bootsnap", require: false
13
- gem "builder"
14
- gem "listen", "~> 3.0.8"
15
- gem "rspec"
16
- gem "rubocop", require: false
17
- gem "rubocop-rails"
18
- gem "sprockets", "3.7.2"
19
- end
20
-
21
- gemspec path: "../"
data/gemfiles/7.0.gemfile DELETED
@@ -1,21 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "pry"
6
- gem "sqlite3", "~> 1.4", platforms: :ruby
7
- gem "aruba", "~> 1.0", ">= 1.0.4"
8
- gem "rails", "~> 7.0.0"
9
-
10
- group :development, :test do
11
- gem "activerecord-import"
12
- gem "bootsnap", require: false
13
- gem "builder"
14
- gem "listen", "~> 3.0.8"
15
- gem "rspec"
16
- gem "rubocop", require: false
17
- gem "rubocop-rails"
18
- gem "sprockets", "3.7.2"
19
- end
20
-
21
- gemspec path: "../"
data/paperclip.gemspec DELETED
@@ -1,50 +0,0 @@
1
- $LOAD_PATH.push File.expand_path("lib", __dir__)
2
- require "paperclip/version"
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "kt-paperclip"
6
- s.version = Paperclip::VERSION
7
- s.platform = Gem::Platform::RUBY
8
- s.author = "Surendra Singhi"
9
- s.email = ["ssinghi@kreeti.com"]
10
- s.homepage = "https://github.com/kreeti/kt-paperclip"
11
- s.summary = "File attachments as attributes for ActiveRecord"
12
- s.description = "Easy upload management for ActiveRecord"
13
- s.license = "MIT"
14
-
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
18
- s.require_paths = ["lib"]
19
-
20
- s.post_install_message = File.read("UPGRADING") if File.exist?("UPGRADING")
21
-
22
- s.requirements << "ImageMagick"
23
- s.required_ruby_version = ">= 2.3.0"
24
-
25
- s.add_dependency("activemodel", ">= 4.2.0")
26
- s.add_dependency("activesupport", ">= 4.2.0")
27
- s.add_dependency("mime-types")
28
- s.add_dependency("marcel", "~> 1.0.1")
29
- s.add_dependency("terrapin", ">= 0.6.0", "< 2.0")
30
-
31
- s.add_development_dependency("activerecord", ">= 4.2.0")
32
- s.add_development_dependency("appraisal")
33
- s.add_development_dependency("aruba", "~> 0.9.0")
34
- s.add_development_dependency("aws-sdk-s3")
35
- s.add_development_dependency("bundler")
36
- s.add_development_dependency("capybara")
37
- s.add_development_dependency("cucumber-expressions")
38
- s.add_development_dependency("cucumber-rails")
39
- s.add_development_dependency("fakeweb")
40
- s.add_development_dependency("fog-aws")
41
- s.add_development_dependency("fog-local")
42
- s.add_development_dependency("generator_spec")
43
- s.add_development_dependency("launchy")
44
- s.add_development_dependency("nokogiri")
45
- s.add_development_dependency("railties")
46
- s.add_development_dependency("rake")
47
- s.add_development_dependency("rspec", "~> 3.0")
48
- s.add_development_dependency("shoulda")
49
- s.add_development_dependency("timecop")
50
- end
data/spec/database.yml DELETED
@@ -1,4 +0,0 @@
1
- test:
2
- adapter: sqlite3
3
- database: ":memory:"
4
-
@@ -1,13 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Attachment Definitions" do
4
- it "returns all of the attachments on the class" do
5
- reset_class "Dummy"
6
- Dummy.has_attached_file :avatar, path: "abc"
7
- Dummy.has_attached_file :other_attachment, url: "123"
8
- Dummy.do_not_validate_attachment_file_type :avatar
9
- expected = { avatar: { path: "abc" }, other_attachment: { url: "123" } }
10
-
11
- expect(Dummy.attachment_definitions).to eq expected
12
- end
13
- end
@@ -1,79 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Attachment Processing" do
4
- before { rebuild_class }
5
-
6
- context "using validates_attachment_content_type" do
7
- it "processes attachments given a valid assignment" do
8
- file = File.new(fixture_file("5k.png"))
9
- Dummy.validates_attachment_content_type :avatar, content_type: "image/png"
10
- instance = Dummy.new
11
- attachment = instance.avatar
12
- expect(attachment).to receive(:post_process_styles)
13
-
14
- attachment.assign(file)
15
- end
16
-
17
- it "does not process attachments given an invalid assignment with :not" do
18
- file = File.new(fixture_file("5k.png"))
19
- Dummy.validates_attachment_content_type :avatar, not: "image/png"
20
- instance = Dummy.new
21
- attachment = instance.avatar
22
- expect(attachment).not_to receive(:post_process_styles)
23
-
24
- attachment.assign(file)
25
- end
26
-
27
- it "does not process attachments given an invalid assignment with :content_type" do
28
- file = File.new(fixture_file("5k.png"))
29
- Dummy.validates_attachment_content_type :avatar, content_type: "image/tiff"
30
- instance = Dummy.new
31
- attachment = instance.avatar
32
- expect(attachment).not_to receive(:post_process_styles)
33
-
34
- attachment.assign(file)
35
- end
36
-
37
- it "allows what would be an invalid assignment when validation :if clause returns false" do
38
- invalid_assignment = File.new(fixture_file("5k.png"))
39
- Dummy.validates_attachment_content_type :avatar, content_type: "image/tiff", if: lambda { false }
40
- instance = Dummy.new
41
- attachment = instance.avatar
42
- expect(attachment).to receive(:post_process_styles)
43
-
44
- attachment.assign(invalid_assignment)
45
- end
46
- end
47
-
48
- context "using validates_attachment" do
49
- it "processes attachments given a valid assignment" do
50
- file = File.new(fixture_file("5k.png"))
51
- Dummy.validates_attachment :avatar, content_type: { content_type: "image/png" }
52
- instance = Dummy.new
53
- attachment = instance.avatar
54
- expect(attachment).to receive(:post_process_styles)
55
-
56
- attachment.assign(file)
57
- end
58
-
59
- it "does not process attachments given an invalid assignment with :not" do
60
- file = File.new(fixture_file("5k.png"))
61
- Dummy.validates_attachment :avatar, content_type: { not: "image/png" }
62
- instance = Dummy.new
63
- attachment = instance.avatar
64
- expect(attachment).not_to receive(:post_process_styles)
65
-
66
- attachment.assign(file)
67
- end
68
-
69
- it "does not process attachments given an invalid assignment with :content_type" do
70
- file = File.new(fixture_file("5k.png"))
71
- Dummy.validates_attachment :avatar, content_type: { content_type: "image/tiff" }
72
- instance = Dummy.new
73
- attachment = instance.avatar
74
- expect(attachment).not_to receive(:post_process_styles)
75
-
76
- attachment.assign(file)
77
- end
78
- end
79
- end