mineshaft 3.1.0 → 4.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: 17c5ce0cd0c41d4f8477fd9474cd686c001da38338a73c3dad31143db984d83a
4
- data.tar.gz: a7f28ff5796900d12e2ea2d7914fab05a288de4ca0093f858ab845c38889285f
3
+ metadata.gz: 615fbc3af4fb7f9b59cc8fc460187d716231a87132167ea33c9e5b99e7bb09fd
4
+ data.tar.gz: da87f368e837efd12e05861becce3fa2e6ce639f79bd2af620778af9d6c13652
5
5
  SHA512:
6
- metadata.gz: 130917145cbd610b4d6a6b6d5f59518f2f1b47bb5541c6eb44afddb1943c22979c42bda2cbc4dbfd7654dc8d283580618341d3d6e2f402dc2216ab029a6f564d
7
- data.tar.gz: f71044bac92d69468bfcb3521bc8fc0dc3eaba4cf5704843018602deed55d2dbd475c71bda398729897722e42ef84de64a84ff2856c1885c1c669b7b4de0db1e
6
+ metadata.gz: 55a67edac8f378be32468c05bdedb43df8908f03838a98b4f81c99cd0b2be59837a7e81924c4ad686bf8b76de9069d0b4e9b4fe06725dbd192d7d4063e5051c8
7
+ data.tar.gz: a7deb29fe60d8e3792ed54c075d1f597daa171e1d6875ea407f5c99d407f5bbd9a27ac15df091abf06a863d8808c714d584d453fe7c47572447037160b5b33c4
data/bin/ms CHANGED
@@ -6,7 +6,7 @@
6
6
  # email:: cameronbtesterman@gmail.com
7
7
  # created:: 2017-04-14 1:19PM
8
8
  #
9
- # Copyright (c) 2017-2018 Cameron Testerman
9
+ # Copyright (c) 2017-2019 Cameron Testerman
10
10
 
11
11
  require "mineshaft"
12
12
  require "optparse"
@@ -18,24 +18,14 @@ options = {
18
18
  global: false
19
19
  }
20
20
 
21
- if ARGV[0] == "new"
22
- new_arg = ARGV[ARGV.index("new") + 1]
23
- new_env = true
24
- elsif ARGV[0] == "list"
25
- Mineshaft::List.display
26
- elsif ARGV[0] == "reload"
27
- reload = true
28
- elsif ARGV[0] == "use"
29
- environment = ARGV[ARGV.index("use") + 1]
30
- use_environment = true
31
- end
32
-
33
21
  parser = OptionParser.new do |opts|
34
22
  opts.banner = "Usage: ms [command] [options]"
35
23
  opts.separator ""
36
24
  opts.separator "Commands"
37
- opts.separator " new creates new environment"
25
+ opts.separator " env shows a list of all installed global Rubies, with the current one in use highlighted"
26
+ opts.separator " install installs a new global Ruby"
38
27
  opts.separator " list lists the ten latest versions of Ruby available to install"
28
+ opts.separator " new creates new environment"
39
29
  opts.separator " reload reloads binaries using the current global Ruby version"
40
30
  opts.separator " use selects an installed global Ruby environment to use"
41
31
  opts.separator ""
@@ -48,46 +38,47 @@ parser = OptionParser.new do |opts|
48
38
  exit
49
39
  end
50
40
 
51
- opts.on("-r",
52
- "--ruby-version VERSION",
53
- "specify the version of Ruby to install") do |version|
54
- options[:version] = version
55
- end
56
-
57
41
  opts.on("-o",
58
42
  "--with-openssl-dir DIR",
59
43
  "specify the directory where OpenSSL is installed") do |openssl_dir|
60
44
  options[:openssl_dir] = openssl_dir
61
45
  end
62
46
 
63
- opts.on("-g",
64
- "--global",
65
- "install the Ruby environment globally") do |global|
66
- options[:global] = true
67
- options[:version] = new_arg
68
- end
69
-
70
47
  opts.on("-n",
71
48
  "--no-openssl-dir",
72
49
  "do not set the OpenSSL directory - otherwise this defaults to /usr/local/opt/openssl") do |no_openssl|
73
50
  options[:no_openssl_dir] = true
74
51
  end
75
-
76
- opts.on("-i",
77
- "--installed",
78
- "lists the globally installed and available Rubies") do |installed|
79
- options[:installed] = true
80
- end
81
52
  end
