Sha256: 74fe7b6c251ce0ffb8ab447361d8199c4176e627f5e671d413874857bb133b88

Contents?: true

Size: 957 Bytes

Versions: 4

Compression:

Stored size: 957 Bytes

Contents

require 'generators/happy_seed/happy_seed_generator'

module HappySeed
  module Generators
    class AngularInstallGenerator < HappySeedGenerator
      source_root File.expand_path('../templates', __FILE__)

      def self.fingerprint
        File.exists? 'app/controllers/angular_controller.rb'
      end

      def install_angular
        return if already_installed

        gem 'angularjs-rails'

        Bundler.with_clean_env do
          run "bundle install --without production"
        end

        directory "app"
        directory "docs"
        append_to_file 'app/assets/javascripts/application.js', <<-'JS'

//= require angular
//= require angular-animate
//= require angular-resource
//= require angular-route
//= require angular_app
//= require_tree ./controllers
JS
        gsub_file "config/routes.rb", /\s*root.*\n/, "\n"
        route "root 'angular#index'"
        generate 'happy_seed:angular_view landing'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
happy_seed-0.0.21 lib/generators/happy_seed/angular_install/angular_install_generator.rb
happy_seed-0.0.19 lib/generators/happy_seed/angular_install/angular_install_generator.rb
happy_seed-0.0.18 lib/generators/happy_seed/angular_install/angular_install_generator.rb
happy_seed-0.0.17 lib/generators/happy_seed/angular_install/angular_install_generator.rb