pbmenv 0.1.1 → 0.1.5

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: ef480a00f5dc91ea2269721035b8bc58c20078bd89f6b5484ccf96e664e68e10
4
- data.tar.gz: 0cde53229b1177ec6adba401687e15302529fbcc261820eb5e5e1d1034192563
3
+ metadata.gz: a9a7bfc60b36d4c37090e73b0b8ce6e2c0bba454bc15d1eb868a7c79bdbe1bf4
4
+ data.tar.gz: 7ab067f69450da109588bb69f4fbb5ab4cb928f77335b312988db6bc261aac62
5
5
  SHA512:
6
- metadata.gz: c8e9401fb8e6f01d04fa55ccfe48e60026b1cc7b400203172ae7a1793bc3f4cd6fc78e8a2ef8c8b7d2fee180ed0c86b6b5f3b2b1b95575dd8091e64b57ad94b7
7
- data.tar.gz: 537a0dc40da2f341319d664d0f7cc154de6f9e632712b0c2a1e16afbb8fbb4becd164dfe1c036da8d8c75b39e4b10e59e17bdef7db5c645533ddec97f0ea5a20
6
+ metadata.gz: 6d8d3cccb07cbaca61a8e677ff49d03ec30025db9855bed03277e0ce7ddb18b15216978250fa6f15503bdff1cb08988eaec84ab15f9d1ad886e047e05f9da0ef
7
+ data.tar.gz: 4f3d85457dc011d46f05b820b2f145c34e02b5fbe75b9cf6fa91a4c11300e39179d343b5f3a0bb269bd9232713fa0ffaf39d8bbede5d68280799741aecc15fcc
data/.circleci/config.yml CHANGED
@@ -36,7 +36,6 @@ build_jobs: &build_jobs
36
36
  parameters:
37
37
  version:
38
38
  - "2.5"
39
- - "2.6"
40
39
  - "2.7"
41
40
  - "3.0"
42
41
  workflows:
@@ -0,0 +1,33 @@
1
+ name: Publish to RubyGems
2
+
3
+ on:
4
+ [workflow_dispatch]
5
+
6
+ jobs:
7
+ release:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ contents: write
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ with:
15
+ token: ${{ secrets.GITHUB_TOKEN }}
16
+ - name: Set up Ruby 2.6
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 2.6
20
+ bundler-cache: true
21
+ - name: Publish to RubyGems
22
+ run: |
23
+ git config --local user.email "action@github.com"
24
+ git config --local user.name "GitHub Action"
25
+
26
+ mkdir -p $HOME/.gem
27
+ touch $HOME/.gem/credentials
28
+ chmod 0600 $HOME/.gem/credentials
29
+ printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_TOKEN}\n" > $HOME/.gem/credentials
30
+ bundle exec rake release
31
+ env:
32
+ RUBYGEMS_API_TOKEN: "${{secrets.RUBYGEMS_API_TOKEN}}"
33
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -0,0 +1,32 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ [push, workflow_dispatch]
12
+
13
+ jobs:
14
+ test:
15
+
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ ruby-version: ['2.5', '2.7', '3.0']
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
+ # uses: ruby/setup-ruby@v1
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31
+ - name: Run tests
32
+ run: bundle exec rake
data/.rspec CHANGED
@@ -1 +1,2 @@
1
1
  --require spec_helper
2
+ -f d
data/CHANGELOG.md CHANGED
@@ -1,4 +1,19 @@
1
- ## [0.1.1] - 2021-09-
1
+ ## [0.1.5] - 2021-11-16
2
+
3
+ - `/usr/share/pbm/shared/device_id` を作成するようにしました
4
+ ## [0.1.4] - 2021-11-15
5
+
6
+ - `/usr/share/pbm/current/device_id` にシムリンクを作成するようにしました
7
+
8
+ ## [0.1.3] - 2021-10-22
9
+
10
+ - help的な出力をする
11
+
12
+ ## [0.1.2] - 2021-09-19
13
+
14
+ - Github Actionsを使う
15
+
16
+ ## [0.1.1] - 2021-09-18
2
17
 
3
18
  - installの引数にlatestという値を渡せるようにしました
4
19
 
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 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.1)
4
+ pbmenv (0.1.5)
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
+ x86_64-linux
33
34
 
34
35
  DEPENDENCIES