82
53
 
83
54
  parser.parse!
84
55
 
85
- Mineshaft.reload_binaries if reload
86
- Mineshaft.list_globals if options[:installed]
56
+ case ARGV[0]
57
+ when "env"
58
+ Mineshaft.env
59
+ when "install"
60
+ options[:global] = true
87
61
 
88
- if use_environment
62
+ if ARGV[1]
63
+ options[:version] = ARGV[1] if ARGV[1]
64
+ name = options[:version]
65
+ else
66
+ name = Mineshaft::Constants::RUBY_VERSION_STABLE
67
+ end
68
+
69
+ Mineshaft.new(name, options)
70
+ when "list"
71
+ Mineshaft.list
72
+ when "new"
73
+ name = ARGV[ARGV.index("new") + 1]
74
+ options[:version] = ARGV[2] if ARGV[2]
75
+ Mineshaft.new(name, options)
76
+ when "reload"
77
+ Mineshaft.reload
78
+ when "use"
79
+ name = ARGV[ARGV.index("use") + 1]
89
80
  options[:global] = true
90
- Mineshaft::Environment.new(environment, options).use
81
+ Mineshaft.use(name, options)
82
+ else
83
+ puts "Unrecognized command - #{ARGV[0]}"
91
84
  end
92
-
93
- Mineshaft::Environment.new(new_arg, options).create if new_env
@@ -4,12 +4,10 @@
4
4
  # email:: cameronbtesterman@gmail.com
5
5
  # created:: 2017-04-14 1:19PM
6
6
  #
7
- # Copyright (c) 2017-2018 Cameron Testerman
7
+ # Copyright (c) 2017-2019 Cameron Testerman
8
8
 
9
9
  require "mineshaft/constants"
10
- require "mineshaft/list"
11
- require "mineshaft/list_globals"
12
- require "mineshaft/reload"
13
10
  require "mineshaft/environment"
14
11
  require "mineshaft/installer"
15
12
  require "mineshaft/version"
13
+ require "mineshaft/commands"
@@ -0,0 +1,58 @@
1
+ # mineshaft
2
+ #
3
+ # author:: Cameron Testerman
4
+ # email:: cameronbtesterman@gmail.com
5
+ # created:: 2018-12-15 10:20PM
6
+ #
7
+ # Copyright (c) 2017-2019 Cameron Testerman
8
+
9
+ require 'yaml'
10
+
11
+ module Mineshaft
12
+ def self.env
13
+ rubies = Dir["#{Mineshaft::Constants::GLOBAL_DIR}/*"]
14
+ rubies.delete Mineshaft::Constants::GLOBAL_BIN
15
+
16
+ puts "Globally installed Ruby versions"
17
+ puts "--------------------------------"
18
+ rubies.each { |ruby| puts ruby.split("/").last }
19
+ end
20
+
21
+ def self.environment(name, options)
22
+ Mineshaft::Environment.new(name, options)
23
+ end
24
+
25
+ def self.new(name, options)
26
+ environment(name, options).create
27
+ end
28
+
29
+ def self.use(name, options)
30
+ environment(name, options).use
31
+ end
32
+
33
+ def self.reload
34
+ ruby = File.readlink("#{Dir.home}/.mineshaft/bin/ruby").split('/')
35
+ bin_dir = ruby.shift(ruby.length - 1).join("/")
36
+ FileUtils.rm Dir.glob("#{Dir.home}/.mineshaft/bin/*")
37
+
38
+ Dir["#{bin_dir}/*"].each do |binary_absolute|
39
+ binary = binary_absolute.split("/").last
40
+ FileUtils::ln_s binary_absolute, "#{Dir.home}/.mineshaft/bin/#{binary}"
41
+ end
42
+
43
+ puts "Binaries successfully reloaded!"
44
+ end
45
+
46
+ def self.list
47
+ versions = YAML.load_file(File.join(File.dirname(File.expand_path(__FILE__)), '../../versions/versions.yaml'))
48
+ last_ten = []
49
+
50
+ Hash[versions.sort_by {|k, v| -v }[versions.length - 10..versions.length]].each do |version, url|
51
+ last_ten.push(version)
52
+ end
53
+
54
+ puts "Latest 10 Ruby versions available for download"
55
+ puts "--------------------------------"
56
+ last_ten.reverse.each {|ver| puts ver}
57
+ end
58
+ end
@@ -4,11 +4,11 @@
4
4
  # email:: cameronbtesterman@gmail.com
