Class: Havior::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/havior/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_haxe_libsObject



11
12
13
14
# File 'lib/generators/havior/install_generator.rb', line 11

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

#create_haxe_hxmlObject



7
8
9
# File 'lib/generators/havior/install_generator.rb', line 7

def create_haxe_hxml
  create_file "haxe/havior.hxml", ""
end

#inject_havior_helperObject



16
17
18
19
20
21
# File 'lib/generators/havior/install_generator.rb', line 16

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

#inject_routesObject



23
24
25
26
27
28
# File 'lib/generators/havior/install_generator.rb', line 23

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