madscience 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf908a07554ef2fe92e8de0344c8618adba28aff
4
- data.tar.gz: 321c2f0df96b92ab2f9d544e675ac16171c0912e
3
+ metadata.gz: c1ff95532387f998abdddfd31a6bc077bab327e1
4
+ data.tar.gz: 2d36f07a338ae5d6c1684388ea027c83925d318c
5
5
  SHA512:
6
- metadata.gz: 6ef2f3e8a0e45a1ebf2709a6735cece2d2628b19338f40eee1392b0023301a6a00ff07079094ccb230827f71345b0a38e551a3fbcf6cf7f838bdbdd5d400fc8e
7
- data.tar.gz: 827f27f688a0409b305b54038c8488268ed3dfeb0b5e41897afcbb9559225eb4614f690633eea74afd2579c869b8f56684e71e0ae84d5e71340f2b1a162f6c23
6
+ metadata.gz: e3e8fa586229649f00a18e723b5fa7da2496044d53dbb09d824449c91f7bc03a2568758766fe41e718bf8334d0e65b4751e625377afbac98292b840329079fa6
7
+ data.tar.gz: 90e4c34b909569fe1d0daa331834d60b26f43804e745a58e4b3744a07c0dd2012ba739f7c149375ee60bb688e6c4a50db33c796022dd0294789290f06cbd2881
data/bin/madscience CHANGED
@@ -31,16 +31,22 @@ end
31
31
  require "madscience"
32
32
  require "madscience/version"
33
33
 
34
- cur_dir = Dir.pwd
34
+ def in_madscience_dir
35
+ initial_dir = Dir.pwd
35
36
 
36
- # Change to MadScience dir to get correct Gemfile
37
- ms_path = $LOAD_PATH.detect { |p| File.exist? File.join(p, "..", ".madscience_gem_location") }
38
- raise "Can't find MadScience gem in $LOAD_PATH: #{$LOAD_PATH.inspect}!" unless ms_path
39
- Dir.chdir File.join(ms_path, "..")
37
+ # Change to MadScience dir to get correct Gemfile
38
+ ms_path = $LOAD_PATH.detect { |p| File.exist? File.join(p, "..", ".madscience_gem_location") }
39
+ raise "Can't find MadScience gem in $LOAD_PATH: #{$LOAD_PATH.inspect}!" unless ms_path
40
+ Dir.chdir File.join(ms_path, "..")
41
+
42
+ yield
43
+
44
+ Dir.chdir initial_dir
45
+ end
40
46
 
41
47
  # Set up Bundler with the MadScience gem's Gemfile
42
48
  require "bundler"
43
- Bundler.setup
49
+ in_madscience_dir { Bundler.setup }
44
50
 
45
51
  def check_superuser
46
52
  raise "Must run as superuser!" unless Process.uid == 0
@@ -57,12 +63,15 @@ def get_sudo_uid
57
63
  end
58
64
 
59
65
  def drop_sudo_privileges
60
- Process.setuid get_sudo_id
66
+ Process::Sys.setuid get_sudo_uid
61
67
  end
62
68
 
63
69
  def do_local_setup
64
- system("librarian-chef", "install")
65
- system("chef-solo", "-c", "solo.rb") or raise "Failed during chef run!"
70
+ in_madscience_dir do
71
+ system("librarian-chef", "install")
72
+ system("chown -R #{get_sudo_user} cookbooks")
73
+ system("chef-solo", "-c", "solo.rb") or raise "Failed during chef run!"
74
+ end
66
75
  end
67
76
 
68
77
  def do_clone
@@ -113,7 +122,7 @@ end
113
122
  if ARGV[0] == "clone"
114
123
  do_clone
115
124
 
116
- puts "Successfully cloned repo into #{location} under this directory. Now customize nodes/all_nodes.json.erb!"
125
+ puts "Successfully cloned repo under this directory. Now customize nodes/all_nodes.json.erb!"
117
126
  exit 0
118
127
  end
119
128
 
@@ -126,7 +135,7 @@ if ARGV[0] == "setup_clone_and_deploy"
126
135
  do_clone
127
136
  do_deploy
128
137
 
129
- puts "Successfully cloned repo into #{location} under directory #{location}. Now customize nodes/all_nodes.json.erb!"
138
+ puts "Successfully cloned repo #{MADSCIENCE_REPO_URL} under this directory. Now customize nodes/all_nodes.json.erb!"
130
139
  exit 0
131
140
  end
132
141
 
@@ -1,3 +1,3 @@
1
1
  module MadScience
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madscience
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Gibbs