Class: Pineapples::Actions::Rails::CopyMigration

Inherits:
CopyFile show all
Defined in:
lib/pineapples/actions/rails/copy_migration.rb

Constant Summary

Constants inherited from Action

Action::STATUS_COLORS

Instance Attribute Summary collapse

Attributes inherited from CopyFile

#source

Attributes inherited from CreateFile

#content

Attributes inherited from EmptyDirectory

#skip, #target

Attributes inherited from Action

#colors, #generator, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CreateFile

#identical?, #render

Methods inherited from EmptyDirectory

#exists?, #revoke!

Methods inherited from Action

colors, inherited, #skip?, status_color

Constructor Details

#initialize(generator, migration_name, options) ⇒ CopyMigration

Returns a new instance of CopyMigration.



22
23
24
25
26
27
28
29
30
# File 'lib/pineapples/actions/rails/copy_migration.rb', line 22

def initialize(generator, migration_name, options)
  @generator = generator
  @migration_name = File.basename(migration_name, File.extname(migration_name))

  set_source_for_migration!
  @target = target_for_migration

  super(generator, @source, @target, options)
end

Instance Attribute Details

#migration_nameObject (readonly)

Returns the value of attribute migration_name.



12
13
14
# File 'lib/pineapples/actions/rails/copy_migration.rb', line 12

def migration_name
  @migration_name
end

Class Method Details

.timeObject



14
15
16
# File 'lib/pineapples/actions/rails/copy_migration.rb', line 14

def self.time
  @time ||= Time.now
end

.time=(value) ⇒ Object



18
19
20
# File 'lib/pineapples/actions/rails/copy_migration.rb', line 18

def self.time=(value)
  @time = value
end

Instance Method Details

#invoke!Object



32
33
34
35
# File 'lib/pineapples/actions/rails/copy_migration.rb', line 32

def invoke!
  super
  self.class.time = self.class.time + 2
end