pbmenv 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 963376cad2db3fdeb567e333e980a9fd37769d2fcb63be03a9292a49fc6934e6
4
- data.tar.gz: 855f53dd708ff941bf4cae896eb87861a9c2f5aacb9e3bcc42c445633065a8eb
3
+ metadata.gz: 7f3ac7d44e0f095598e3a3a80728d61cf0fc8f8bd363c50a37beaa1bc08537bc
4
+ data.tar.gz: 929ccd1944970ee956efe39855a17aa4c488462725ab7cf7c7f5b89dcca014bf
5
5
  SHA512:
6
- metadata.gz: 4764912ad9754c55a89406b4540dd1ce9f31e1148d0b40bc8ef4db48c16ef559e3be12cb329253eebb4c4b1bd40dba069d8b2dfcb68cfc4c68531cc34e06ddf8
7
- data.tar.gz: a729bf9fa4dafab651e7b84e9243cdb509857be8f7fdcc2c9bde2973fefc91503a7b738183d8cc083751643ae71703a20584a031c74c80f066d9a259e2ff1fc9
6
+ metadata.gz: af65fec992aeaaff02bf3ca0abc7f3f2c92f0deb5f065e4bce53b0169d1030f2f5f39cd0758bb630c016c0d66a53f6174ab1cd85b8017b7522d621c174493048
7
+ data.tar.gz: 9716ea9f4f06624680d5169bf7f2f36a36957fbf960966dfbab279708006f40ac6855ccaa8df93abd27bfa67b077c4c4ffb766eefee9a3b11816ae38ff29746a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [0.1.7] - 2022-01-11
2
+ - currentが存在しないときに、installを実行するとcurrentを貼るようにしました
3
+
1
4
  ## [0.1.6] - 2021-12-01
2
5
  - Improve spec
3
6
  - installコマンドでcurrentの張り替えをしないようにしました。currentの参照を変えるときはuseコマンドを使ってください
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pbmenv (0.1.6)
4
+ pbmenv (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -30,6 +30,7 @@ GEM
30
30
  PLATFORMS
31
31
  aarch64-linux
32
32
  arm64-darwin-20
33
+ arm64-darwin-21
33
34
  x86_64-linux
34
35
 
35
36
  DEPENDENCIES
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pbmenv
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
data/lib/pbmenv.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "securerandom"
4
+ require "pathname"
4
5
 
5
6
  require_relative "pbmenv/version"
6
7
  require_relative "pbmenv/cli"
@@ -14,7 +15,7 @@ module Pbmenv
14
15
  end
15
16
 
16
17
  def self.versions
17
- Pbmenv::PBM.new.versions.map { |name| Pathname.new(name).basename.to_s =~ /^v([\d.]+)/ && $1 }.compact
18
+ Pbmenv::PBM.new.versions.map { |name| Pathname.new(name).basename.to_s =~ /^v([\d.]+)/ && $1 }.compact.sort_by {|x| Gem::Version.new(x) }.compact
18
19
  end
19
20
 
20
21
  def self.install(version)
@@ -45,6 +46,11 @@ module Pbmenv
45
46
  system_and_puts <<~SHELL
46
47
  ln -s #{PBM_DIR}/shared/device_id #{PBM_DIR}/v#{version}/device_id
47
48
  SHELL
49
+
50
+ # 初回だけinstall時にcurrentを作成する
51
+ if not File.exists?("#{PBM_DIR}/current")
52
+ use(version)
53
+ end
48
54
  rescue => e
49
55
  system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
50
56
  raise
@@ -66,8 +72,9 @@ module Pbmenv
66
72
 
67
73
  def self.use(version)
68
74
  raise "Need a version" if version.nil?
75
+ version = versions.last if version == "latest"
69
76
 
70
- unless File.exists?("/usr/share/pbm/v#{version}")
77
+ if !File.exists?("/usr/share/pbm/#{version}") && !File.exists?("/usr/share/pbm/v#{version}")
71
78
  return false
72
79
  end
73
80
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pbmenv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-01 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A package manager of PBM
14
14
  email: