Class: Mnenv::AvailableCommand

Inherits:
Thor
  • Object
show all
Defined in:
lib/mnenv/commands/available_command.rb

Instance Method Summary collapse

Instance Method Details

#allObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/mnenv/commands/available_command.rb', line 36

def all
  case options[:format]
  when 'json'
    output = {}
    output['gemfile'] = format_versions_json(GemfileRepository.new.all.sort.reverse)
    output['binary'] = format_versions_json(BinaryRepository.new.all)
    puts JSON.pretty_generate(output)
  else
    puts "\n=== Gemfile (RubyGems) ==="
    gemfile

    puts "\n=== Binary (packed-mn releases) ==="
    binary
  end
end

#binaryObject



27
28
29
30
31
32
# File 'lib/mnenv/commands/available_command.rb', line 27

def binary
  repo = BinaryRepository.new
  versions = repo.all

  show_available_versions('binary', versions)
end

#gemfileObject



18
19
20
21
22
23
# File 'lib/mnenv/commands/available_command.rb', line 18

def gemfile
  repo = GemfileRepository.new
  versions = repo.all.sort.reverse

  show_available_versions('gemfile', versions)
end