class TokyoMetro::Rake::Rails::Deploy::Heroku::MigrationFile

Public Instance Methods

set_body( schema_file_active_record_definition_body ) click to toggle source
# 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

Private Instance Methods

index_where_def_change_begins() click to toggle source
# File lib/tokyo_metro/rake/rails/deploy/heroku/migration_file.rb, line 18
def index_where_def_change_begins
  @rows.index { | row | /\A {2}def change\Z/ === row }
end
index_where_def_change_ends() click to toggle source
# File lib/tokyo_metro/rake/rails/deploy/heroku/migration_file.rb, line 22
def index_where_def_change_ends
  @rows.index { | row | /\A {2}end\Z/ === row }
end