Skip to content
This repository
Browse code

install binary rubies by default, close #1112

  • Loading branch information...
commit 56222bc92c5876c2a223c23bf600d84c9dbb262b 1 parent b8344e5
Michal Papis authored September 14, 2012
17  help/install
... ...
@@ -1,6 +1,6 @@
1 1
 ## Usage
2 2
 
3  
-    rvm install {ruby-string} [--movable] [--verify-download {0,1,2}]
  3
+    rvm install {ruby-string} [--verify-download {0,1,2}] [--binary|--disable-binary|--movable]
4 4
 
5 5
 
6 6
 For a partial list of valid ruby strings please run
@@ -24,7 +24,20 @@ To do clean installation use:
24 24
     rvm reinstall 1.9.2
25 25
 
26 26
 
27  
-## Movable rubies
  27
+## Binary rubies
  28
+
  29
+By default RVM will try to download binary ruby package instead of compiling.
  30
+If such package is not available normal compilation will be performed.
  31
+Using binary builds can significantly increase ruby installation time.
  32
+
  33
+There are two options controlling binary rubies installation:
  34
+
  35
+- `--binary` - force binary installation, do not try to compile ruby.
  36
+- `--disable-binary` - do not try binary ruby, always compile.
  37
+
  38
+More details about managing binary rubies can be found in `rvm help mount`.
  39
+
  40
+### Movable rubies
28 41
 
29 42
 It is possible to build a ruby that can be moved to other locations, renamed
30 43
 or even moved to other machine - as long as the system matches.
4  help/upgrade-notes.txt
@@ -60,3 +60,7 @@
60 60
 
61 61
   * For first installed ruby RVM will: display rvm requirements, set it as default and use it.
62 62
     To avoid this behavior either use full path to rvm binary or prefix it with `command `.
  63
+
  64
+  * Binary rubies are installed by default if available, you can read about it in help:
  65
+      rvm help install
  66
+      rvm help mount
29  scripts/cli
@@ -411,21 +411,24 @@ __rvm_parse_args()
411 411
             rvm_ruby_name="$next_token"
412 412
             next_token="${1:-}"
413 413
             (( $# == 0 )) || shift
  414
+            #TODO: ??? rvm_disable_binary_flag=1
414 415
             ;;
415 416
 
416 417
           --branch)
417 418
             rvm_ruby_repo_branch="$next_token"
418 419
             next_token="${1:-}"
419 420
             (( $# == 0 )) || shift
  421
+            rvm_disable_binary_flag=1
420 422
             ;;
421 423
 
422 424
           --repository|--repo|--url)
423 425
             rvm_ruby_repo_url="$next_token"
424 426
             next_token="${1:-}"
425 427
             (( $# == 0 )) || shift
  428
+            rvm_disable_binary_flag=1
426 429
             ;;
427 430
 
428  
-          -r|--remote)
  431
+          -r|--remote|--binary)
429 432
             rvm_remote_flag=1
430 433
             while
431 434
               [[ -n "${next_token:-}" ]] &&
@@ -459,6 +462,7 @@ __rvm_parse_args()
459 462
             next_token="${1:-}"
460 463
             (( $# == 0 )) || shift
461 464
             rvm_patch_original_pwd="$PWD"
  465
+            rvm_disable_binary_flag=1
462 466
             ;;
463 467
 
464 468
           --arch|--archflags)
@@ -466,26 +470,31 @@ __rvm_parse_args()
466 470
             rvm_architectures="${rvm_architectures##,}" ;
467 471
             next_token="${1:-}"
468 472
             (( $# == 0 )) || shift
  473
+            rvm_disable_binary_flag=1
469 474
             ;;
470 475
 
471 476
           --with-arch=*)
472 477
             rvm_architectures="${rvm_architectures:-},${rvm_token#--with-arch=}" ;
473 478
             rvm_architectures="${rvm_architectures##,}" ;
  479
+            rvm_disable_binary_flag=1
474 480
             ;;
475 481
 
476 482
           --32)
477 483
             rvm_architectures="${rvm_architectures:-},i386" ;
478 484
             rvm_architectures="${rvm_architectures##,}" ;
  485
+            rvm_disable_binary_flag=1
479 486
             ;;
480 487
 
481 488
           --64)
482 489
             rvm_architectures="${rvm_architectures:-},x86_64" ;
483 490
             rvm_architectures="${rvm_architectures##,}" ;
  491
+            rvm_disable_binary_flag=1
484 492
             ;;
485 493
 
486 494
           --universal)
487 495
             rvm_architectures="${rvm_architectures:-},i386,x86_64" ;
488 496
             rvm_architectures="${rvm_architectures##,}" ;
  497
+            rvm_disable_binary_flag=1
489 498
             ;;
490 499
 
491 500
           --bin)
