mineshaft 2.1.0 → 3.0.0

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
  SHA256:
3
- metadata.gz: 329013af9e0a1586742f426e5078b098c94ae4d301670716b6b9a4e4eccb342c
4
- data.tar.gz: 5bd6fb460979c690dab830107b99cd1e3dcdb827e458725a1ff5dcb37309ad8a
3
+ metadata.gz: 62f522f830f314227af21ede58ce1acbdcf8b76a713787749cf50715a912f01a
4
+ data.tar.gz: 2fb777669454a23f05e6b6c2de6880739361b1cf738cdb923775bb33a9278b33
5
5
  SHA512:
6
- metadata.gz: e9d5e5f4fce2cd3a6aec076830449a3422fc81735b24a2afb32c43b022d28292a3fd5e37a08894a4e11abc2377c91fc3525d5f0b733631349c76eac39cfbb8ed
7
- data.tar.gz: 9455d6fb499cb6a3732c2595045e191cd50cd752ad92917620419a9faef32abd6a76da1e6c3afe5b3cdfc256b174bf0a60947d4bd7699ad3768d228b6e8178c5
6
+ metadata.gz: 0d44e9d24c486982c95838dda20137fa03243eccd3dcc26bb60409a821afea1d7a9c80b919b60cd2b186b3d5f070149031f5a8c74c4e7e0d50d0e6c5199572e0
7
+ data.tar.gz: 22a6abd87f3eccdab50c5bcc7a55c1ae9c050426ae9d7276259d0474b060ddd52db8fa704d5c3524ec00dd662f0a6bcedfd03ff02a51c9c86a56ee6b0b572cc9
data/bin/ms CHANGED
@@ -67,6 +67,12 @@ parser = OptionParser.new do |opts|
67
67
  options[:version] = new_arg
68
68
  end
69
69
 
70
+ opts.on("-n",
71
+ "--no-openssl-dir",
72
+ "do not set the OpenSSL directory - otherwise this defaults to /usr/local/opt/openssl") do |no_openssl|
73
+ options[:no_openssl_dir] = true
74
+ end
75
+
70
76
  opts.on("-i",
71
77
  "--installed",
72
78
  "lists the globally installed and available Rubies") do |installed|
@@ -13,4 +13,3 @@ require "mineshaft/reload"
13
13
  require "mineshaft/environment"
14
14
  require "mineshaft/installer"
15
15
  require "mineshaft/version"
16
- require "mineshaft/activate"
@@ -8,7 +8,7 @@
8
8
 
9
9
  module Mineshaft
10
10
  module Constants
11
- RUBY_VERSION_STABLE = '2.5.1'
11
+ RUBY_VERSION_STABLE = '2.5.3'
12
12
  GLOBAL_DIR = "#{Dir.home}/.mineshaft"
13
13
  GLOBAL_BIN = "#{GLOBAL_DIR}/bin"
14
14
  end
@@ -8,6 +8,7 @@
8
8
 
9
9
  require 'fileutils'
10
10
  require 'yaml'
11
+ require 'mineshaft/reload'
11
12
 
12
13
  module Mineshaft
13
14
  class Environment
@@ -29,8 +30,10 @@ module Mineshaft
29
30
  install_ruby
30
31
  if @options[:global]
31
32
  set_new_global
33
+ `gem install mineshaft`
34
+ Mineshaft.reload_binaries
32
35
  else
33
- create_template
36
+ create_activate_script
34
37
  end
35
38
  end
36
39
 
@@ -51,9 +54,28 @@ module Mineshaft
51
54
  end.run
52
55
  end
53
56
 
54
- def create_template
55
- template_file = File.open(File.join(File.dirname(File.expand_path(__FILE__)), '../../environment/activate.sh.erb'))
56
- Mineshaft::ActivateTemplate.new(@dir, template_file).create
57
+ def install_mineshaft
58
+ end
59
+
60
+ def create_activate_script
61
+ open("#{@dir}/bin/activate.sh", 'w') do |f|
62
+ f << "#!/bin/bash\n"
63
+ f << "#\n"
64
+ f << "# activate.sh\n"
65
+ f << "\n"
66
+ f << "OLDPS1=$PS1\n"
67
+ f << "ENV=#{@dir}\n"
68
+ f << 'PS1="($ENV)${OLDPS1}"'
69
+ f << "\n"
70
+ f << "\n"
71
+ f << "OLDPATH=$PATH\n"
72
+ f << "PATH=#{File.expand_path("#{@dir}/bin")}:$OLDPATH\n"
73
+ f << "\n"
74
+ f << "deactivate() {\n"
75
+ f << " PS1=$OLDPS1\n"
76
+ f << " PATH=$OLDPATH\n"
77
+ f << "}\n\n"
78
+ end
57
79
  end
