Class: Migreazy::Action::Diff
- Inherits:
-
Migreazy::Action
- Object
- Migreazy::Action
- Migreazy::Action::Diff
- Defined in:
- lib/migreazy.rb
Instance Method Summary collapse
Methods inherited from Migreazy::Action
Constructor Details
This class inherits a constructor from Migreazy::Action
Instance Method Details
#run ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/migreazy.rb', line 39 def run left_only = (@source1.migrations - @source2.migrations).sort.reverse right_only = (@source2.migrations - @source1.migrations).sort.reverse unless left_only.empty? && right_only.empty? puts( sprintf("%-39s %-39s", @source1.description, @source2.description) ) puts( sprintf( "%-39s %-39s", ("=" * @source1.description.length), ("=" * @source2.description.length) ) ) until (left_only.empty? && right_only.empty?) side = if right_only.empty? :left elsif left_only.empty? :right elsif left_only.first > right_only.first :left else :right end if side == :left puts sprintf("%-39s", left_only.first.to_s) left_only.shift else puts((" " * 39) + sprintf(" %-39s", right_only.first.to_s)) right_only.shift end end end end |