@@ -542,6 +551,7 @@ __rvm_parse_args()
542 551
             rvm_token=${rvm_token//-/_}
543 552
             export "rvm_ruby_${rvm_token}"="$next_token"
544 553
             next_token="${1:-}"
  554
+            rvm_disable_binary_flag=1
545 555
             (( $# == 0 )) || shift
546 556
             ;;
547 557
 
@@ -573,10 +583,11 @@ __rvm_parse_args()
573 583
             rvm_pretty_print_flag=auto
574 584
             ;;
575 585
 
576  
-          --1.8|--1.9)
  586
+          --1.8|--1.9|--18|--19)
577 587
             rvm_token=${rvm_token#--}
578 588
             rvm_token=${rvm_token//\./}
579 589
             export "rvm_${rvm_token}_flag"=1
  590
+            rvm_disable_binary_flag=1
580 591
             ;;
581 592
 
582 593
           --rvmrc|--versions-conf|--ruby-version)
@@ -585,7 +596,13 @@ __rvm_parse_args()
585 596
             export rvm_rvmrc_flag="${rvm_token}"
586 597
             ;;
587 598
 
588  
-          --self|--gem|--rubygems|--reconfigure|--default|--force|--export|--summary|--latest|--yaml|--json|--archive|--shebang|--env|--path|--cron|--tail|--delete|--verbose|--import|--sticky|--create|--gems|--docs|--skip-autoreconf|--18|--19|--force-autoconf|--auto|--autoinstall-bundler|--ignore-gemsets|--skip-gemsets|--debug|--head|--static|--quiet|--silent)
  599
+          --head|--static)
  600