58
80
 
59
81
  def set_new_global
@@ -86,11 +86,12 @@ module Mineshaft
86
86
 
87
87
  def configure_options(prefix)
88
88
  config = @global ? "./configure --prefix #{@directory}" : "./configure --prefix #{File.expand_path(@directory)}"
89
- config << " --with-openssl-dir=#{@options[:openssl_dir]}"
89
+ config << " --with-openssl-dir=#{@options[:openssl_dir]}" unless @options[:no_openssl_dir]
90
90
  end
91
91
 
92
92
  def build(prefix)
93
93
  puts "Building environment in #{prefix}"
94
+ puts "Directory is #{@directory}"
94
95
  dir = "#{@directory}/ruby-#@version"
95
96
  commands = [
96
97
  "chmod +x configure tool/ifchange",
@@ -99,7 +100,6 @@ module Mineshaft
99
100
  "make install"
100
101
  ]
101
102
  commands.each { |command| shell(dir, command) }
102
- shell dir, 'bin/gem install mineshaft'
103
103
  end
104
104
  end
105
105
  end
@@ -9,7 +9,7 @@
9
9
  module Mineshaft
10
10
  module Shell
11
11
  def shell(dir, cmd)
12
- puts "Running #{cmd}"
12
+ puts "Running cd #{dir} && #{cmd}"
13
13
  %x{ cd #{dir} && #{cmd} }
14
14
  end
15
15
  end
@@ -7,5 +7,5 @@
7
7
  # Copyright (c) 2017-2018 Cameron Testerman
8
8
 
9
9
  module Mineshaft
10
- VERSION = "2.1.0"
10
+ VERSION = "3.0.0"
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mineshaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Testerman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-19 00:00:00.000000000 Z
11
+ date: 2018-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -32,9 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - bin/ms
35
- - environment/activate.sh.erb
36
35
  - lib/mineshaft.rb
37
- - lib/mineshaft/activate.rb
38
36
  - lib/mineshaft/constants.rb
39
37
  - lib/mineshaft/date.rb
40
38
  - lib/mineshaft/env_list.rb
@@ -1,15 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # activate.sh
4
-
5
- OLDPS1=$PS1
6
- ENV=<%= $ENVDIR %>
7
- PS1="($ENV)${OLDPS1}"
8
-
9
- OLDPATH=$PATH
10
- PATH=<%= File.expand_path("#$ENVDIR/bin") %>:$OLDPATH
11
-
12
- deactivate() {
13
- PS1=$OLDPS1
14
- PATH=$OLDPATH
15
- }
@@ -1,50 +0,0 @@
1
- # mineshaft
2
- #
3
- # author:: Cameron Testerman
4
- # email:: cameronbtesterman@gmail.com
5
- # created:: 2017-10-26 8:46PM
6
- #
7
- # Copyright (c) 2017-2018 Cameron Testerman
8
-
9
- require 'erb'
10
-
11
- module Mineshaft
12
- class ActivateTemplate
13
- attr_reader :result, :ENVDIR
14
-
15
- def initialize(dir, template_file)
16
- @dir = dir
17
- @template_file = read(template_file)
18
- $ENVDIR = dir
19
- end
20
-
21
- def create
22
- script_path = File.join(@dir, "bin/activate.sh")
23
-
24
- if File.exist?(script_path)
25
- File.truncate(script_path, 0)
26
- mode = 'w'
27
- end
28
-
29
- mode ||= 'a'
30
-
31
- @template_file.each do |line|
32
- File.open(script_path, mode) do |file|
33
- file.write(render(line))
34
- end
35
- end
36
-
37
- File.chmod(0755, script_path)
38
- end
39
-
40
- private
41
-
42
- def render(line)
43
- ERB.new(line).result
44
- end
45
-
46
- def read(file)
47
- File.open(file).readlines
48
- end
49
- end
50
- end