pbmenv 0.1.5 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +16 -1
- data/Gemfile.lock +4 -3
- data/README.md +5 -1
- data/lib/pbmenv/cli.rb +16 -2
- data/lib/pbmenv/version.rb +1 -1
- data/lib/pbmenv.rb +24 -6
- 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: d84d71d3bcf5e7e79a41197911ac54faf9af6dbda23ccedc35975efbb7e6a58b
|
4
|
+
data.tar.gz: 210058e9076ada3295ce82f03b0194c42539d12ae6bc231c004d9d2dbbf94e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f4c9d3ba339adb0c6be98c276eb78e41648735035cf817b02986d8aa1c8c2b5829c3bbbc0bdb716f2cbfae7e25a311282a2af1c52af5990b5876baf91077c7b
|
7
|
+
data.tar.gz: 0352bcc42d5561ca37d6a20554138d1cfffe744adb06700c5443f6068efa5b2a3d77db00c319b147b78f7939e829f51501e86d80b4790ce89e30628a6808a225
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
|
-
## [0.1.
|
1
|
+
## [0.1.9] - 2022-02-18
|
2
|
+
- Pbmenv.installにenable_pbm_cloudオプションを追加しました
|
3
|
+
- Pbmenv.installにuse_optionオプションを追加しました
|
4
|
+
- また、 `pbmenv intall xxx --use` が使えるようになりました
|
5
|
+
|
6
|
+
## [0.1.8] - 2022-02-08
|
7
|
+
- 不具合修正
|
8
|
+
|
9
|
+
## [0.1.7] - 2022-01-11
|
10
|
+
- currentが存在しないときに、installを実行するとcurrentを貼るようにしました
|
2
11
|
|
12
|
+
## [0.1.6] - 2021-12-01
|
13
|
+
- Improve spec
|
14
|
+
- installコマンドでcurrentの張り替えをしないようにしました。currentの参照を変えるときはuseコマンドを使ってください
|
15
|
+
|
16
|
+
## [0.1.5] - 2021-11-16
|
3
17
|
- `/usr/share/pbm/shared/device_id` を作成するようにしました
|
18
|
+
|
4
19
|
## [0.1.4] - 2021-11-15
|
5
20
|
|
6
21
|
- `/usr/share/pbm/current/device_id` にシムリンクを作成するようにしました
|
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.9)
|
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,9 @@ gem 'pbmenv'
|
|
17
17
|
* pbmenv available_versions
|
18
18
|
* pbmenv versions
|
19
19
|
* pbmenv install $version
|
20
|
+
* --use
|
21
|
+
* そのまま/usr/share/pbm/currentディレクトリへのシンボリックリンクを貼ります
|
22
|
+
* pbmenv use $version
|
20
23
|
* pbmenv uninstall $version
|
21
24
|
* API
|
22
25
|
* Pbmenv.available_versions
|
@@ -26,6 +29,7 @@ gem 'pbmenv'
|
|
26
29
|
* Pbmenv.install(version)
|
27
30
|
* https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v#{version}.tar.gz をダウンロードして、
|
28
31
|
* /usr/share/pbm/#{version} に app.rb, pbm.servive, setting.yml を配備する
|
32
|
+
* Pbmenv.use(version)
|
29
33
|
* /usr/share/pbm/#{version} を /usr/share/pbm/current へのシムリンクを作成する
|
30
34
|
* Pbmenv.uninstall(version)
|
31
35
|
* /usr/share/pbm/current が削除対象だったら例外を投げる
|
@@ -40,6 +44,6 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
|
|
40
44
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
45
|
|
42
46
|
## Development
|
43
|
-
* docker-compose build --no-cache
|
47
|
+
* docker-compose build --no-cache
|
44
48
|
* docker-compose run app bash
|
45
49
|
* bin/rspec
|
data/lib/pbmenv/cli.rb
CHANGED
@@ -9,7 +9,21 @@ module Pbmenv
|
|
9
9
|
Pbmenv.versions.each { |x| puts x }
|
10
10
|
when 'install', 'i'
|
11
11
|
sub_command_arg = argv[1]
|
12
|
-
|
12
|
+
case argv[2]
|
13
|
+
when "--use"
|
14
|
+
use_option = true
|
15
|
+
when nil
|
16
|
+
use_option = false
|
17
|
+
else
|
18
|
+
puts <<~EOH
|
19
|
+
Unknown option:
|
20
|
+
available options: --use
|
21
|
+
EOH
|
22
|
+
end
|
23
|
+
Pbmenv.install(sub_command_arg, use_option: use_option)
|
24
|
+
when 'use', 'u'
|
25
|
+
sub_command_arg = argv[1]
|
26
|
+
Pbmenv.use(sub_command_arg)
|
13
27
|
when 'uninstall'
|
14
28
|
sub_command_arg = argv[1]
|
15
29
|
Pbmenv.uninstall(sub_command_arg)
|
@@ -18,7 +32,7 @@ module Pbmenv
|
|
18
32
|
else
|
19
33
|
puts <<~EOH
|
20
34
|
Unknown command:
|
21
|
-
available commands: available_versions, versions, install, uninstall
|
35
|
+
available commands: available_versions, versions, install, use, uninstall
|
22
36
|
EOH
|
23
37
|
end
|
24
38
|
end
|
data/lib/pbmenv/version.rb
CHANGED
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,10 +15,10 @@ 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
|
-
def self.install(version)
|
21
|
+
def self.install(version, use_option: false, enable_pbm_cloud: false)
|
21
22
|
raise "Need a version" if version.nil?
|
22
23
|
if version == 'latest'
|
23
24
|
version = available_versions.first
|
@@ -32,6 +33,14 @@ module Pbmenv
|
|
32
33
|
mkdir -p #{PBM_DIR}/v#{version} && cp -r procon_bypass_man-#{version}/project_template/* #{PBM_DIR}/v#{version}/
|
33
34
|
SHELL
|
34
35
|
|
36
|
+
if enable_pbm_cloud
|
37
|
+
text = File.read("#{PBM_DIR}/v#{version}/app.rb")
|
38
|
+
if text =~ /config\.api_servers\s+=\s+\['(https:\/\/.+)'\]/ && (url = $1)
|
39
|
+
text.gsub!(/#\s+config\.api_servers\s+=\s+.+$/, "config.api_servers = '#{url}'")
|
40
|
+
end
|
41
|
+
File.write("#{PBM_DIR}/v#{version}/app.rb", text)
|
42
|
+
end
|
43
|
+
|
35
44
|
unless File.exists?("#{PBM_DIR}/shared")
|
36
45
|
system_and_puts <<~SHELL
|
37
46
|
mkdir -p #{PBM_DIR}/shared
|
@@ -46,7 +55,10 @@ module Pbmenv
|
|
46
55
|
ln -s #{PBM_DIR}/shared/device_id #{PBM_DIR}/v#{version}/device_id
|
47
56
|
SHELL
|
48
57
|
|
49
|
-
|
58
|
+
# 初回だけinstall時にcurrentを作成する
|
59
|
+
if !File.exists?("#{PBM_DIR}/current") || use_option
|
60
|
+
use(version)
|
61
|
+
end
|
50
62
|
rescue => e
|
51
63
|
system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
|
52
64
|
raise
|
@@ -68,15 +80,21 @@ module Pbmenv
|
|
68
80
|
|
69
81
|
def self.use(version)
|
70
82
|
raise "Need a version" if version.nil?
|
83
|
+
version = versions.last if version == "latest"
|
71
84
|
|
72
|
-
|
85
|
+
if !File.exists?("/usr/share/pbm/#{version}") && !File.exists?("/usr/share/pbm/v#{version}")
|
73
86
|
return false
|
74
87
|
end
|
75
88
|
|
76
|
-
if File.
|
89
|
+
if File.symlink?("#{PBM_DIR}/current")
|
77
90
|
system_and_puts "unlink #{PBM_DIR}/current"
|
78
91
|
end
|
79
|
-
|
92
|
+
|
93
|
+
if(version_number = version.match(/v?([\w.]+)/)[1])
|
94
|
+
system_and_puts "ln -s #{PBM_DIR}/v#{version_number} #{PBM_DIR}/current"
|
95
|
+
else
|
96
|
+
raise "mismatch version number!"
|
97
|
+
end
|
80
98
|
end
|
81
99
|
|
82
100
|
def self.download_src(version)
|
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.9
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A package manager of PBM
|
14
14
|
email:
|