pbmenv 0.1.2 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.rspec +1 -0
- data/CHANGELOG.md +15 -0
- data/Dockerfile +2 -1
- data/Gemfile.lock +3 -3
- data/README.md +4 -1
- data/bin/rspec +29 -0
- data/lib/pbmenv/cli.rb +10 -0
- data/lib/pbmenv/version.rb +1 -1
- data/lib/pbmenv.rb +27 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 963376cad2db3fdeb567e333e980a9fd37769d2fcb63be03a9292a49fc6934e6
|
4
|
+
data.tar.gz: 855f53dd708ff941bf4cae896eb87861a9c2f5aacb9e3bcc42c445633065a8eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4764912ad9754c55a89406b4540dd1ce9f31e1148d0b40bc8ef4db48c16ef559e3be12cb329253eebb4c4b1bd40dba069d8b2dfcb68cfc4c68531cc34e06ddf8
|
7
|
+
data.tar.gz: a729bf9fa4dafab651e7b84e9243cdb509857be8f7fdcc2c9bde2973fefc91503a7b738183d8cc083751643ae71703a20584a031c74c80f066d9a259e2ff1fc9
|
data/.github/workflows/ruby.yml
CHANGED
@@ -24,7 +24,7 @@ jobs:
|
|
24
24
|
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
25
25
|
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
26
|
# uses: ruby/setup-ruby@v1
|
27
|
-
uses: ruby/setup-ruby@
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
28
|
with:
|
29
29
|
ruby-version: ${{ matrix.ruby-version }}
|
30
30
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## [0.1.6] - 2021-12-01
|
2
|
+
- Improve spec
|
3
|
+
- installコマンドでcurrentの張り替えをしないようにしました。currentの参照を変えるときはuseコマンドを使ってください
|
4
|
+
|
5
|
+
## [0.1.5] - 2021-11-16
|
6
|
+
- `/usr/share/pbm/shared/device_id` を作成するようにしました
|
7
|
+
|
8
|
+
## [0.1.4] - 2021-11-15
|
9
|
+
|
10
|
+
- `/usr/share/pbm/current/device_id` にシムリンクを作成するようにしました
|
11
|
+
|
12
|
+
## [0.1.3] - 2021-10-22
|
13
|
+
|
14
|
+
- help的な出力をする
|
15
|
+
|
1
16
|
## [0.1.2] - 2021-09-19
|
2
17
|
|
3
18
|
- Github Actionsを使う
|
data/Dockerfile
CHANGED
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.6)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -25,7 +25,7 @@ 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
|
@@ -39,4 +39,4 @@ DEPENDENCIES
|
|
39
39
|
rspec
|
40
40
|
|
41
41
|
BUNDLED WITH
|
42
|
-
2.2.
|
42
|
+
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,5 +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
|
47
|
+
* bin/rspec
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/lib/pbmenv/cli.rb
CHANGED
@@ -10,9 +10,19 @@ 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)
|
19
|
+
when '--version'
|
20
|
+
puts Pbmenv::VERSION
|
21
|
+
else
|
22
|
+
puts <<~EOH
|
23
|
+
Unknown command:
|
24
|
+
available commands: available_versions, versions, install, use, uninstall
|
25
|
+
EOH
|
16
26
|
end
|
17
27
|
end
|
18
28
|
end
|
data/lib/pbmenv/version.rb
CHANGED
data/lib/pbmenv.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "securerandom"
|
4
|
+
|
3
5
|
require_relative "pbmenv/version"
|
4
6
|
require_relative "pbmenv/cli"
|
5
7
|
require_relative "pbmenv/pbm"
|
@@ -26,15 +28,30 @@ module Pbmenv
|
|
26
28
|
end
|
27
29
|
|
28
30
|
download_src(version)
|
29
|
-
|
31
|
+
system_and_puts <<~SHELL
|
30
32
|
mkdir -p #{PBM_DIR}/v#{version} && cp -r procon_bypass_man-#{version}/project_template/* #{PBM_DIR}/v#{version}/
|
31
33
|
SHELL
|
32
|
-
|
34
|
+
|
35
|
+
unless File.exists?("#{PBM_DIR}/shared")
|
36
|
+
system_and_puts <<~SHELL
|
37
|
+
mkdir -p #{PBM_DIR}/shared
|
38
|
+
SHELL
|
39
|
+
end
|
40
|
+
|
41
|
+
unless File.exists?("#{PBM_DIR}/shared/device_id")
|
42
|
+
File.write("#{PBM_DIR}/shared/device_id", "d_#{SecureRandom.uuid}")
|
43
|
+
end
|
44
|
+
|
45
|
+
system_and_puts <<~SHELL
|
46
|
+
ln -s #{PBM_DIR}/shared/device_id #{PBM_DIR}/v#{version}/device_id
|
47
|
+
SHELL
|
33
48
|
rescue => e
|
34
|
-
|
49
|
+
system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
|
35
50
|
raise
|
36
51
|
ensure
|
37
|
-
|
52
|
+
if Dir.exists?("./procon_bypass_man-#{version}")
|
53
|
+
system_and_puts "rm -rf ./procon_bypass_man-#{version}"
|
54
|
+
end
|
38
55
|
end
|
39
56
|
|
40
57
|
# TODO currentが挿しているバージョンはどうする?
|
@@ -44,7 +61,7 @@ module Pbmenv
|
|
44
61
|
unless File.exists?("/usr/share/pbm/v#{version}")
|
45
62
|
return false
|
46
63
|
end
|
47
|
-
|
64
|
+
system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
|
48
65
|
end
|
49
66
|
|
50
67
|
def self.use(version)
|
@@ -55,9 +72,9 @@ module Pbmenv
|
|
55
72
|
end
|
56
73
|
|
57
74
|
if File.exists?("#{PBM_DIR}/current")
|
58
|
-
|
75
|
+
system_and_puts "unlink #{PBM_DIR}/current"
|
59
76
|
end
|
60
|
-
|
77
|
+
system_and_puts "ln -s #{PBM_DIR}/v#{version} #{PBM_DIR}/current"
|
61
78
|
end
|
62
79
|
|
63
80
|
def self.download_src(version)
|
@@ -66,17 +83,18 @@ module Pbmenv
|
|
66
83
|
git clone https://github.com/splaplapla/procon_bypass_man.git procon_bypass_man-#{version}
|
67
84
|
SHELL
|
68
85
|
else
|
86
|
+
# TODO cache for testing
|
69
87
|
shell = <<~SHELL
|
70
88
|
curl -L https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v#{version}.tar.gz | tar xvz
|
71
89
|
SHELL
|
72
90
|
end
|
73
|
-
|
91
|
+
system_and_puts(shell)
|
74
92
|
unless File.exists?("procon_bypass_man-#{version}/project_template")
|
75
93
|
raise "This version is not support by pbmenv"
|
76
94
|
end
|
77
95
|
end
|
78
96
|
|
79
|
-
def self.
|
97
|
+
def self.system_and_puts(shell)
|
80
98
|
puts "[SHELL] #{shell}"
|
81
99
|
system(shell)
|
82
100
|
end
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A package manager of PBM
|
14
14
|
email:
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- README.md
|
33
33
|
- Rakefile
|
34
34
|
- bin/console
|
35
|
+
- bin/rspec
|
35
36
|
- bin/setup
|
36
37
|
- docker-compose.yml
|
37
38
|
- docker/Gemfile
|