Class: Wasmify::PwaGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/wasmify/pwa/pwa_generator.rb

Instance Method Summary collapse

Instance Method Details

#configure_wasm_distObject



10
11
12
13
14
# File 'lib/generators/wasmify/pwa/pwa_generator.rb', line 10

def configure_wasm_dist
  prepend_to_file "config/wasmify.yml", <<~EOF
    output_dir: pwa/public
  EOF
end

#copy_filesObject



6
7
8
# File 'lib/generators/wasmify/pwa/pwa_generator.rb', line 6

def copy_files
  directory "pwa", "pwa"
end

#install_npm_depsObject



16
17
18
19
20
21
22
23
24
# File 'lib/generators/wasmify/pwa/pwa_generator.rb', line 16

def install_npm_deps
  begin
    in_root do
      run "(cd pwa/ && yarn install)"
    end
  rescue
    say "Please, make sure to run `yarn install` within the pwa/ folder", :red
  end
end