Module: Npm::Rails::TaskHelpers

Defined in:
lib/npm/rails/task_helpers.rb

Class Method Summary collapse

Class Method Details

.create_file(path, file) ⇒ Object



19
20
21
22
23
24
25
26
# 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) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# 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