Class: Mrsk::Cli::Main

Inherits:
Base
  • Object
show all
Defined in:
lib/mrsk/cli/main.rb

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?, #initialize

Constructor Details

This class inherits a constructor from Mrsk::Cli::Base

Instance Method Details

#configObject



49
50
51
52
53
# File 'lib/mrsk/cli/main.rb', line 49

def config
  run_locally do
    pp MRSK.config.to_h
  end
end

#deployObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mrsk/cli/main.rb', line 13

def deploy
  print_runtime do
    invoke "mrsk:cli:server:bootstrap"
    invoke "mrsk:cli:registry:login"
    invoke "mrsk:cli:build:deliver"
    invoke "mrsk:cli:traefik:boot"
    invoke "mrsk:cli:app:stop"
    invoke "mrsk:cli:app:boot"
    invoke "mrsk:cli:prune:all"
  end
end

#detailsObject



43
44
45
46
# File 'lib/mrsk/cli/main.rb', line 43

def details
  invoke "mrsk:cli:traefik:details"
  invoke "mrsk:cli:app:details"
end

#installObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/mrsk/cli/main.rb', line 57

def install
  require "fileutils"

  if (deploy_file = Pathname.new(File.expand_path("config/deploy.yml"))).exist?
    puts "Config file already exists in config/deploy.yml (remove first to create a new one)"
  else
    FileUtils.cp_r Pathname.new(File.expand_path("templates/deploy.yml", __dir__)), deploy_file
    puts "Created configuration file in config/deploy.yml"
  end

  unless options[:skip_binstub]
    if (binstub = Pathname.new(File.expand_path("bin/mrsk"))).exist?
      puts "Binstub already exists in bin/mrsk (remove first to create a new one)"
    else
      `bundle add mrsk`
      `bundle binstubs mrsk`
      puts "Created binstub file in bin/mrsk"
    end
  end
end

#redeployObject



26
27
28
29
30
31
32
# File 'lib/mrsk/cli/main.rb', line 26

def redeploy
  print_runtime do
    invoke "mrsk:cli:build:deliver"
    invoke "mrsk:cli:app:stop"
    invoke "mrsk:cli:app:boot"
  end
end

#removeObject



79
80
81
82
83
# File 'lib/mrsk/cli/main.rb', line 79

def remove
  invoke "mrsk:cli:traefik:remove"
  invoke "mrsk:cli:app:remove"
  invoke "mrsk:cli:registry:logout"
end

#rollback(version) ⇒ Object



35
36
37
38
39
40
# File 'lib/mrsk/cli/main.rb', line 35

def rollback(version)
  on(MRSK.hosts) do
    execute *MRSK.app.stop, raise_on_non_zero_exit: false
    execute *MRSK.app.start(version: version)
  end
end

#versionObject



86
87
88
# File 'lib/mrsk/cli/main.rb', line 86

def version
  puts Mrsk::VERSION
end