Skip to content

Commit

Permalink
Fix lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianPasquale committed Nov 29, 2023
1 parent b8ffc0e commit 095e18c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ node_modules/
package.json
spec/tmp/
yarn.lock
bun.lockb
21 changes: 8 additions & 13 deletions lib/generators/htmx/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,12 @@ class InstallGenerator < ::Rails::Generators::Base

# Setup HTMX
def setup
if bun?
setup_bun
elsif importmap?
setup_importmap
elsif webpacker?
setup_webpacker
elsif sprockets?
setup_sprockets
else
raise 'No known asset pipeline detected'
end
return setup_bun if bun?
return setup_importmap if importmap?
return setup_webpacker if webpacker?
return setup_sprockets if sprockets?

raise 'No known asset pipeline detected.'
end

private
Expand Down Expand Up @@ -62,7 +57,7 @@ def setup_bun
end

def setup_importmap
run "bin/importmap pin htmx.org#{Htmx::Rails::HTMX_VERSION}"
run "bin/importmap pin htmx.org@#{Htmx::Rails::HTMX_VERSION}"

add_to_manifest(manifest('app/javascript'), IMPORTMAP_SETUP)
end
Expand All @@ -72,7 +67,7 @@ def setup_sprockets
end

def setup_webpacker
run "yarn add htmx.org#{Htmx::Rails::HTMX_VERSION}"
run "yarn add htmx.org@#{Htmx::Rails::HTMX_VERSION}"

add_to_manifest(manifest(webpack_source_path), WEBPACKER_SETUP)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/generators/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
end

it 'raise an error' do
expect { run_generator }.to raise_error('No known asset pipeline detected')
expect { run_generator }.to raise_error('No known asset pipeline detected.')
end
end
end

0 comments on commit 095e18c

Please sign in to comment.