bundled_gems 0.0.6 → 0.1.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: 8182b42339f70a4386c91a044dbbe197da789f4a85fd5abf865babc05fa5990b
4
+ data.tar.gz: 8bc078d2605d287b3b0d9852e58e37a14a74538b2896c1ff51befc8227c1631a
5
5
  SHA512:
6
- metadata.gz: 302b6b130c8614f1ab9546589d6e0f2e453a3719a3def12ac56d657bcc8afae1d0d4b25ebe67433600ccb99f4c887919857793493462eb83515c4181b5e55bd1
7
- data.tar.gz: 8350de78097cdb9eb2eeb225a703a8293619227d3616e003265a63f35b2eb6ec2a0f11951e8b3d4ac1c087680222f3facda635aed08388f99dd81c8008d75506
6
+ metadata.gz: 2d2b7d061860f4f624d7a467b7d50efc24bea241eb610a5b2118a07c15b738fa89ce1e07b6d16088a45037c729c485c070e03c7a501df9f27f938ba435c7fe82
7
+ data.tar.gz: b418d15204579e49a240299cc16c9d721c26373872df28007bb5362e73c70196a3083e416c47a35c4b1a1d15c4d75961885441d8e6672727923c5d580ab89cb4
@@ -6,18 +6,21 @@ jobs:
6
6
  matrix:
7
7
  ruby: [2.4.x, 2.5.x, 2.6.x]
8
8
  os: [ubuntu-latest, macos-latest]
9
+
9
10
  runs-on: ${{ matrix.os }}
11
+
10
12
  steps:
11
13
  - uses: actions/checkout@v1
12
14
  - name: Set up Ruby ${{ matrix.ruby }}
13
15
  uses: actions/setup-ruby@v1
14
16
  with:
15
17
  ruby-version: ${{ matrix.ruby }}
16
- - name: Build and test with Rake
18
+ - name: Install gems
17
19
  run: |
18
20
  gem install bundler --force --no-document
19
21
  bundle install --jobs 4 --retry 3
20
- bundle exec rake
22
+ - run: bundle exec rake
23
+ - run: bundle exec rubocop
21
24
  - run: ./bin/bgem
22
25
  - run: ./bin/bgem list
23
26
  - run: ./bin/bgem install rake
@@ -11,7 +11,7 @@ jobs:
11
11
  ruby-version: 2.6.x
12
12
  - name: Install RuboCop and Run
13
13
  run: |
14
- bundle install --jobs 4 --retry 3
14
+ bundle install
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
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.4
7
+
8
+ # Prefer assert_not_x over refute_x
9
+ Rails/RefuteMethods:
10
+ Enabled: false
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
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
data/README.md CHANGED
@@ -1,5 +1,6 @@
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
6
  Install gem specified in `Gemfile.lock` without `bundle install`.
@@ -14,19 +15,49 @@ Then, you can use `bgem` command.
14
15
 
15
16
  ## Usage
16
17
 
18
+ ```console
19
+ $ bgem
20
+ Commands:
21
+ bgem help [COMMAND] # Describe available commands or one specific command
22
+ bgem install [BUNDLED_GEM] # install [BUNDLED_GEM] specified in `Gemfile.lock`
23
+ bgem list # bundle list without `bundle install`
24
+ bgem version # bundled_gems version
25
+ ```
26
+
27
+ ### List gems
28
+
29
+ ```console
30
+ $ bgem list
31
+ Gems included in `Gemfile.lock`:
32
+ * actionpack, 5.2.3
33
+ * actionview, 5.2.3
34
+ * activesupport, 5.2.3
35
+ ...(snip)...
36
+ ```
37
+
38
+ ### Install gem
39
+
17
40
  ```console
18
41
  $ bgem install gem_name
19
42
  ```
20
43
 
44
+ ## Example
45
+
46
+ ```console
47
+ $ gem install bundled_gems # Install bundled_gems and `bgem` command is available
48
+ $ bgem install rubocop # install rubocop specified in `Gemfile.lock`
49
+ $ rubocop # Run rubocop
50
+ ```
51
+
21
52
  ## Development
22
53
 
23
54
  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
55
 
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).
56
+ To install this gem onto your local machine, run `bundle exec rake install`.
26
57
 
27
58
  ## Contributing
28
59
 
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.
60
+ 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
61
 
31
62
  ## License
32
63
 
@@ -34,4 +65,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
34
65
 
35
66
  ## Code of Conduct
36
67
 
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).
68
+ 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/master/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,32 @@ 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"]
31
+
28
32
  spec.required_ruby_version = ">= 2.4.0"
29
33
 
30
34
  spec.add_dependency "bundler"
31
35
  spec.add_dependency "thor"
32
-
33
- spec.add_development_dependency "minitest"
36
+
34
37
  spec.add_development_dependency "minitest-reporters"
38
+ spec.add_development_dependency "minitest"
35
39
  spec.add_development_dependency "rake"
36
- # spec.add_development_dependency "rubocop-rails_config"
40
+ spec.add_development_dependency "rubocop-rails_config"
37
41
  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?
@@ -22,17 +22,19 @@ module BundledGem
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 = "0.1.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: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - toshimaru
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-12 00:00:00.000000000 Z
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: minitest
42
+ name: minitest-reporters
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: minitest-reporters
56
+ name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -80,7 +80,21 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: BundledGems
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rails_config
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Install gem specified in Gemfile.lock without `bundle install`
84
98
  email:
85
99
  - me@toshimaru.net
86
100
  executables:
@@ -91,6 +105,7 @@ files:
91
105
  - ".github/workflows/ci.yml"
92
106
  - ".github/workflows/rubocop-install-sample.yml"
93
107
  - ".gitignore"
108
+ - ".rubocop.yml"
94
109
  - CODE_OF_CONDUCT.md
95
110
  - Gemfile
96
111
  - LICENSE.txt
@@ -110,7 +125,7 @@ licenses:
110
125
  metadata:
111
126
  homepage_uri: https://github.com/toshimaru/bundled_gems
112
127
  source_code_uri: https://github.com/toshimaru/bundled_gems
113
- changelog_uri: https://github.com/toshimaru/bundled_gems
128
+ changelog_uri: https://github.com/toshimaru/bundled_gems/releases
114
129
  post_install_message:
115
130
  rdoc_options: []
116
131
  require_paths:
@@ -129,5 +144,5 @@ requirements: []
129
144
  rubygems_version: 3.0.3
130
145
  signing_key:
131
146
  specification_version: 4
132
- summary: BundledGems
147
+ summary: Install gem specified in Gemfile.lock without `bundle install`
133
148
  test_files: []