+            rvm_token=${rvm_token#--}
  601
+            rvm_token=${rvm_token//-/_}
  602
+            export "rvm_${rvm_token}_flag"=1
  603
+            ;;
  604
+
  605
+          --self|--gem|--rubygems|--reconfigure|--default|--force|--export|--summary|--latest|--yaml|--json|--archive|--shebang|--env|--path|--cron|--tail|--delete|--verbose|--import|--sticky|--create|--gems|--docs|--skip-autoreconf|--force-autoconf|--auto|--autoinstall-bundler|--disable-binary|--ignore-gemsets|--skip-gemsets|--debug|--quiet|--silent)
589 606
             rvm_token=${rvm_token#--}
590 607
             rvm_token=${rvm_token//-/_}
591 608
             export "rvm_${rvm_token}_flag"=1
@@ -601,6 +618,7 @@ __rvm_parse_args()
601 618
 
602 619
           --clang)
603 620
             rvm_configure_flags+=( --with-gcc=clang )
  621
+            #TODO: ??? rvm_disable_binary_flag=1
604 622
             ;;
605 623
 
606 624
           -M)
@@ -610,6 +628,7 @@ __rvm_parse_args()
610 628
               __rvm_custom_separated_array rvm_make_flags , "${next_token}"
611 629
               next_token="${1:-}"
612 630
               (( $# == 0 )) || shift
  631
+              rvm_disable_binary_flag=1
613 632
             else
614 633
               rvm_action="error"
615 634
               rvm_error_message="--make *must* be followed by make flags."
@@ -642,6 +661,7 @@ __rvm_parse_args()
642 661
               __rvm_custom_separated_array rvm_configure_flags , "${next_token}"
643 662
               next_token="${1:-}"
644 663
               (( $# == 0 )) || shift
  664
+              rvm_disable_binary_flag=1
645 665
             else
646 666
               rvm_action="error"
647 667
               rvm_error_message="--configure *must* be followed by configure flags."
@@ -650,10 +670,12 @@ __rvm_parse_args()
650 670
 
651 671
           --movable)
652 672
             rvm_configure_flags+=( --enable-shared --enable-load-relative --sysconfdir=/etc )
  673
+            rvm_disable_binary_flag=1
653 674
             ;;
654 675
 
655 676
           --with-*|--without-*|--enable-*|--disable-*)
656 677
             rvm_configure_flags+=( "$rvm_token" )
  678
+            rvm_disable_binary_flag=1
657 679
             ;;
658 680
 
659 681
           --trace)
@@ -671,6 +693,7 @@ __rvm_parse_args()
671 693
             then rvm_configure_flags+=( "$next_token" "$@" )
672 694
             else rvm_ruby_args=( "$next_token" "$@" )
673 695
             fi
  696
+            rvm_disable_binary_flag=1
674 697
             rvm_parse_break=1
675 698
             ;;
676 699
 
4  scripts/functions/environment
@@ -210,7 +210,7 @@ __rvm_run_with_env()
210 210
 __rvm_setup()
211 211
 {
212 212
   # NOTE: the same set is located below - maker kjfdngkjd
213  
-  export rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag rvm_verify_downloads_flag
  213
+  export rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_disable_binary_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag rvm_verify_downloads_flag
214 214
   export rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
215 215
   export rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
216 216
   export __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_tar_command rvm_tar_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name rvm_without_gems
@@ -292,7 +292,7 @@ __rvm_teardown()
292 292
   # a corrupt PATH, breaking the RVM installation.
293 293
   #
294 294
   # NOTE: the same set is located above - maker kjfdngkjd
295  
-  unset  rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag rvm_verify_downloads_flag
  295
+  unset  rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_disable_binary_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag rvm_remote_flag rvm_verify_downloads_flag
296 296
   unset  rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
297 297
   unset  rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
298 298
   unset  __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_tar_command rvm_tar_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name rvm_without_gems
52  scripts/functions/manage/base
@@ -236,6 +236,53 @@ __rvm_install_source()
236 236
   rvm_log "Install of $rvm_ruby_string - #complete "
237 237
 }
238 238
 
  239
+__rvm_install_ruby_try_remote()
  240
+{
  241
+  : rvm_disable_binary_flag:${rvm_disable_binary_flag:=0}: rvm_remote_flag:${rvm_remote_flag:=0}:
  242
+  (( rvm_disable_binary_flag )) ||
  243
+  {
  244
+    true "${rvm_remote_server:=$(__rvm_db "rvm_remote_server_url")}"
  245
+    __rvm_detect_system
  246
+    rubies=($(
  247
+      rvm_ruby_url="${rvm_remote_server}/${_system_name}/${_system_version}/${_system_arch}/${rvm_ruby_string//\./\.}\.tar\..*"
  248
+      awk -F/ '/'"${rvm_ruby_url//\//\/}"'/{print}' < $rvm_path/config/remote
  249
+    ))
  250
+    case ${#rubies[@]} in
  251
+      (0)
  252
+        if
  253
+          (( rvm_remote_flag ))
  254
+        then
  255
+          rvm_error "Requested binary installation but no rubies are available to download, consider skipping --binary flag."
  256
+          return 1
  257
+        else
  258
+          rvm_warn "No binary rubies available for: ${_system_name}/${_system_version}/${_system_arch}/${rvm_ruby_string}.
  259
+Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies."
  260
+        fi
  261
+        ;;
  262
+      (1)
  263
+        if
  264
+          rvm_remote_flag=1 "${rvm_scripts_path}/external" mount "$rvm_ruby_string"
  265
+        then
  266
+          return 0
  267
+        else
  268
+          rvm_warn "Mounting remote ruby failed, trying to compile."
  269
+        fi
  270
+        ;;
  271
+      (*)
  272
+        if
  273
+          (( rvm_remote_flag ))
  274
+        then
  275
+          rvm_error "Requested binary installation but multiple rubies are available to download, this most likely is a bug, please report an issue!"
  276
+          return 1
  277
+        else
  278
+          rvm_warn "More then one binary ruby found, this most likely is a bug, please report an issue!"
  279
+        fi
  280
+        ;;
  281
+    esac
  282
+  }
  283
+  return 2 # continue with compilation
  284
+}
  285
+
239 286
 __rvm_install_ruby()
240 287
 {
241 288
   true ${rvm_head_flag:=0} ${rvm_ruby_selected_flag:=0}
@@ -272,6 +319,11 @@ https://rvm.io/rubies/named/
272 319
     unset RUBYOPT
273 320
   fi
274 321
 
  322
+  if __rvm_install_ruby_try_remote
  323
+  then return 0
  324
+  else (( $? == 2 )) || return 1 # 2 => continue with compilation
  325
+  fi
  326
+
275 327
   if __rvm_check_for_compiler
276 328
   then true # sok
277 329
   else return $?

0 notes on commit 56222bc

Joshua Flanagan

Don't you mean decrease installation time?

Michal Papis

yes, thank you for pointing that out!

Please sign in to comment.
Something went wrong with that request. Please try again.