Skip to content
This repository

Added autolibs script flags #186

Open
wants to merge 4 commits into from

11 participants

Leonard Teo Jörg Thalheim cromulus Jigarsolanki Miles Smith Dr Nic Williams Aaron Kalin Greg Molnar Andrey Kryachkov Brandon Turner Fletcher Nichol
Leonard Teo

This solves a lot of dependency issues.

Jörg Thalheim
Mic92 commented March 30, 2013

This cause problems in combination with rvm::user, because the sudo password is requested. So it should be only used for rvm::system

Leonard Teo

Could someone please advise how to run the tests? I'll also get them to pass before doing another pull request.

Roderik van der Veer roderik referenced this pull request in kitchenplan/kitchenplan April 13, 2013
Closed

rvm ruby install is fubar #17

cromulus

:+1:
This would be a great addition. Thanks for your work!

Miles Smith
wedtm commented April 30, 2013

+1 Why is this taking so long to implement?

Jörg Thalheim
Mic92 commented April 30, 2013

@leonardteo to run the test just do
$ bundle # if you don't have bundler: gem install bundler
$ rake unit

I'm not an expert in chef, but have some experience with ruby, otherwise I would fork this project.
There are also a bunch of deprecation warnings, when running under chef 11.

Jörg Thalheim
Mic92 commented April 30, 2013

As it seems you only have to adapt the expected output a little.

Jörg Thalheim
Mic92 commented April 30, 2013

I did not have any luck to get the integration tests running. The dependencies seems to exclude each other.

Dr Nic Williams
drnic commented May 03, 2013

Perhaps someone who knows how to fix the tests could help @Mic92 ?

Leonard Teo
Aaron Kalin
Collaborator

Hi @leonardteo
Let me know if you need any help with the test issues. I'm a little weary of making autolibs a default because this might break compatibility with previous RVM versions. To my knowledge, autolibs was not introduced until 1.19.x so we would have to add in some caveats to the README to accomodate this feature.

Aaron Kalin
Collaborator

@wedtm been trying to help out with this cookbook in my spare time. One weekend at a time we'll eventually get it back into shape. Please be patient.

Miles Smith
wedtm commented May 03, 2013

@martinisoft I didn't mean it in a mean way, was really just curious if there was something upstream causing the delay, or if some community involvement could help as well. Sorry if I offended :)

Aaron Kalin
Collaborator

@wedtm no offense taken. Helping out @fnichol catch things up and taking on the task of re-factoring the cookbook to make it more stable for everyone to use. Been touching on a lot of the older tickets (some as old as 2 years now) to see what is actionable.

Leonard Teo
Aaron Kalin
Collaborator

@leonardteo try merging master into your branch, that was fixed. If you run just rake it should work. Though now its spamming deprecation warnings so I'll look into fixing that in master.

Leonard Teo

Ok I disabled autolibs by default for user installs. It is only enabled for system-wide installs. Also fixed the spec file and added a test for autolibs. Hopefully that's good enough. Let me know if there's anything else you need!

Greg Molnar

Can this be merged?

Andrey Kryachkov

Any workaround on merging this?

Brandon Turner

As of RVM v1.20, autolibs is enabled by default. Without this pull request, my user installs are failing because autolibs always calls sudo.

Any chance this could be merged?

Aaron Kalin
Collaborator

This looks good to me and since it passes the build I am in favor of merging it before the official 1.0 release change. Unless @fnichol has any objections I'll merge this next week before the 0.9.2 release is cut since it does not appear to harm current usage of the cookbook.

Fletcher Nichol
Owner

Sounds good to me!

