Class: Jets::CLI::Tip

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/cli/tip.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Tip

Returns a new instance of Tip.



11
12
13
# File 'lib/jets/cli/tip.rb', line 11

def initialize(name)
  @name = name
end

Class Method Details

.show(name, options = {}) ⇒ Object



4
5
6
# File 'lib/jets/cli/tip.rb', line 4

def show(name, options = {})
  new(name).show(options)
end

Instance Method Details

#already_configured?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
30
31
# File 'lib/jets/cli/tip.rb', line 22

def already_configured?
  if @name == :faster_deploy
    config = Jets.bootstrap.config
    config.codebuild.project.env.vars.key?(:DOCKER_HOST) ||
      config.codebuild.fleet.enable ||
      config.codebuild.fleet_override
  else
    false
  end
end

#concurrency_changeObject



44
45
46
47
48
49
# File 'lib/jets/cli/tip.rb', line 44

def concurrency_change
  <<~EOL

    Note: CLI changes to concurrency are outside of deployment
  EOL
end

#disable_howtoObject



66
67
68
69
70
71
72
73
# File 'lib/jets/cli/tip.rb', line 66

def disable_howto
  <<~EOL
    To disable this tip:

    * set config.tips.#{@name} = false in config/jets/project.rb
    * See: https://docs.rubyonjets.com/docs/more/cli-tips/
  EOL
end

#enabled?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/jets/cli/tip.rb', line 82

def enabled?
  config.tips.enable && config.tips[@name]
end

#env_changeObject



51
52
53
54
55
56
57
# File 'lib/jets/cli/tip.rb', line 51

def env_change
  <<~EOL

    Note: CLI changes to env vars are outside of deployment
    See: https://docs.rubyonjets.com/env/cli/
  EOL
end

#faster_deployObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/jets/cli/tip.rb', line 33

def faster_deploy
  <<~EOL
    Tip: You can speed the deploy with one of these options:

    * Docker Remote Host: https://docs.rubyonjets.com/docs/remote/codebuild/docker/
    * CodeBuild Fleet: https://docs.rubyonjets.com/docs/remote/codebuild/fleet/

    Enabling of those options will also remove this message.
  EOL
end

#remote_runObject



75
76
77
78
79
80
# File 'lib/jets/cli/tip.rb', line 75

def remote_run
  <<~EOL
    Ctrl-C will stop showing logs. Jets will continue to run remotely.
    If you want to stop the remote process, use: jets stop
  EOL
end

#show(options = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/jets/cli/tip.rb', line 15

def show(options = {})
  return if already_configured?
  return unless enabled?
  puts send(@name)
  puts disable_howto unless options[:disable_howto] == false
end

#ssm_changeObject



59
60
61
62
63
64
# File 'lib/jets/cli/tip.rb', line 59

def ssm_change
  <<~EOL
    After deleting a parameter, wait for at least 30 seconds
    to create a parameter with the same name
  EOL
end