Skip to content

Commit

Permalink
Coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
n-rodriguez committed Sep 30, 2024
1 parent 8981b7e commit 8c454bd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ AllCops:
- bin/*
- gemfiles/*
- spec/dummy/**/*
- lib/generators/**/*.rb

Gemspec/RequireMFA:
Enabled: false
Expand All @@ -37,6 +36,7 @@ Layout/LineLength:
Exclude:
- remotipart.gemspec
- spec/remotipart/features/comments_spec.rb
- lib/generators/remotipart/install/install_generator.rb

Layout/EmptyLines:
Enabled: false
Expand Down
12 changes: 7 additions & 5 deletions lib/generators/remotipart/install/install_generator.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
require 'rails'
# frozen_string_literal: true

require 'rails/generators'

module Remotipart
module Generators
class InstallGenerator < ::Rails::Generators::Base

desc "This generator installs IframeTransport.js #{Remotipart::IFRAMETRANSPORT_VERSION} and Remotipart #{Remotipart::VERSION}"
source_root File.expand_path('../../../../../vendor/assets/javascripts', __FILE__)
source_root File.expand_path('../../../../vendor/assets/javascripts', __dir__)

def install_iframe_transport
say_status "copying", "IframeTransport.js #{Remotipart::IFRAMETRANSPORT_VERSION}", :green
copy_file "jquery.iframe-transport.js", "public/javascripts/jquery.iframe-transport.js"
say_status 'copying', "IframeTransport.js #{Remotipart::IFRAMETRANSPORT_VERSION}", :green
copy_file 'jquery.iframe-transport.js', 'public/javascripts/jquery.iframe-transport.js'
end

def install_remotipart
say_status "copying", "Remotipart.js #{Remotipart::VERSION}", :green
say_status 'copying', "Remotipart.js #{Remotipart::VERSION}", :green
copy_file 'jquery.remotipart.js', 'public/javascripts/jquery.remotipart.js'
end
end
Expand Down
13 changes: 8 additions & 5 deletions lib/remotipart.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# frozen_string_literal: true

# require external dependencies
require 'zeitwerk'
loader = Zeitwerk::Loader.for_gem
generators = "#{__dir__}/generators"
loader.ignore(generators)
loader.setup

# load zeitwerk
Zeitwerk::Loader.for_gem.tap do |loader|
loader.ignore("#{__dir__}/generators")
loader.setup
end

module Remotipart
require 'remotipart/engine' if defined?(Rails)
require_relative 'remotipart/engine' if defined?(Rails)
end

0 comments on commit 8c454bd

Please sign in to comment.