5
5
  # created:: 2018-07-02 9:27PM
6
6
  #
7
- # Copyright (c) 2017-2018 Cameron Testerman
7
+ # Copyright (c) 2017-2019 Cameron Testerman
8
8
 
9
9
  module Mineshaft
10
10
  module Constants
11
- RUBY_VERSION_STABLE = '2.5.3'
11
+ RUBY_VERSION_STABLE = '2.6.0'
12
12
  GLOBAL_DIR = "#{Dir.home}/.mineshaft"
13
13
  GLOBAL_BIN = "#{GLOBAL_DIR}/bin"
14
14
  end
@@ -3,7 +3,7 @@
3
3
  # author:: Cameron Testerman
4
4
  # email:: cameronbtesterman@gmail.com
5
5
  #
6
- # Copyright (c) 2017-2018 Cameron Testerman
6
+ # Copyright (c) 2017-2019 Cameron Testerman
7
7
 
8
8
  module Mineshaft
9
9
  module Date
@@ -4,11 +4,11 @@
4
4
  # email:: cameronbtesterman@gmail.com
5
5
  # created:: 2017-04-14 1:19PM
6
6
  #
7
- # Copyright (c) 2017-2018 Cameron Testerman
7
+ # Copyright (c) 2017-2019 Cameron Testerman
8
8
 
9
9
  require 'fileutils'
10
10
  require 'yaml'
11
- require 'mineshaft/reload'
11
+ require 'mineshaft/commands'
12
12
 
13
13
  module Mineshaft
14
14
  class Environment
@@ -27,7 +27,7 @@ module Mineshaft
27
27
  if @options[:global]
28
28
  set_new_global
29
29
  `gem install mineshaft`
30
- Mineshaft.reload_binaries
30
+ Mineshaft.reload
31
31
  else
32
32
  create_activate_script
33
33
  end
@@ -4,7 +4,7 @@
4
4
  # email:: cameronbtesterman@gmail.com
5
5
  # created:: 2017-04-14 1:19PM
6
6
  #
7
- # Copyright (c) 2017-2018 Cameron Testerman
7
+ # Copyright (c) 2017-2019 Cameron Testerman
8
8
 
9
9
  require 'fileutils'
10
10
  require 'net/http'
@@ -88,12 +88,20 @@ module Mineshaft
88
88
 
89
89
  def configure_options(prefix)
90
90
  config = @global ? "./configure --prefix #{@directory}" : "./configure --prefix #{File.expand_path(@directory)}"
91
- config << " --with-openssl-dir=#{@options[:openssl_dir]}" unless @options[:no_openssl_dir]
91
+
92
+ if @options[:no_openssl_dir]
93
+ config
94
+ else
95
+ config << " --with-openssl-dir=#{@options[:openssl_dir]}"
96
+ end
97
+
98
+ return config
92
99
  end
93
100
 
94
101
  def build(prefix)
95
102
  puts "Building environment in #{prefix}"
96
103
  puts "Directory is #{@directory}"
104
+ puts @options[:no_openssl_dir]
97
105
  dir = "#{@directory}/ruby-#@version"
