Class: SpreeZipAutocomplete::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/spree_zip_autocomplete/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_javascriptsObject



4
5
6
7
8
9
10
11
# File 'lib/generators/spree_zip_autocomplete/install/install_generator.rb', line 4

def add_javascripts
  js_directory = SpreeZipAutocomplete::Engine.root.join('app', 'assets', 'javascripts')
  manifest_file = 'app/assets/config/manifest.js'
  Dir.glob("#{js_directory}/**/*.js").each do |file|
    relative_path = file.sub("#{js_directory.to_s}/", '')
    append_file manifest_file, "//= link #{relative_path}\n"
  end
end