Skip to content

Commit

Permalink
rubocop syntax updates in lib folder (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbhawsingka authored and ssinghi committed Dec 10, 2019
1 parent 5ed72dc commit 8420ed0
Show file tree
Hide file tree
Showing 51 changed files with 489 additions and 533 deletions.
14 changes: 6 additions & 8 deletions lib/generators/paperclip/paperclip_generator.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require 'rails/generators/active_record'
require "rails/generators/active_record"

class PaperclipGenerator < ActiveRecord::Generators::Base
desc "Create a migration to add paperclip-specific fields to your model. " +
"The NAME argument is the name of your model, and the following " +
"arguments are the name of the attachments"

argument :attachment_names, :required => true, :type => :array, :desc => "The names of the attachment(s) to add.",
:banner => "attachment_one attachment_two attachment_three ..."
argument :attachment_names, required: true, type: :array, desc: "The names of the attachment(s) to add.",
banner: "attachment_one attachment_two attachment_three ..."

def self.source_root
@source_root ||= File.expand_path('../templates', __FILE__)
@source_root ||= File.expand_path("templates", __dir__)
end

def generate_migration
Expand All @@ -19,7 +19,7 @@ def generate_migration
end

def migration_name
"add_attachment_#{attachment_names.join("_")}_to_#{name.underscore.pluralize}"
"add_attachment_#{attachment_names.join('_')}_to_#{name.underscore.pluralize}"
end

def migration_file_name
Expand All @@ -31,8 +31,6 @@ def migration_class_name
end

def migration_version
if Rails.version.start_with? "5"
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if Rails.version.start_with? "5"
end
end
96 changes: 48 additions & 48 deletions lib/paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,37 @@
#
# See the +has_attached_file+ documentation for more details.

require 'erb'
require 'digest'
require 'tempfile'
require 'paperclip/version'
require 'paperclip/geometry_parser_factory'
require 'paperclip/geometry_detector_factory'
require 'paperclip/geometry'
require 'paperclip/processor'
require 'paperclip/processor_helpers'
require 'paperclip/tempfile'
require 'paperclip/thumbnail'
require 'paperclip/interpolations/plural_cache'
require 'paperclip/interpolations'
require 'paperclip/tempfile_factory'
require 'paperclip/style'
require 'paperclip/attachment'
require 'paperclip/storage'
require 'paperclip/callbacks'
require 'paperclip/file_command_content_type_detector'
require 'paperclip/media_type_spoof_detector'
require 'paperclip/content_type_detector'
require 'paperclip/glue'
require 'paperclip/errors'
require 'paperclip/missing_attachment_styles'
require 'paperclip/validators'
require 'paperclip/logger'
require 'paperclip/helpers'
require 'paperclip/has_attached_file'
require 'paperclip/attachment_registry'
require 'paperclip/filename_cleaner'
require 'paperclip/rails_environment'
require "erb"
require "digest"
require "tempfile"
require "paperclip/version"
require "paperclip/geometry_parser_factory"
require "paperclip/geometry_detector_factory"
require "paperclip/geometry"
require "paperclip/processor"
require "paperclip/processor_helpers"
require "paperclip/tempfile"
require "paperclip/thumbnail"
require "paperclip/interpolations/plural_cache"
require "paperclip/interpolations"
require "paperclip/tempfile_factory"
require "paperclip/style"
require "paperclip/attachment"
require "paperclip/storage"
require "paperclip/callbacks"
require "paperclip/file_command_content_type_detector"
require "paperclip/media_type_spoof_detector"
require "paperclip/content_type_detector"
require "paperclip/glue"
require "paperclip/errors"
require "paperclip/missing_attachment_styles"
require "paperclip/validators"
require "paperclip/logger"
require "paperclip/helpers"
require "paperclip/has_attached_file"
require "paperclip/attachment_registry"
require "paperclip/filename_cleaner"
require "paperclip/rails_environment"

begin
# Use mime/types/columnar if available, for reduced memory usage
Expand All @@ -64,12 +64,12 @@
require "mime/types"
end

require 'mimemagic'
require 'mimemagic/overlay'
require 'logger'
require 'terrapin'
require "mimemagic"
require "mimemagic/overlay"
require "logger"
require "terrapin"

require 'paperclip/railtie' if defined?(Rails::Railtie)
require "paperclip/railtie" if defined?(Rails::Railtie)

# The base module that gets included in ActiveRecord::Base. See the
# documentation for Paperclip::ClassMethods for more useful information.
Expand Down Expand Up @@ -201,15 +201,15 @@ def has_attached_file(name, options = {})
end

# This stuff needs to be run after Paperclip is defined.
require 'paperclip/io_adapters/registry'
require 'paperclip/io_adapters/abstract_adapter'
require 'paperclip/io_adapters/empty_string_adapter'
require 'paperclip/io_adapters/identity_adapter'
require 'paperclip/io_adapters/file_adapter'
require 'paperclip/io_adapters/stringio_adapter'
require 'paperclip/io_adapters/data_uri_adapter'
require 'paperclip/io_adapters/nil_adapter'
require 'paperclip/io_adapters/attachment_adapter'
require 'paperclip/io_adapters/uploaded_file_adapter'
require 'paperclip/io_adapters/uri_adapter'
require 'paperclip/io_adapters/http_url_proxy_adapter'
require "paperclip/io_adapters/registry"
require "paperclip/io_adapters/abstract_adapter"
require "paperclip/io_adapters/empty_string_adapter"
require "paperclip/io_adapters/identity_adapter"
require "paperclip/io_adapters/file_adapter"
require "paperclip/io_adapters/stringio_adapter"
require "paperclip/io_adapters/data_uri_adapter"
require "paperclip/io_adapters/nil_adapter"
require "paperclip/io_adapters/attachment_adapter"
require "paperclip/io_adapters/uploaded_file_adapter"
require "paperclip/io_adapters/uri_adapter"
require "paperclip/io_adapters/http_url_proxy_adapter"
Loading

0 comments on commit 8420ed0

Please sign in to comment.