Class: EnvCompare::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/env_compare/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#envsObject

Returns the value of attribute envs.



12
13
14
# File 'lib/env_compare/cli.rb', line 12

def envs
  @envs
end

Instance Method Details

#diff(*envs) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/env_compare/cli.rb', line 29

def diff(*envs)
  return list(envs.first) if envs.size == 1

  heroku_results(envs)

  html =
    ::EnvCompare::Template.new(
      data: calculated_output(envs),
      headers: ['KEY', envs].flatten,
      theme_base_path: theme_base_path
    ).render(theme_name(options[:theme]))

  save_and_open_file(html)
end

#list(environment) ⇒ Object



21
22
23
24
# File 'lib/env_compare/cli.rb', line 21

def list(environment)
  output = `heroku config -a #{environment}`
  puts output
end

#update(*apps) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/env_compare/cli.rb', line 48

def update(*apps)
  apps.each do |app|
    if options.force
      config_var_update(app, { options[:key] => options[:value] })
    else
      conditional_config_var_update(app, { options[:key] => options[:value] })
    end
  end
end

#versionObject



15
16
17
# File 'lib/env_compare/cli.rb', line 15

def version
  puts EnvCompare::VERSION
end