Class: TokyoMetro::Rake::Rails::Deploy::Heroku::MigrationFile

Inherits:
FileInfo
  • Object
show all
Defined in:
lib/tokyo_metro/rake/rails/deploy/heroku/migration_file.rb

Instance Method Summary collapse

Methods inherited from FileInfo

#initialize

Constructor Details

This class inherits a constructor from TokyoMetro::Rake::Rails::Deploy::Heroku::FileInfo

Instance Method Details

#set_body(schema_file_active_record_definition_body) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/tokyo_metro/rake/rails/deploy/heroku/migration_file.rb', line 3

def set_body( schema_file_active_record_definition_body )
  ::File.open( @filename , "w:utf-8" ) do |f|
    f.print( @rows[ 0..( index_where_def_change_begins ) ].join( "\n" ) )
    f.print( "\n" )

    schema_file_active_record_definition_body.each do | row |
      f.print( " " * 2 + row + "\n" )
    end

    f.print( @rows[ ( index_where_def_change_ends )..( @rows.length - 1 ) ].join( "\n" ) )
  end
end