Skip to content

Commit

Permalink
add setup generator
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Dec 8, 2019
1 parent 71146a2 commit ce6d360
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/generators/enju_inventory/setup/USAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Description:
Explain the generator

Example:
rails generate setup Thing

This will create:
what/will/it/create
13 changes: 13 additions & 0 deletions lib/generators/enju_inventory/setup/setup_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class EnjuInventory::SetupGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)

def copy_setup_files
inject_into_file 'app/controllers/application_controller.rb',
" include EnjuInventory::Controller\n", after: "EnjuLibrary::Controller\n"
append_to_file("app/models/user.rb") do
<<"EOS"
Item.include(EnjuInventory::EnjuItem)
EOS
end
end
end

0 comments on commit ce6d360

Please sign in to comment.