Class: Mimas::CLI::Commands::Push

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/mimas/commands/push.rb

Constant Summary

Constants included from Template

Template::BASE_DIRECTORY

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Methods included from Terminal::Printer

#ask, #say

Methods included from SSH

#ssh

Methods included from Template

#copy_file, lookup_paths, #read_file, #template

Constructor Details

This class inherits a constructor from Mimas::CLI::Commands::BaseCommand

Instance Method Details

#call(server_name:, site: :default) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mimas/commands/push.rb', line 15

def call(server_name:, site: :default)
  server  = Config.current.servers[server_name.to_sym]
  site    = Config.current.sites[site.to_sym]

  working_copy = `git status --porcelain`
  unless working_copy == ""
    confirm = ask "You have modified files in your working copy, would you like to continue with deployment? (y|n)"

    if confirm.downcase != "y"
      say "Aborting delpoyment due to modified files"
      return
    end
  end

  @hooks[:before_push].each { it.call }

  Deployment.new(site: site, server: server).deploy

  @hooks[:after_push].each { it.call }
end