35
36
  pbmenv!
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Pbmenv
2
+ [![Ruby](https://github.com/splaplapla/pbmenv/actions/workflows/ruby.yml/badge.svg?branch=master)](https://github.com/splaplapla/pbmenv/actions/workflows/ruby.yml)
2
3
 
3
4
  * https://github.com/splaplapla/procon_bypass_man のバージョンマネージャー
4
5
  * Raspberry Pi OSでの実行を想定しています
@@ -41,3 +42,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
41
42
  ## Development
42
43
  * docker-compose build --no-cache
43
44
  * docker-compose run app bash
45
+ * bin/rspec
data/Rakefile CHANGED
@@ -1,4 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- task default: %i[]
4
+
5
+ begin
6
+ require 'rspec/core/rake_task'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ task :default => :spec
11
+ rescue LoadError
12
+ # no rspec available
13
+ end
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
@@ -13,6 +13,13 @@ module Pbmenv
13
13
  when 'uninstall'
14
14
  sub_command_arg = argv[1]
15
15
  Pbmenv.uninstall(sub_command_arg)
16
+ when '--version'
17
+ puts Pbmenv::VERSION
18
+ else
19
+ puts <<~EOH
20
+ Unknown command:
21
+ available commands: available_versions, versions, install, uninstall
22
+ EOH
16
23
  end
17
24
  end
18
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pbmenv
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.5"
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,32 @@ 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
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
48
+
32
49
  use version
33
50
  rescue => e
34
- system_with_puts "rm -rf #{PBM_DIR}/v#{version}"
51
+ system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
35
52
  raise
36
53
  ensure
37
- system_with_puts "rm -rf ./procon_bypass_man-#{version}"
54
+ if Dir.exists?("./procon_bypass_man-#{version}")
55
+ system_and_puts "rm -rf ./procon_bypass_man-#{version}"
56
+ end
38
57
  end
39
58
 
40
59
  # TODO currentが挿しているバージョンはどうする?
@@ -44,7 +63,7 @@ module Pbmenv
44
63
  unless File.exists?("/usr/share/pbm/v#{version}")
45
64
  return false
46
65
  end
47
- system_with_puts "rm -rf #{PBM_DIR}/v#{version}"
66
+ system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
48
67
  end
49
68
 
50
69
  def self.use(version)
@@ -55,9 +74,9 @@ module Pbmenv
55
74
  end
56
75
 
57
76
  if File.exists?("#{PBM_DIR}/current")
58
- system_with_puts "unlink #{PBM_DIR}/current"
77
+ system_and_puts "unlink #{PBM_DIR}/current"
59
78
  end
60
- system_with_puts "ln -s #{PBM_DIR}/v#{version} #{PBM_DIR}/current"
79
+ system_and_puts "ln -s #{PBM_DIR}/v#{version} #{PBM_DIR}/current"
61
80
  end
62
81
 
63
82
  def self.download_src(version)
@@ -66,17 +85,18 @@ module Pbmenv
66
85
  git clone https://github.com/splaplapla/procon_bypass_man.git procon_bypass_man-#{version}
67
86
  SHELL
68
87
  else
88
+ # TODO cache for testing
69
89
  shell = <<~SHELL
70
90
  curl -L https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v#{version}.tar.gz | tar xvz
71
91
  SHELL
72
92
  end
73
- system_with_puts(shell)
93
+ system_and_puts(shell)
74
94
  unless File.exists?("procon_bypass_man-#{version}/project_template")
75
95
  raise "This version is not support by pbmenv"
76
96
  end
77
97
  end
78
98
 
79
- def self.system_with_puts(shell)
99
+ def self.system_and_puts(shell)
80
100
  puts "[SHELL] #{shell}"
81
101
  system(shell)
82
102
  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.1
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-17 00:00:00.000000000 Z
11
+ date: 2021-11-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A package manager of PBM
14
14
  email:
@@ -19,6 +19,8 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - ".circleci/config.yml"
22
+ - ".github/workflows/release.yml"
23
+ - ".github/workflows/ruby.yml"
22
24
  - ".gitignore"
23
25
  - ".rspec"
24
26
  - CHANGELOG.md
@@ -30,6 +32,7 @@ files:
30
32
  - README.md
31
33
  - Rakefile
32
34
  - bin/console
35
+ - bin/rspec
33
36
  - bin/setup
34
37
  - docker-compose.yml
35
38
  - docker/Gemfile
@@ -44,7 +47,7 @@ licenses:
44
47
  - MIT
45
48
  metadata:
46
49
  homepage_uri: https://github.com/splaplapla/pbmenv
47
- post_install_message:
50
+ post_install_message:
48
51
  rdoc_options: []
49
52
  require_paths:
50
53
  - lib
@@ -59,8 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
62
  - !ruby/object:Gem::Version
60
63
  version: '0'
61
64
  requirements: []
62
- rubygems_version: 3.2.3
63
- signing_key:
65
+ rubygems_version: 3.0.3.1
66
+ signing_key:
64
67
  specification_version: 4
65
68
  summary: A package manager of PBM
66
69
  test_files: []