Class: BigbluebuttonRails::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



17
18
19
# File 'lib/generators/bigbluebutton_rails/install_generator.rb', line 17

def self.next_migration_number(dirname)
  ActiveRecord::Generators::Base.next_migration_number(dirname)
end

Instance Method Details

#copy_localeObject



13
14
15
# File 'lib/generators/bigbluebutton_rails/install_generator.rb', line 13

def copy_locale
  copy_file "config/locales/en.yml", "config/locales/bigbluebutton_rails.en.yml" unless options.migration_only?
end

#create_migration_fileObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/generators/bigbluebutton_rails/install_generator.rb', line 25

def create_migration_file
  if migrate_to_version.blank?
    migration_template "#{migration_path}/migration.rb", "db/migrate/create_bigbluebutton_rails.rb"
  else
    migrations = Dir.glob(File.join(source_root, migration_path, "migration_#{version_filename}*"))
    migrations.sort.each do |path|
      filename = File.basename(path)
      target_filename = filename.gsub('migration', 'bigbluebutton_rails_to')
      migration_template "#{migration_path}/#{filename}", "db/migrate/#{target_filename}"
    end
  end
end

#source_rootObject



21
22
23
# File 'lib/generators/bigbluebutton_rails/install_generator.rb', line 21

def source_root
  BigbluebuttonRails::Generators::InstallGenerator.source_root
end