module Npm::Rails::TaskHelpers

Public Class Methods

create_file(path, file) click to toggle source
# File lib/npm/rails/task_helpers.rb, line 19
def self.create_file(path, file)
  unless File.directory?(path)
    FileUtils.mkdir_p(path)
  end

  file_path = path.join(file)
  FileUtils.touch(file_path)
end
find_browserify(npm_directory) click to toggle source
# File lib/npm/rails/task_helpers.rb, line 8
def self.find_browserify(npm_directory)
  browserify = find_executable0("browserify") ||
    find_executable0("#{ npm_directory }/.bin/browserify")

  if browserify.nil?
    raise Npm::Rails::BrowserifyNotFound, "Browserify not found! You can install Browserify using npm: npm install browserify -g"
  else
    browserify
  end
end