Class: Egads::Stage

Inherits:
Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/egads/command/stage.rb

Instance Method Summary collapse

Methods inherited from Group

exit_on_failure?

Instance Method Details

#bundleObject



23
24
25
26
27
28
29
# File 'lib/egads/command/stage.rb', line 23

def bundle
  return unless should_stage?

  inside(dir) do
    run_with_code("bundle install #{RemoteConfig.bundler_options}", stream: true) if File.readable?("Gemfile")
  end
end

#extractObject



14
15
16
# File 'lib/egads/command/stage.rb', line 14

def extract
  invoke(Egads::Extract, [sha], options)
end

#mark_as_stagedObject



55
56
57
# File 'lib/egads/command/stage.rb', line 55

def mark_as_staged
  FileUtils.touch(stage_flag_path)
end

#run_after_stage_hooksObject



50
51
52
53
# File 'lib/egads/command/stage.rb', line 50

def run_after_stage_hooks
  return unless should_stage?
  inside(dir) { run_hooks_for(:stage, :after) }
end

#run_before_hooksObject



18
19
20
21
# File 'lib/egads/command/stage.rb', line 18

def run_before_hooks
  return unless should_stage?
  inside(dir){ run_hooks_for(:stage, :before) }
end

#setup_environmentObject



10
11
12
# File 'lib/egads/command/stage.rb', line 10

def setup_environment
  RemoteConfig.setup_environment
end


37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/egads/command/stage.rb', line 37

def symlink_config_files
  return unless should_stage? && shared_path

  shared_config = File.join(shared_path, 'config')
  if File.directory?(shared_config)
    Dir.glob("#{shared_config}/*").each do |source|
      basename = File.basename(source)
      destination = File.join(dir, 'config', basename)
      symlink(source, destination)
    end
  end
end


31
32
33
34
35
# File 'lib/egads/command/stage.rb', line 31

def symlink_system_paths
  return unless should_stage? && shared_path
  symlink_directory File.join(shared_path, 'system'), File.join(dir, 'public', 'system')
  symlink_directory File.join(shared_path, 'log'), File.join(dir, 'log')
end