Class: Fvm::CLI::Shell
- Inherits:
-
Object
- Object
- Fvm::CLI::Shell
- Defined in:
- lib/fvm/cli/shell.rb
Instance Method Summary collapse
-
#choose(builds) ⇒ Object
Chooses a build from a set of builds.
-
#exit(message) ⇒ Object
Exit with the specified message.
-
#list(builds) ⇒ Object
Outputs a list of all builds in the set.
-
#mpl? ⇒ Boolean
Asks the user if they agree to the MPL terms.
-
#props(message) ⇒ Object
Give mad props to the user.
-
#warn_restart! ⇒ Object
For the time being, the user must manually re-set $FLEX_HOME.
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., 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( ) highline.say 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. end end |
#mpl? ⇒ Boolean
Asks the user if they agree to the MPL terms
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( ) highline.say "<%= color( '#{}', 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 |