Class: Hyrax::ActiveEncode::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#enhance_file_setObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/hyrax/active_encode/install_generator.rb', line 9

def enhance_file_set
  # This module include has to come before Hyrax::FileSetBehavior since it finalizes properties
  insert_into_file 'app/models/file_set.rb', before: 'include ::Hyrax::FileSetBehavior' do
    "include Hyrax::ActiveEncode::FileSetBehavior\n  "
  end
  # The indexer has to be set after Hyrax::FileSetBehavior in order to have effect
  insert_into_file 'app/models/file_set.rb', after: 'include ::Hyrax::FileSetBehavior' do
    "\n  self.indexer = Hyrax::ActiveEncode::ActiveEncodeIndexer"
  end
end

#install_active_encodeObject



20
21
22
23
# File 'lib/generators/hyrax/active_encode/install_generator.rb', line 20

def install_active_encode
  rake 'active_encode:install:migrations'
  rake 'db:migrate'
end