mineshaft 1.0.1 → 1.1.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
  SHA1:
3
- metadata.gz: 4abda75dc3fc8d0746f30db44525932a02cd4764
4
- data.tar.gz: 4e8a23ed9db969b77c5e7bd35a2d760769d1697f
3
+ metadata.gz: 3ba4556a8921cc75e09cbaccf0d8aa5d9159861a
4
+ data.tar.gz: 96243ff6d1ee7ba0333a1a8627fd69f3709bcf62
5
5
  SHA512:
6
- metadata.gz: 42978fa1f5ca1221965fd1ab86e21399e430a457b84841e8974e249194a9884a5f5f1941574d2b6b693f06d8cd4e30e8ee6c638f71986422ee8e8284c79a6639
7
- data.tar.gz: 59ec612e143939c6234670780d12473711f9b58da440ae25f6b90e44b960781b38a19559e3f576a1f3f79156c2a8b42cf421350d01f66762e0a389a65bf2c232
6
+ metadata.gz: f9d91dc8878d550169934585bc9ecb5079ac9cc09cead3e98a34dec5c2d77bc31aaa5685e45265f3703cb8e77a33cdd1d0e6f9198b67085a95cbb4e3afe27b09
7
+ data.tar.gz: 7e945bd43f5f1125d68cd8c1e8e57004d05248f070f52a103078268891a76fe5458d1f67663f097693e52ea3116755788dc8c97f6dbdca19b88716bc4673245b
@@ -19,6 +19,7 @@ parser = OptionParser.new do |opts|
19
19
  opts.separator ""
20
20
  opts.separator "Commands"
21
21
  opts.separator " new create new environment"
22
+ opts.separator " global installs Ruby environment globally"
22
23
  opts.separator ""
23
24
  opts.separator "Options"
24
25
 
@@ -44,7 +45,10 @@ end
44
45
 
45
46
  parser.parse!
46
47
 
47
- if ARGV.include?("new")
48
+ if ARGV[0] == "new"
48
49
  dir_name = ARGV[ARGV.index("new") + 1]
49
50
  Mineshaft::Environment.new(dir_name, options).create
51
+ elsif ARGV[0] == "global"
52
+ options[:global] = true
53
+ Mineshaft::Environment.new(options[:version], options).create
50
54
  end
@@ -6,6 +6,10 @@ OLDPS1=$PS1
6
6
  ENV=<%= $ENVDIR %>
7
7
  PS1="($ENV)${OLDPS1}"
8
8
 
9
+ OLDPATH=$PATH
10
+ PATH=<%= File.expand_path("#$ENVDIR/bin") %>:$OLDPATH
11
+
9
12
  deactivate() {
10
13
  PS1=$OLDPS1
14
+ PATH=$OLDPATH
11
15
  }
@@ -19,6 +19,7 @@ module Mineshaft
19
19
 
20
20
  def create
21
21
  script_path = File.join(@dir, "bin/activate.sh")
22
+ script_path.chmod(0755)
22
23
  File.truncate(script_path, 0) if File.exist?(script_path)
23
24
  @template_file.each do |line|
24
25
  File.open(script_path, "a") do |file|
@@ -13,24 +13,36 @@ module Mineshaft
13
13
  attr_reader :dir
14
14
 
15
15
  def initialize(dir, options)
16
- @dir = dir
16
+ if options[:global]
17
+ @dir = File.join(Dir.home, ".mineshaft", dir)
18
+ else
19
+ @dir = dir
20
+ end
17
21
  @options = options
22
+ @versions = YAML.load_file(File.join(File.dirname(File.expand_path(__FILE__)), '../../versions/versions.yaml'))
23
+ @version = @options[:version] ? @options[:version] : Mineshaft::Installer.get_latest_stable
18
24
  end
19
25
 
20
26
  def create
21
27
  FileUtils::mkdir_p(@dir)
22
- versions = YAML.load_file(File.join(File.dirname(File.expand_path(__FILE__)), '../../versions/versions.yaml'))
23
- version = @options[:version] ? @options[:version] : Mineshaft::Installer.get_latest_stable
24
- installer = Mineshaft::Installer.new do |config|
25
- config.url = versions[version]
28
+ install_ruby
29
+ create_template
30
+ end
31
+
32
+ private
33
+
34
+ def install_ruby
35
+ Mineshaft::Installer.new do |config|
36
+ config.url = @versions[@version]
26
37
  config.directory = @dir
27
- config.version = version
38
+ config.version = @version
28
39
  config.options = @options
29
- end
30
- installer.run
40
+ end.run
41
+ end
42
+
43
+ def create_template
31
44
  template_file = File.open(File.join(File.dirname(File.expand_path(__FILE__)), '../../environment/activate.sh.erb'))
32
- activate_script = Mineshaft::ActivateTemplate.new(@dir, template_file)
33
- activate_script.create
45
+ Mineshaft::ActivateTemplate.new(@dir, template_file).create
34
46
  end
35
47
  end
36
48
  end
@@ -7,5 +7,5 @@
7
7
  # Copyright (c) 2017 Cameron Testerman
8
8
 
9
9
  module Mineshaft
10
- VERSION = "1.0.1"
10
+ VERSION = "1.1.0"
11
11
  end
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  2.5.0: https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.gz
3
3
  2.5.0-preview1: https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0-preview1.tar.gz
4
+ 2.4.3: https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.3.tar.gz
4
5
  2.4.2: https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.2.tar.gz
5
6
  2.4.1: https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz
6
7
  2.4.0: https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.0.tar.gz
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mineshaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Testerman