Skip to content

Commit

Permalink
Appease Standard
Browse files Browse the repository at this point in the history
  • Loading branch information
rossta committed Jul 23, 2024
1 parent 3c280b5 commit 7f3a612
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lib/generators/serviceworker/install_generator.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# frozen_string_literal: true

require 'rails/generators'
require 'fileutils'
require "rails/generators"
require "fileutils"

module Serviceworker
module Generators
class InstallGenerator < ::Rails::Generators::Base
desc 'Make your Rails app a progressive web app'
source_root File.join(File.dirname(__FILE__), 'templates')
desc "Make your Rails app a progressive web app"
source_root File.join(File.dirname(__FILE__), "templates")

def create_assets
template 'manifest.json', javascripts_dir('manifest.json.erb')
template 'serviceworker.js', javascripts_dir('serviceworker.js.erb')
template 'serviceworker-companion.js', javascripts_dir('serviceworker-companion.js')
template "manifest.json", javascripts_dir("manifest.json.erb")
template "serviceworker.js", javascripts_dir("serviceworker.js.erb")
template "serviceworker-companion.js", javascripts_dir("serviceworker-companion.js")
end

def create_initializer
template 'serviceworker.rb', initializers_dir('serviceworker.rb')
template "serviceworker.rb", initializers_dir("serviceworker.rb")
end

def update_precompiled_assets
snippet = "Rails.configuration.assets.precompile += %w[serviceworker.js manifest.json]\n"
file_path = initializers_dir('assets.rb')
file_path = initializers_dir("assets.rb")
FileUtils.touch file_path
append_to_file file_path, snippet
end
Expand All @@ -38,7 +38,7 @@ def update_application_layout
end

def add_offline_html
template 'offline.html', public_dir('offline.html')
template "offline.html", public_dir("offline.html")
end

private
Expand All @@ -51,19 +51,19 @@ def detect_layout
end

def javascripts_dir(*paths)
join('app', 'assets', 'javascripts', *paths)
join("app", "assets", "javascripts", *paths)
end

def initializers_dir(*paths)
join('config', 'initializers', *paths)
join("config", "initializers", *paths)
end

def layouts_dir(*paths)
join('app', 'views', 'layouts', *paths)
join("app", "views", "layouts", *paths)
end

def public_dir(*paths)
join('public', *paths)
join("public", *paths)
end

def join(*paths)
Expand All @@ -75,7 +75,7 @@ def conditional_warn(warning)
end

def silenced?
ENV['RAILS_ENV'] == 'test'
ENV["RAILS_ENV"] == "test"
end
end
end
Expand Down

0 comments on commit 7f3a612

Please sign in to comment.