bundled_gems 0.0.6 → 1.0.0

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: fda1bb7a55e1f2044846b67333cdfc9d4d4ee679837cefaef30cff3d4f06f9e5
4
- data.tar.gz: d000cb6953d0e7e5682cf1ff3f0ecd457056be97d0648695e35ce08d582f12ef
3
+ metadata.gz: 19b10078e762bc06af175dd64cf9eeb3cc079e9dc32031394e59c5664c6163be
4
+ data.tar.gz: 8a2863413cd32483e99b3f5e56da834c2f910f881bf200d90f9c20b572d2e8c0
5
5
  SHA512:
6
- metadata.gz: 302b6b130c8614f1ab9546589d6e0f2e453a3719a3def12ac56d657bcc8afae1d0d4b25ebe67433600ccb99f4c887919857793493462eb83515c4181b5e55bd1
7
- data.tar.gz: 8350de78097cdb9eb2eeb225a703a8293619227d3616e003265a63f35b2eb6ec2a0f11951e8b3d4ac1c087680222f3facda635aed08388f99dd81c8008d75506
6
+ metadata.gz: 4b14966bbb5c14f56b396c6b91a733fcd94ff6b3bffb4292accc050907c91d4f143b81acf7f5187c9248d8b72ac16b458571bc20bf19a5855e5a862c733361d3
7
+ data.tar.gz: ff7ac6286465ea7a010049441160fffc96d40298e5ab952883528916e704a5bb2f8f9a7250cebd2bdcf708c6a4b08c3e48233532e3ac3c11d9d1e4bff8ac0d2d
@@ -1,23 +1,27 @@
1
1
  name: Ruby Test
2
- on: [push]
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
3
9
  jobs:
4
10
  build:
5
11
  strategy:
6
12
  matrix:
7
- ruby: [2.4.x, 2.5.x, 2.6.x]
13
+ ruby: ['2.6', '2.7', '3.0', '3.1']
8
14
  os: [ubuntu-latest, macos-latest]
9
15
  runs-on: ${{ matrix.os }}
10
16
  steps:
11
- - uses: actions/checkout@v1
17
+ - uses: actions/checkout@v2
12
18
  - name: Set up Ruby ${{ matrix.ruby }}
13
- uses: actions/setup-ruby@v1
19
+ uses: ruby/setup-ruby@v1
14
20
  with:
15
21
  ruby-version: ${{ matrix.ruby }}
16
- - name: Build and test with Rake
17
- run: |
18
- gem install bundler --force --no-document
19
- bundle install --jobs 4 --retry 3
20
- bundle exec rake
22
+ bundler-cache: true
23
+ - run: bundle exec rake
24
+ - run: bundle exec rubocop
21
25
  - run: ./bin/bgem
22
26
  - run: ./bin/bgem list
23
27
  - run: ./bin/bgem install rake
@@ -4,14 +4,17 @@ jobs:
4
4
  sample:
5
5
  runs-on: ubuntu-latest
6
6
  steps:
7
- - uses: actions/checkout@v1
8
- - name: Set up Ruby 2.6.x
9
- uses: actions/setup-ruby@v1
7
+ - uses: actions/checkout@v2
8
+ - name: Set up Ruby
9
+ uses: ruby/setup-ruby@v1
10
10
  with:
11
- ruby-version: 2.6.x
11
+ ruby-version: 3.1
12
12
  - name: Install RuboCop and Run
13
13
  run: |
14
- bundle install --jobs 4 --retry 3
14
+ bundle install --without development
15
15
  ./bin/bgem list --lockfile test/fixture/Gemfile.sample.lock
16
16
  ./bin/bgem install rubocop --lockfile test/fixture/Gemfile.sample.lock
17
17
  rubocop --version
18
+ - name: Installed rubocop version test
19
+ run: |
20
+ [[ $(rubocop --version) == "0.70.0" ]] || exit 1
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ inherit_gem:
2
+ rubocop-rails_config:
3
+ - config/rails.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
7
+
8
+ # Prefer assert_not_x over refute_x
9
+ Rails/RefuteMethods:
10
+ Enabled: false
data/Gemfile CHANGED
@@ -1,4 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in bundled_gems.gemspec
4
6
  gemspec
