Class: AppUp::Hooks::RailsUp

Inherits:
Hook
  • Object
show all
Defined in:
lib/app_up/hooks/rails_up.rb

Constant Summary collapse

BUNDLE_COMMAND =
"bundle --local || bundle"

Instance Attribute Summary

Attributes inherited from Hook

#files, #options, #shell

Instance Method Summary collapse

Methods inherited from Hook

run

Constructor Details

#initialize(*args) ⇒ RailsUp



8
9
10
11
# File 'lib/app_up/hooks/rails_up.rb', line 8

def initialize(*args)
  @commands = {}
  super(*args)
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/app_up/hooks/rails_up.rb', line 13

def run
  shell.notify( "Running RailsUp\n----------")

  files.each do |file|
    if File.basename(file) == "Gemfile.lock"
      add_command(:bundle, dir: File.split(file)[0])
    end

    if file.match(/db\/migrate/)
      add_command(:migrate, dir: file.sub(/\/db\/migrate\/.*/, ''))
    end
  end

  enqueue_commands
end