pbmenv 0.1.4 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -1
- data/Gemfile.lock +4 -3
- data/README.md +3 -1
- data/lib/pbmenv/cli.rb +4 -1
- data/lib/pbmenv/version.rb +1 -1
- data/lib/pbmenv.rb +26 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03103c7de7428f2c8c92aabd221463bed7ec8f5017f119feeb9204673afec788
|
4
|
+
data.tar.gz: 30ac40f3e940ef3599a14bf5b27ef1973221955b8bf2d2c0a351da197af40374
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bf0ffcd4cf070c467363b510cf9239653582e433ce8f2e17d155f226615097520839ed99ab91afd316bb5f3b5c73f73d2219decaf40e923df96f59c6dcfc376
|
7
|
+
data.tar.gz: 35015b260bd3721b8d5e2b26541498c7d3e91ea09b970c3140cc8f3c26f1424a53bdf0510cedea325a062f504c94023b3f695b42f1a512dfec79c9dba841f731
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
+
## [0.1.8] - 2022-02-08
|
2
|
+
- 不具合修正
|
3
|
+
|
4
|
+
## [0.1.7] - 2022-01-11
|
5
|
+
- currentが存在しないときに、installを実行するとcurrentを貼るようにしました
|
6
|
+
|
7
|
+
## [0.1.6] - 2021-12-01
|
8
|
+
- Improve spec
|
9
|
+
- installコマンドでcurrentの張り替えをしないようにしました。currentの参照を変えるときはuseコマンドを使ってください
|
10
|
+
|
11
|
+
## [0.1.5] - 2021-11-16
|
12
|
+
- `/usr/share/pbm/shared/device_id` を作成するようにしました
|
13
|
+
|
1
14
|
## [0.1.4] - 2021-11-15
|
2
15
|
|
3
|
-
- `/usr/share/pbm/
|
16
|
+
- `/usr/share/pbm/current/device_id` にシムリンクを作成するようにしました
|
4
17
|
|
5
18
|
## [0.1.3] - 2021-10-22
|
6
19
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pbmenv (0.1.
|
4
|
+
pbmenv (0.1.8)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -25,11 +25,12 @@ GEM
|
|
25
25
|
rspec-mocks (3.10.2)
|
26
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
27
|
rspec-support (~> 3.10.0)
|
28
|
-
rspec-support (3.10.
|
28
|
+
rspec-support (3.10.3)
|
29
29
|
|
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
|
@@ -39,4 +40,4 @@ DEPENDENCIES
|
|
39
40
|
rspec
|
40
41
|
|
41
42
|
BUNDLED WITH
|
42
|
-
2.2.
|
43
|
+
2.2.31
|
data/README.md
CHANGED
@@ -17,6 +17,7 @@ gem 'pbmenv'
|
|
17
17
|
* pbmenv available_versions
|
18
18
|
* pbmenv versions
|
19
19
|
* pbmenv install $version
|
20
|
+
* pbmenv use $version
|
20
21
|
* pbmenv uninstall $version
|
21
22
|
* API
|
22
23
|
* Pbmenv.available_versions
|
@@ -26,6 +27,7 @@ gem 'pbmenv'
|
|
26
27
|
* Pbmenv.install(version)
|
27
28
|
* https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v#{version}.tar.gz をダウンロードして、
|
28
29
|
* /usr/share/pbm/#{version} に app.rb, pbm.servive, setting.yml を配備する
|
30
|
+
* Pbmenv.use(version)
|
29
31
|
* /usr/share/pbm/#{version} を /usr/share/pbm/current へのシムリンクを作成する
|
30
32
|
* Pbmenv.uninstall(version)
|
31
33
|
* /usr/share/pbm/current が削除対象だったら例外を投げる
|
@@ -40,6 +42,6 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
40
42
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
43
|
|
42
44
|
## Development
|
43
|
-
* docker-compose build --no-cache
|
45
|
+
* docker-compose build --no-cache
|
44
46
|
* docker-compose run app bash
|
45
47
|
* bin/rspec
|
data/lib/pbmenv/cli.rb
CHANGED
@@ -10,6 +10,9 @@ module Pbmenv
|
|
10
10
|
when 'install', 'i'
|
11
11
|
sub_command_arg = argv[1]
|
12
12
|
Pbmenv.install(sub_command_arg)
|
13
|
+
when 'use', 'u'
|
14
|
+
sub_command_arg = argv[1]
|
15
|
+
Pbmenv.use(sub_command_arg)
|
13
16
|
when 'uninstall'
|
14
17
|
sub_command_arg = argv[1]
|
15
18
|
Pbmenv.uninstall(sub_command_arg)
|
@@ -18,7 +21,7 @@ module Pbmenv
|
|
18
21
|
else
|
19
22
|
puts <<~EOH
|
20
23
|
Unknown command:
|
21
|
-
available commands: available_versions, versions, install, uninstall
|
24
|
+
available commands: available_versions, versions, install, use, uninstall
|
22
25
|
EOH
|
23
26
|
end
|
24
27
|
end
|
data/lib/pbmenv/version.rb
CHANGED
data/lib/pbmenv.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "securerandom"
|
4
|
+
require "pathname"
|
5
|
+
|
3
6
|
require_relative "pbmenv/version"
|
4
7
|
require_relative "pbmenv/cli"
|
5
8
|
require_relative "pbmenv/pbm"
|
@@ -12,7 +15,7 @@ module Pbmenv
|
|
12
15
|
end
|
13
16
|
|
14
17
|
def self.versions
|
15
|
-
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
|
16
19
|
end
|
17
20
|
|
18
21
|
def self.install(version)
|
@@ -30,22 +33,31 @@ module Pbmenv
|
|
30
33
|
mkdir -p #{PBM_DIR}/v#{version} && cp -r procon_bypass_man-#{version}/project_template/* #{PBM_DIR}/v#{version}/
|
31
34
|
SHELL
|
32
35
|
|
33
|
-
# sharedディレクトリを作成して、device_idへのシムリンクを作成する. device_idの中身はpbmで行う
|
34
36
|
unless File.exists?("#{PBM_DIR}/shared")
|
35
37
|
system_and_puts <<~SHELL
|
36
38
|
mkdir -p #{PBM_DIR}/shared
|
37
39
|
SHELL
|
38
40
|
end
|
39
41
|
|
42
|
+
unless File.exists?("#{PBM_DIR}/shared/device_id")
|
43
|
+
File.write("#{PBM_DIR}/shared/device_id", "d_#{SecureRandom.uuid}")
|
44
|
+
end
|
45
|
+
|
40
46
|
system_and_puts <<~SHELL
|
41
47
|
ln -s #{PBM_DIR}/shared/device_id #{PBM_DIR}/v#{version}/device_id
|
42
48
|
SHELL
|
43
|
-
|
49
|
+
|
50
|
+
# 初回だけinstall時にcurrentを作成する
|
51
|
+
if not File.exists?("#{PBM_DIR}/current")
|
52
|
+
use(version)
|
53
|
+
end
|
44
54
|
rescue => e
|
45
55
|
system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
|
46
56
|
raise
|
47
57
|
ensure
|
48
|
-
|
58
|
+
if Dir.exists?("./procon_bypass_man-#{version}")
|
59
|
+
system_and_puts "rm -rf ./procon_bypass_man-#{version}"
|
60
|
+
end
|
49
61
|
end
|
50
62
|
|
51
63
|
# TODO currentが挿しているバージョンはどうする?
|
@@ -60,15 +72,21 @@ module Pbmenv
|
|
60
72
|
|
61
73
|
def self.use(version)
|
62
74
|
raise "Need a version" if version.nil?
|
75
|
+
version = versions.last if version == "latest"
|
63
76
|
|
64
|
-
|
77
|
+
if !File.exists?("/usr/share/pbm/#{version}") && !File.exists?("/usr/share/pbm/v#{version}")
|
65
78
|
return false
|
66
79
|
end
|
67
80
|
|
68
|
-
if File.
|
81
|
+
if File.symlink?("#{PBM_DIR}/current")
|
69
82
|
system_and_puts "unlink #{PBM_DIR}/current"
|
70
83
|
end
|
71
|
-
|
84
|
+
|
85
|
+
if(version_number = version.match(/v?([\w.]+)/)[1])
|
86
|
+
system_and_puts "ln -s #{PBM_DIR}/v#{version_number} #{PBM_DIR}/current"
|
87
|
+
else
|
88
|
+
raise "mismatch version number!"
|
89
|
+
end
|
72
90
|
end
|
73
91
|
|
74
92
|
def self.download_src(version)
|
@@ -77,6 +95,7 @@ module Pbmenv
|
|
77
95
|
git clone https://github.com/splaplapla/procon_bypass_man.git procon_bypass_man-#{version}
|
78
96
|
SHELL
|
79
97
|
else
|
98
|
+
# TODO cache for testing
|
80
99
|
shell = <<~SHELL
|
81
100
|
curl -L https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v#{version}.tar.gz | tar xvz
|
82
101
|
SHELL
|
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.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A package manager of PBM
|
14
14
|
email:
|