Class: TerraspaceBundler::Info

Inherits:
TB::CLI::Base
  • Object
show all
Defined in:
lib/terraspace_bundler/info.rb

Instance Method Summary collapse

Instance Method Details

#lockfileObject



28
29
30
# File 'lib/terraspace_bundler/info.rb', line 28

def lockfile
  Lockfile.instance
end

#runObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/terraspace_bundler/info.rb', line 3

def run
  file = TB.config.lockfile
  unless File.exist?(file)
    logger.info "No #{file} found".color(:red)
    logger.info "Maybe run: terraspace bundle"
    return
  end
  
  name = @options[:mod]
  found = lockfile.mods.find { |m| m.name == @options[:mod] }
  if found
    show(found)
  else
    logger.info "Could not find module in #{TB.config.lockfile}: #{name}".color(:red)
  end
end

#show(mod) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/terraspace_bundler/info.rb', line 20

def show(mod)
  props = mod.props.reject { |k,v| k == :name }.stringify_keys # for sort
  puts "#{mod.name}:"
  props.keys.sort.each do |k|
    puts "    #{k}: #{props[k]}"
  end
end