Class: Fvm::CLI::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/fvm/cli/shell.rb

Instance Method Summary collapse

Instance Method Details

#choose(builds) ⇒ Object

Chooses a build from a set of builds



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fvm/cli/shell.rb', line 10

def choose( builds )

  builds = ActiveSupport::OrderedHash[ builds.sort.reverse.map { |b| [ b.to_menu, b ] } ]
  
  highline.choose do |m|
    
    m.choices *builds.keys do |choice|
      
      builds[ choice ]
      
    end
  end
end

#exit(message) ⇒ Object

Exit with the specified message



41
42
43
44
# File 'lib/fvm/cli/shell.rb', line 41

def exit( message )
  highline.say message
  Kernel.exit 1
end

#list(builds) ⇒ Object

Outputs a list of all builds in the set



26
27
28
29
30
# File 'lib/fvm/cli/shell.rb', line 26

def list( builds )
  builds.sort.reverse.each do |build|
    puts build.to_menu
  end
end

#mpl?Boolean

Asks the user if they agree to the MPL terms

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/fvm/cli/shell.rb', line 34

def mpl?
  highline.say license
  highline.agree agreement
end

#props(message) ⇒ Object

Give mad props to the user



48
49
50
# File 'lib/fvm/cli/shell.rb', line 48

def props( message )
  highline.say "<%= color( '#{message}', GREEN, BOLD )%>"
end

#warn_restart!Object

For the time being, the user must manually re-set $FLEX_HOME. Warn them!



54
55
56
# File 'lib/fvm/cli/shell.rb', line 54

def warn_restart!
  highline.say "<%= color( 'You have changed the Flex SDK version. Please run `fvm-restart` to re-set $FLEX_HOME.', RED )%>"
end