Sha256: 8710af93e41cc90d721e7c56b2d95fd0d7880e3ec26d13a594312fd096eabaed

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

module Havior
  module Generators
    class InstallGenerator < Rails::Generators::Base

      source_root File.expand_path('../templates', __FILE__)

      def create_haxe_hxml
        create_file "haxe/havior.hxml", ""
      end
  
      def copy_haxe_libs
        copy_file "haxe/lib/Havior.hx", "haxe/lib/Havior.hx"
      end

      def inject_havior_helper
        inject_into_file "app/helpers/application_helper.rb",
          after: "module ApplicationHelper\n"do
            "  include Havior::Helper\n"
          end
      end

      def inject_routes
        inject_into_file "config/routes.rb",
          after: "Rails.application.routes.draw do\n" do
            '  Dir["#{Rails.root}/app/haviors/**/routes.rb"].each{|r| load r }\n'
          end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
havior-0.1.1 lib/generators/havior/install_generator.rb