Class: Squasher::Worker
- Inherits:
-
Object
- Object
- Squasher::Worker
- Defined in:
- lib/squasher/worker.rb
Constant Summary collapse
- OPTIONS =
[:d, :r]
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(date, options = []) ⇒ Worker
constructor
A new instance of Worker.
- #process ⇒ Object
Constructor Details
#initialize(date, options = []) ⇒ Worker
Returns a new instance of Worker.
13 14 15 16 |
# File 'lib/squasher/worker.rb', line 13 def initialize(date, = []) @date = date @options = end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
7 8 9 |
# File 'lib/squasher/worker.rb', line 7 def date @date end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/squasher/worker.rb', line 7 def @options end |
Class Method Details
.process(*args) ⇒ Object
9 10 11 |
# File 'lib/squasher/worker.rb', line 9 def self.process(*args) new(*args).process end |
Instance Method Details
#process ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/squasher/worker.rb', line 18 def process check! result = under_squash_env do if .include?(:d) Squasher.tell(:dry_mode_finished) puts Render.render(:init_schema, config) else path = config.migration_file(, :init_schema) File.open(path, 'wb') { |io| io << Render.render(:init_schema, config) } migrations.each { |file| FileUtils.rm(file) } end Squasher.rake("db:drop") unless Squasher.ask(:keep_database) end Squasher.clean if result && Squasher.ask(:apply_clean) end |