pbmenv 0.1.0 → 0.1.4

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: e8dc67105ea7fe29bcbac78e0c9cdebf6392113e392da9007c6ae0e44a9c7a61
4
- data.tar.gz: 0f496a0a230b481650f115f94b9e8557930548fec2d72f52c9b2dbb13baebe66
3
+ metadata.gz: bf5ef3a99a0d05aefe181d42dacabc84929a659205d2af7e315c0deea135fac9
4
+ data.tar.gz: 63992a7e432f7c185b06dd2d5346bdc0e33500bd167b7b121a99c3b9681c9474
5
5
  SHA512:
6
- metadata.gz: 4ce6fc89439dbdf1e22e884997dd0271d6ac3c00babddf280fae284efbcf49adbb45a31a596e2b6f9c7e7a14f130794c5bb93c28935022b901b15d744386d991
7
- data.tar.gz: c69a318d18164520af09769678a88eb081826c8e91af64ac658e322b34336eee792c2b7d6a0945b553c256a26a482a60ada116ad7180b3b322f8509f66e7ebb4
6
+ metadata.gz: 6de90267f2b5501986d8325ef530a943a19933c85c8e28eba7eed879177e479999e65ba2bcddab73d59f61f78397d65bf72e92a256a24e357b7ce1880a0f4777
7
+ data.tar.gz: 56487c5af4ce175ec4cda01ca46800ec5b5d586fab88793f37d506a6ed818ce50e67f78952efd12a60d929c573a3ad57178d8e41618c207fe854907bcea9844d
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,18 @@
1
- ## [Unreleased]
1
+ ## [0.1.4] - 2021-11-15
2
+
3
+ - `/usr/share/pbm/shared/device_id` へのシムリンクを作成するようにしました
4
+
5
+ ## [0.1.3] - 2021-10-22
6
+
7
+ - help的な出力をする
8
+
9
+ ## [0.1.2] - 2021-09-19
10
+
11
+ - Github Actionsを使う
12
+
13
+ ## [0.1.1] - 2021-09-18
14
+
15
+ - installの引数にlatestという値を渡せるようにしました
2
16
 
3
17
  ## [0.1.0] - 2021-09-11
4
18
 
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.0)
4
+ pbmenv (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -30,9 +30,13 @@ 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!
36
37
  pry
37
38
  rake
38
39
  rspec
40
+
41
+ BUNDLED WITH
42
+ 2.2.16
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.0"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/pbmenv.rb CHANGED
@@ -17,21 +17,35 @@ module Pbmenv
17
17
 
18
18
  def self.install(version)
19
19
  raise "Need a version" if version.nil?
20
+ if version == 'latest'
21
+ version = available_versions.first
22
+ end
20
23
 
21
24
  if File.exists?("/usr/share/pbm/v#{version}")
22
25
  return false
23
26
  end
24
27
 
25
28
  download_src(version)
26
- system_with_puts <<~SHELL
29
+ system_and_puts <<~SHELL
27
30
  mkdir -p #{PBM_DIR}/v#{version} && cp -r procon_bypass_man-#{version}/project_template/* #{PBM_DIR}/v#{version}/
28
31
  SHELL
32
+
33
+ # sharedディレクトリを作成して、device_idへのシムリンクを作成する. device_idの中身はpbmで行う
34
+ unless File.exists?("#{PBM_DIR}/shared")
35
+ system_and_puts <<~SHELL
36
+ mkdir -p #{PBM_DIR}/shared
37
+ SHELL
38
+ end
39
+
40
+ system_and_puts <<~SHELL
41
+ ln -s #{PBM_DIR}/shared/device_id #{PBM_DIR}/v#{version}/device_id
42
+ SHELL
29
43
  use version
30
44
  rescue => e
31
- system_with_puts "rm -rf #{PBM_DIR}/v#{version}"
45
+ system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
32
46
  raise
33
47
  ensure
34
- system_with_puts "rm -rf ./procon_bypass_man-#{version}"
48
+ system_and_puts "rm -rf ./procon_bypass_man-#{version}"
35
49
  end
36
50
 
37
51
  # TODO currentが挿しているバージョンはどうする?
@@ -41,7 +55,7 @@ module Pbmenv
41
55
  unless File.exists?("/usr/share/pbm/v#{version}")
42
56
  return false
43
57
  end
44
- system_with_puts "rm -rf #{PBM_DIR}/v#{version}"
58
+ system_and_puts "rm -rf #{PBM_DIR}/v#{version}"
45
59
  end
46
60
 
47
61
  def self.use(version)
@@ -52,9 +66,9 @@ module Pbmenv
52
66
  end
53
67
 
54
68
  if File.exists?("#{PBM_DIR}/current")
55
- system_with_puts "unlink #{PBM_DIR}/current"
69
+ system_and_puts "unlink #{PBM_DIR}/current"
56
70
  end
57
- system_with_puts "ln -s #{PBM_DIR}/v#{version} #{PBM_DIR}/current"
71
+ system_and_puts "ln -s #{PBM_DIR}/v#{version} #{PBM_DIR}/current"
58
72
  end
59
73
 
60
74
  def self.download_src(version)
@@ -67,13 +81,13 @@ module Pbmenv
67
81
  curl -L https://github.com/splaplapla/procon_bypass_man/archive/refs/tags/v#{version}.tar.gz | tar xvz
68
82
  SHELL
69
83
  end
70
- system_with_puts(shell)
84
+ system_and_puts(shell)
71
85
  unless File.exists?("procon_bypass_man-#{version}/project_template")
72
86
  raise "This version is not support by pbmenv"
73
87
  end
74
88
  end
75
89
 
76
- def self.system_with_puts(shell)
90
+ def self.system_and_puts(shell)
77
91
  puts "[SHELL] #{shell}"
78
92
  system(shell)
79
93
  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.0
4
+ version: 0.1.4
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-11 00:00:00.000000000 Z
11
+ date: 2021-11-15 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: []