Brandon Turner blt04 referenced this pull request from a commit in blt04/chef-rvm December 26, 2013
Brandon Turner Merge ballistiq:master (PR #186)
This allows setting autolibs.  Autolibs became the default in RVM 1.20,
which requires sudo for user installs.  This allows disabling it.
af9d2d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
4  attributes/default.rb
@@ -50,6 +50,10 @@
50 50
 default['rvm']['version'] = "head"
51 51
 default['rvm']['upgrade'] = "none"
52 52
 
  53
+# Autolibs
  54
+default['rvm']['autolibs'] = "enabled"
  55
+default['rvm']['user_autolibs'] = "disabled"
  56
+
53 57
 # extra system-wide tunables
54 58
 default['rvm']['root_path']     = "/usr/local/rvm"
55 59
 default['rvm']['group_id']      = 'default'
6  libraries/chef_rvm_recipe_helpers.rb
@@ -22,11 +22,11 @@
22 22
 class Chef
23 23
   module RVM
24 24
     module RecipeHelpers
25  
-      def build_script_flags(branch, version = "head")
  25
+      def build_script_flags(branch, version = "head", autolibs = "enabled")
26 26
         if version =~ /\A\d+\.\d+\.\d+/ && %w{stable master none}.include?(branch)
27  
-          " -s -- --version #{version}"
  27
+          " -s -- --version #{version} --autolibs=#{autolibs}"
28 28
         else
29  
-          " -s -- --branch #{branch} --version #{version}"
  29
+          " -s -- --branch #{branch} --version #{version} --autolibs=#{autolibs}"
30 30
         end
31 31
       end
32 32
 
2  recipes/system_install.rb
@@ -19,7 +19,7 @@
19 19
 
20 20
 include_recipe 'rvm'
21 21
 
22  
-script_flags      = build_script_flags(node['rvm']['branch'], node['rvm']['version'])
  22
+script_flags      = build_script_flags(node['rvm']['branch'], node['rvm']['version'], node['rvm']['autolibs'])
23 23
 upgrade_strategy  = build_upgrade_strategy(node['rvm']['upgrade'])
24 24
 installer_url     = node['rvm']['installer_url']
25 25
 rvm_prefix        = ::File.dirname(node['rvm']['root_path'])
5  recipes/user_install.rb
@@ -24,14 +24,15 @@
24 24
 Array(node['rvm']['user_installs']).each do |rvm_user|
25 25
   version = rvm_user['version'] || node['rvm']['version']
26 26
   branch  = rvm_user['branch'] || node['rvm']['branch']
  27
+  autolibs = rvm_user['autolibs'] || node['rvm']['user_autolibs']
27 28
 
28  
-  script_flags      = build_script_flags(branch, version)
  29
+  script_flags      = build_script_flags(branch, version, autolibs)
29 30
   upgrade_strategy  = build_upgrade_strategy(rvm_user['upgrade'])
30 31
   installer_url     = rvm_user['installer_url'] || node['rvm']['installer_url']
31 32
   rvm_prefix        = rvm_user['home'] ||
32 33
                       "#{node['rvm']['user_home_root']}/#{rvm_user['user']}"
33 34
   rvm_gem_options   = rvm_user['rvm_gem_options'] || node['rvm']['rvm_gem_options']
34  
-  rvmrc             = rvm_user['rvmrc'] || node['rvm']['rvmrc'] 
  35
+  rvmrc             = rvm_user['rvmrc'] || node['rvm']['rvmrc']
35 36
 
36 37
   rvmrc_template  :rvm_prefix => rvm_prefix,
37 38
                   :rvm_gem_options => rvm_gem_options,
18  test/unit/chef/rvm/recipe_helpers_spec.rb
@@ -42,32 +42,38 @@ class Dummy
42 42
 
43 43
     it 'sets branch and version flags' do
44 44
       subject.build_script_flags("stable", "head").
45  
-        must_equal " -s -- --branch stable --version head"
  45
+        must_equal " -s -- --branch stable --version head --autolibs=enabled"
46 46
     end
47 47
 
48 48
     it 'sets a missing branch to "head"' do
49 49
       subject.build_script_flags("cool").
50  
-        must_equal " -s -- --branch cool --version head"
  50
+        must_equal " -s -- --branch cool --version head --autolibs=enabled"
51 51
     end
52 52
 
53 53
     it 'only emits version with branch=stable and version=x.y.z' do
54 54
       subject.build_script_flags("stable", "1.2.3").
55  
-        must_equal " -s -- --version 1.2.3"
  55
+        must_equal " -s -- --version 1.2.3 --autolibs=enabled"
56 56
     end
57 57
 
58 58
     it 'only emits version with branch=master and version=x.y.z' do
59 59
       subject.build_script_flags("master", "4.5.6").
60  
-        must_equal " -s -- --version 4.5.6"
  60
+        must_equal " -s -- --version 4.5.6 --autolibs=enabled"
61 61
     end
62 62
 
63 63
     it 'only emits version with branch=none and version=x.y.z' do
64 64
       subject.build_script_flags("none", "7.3.5").
65  
-        must_equal " -s -- --version 7.3.5"
  65
+        must_equal " -s -- --version 7.3.5 --autolibs=enabled"
66 66
     end
67 67
 
68 68
     it 'emits version and branch with branch not stable|master and version=x.y.z' do
69 69
       subject.build_script_flags("foo/bar", "0.9.8").
70  
-        must_equal " -s -- --branch foo/bar --version 0.9.8"
  70
+        must_equal " -s -- --branch foo/bar --version 0.9.8 --autolibs=enabled"
71 71
     end
  72
+
  73
+    it 'disables autolibs' do
  74
+      subject.build_script_flags("master", "head", "disabled").
  75
+        must_equal " -s -- --branch master --version head --autolibs=disabled"
  76
+    end
  77
+
72 78
   end
73 79
 end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.