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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0a9101c515824a7260f8b7fa580f1ed510170115d2181defc5f45883bf5eccc
4
- data.tar.gz: 6e90fafc2894fc95d6ace3a63864117fbeaf2da18527f0748f7bb41a6240813a
3
+ metadata.gz: 963376cad2db3fdeb567e333e980a9fd37769d2fcb63be03a9292a49fc6934e6
4
+ data.tar.gz: 855f53dd708ff941bf4cae896eb87861a9c2f5aacb9e3bcc42c445633065a8eb
5
5
  SHA512:
6
- metadata.gz: 1d880d194e32cd5070a8b4eb871a6ac7ef05a9aa4803532b9dcc8c95ad81358b0b18e763a77cd86d6fb93b46c3b12b2e1bca468ea7bb04a0bf7e097c65a93933
7
- data.tar.gz: a82362de51b9910c13876938cbb4ea31b03ec9709bbae00785b989a13520f243da40d9fa4698d5e4c29ab5a8679af9846e046dc6ede8eefb974be4d2ba59c913
6
+ metadata.gz: 4764912ad9754c55a89406b4540dd1ce9f31e1148d0b40bc8ef4db48c16ef559e3be12cb329253eebb4c4b1bd40dba069d8b2dfcb68cfc4c68531cc34e06ddf8
7
+ data.tar.gz: a729bf9fa4dafab651e7b84e9243cdb509857be8f7fdcc2c9bde2973fefc91503a7b738183d8cc083751643ae71703a20584a031c74c80f066d9a259e2ff1fc9
@@ -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@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
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
@@ -1 +1,2 @@
1
1
  --require spec_helper
2
+ -f d
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
@@ -2,5 +2,6 @@ FROM ruby:2.5
2
2
 
3
3
  WORKDIR /pbmenv
4
4
 
5
+ ENV CI=1
5
6
  ADD docker/Gemfile .
6
- RUN apt-get update && apt-get install vim && gem i bundler && bundle install
7
+ RUN apt-get update && apt-get install vim -y && gem i bundler && bundle install
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pbmenv (0.1.2)
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.2)
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.16
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pbmenv
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.6"
5
5
  end
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
- system_with_puts <<~SHELL
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
- use version
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
- system_with_puts "rm -rf #{PBM_DIR}/v#{version}"
49
+ system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
35
50
  raise
36
51
  ensure
37
- system_with_puts "rm -rf ./procon_bypass_man-#{version}"
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
- system_with_puts "rm -rf #{PBM_DIR}/v#{version}"
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
- system_with_puts "unlink #{PBM_DIR}/current"
75
+ system_and_puts "unlink #{PBM_DIR}/current"
59
76
  end
60
- system_with_puts "ln -s #{PBM_DIR}/v#{version} #{PBM_DIR}/current"
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
- system_with_puts(shell)
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.system_with_puts(shell)
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.2
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-09-19 00:00:00.000000000 Z
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