Class: Recipes::Yarn

Inherits:
Rails::AppBuilder
  • Object
show all
Defined in:
lib/potassium/recipes/yarn.rb

Instance Method Summary collapse

Instance Method Details

#createObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/potassium/recipes/yarn.rb', line 2

def create
  template '../assets/package.json', 'package.json'
  template '../assets/bin/update.erb', 'bin/update', force: true
  application "config.assets.paths << Rails.root.join('node_modules')"
  append_to_file ".gitignore", "node_modules/\n"

  if get(:heroku)
    node_buildpack_url = 'https://github.com/heroku/heroku-buildpack-nodejs'
    insert_point = 'https://github.com/platanus/heroku-buildpack-ruby-version.git'
    inject_into_file '.buildpacks', "#{node_buildpack_url}\n", before: insert_point
  end
end