class GulpRails::Generator

Attributes

settings[RW]

Public Class Methods

source_root() click to toggle source
# File lib/gulp-rails/generator.rb, line 8
def self.source_root
  File.expand_path('../../../templates', __FILE__)
end

Public Instance Methods

append_to_gitignore() click to toggle source
# File lib/gulp-rails/generator.rb, line 50
def append_to_gitignore
  append_to_file '.gitignore' do
    %w[
      /node_modules
      /app/frontend/scripts/templates
      /public/images
      /public/javascripts
      /public/stylesheets
      /public/rev-manifest.json
      /public/sm-*
    ].join("\n")
  end
end
copy_frontend_directory() click to toggle source
# File lib/gulp-rails/generator.rb, line 32
def copy_frontend_directory
  directory 'frontend', 'app/frontend', recursive: true
end
copy_gulp_tasks() click to toggle source
# File lib/gulp-rails/generator.rb, line 40
def copy_gulp_tasks
  directory 'gulp', 'gulp', recursive: true
  copy_file "gulp_#{settings.test_dirname}_task.js", "gulp/tasks/#{settings.test_dirname}.js"
  template 'gulp_watch_task.js.erb', 'gulp/tasks/watch.js'
  template 'gulp_default_task.js.erb', 'gulp/tasks/default.js'
  template 'gulp_config.js.erb', 'gulp/config.js'
  other_test_task_file = (Settings::TEST_DIRNAME.values - [settings.test_dirname]).first
  remove_file File.join('gulp/tasks', "#{other_test_task_file}.js")
end
copy_gulpfile() click to toggle source
# File lib/gulp-rails/generator.rb, line 20
def copy_gulpfile
  copy_file 'Gulpfile.js', 'Gulpfile.js'
end
copy_helper() click to toggle source
# File lib/gulp-rails/generator.rb, line 28
def copy_helper
  copy_file 'asset_rev_helper.rb', 'app/helpers/asset_rev_helper.rb'
end
copy_package() click to toggle source
# File lib/gulp-rails/generator.rb, line 24
def copy_package
  template 'package.json.erb', 'package.json'
end
copy_test_directory() click to toggle source
# File lib/gulp-rails/generator.rb, line 36
def copy_test_directory
  directory settings.test_dirname, "#{settings.test_dirname}/javascript", recursive: true
end
create_jshintrc() click to toggle source
# File lib/gulp-rails/generator.rb, line 16
def create_jshintrc
  copy_file 'jshintrc.json', '.jshintrc'
end
create_testem_config_file() click to toggle source
# File lib/gulp-rails/generator.rb, line 12
def create_testem_config_file
 template 'testem.json.erb', 'testem.json'
end
install_npm_packages() click to toggle source
# File lib/gulp-rails/generator.rb, line 64
def install_npm_packages
  in_root do
    run 'npm install --save-dev'
    run 'npm prune'
  end
end