Sha256: a2713e173851f081fbfef7c7d8b0a2277b7f7ad47b99ed51d8cb7749b23d8483

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 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"
        copy_file "haxe/lib/FileUploader.hx", "haxe/lib/FileUploader.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.2 lib/generators/havior/install_generator.rb