Sha256: 9c7001fa1d54330a3f214cd9b96b1b4257ec73748c2d0b53cf52157adfb1c97f

Contents?: true

Size: 992 Bytes

Versions: 29

Compression:

Stored size: 992 Bytes

Contents

# Install hook code here

require 'ftools'

# keep everything inside fo this scope
class InstallMetricTrackingTables

  def initialize
    show_banner
    check_system_cosistency
    copy_migration_files
  end

  def here
    File.dirname(__FILE__)
  end

  def sources
    Dir.glob(File.join([here, 'migrations', '*.*']))
  end

  def target
    File.join([here, '..', '..', '..', 'db', 'migrate'])
  end

  def validate_file_existance(file)
    abort "File not found: #{target}" unless File.exist? file
  end

  def show_banner
    puts '
      ** Copying migrations to your application
    '
  end

  def check_system_cosistency
    validate_file_existance(target)
    sources.each { |file| validate_file_existance(file) }
  end

  def copy_migration_files
    sources.each do |file|
      File.copy(file, target)
      puts "
      Source : #{file}
      Target : #{target}
      "
    end
  end

end

#InstallMetricTrackingTables.new

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
mountain-goat-1.0.6pre1 install.rb
mountain-goat-1.0.5 install.rb
mountain-goat-1.0.4 install.rb
mountain-goat-1.0.3 install.rb
mountain-goat-1.0.2 install.rb
mountain-goat-1.0.1 install.rb
mountain-goat-1.0.0 install.rb
mountain-goat-0.1.8 install.rb
mountain-goat-0.1.7 install.rb
mountain-goat-0.1.6 install.rb
mountain-goat-0.1.5 install.rb
mountain-goat-0.1.4 install.rb
mountain-goat-0.1.3 install.rb
mountain-goat-0.1.2 install.rb
mountain-goat-0.1.1 install.rb
mountain-goat-0.1.0 install.rb
mountain-goat-0.0.20 install.rb
mountain-goat-0.0.19 install.rb
mountain-goat-0.0.18 install.rb
mountain-goat-0.0.17 install.rb