Sha256: b6cbfa1b5b54a41d572d737d73320ecd1bd0a6c1c6c201eb4964dfbf0137b2d3

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

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

  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

  def index_where_def_change_begins
    @rows.index { | row | /\A {2}def change\Z/ === row }
  end

  def index_where_def_change_ends
    @rows.index { | row | /\A {2}end\Z/ === row }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/rake/rails/deploy/heroku/migration_file.rb