98
106
  commands = [
99
107
  "chmod +x configure tool/ifchange",
@@ -4,7 +4,7 @@
4
4
  # email:: cameronbtesterman@gmail.com
5
5
  # created:: 2017-10-23 7:01PM
6
6
  #
7
- # Copyright (c) 2017-2018 Cameron Testerman
7
+ # Copyright (c) 2017-2019 Cameron Testerman
8
8
 
9
9
  module Mineshaft
10
10
  module Shell
@@ -4,8 +4,8 @@
4
4
  # email:: cameronbtesterman@gmail.com
5
5
  # created:: 2017-04-14 1:19PM
6
6
  #
7
- # Copyright (c) 2017-2018 Cameron Testerman
7
+ # Copyright (c) 2017-2019 Cameron Testerman
8
8
 
9
9
  module Mineshaft
10
- VERSION = "3.1.0"
10
+ VERSION = "4.0.0"
11
11
  end
@@ -330,3 +330,5 @@
330
330
  2.6.0-preview2: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-preview2.tar.gz
331
331
  2.6.0-preview3: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-preview3.tar.gz
332
332
  2.6.0-rc1: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-rc1.tar.gz
333
+ 2.6.0-rc2: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0-rc2.tar.gz
334
+ 2.6.0: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.tar.gz
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: 3.1.0
4
+ version: 4.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-12-07 00:00:00.000000000 Z
11
+ date: 2019-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -33,14 +33,11 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - bin/ms
35
35
  - lib/mineshaft.rb
36
+ - lib/mineshaft/commands.rb
36
37
  - lib/mineshaft/constants.rb
37
38
  - lib/mineshaft/date.rb
38
- - lib/mineshaft/env_list.rb
39
39
  - lib/mineshaft/environment.rb
40
40
  - lib/mineshaft/installer.rb
41
- - lib/mineshaft/list.rb
42
- - lib/mineshaft/list_globals.rb
43
- - lib/mineshaft/reload.rb
44
41
  - lib/mineshaft/shell.rb
45
42
  - lib/mineshaft/version.rb
46
43
  - versions/versions.yaml
@@ -63,8 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
60
  - !ruby/object:Gem::Version
64
61
  version: '0'
65
62
  requirements: []
66
- rubyforge_project:
67
- rubygems_version: 2.7.6
63
+ rubygems_version: 3.0.1
68
64
  signing_key:
69
65
  specification_version: 4
70
66
  summary: Ruby virtual environment manager
@@ -1,14 +0,0 @@
1
- # mineshaft
2
- #
3
- # author:: Cameron Testerman
4
- # email:: cameronbtesterman@gmail.com
5
- # created:: 2018-09-20 10:23PM
6
- #
7
- # Copyright (c) 2017-2018 Cameron Testerman
8
-
9
- module Mineshaft
10
- def Mineshaft.env_list
11
- # This should output a list of globally installed Rubies.
12
- # The currently used environment should be highlighted.
13
- end
14
- end
@@ -1,24 +0,0 @@
1
- # mineshaft
2
- #
3
- # author:: Cameron Testerman
4
- # email:: cameronbtesterman@gmail.com
5
- # created:: 2018-07-03 9:16PM
6
- #
7
- # Copyright (c) 2017-2018 Cameron Testerman
8
-
9
- require 'yaml'
10
-
11
- module Mineshaft
12
- module List
13
- def List.display
14
- versions = YAML.load_file(File.join(File.dirname(File.expand_path(__FILE__)), '../../versions/versions.yaml'))
15
- last_ten = []
16
-
17
- Hash[versions.sort_by {|k, v| -v }[versions.length - 10..versions.length]].each do |version, url|
18
- last_ten.push(version)
19
- end
20
-
21
- last_ten.reverse.each {|ver| puts ver}
22
- end
23
- end
24
- end
@@ -1,18 +0,0 @@
1
- # mineshaft
2
- #
3
- # author:: Cameron Testerman
4
- # email:: cameronbtesterman@gmail.com
5
- # created:: 2018-08-04 11:42PM
6
- #
7
- # Copyright (c) 2017-2018 Cameron Testerman
8
-
9
- module Mineshaft
10
- def Mineshaft.list_globals
11
- rubies = Dir["#{Mineshaft::Constants::GLOBAL_DIR}/*"]
12
- rubies.delete Mineshaft::Constants::GLOBAL_BIN
13
-
14
- puts "Globally installed Ruby versions"
15
- puts "--------------------------------"
16
- rubies.each { |ruby| puts ruby.split("/").last }
17
- end
18
- end
@@ -1,22 +0,0 @@
1
- # mineshaft
2
- #
3
- # author:: Cameron Testerman
4
- # email:: cameronbtesterman@gmail.com
5
- # created:: 2018-07-03 9:53PM
6
- #
7
- # Copyright (c) 2017-2018 Cameron Testerman
8
-
9
- module Mineshaft
10
- def Mineshaft.reload_binaries
11
- ruby = File.readlink("#{Dir.home}/.mineshaft/bin/ruby").split('/')
12
- bin_dir = ruby.shift(ruby.length - 1).join("/")
13
- FileUtils.rm Dir.glob("#{Dir.home}/.mineshaft/bin/*")
14
-
15
- Dir["#{bin_dir}/*"].each do |binary_absolute|
16
- binary = binary_absolute.split("/").last
17
- FileUtils::ln_s binary_absolute, "#{Dir.home}/.mineshaft/bin/#{binary}"
18
- end
19
-
20
- puts "Binaries successfully reloaded!"
21
- end
22
- end