7
+
8
+ gem "rake"
9
+
10
+ group :development do
11
+ gem "minitest-reporters"
12
+ gem "minitest"
13
+ gem "rubocop-rails_config"
14
+ end
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 toshimaru
3
+ Copyright (c) 2019-2022 toshimaru
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,8 +1,15 @@
1
1
  # BundledGems
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/bundled_gems.svg)](https://badge.fury.io/rb/bundled_gems)
3
4
  [![Actions Status](https://github.com/toshimaru/bundled_gems/workflows/Ruby%20Test/badge.svg)](https://github.com/toshimaru/bundled_gems/actions)
4
5
 
5
- Install gem specified in `Gemfile.lock` without `bundle install`.
6
+ Install a gem specified in `Gemfile.lock` without running `bundle install`.
7
+
8
+ ## Motivation
9
+
10
+ After the emergence of Docker, libraries (such as rubygems) are installed inside Docker or Docker Volume, but we sometimes want to install specific version of libraries in Host machine.
11
+
12
+ Here comes the bundled_gems command (`bgem`). `bgem` reads your `Gemfile.lock` and install the specific version of the gem.
6
13
 
7
14
  ## Installation
8
15
 
@@ -10,23 +17,53 @@ Install gem specified in `Gemfile.lock` without `bundle install`.
10
17
  $ gem install bundled_gems
11
18
  ```
12
19
 
13
- Then, you can use `bgem` command.
20
+ Then, `bgem` command is available.
14
21
 
15
22
  ## Usage
16
23
 
24
+ ```console
25
+ $ bgem
26
+ Commands:
27
+ bgem help [COMMAND] # Describe available commands or one specific command
28
+ bgem install [BUNDLED_GEM] # install [BUNDLED_GEM] specified in `Gemfile.lock`
29
+ bgem list # bundle list without `bundle install`
30
+ bgem version # bundled_gems version
31
+ ```
32
+
33
+ ### List gems
34
+
35
+ ```console
36
+ $ bgem list
37
+ Gems included in `Gemfile.lock`:
38
+ * actionpack, 5.2.3
39
+ * actionview, 5.2.3
40
+ * activesupport, 5.2.3
41
+ ...(snip)...
42
+ ```
43
+
44
+ ### Install gem
45
+
17
46
  ```console
18
47
  $ bgem install gem_name
19
48
  ```
20
49
 
50
+ ## Example
51
+
52
+ ```console
53
+ $ gem install bundled_gems # Install bundled_gems and `bgem` command is available
54
+ $ bgem install rubocop # install rubocop specified in `Gemfile.lock`
55
+ $ rubocop # Run rubocop
56
+ ```
57
+
21
58
  ## Development
22
59
 
23
60
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
61
 
25
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
62
+ To install this gem onto your local machine, run `bundle exec rake install`.
26
63
 
27
64
  ## Contributing
28
65
 
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bundled_gems. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
66
+ Bug reports and pull requests are welcome on GitHub at https://github.com/toshimaru/bundled_gems/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
30
67
 
31
68
  ## License
32
69
 
@@ -34,4 +71,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
34
71
 
35
72
  ## Code of Conduct
36
73
 
37
- Everyone interacting in the BundledGem project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bundled_gems/blob/master/CODE_OF_CONDUCT.md).
74
+ Everyone interacting in the BundledGem project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/toshimaru/bundled_gems/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rake/testtask"
3
5
 
@@ -7,4 +9,4 @@ Rake::TestTask.new(:test) do |t|
7
9
  t.test_files = FileList["test/**/*_test.rb"]
8
10
  end
9
11
 
10
- task :default => :test
12
+ task default: :test
data/bundled_gems.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path("lib", __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require "bundled_gem/version"
@@ -8,30 +10,27 @@ Gem::Specification.new do |spec|
8
10
  spec.authors = ["toshimaru"]
9
11
  spec.email = ["me@toshimaru.net"]
10
12
 
11
- spec.summary = %q{BundledGems}
12
- spec.description = %q{BundledGems}
13
+ spec.summary = "Install gem specified in Gemfile.lock without `bundle install`"
14
+ spec.description = "Install gem specified in Gemfile.lock without `bundle install`"
15
+
13
16
  spec.homepage = "https://github.com/toshimaru/bundled_gems"
14
17
  spec.license = "MIT"
15
18
 
16
19
  spec.metadata["homepage_uri"] = spec.homepage
17
20
  spec.metadata["source_code_uri"] = "https://github.com/toshimaru/bundled_gems"
18
- spec.metadata["changelog_uri"] = "https://github.com/toshimaru/bundled_gems"
21
+ spec.metadata["changelog_uri"] = "https://github.com/toshimaru/bundled_gems/releases"
19
22
 
20
23
  # Specify which files should be added to the gem when it is released.
21
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
25
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
23
26
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
27
  end
25
28
  spec.bindir = "exe"
26
29
  spec.executables = %w[bgem]
27
30
  spec.require_paths = ["lib"]
28
- spec.required_ruby_version = ">= 2.4.0"
31
+
32
+ spec.required_ruby_version = ">= 2.6.0"
29
33
 
30
34
  spec.add_dependency "bundler"
31
35
  spec.add_dependency "thor"
32
-
33
- spec.add_development_dependency "minitest"
34
- spec.add_development_dependency "minitest-reporters"
35
- spec.add_development_dependency "rake"
36
- # spec.add_development_dependency "rubocop-rails_config"
37
36
  end
data/exe/bgem CHANGED
@@ -2,6 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundled_gems"
5
- require 'bundled_gem/cli'
5
+ require "bundled_gem/cli"
6
6
 
7
7
  BundledGem::Cli.start(ARGV)
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'open3'
4
- require 'thor'
3
+ require "open3"
4
+ require "thor"
5
5
 
6
6
  module BundledGem
7
7
  # bundled_gem CLI class powered by thor
8
8
  class Cli < Thor
9
- desc "install [BUNDLED_GEM]", "install [BUNDLED_GEM] from `Gemfile.lock`"
9
+ desc "install [BUNDLED_GEM]", "install [BUNDLED_GEM] specified in `Gemfile.lock`"
10
10
  option "lockfile", type: :string, default: LOCKFILE, desc: "Use the specified gemfile.lock instead of Gemfile.lock"
11
11
  def install(*bundled_gems)
12
12
  abort "Please specify at least one gem name (e.g. gem build GEMNAME)" if bundled_gems.empty?
@@ -15,24 +15,26 @@ module BundledGem
15
15
  bundled_gems.each do |bundled_gem|
16
16
  if reader.gem_listed?(bundled_gem)
17
17
  version = reader.get_version(bundled_gem)
18
- command = "gem install #{bundled_gem} --version #{version}"
18
+ command = "gem install #{bundled_gem}:#{version}"
19
19
  IO.popen(command) do |f|
20
20
  while line = f.gets
21
21
  puts line
22
22
  end
23
23
  end
24
24
  else
25
- warn "`#{bundled_gem}` is not listed in Gemfile.lock."
25
+ warn "`#{bundled_gem}` is not listed in Gemfile.lock."
26
26
  end
27
27
  end
28
28
  end
29
29
 
30
+ # TODO: create i command for aliasing install
31
+
30
32
  desc "list", "bundle list without `bundle install`"
31
33
  option "lockfile", type: :string, default: LOCKFILE, desc: "Use the specified gemfile.lock instead of Gemfile.lock"
32
34
  def list
33
35
  puts "Gems included in `#{options[:lockfile]}`:"
34
- LockfileReader.new(lockfile: options[:lockfile]).lockfile_specs.each do |spec|
35
- puts " * #{spec.name}, #{spec.version}"
36
+ LockfileReader.new(lockfile: options[:lockfile]).lockfile_specs.each do |spec|
37
+ puts " * #{spec.name}, #{spec.version}"
36
38
  end
37
39
  end
38
40
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BundledGem
4
- VERSION = "0.0.6"
4
+ VERSION = "1.0.0"
5
5
  end
data/lib/bundled_gems.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler'
3
+ require "bundler"
4
4
  require "bundled_gem/version"
5
5
 
6
6
  module BundledGem
@@ -20,7 +20,7 @@ module BundledGem
20
20
 
21
21
  # Get version info from `Gemfile.lock`
22
22
  def get_version(gem)
23
- lockfile_specs.find{ |s| s.name == gem }&.version
23
+ lockfile_specs.find { |s| s.name == gem }&.version
24
24
  end
25
25
 
26
26
  # Check gem is listed in `Gemfile.lock`
@@ -29,9 +29,8 @@ module BundledGem
29
29
  end
30
30
 
31
31
  private
32
-
33
- def lockfile
34
- @lockfile ||= ::Bundler::LockfileParser.new(@lockfile_content)
35
- end
32
+ def lockfile
33
+ @lockfile ||= ::Bundler::LockfileParser.new(@lockfile_content)
34
+ end
36
35
  end
37
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundled_gems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - toshimaru
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-12 00:00:00.000000000 Z
11
+ date: 2022-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,49 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest-reporters
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- description: BundledGems
41
+ description: Install gem specified in Gemfile.lock without `bundle install`
84
42
  email:
85
43
  - me@toshimaru.net
86
44
  executables:
@@ -91,6 +49,7 @@ files:
91
49
  - ".github/workflows/ci.yml"
92
50
  - ".github/workflows/rubocop-install-sample.yml"
93
51
  - ".gitignore"
52
+ - ".rubocop.yml"
94
53
  - CODE_OF_CONDUCT.md
95
54
  - Gemfile
96
55
  - LICENSE.txt
@@ -110,8 +69,8 @@ licenses:
110
69
  metadata:
111
70
  homepage_uri: https://github.com/toshimaru/bundled_gems
112
71
  source_code_uri: https://github.com/toshimaru/bundled_gems
113
- changelog_uri: https://github.com/toshimaru/bundled_gems
114
- post_install_message:
72
+ changelog_uri: https://github.com/toshimaru/bundled_gems/releases
73
+ post_install_message:
115
74
  rdoc_options: []
116
75
  require_paths:
117
76
  - lib
@@ -119,15 +78,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
78
  requirements:
120
79
  - - ">="
121
80
  - !ruby/object:Gem::Version
122
- version: 2.4.0
81
+ version: 2.6.0
123
82
  required_rubygems_version: !ruby/object:Gem::Requirement
124
83
  requirements:
125
84
  - - ">="
126
85
  - !ruby/object:Gem::Version
127
86
  version: '0'
128
87
  requirements: []
129
- rubygems_version: 3.0.3
130
- signing_key:
88
+ rubygems_version: 3.3.7
89
+ signing_key:
131
90
  specification_version: 4
132
- summary: BundledGems
91
+ summary: Install gem specified in Gemfile.lock without `bundle install`
133
92
  test_files: []