bundle-only 0.3.0 → 0.4.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: a224e4c2c02c9547541678c099de9d001d608dcd93aa5011b37f75bba147c91f
4
- data.tar.gz: c319abc444e4764e156671cb9e7d8c3af9a60662ac59a8901ab7cd4130ea76a8
3
+ metadata.gz: 867805f0a3fd082b61eaf648224640fc057ece34c1544f545624fb6fea102e13
4
+ data.tar.gz: 4922cd046b99d1913d0c18034c277855881593a3f8c1b05b88728526e13a5018
5
5
  SHA512:
6
- metadata.gz: b3ef06472ba540de0352e809c1a3317732eae6a979da6aff463cc84579c860250a7701b71d168497f3e7fb45e1b79e174b978738172db8f187486679eedd7603
7
- data.tar.gz: 9c95e8e5c0a1eb34bb58a4318ddb9925842f561b47a304355093d283d4d233199ef0824dff6ea365fa9754c933972d8faeb72454aa7e16237a472d7a53e3cb47
6
+ metadata.gz: 647df0b373bf683fadaa4a64ef0b78354d5b92f2cc4d814f0c27fde5fcef818681dde1a1b297638698bb0cea8b7b6ad45ff39c2e3b7c6afb0d2d6464ee700401
7
+ data.tar.gz: cafc443ea654041d4fa212e54d146318ebadf182221e2da33c86a343b64d52bc3a085241cd539f38da4274d020a7188780622b043ae831dd86cb591e12e5800b
@@ -3,7 +3,9 @@ AllCops:
3
3
  TargetRubyVersion: 2.3
4
4
  Metrics/LineLength:
5
5
  Enabled: false
6
- Style/FileName:
6
+ Naming/FileName:
7
7
  Enabled: false
8
8
  Style/Documentation:
9
9
  Enabled: false
10
+ Style/StderrPuts:
11
+ Enabled: false
@@ -1,14 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-01-23 23:34:56 +0300 using RuboCop version 0.36.0.
3
+ # on 2019-07-22 14:21:08 +0300 using RuboCop version 0.73.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- Style/Documentation:
10
+ Style/CommentedKeyword:
11
11
  Exclude:
12
- - 'spec/**/*'
13
- - 'test/**/*'
14
12
  - 'exe/bundle-only'
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - ruby
4
+ - jruby
5
+ - truffleruby
6
+ # Backward compatiblity checks
7
+ - 2.1
8
+ - 2.2
9
+ - 2.3
10
+ - 2.4
11
+ - 2.5
12
+ - 2.6
@@ -0,0 +1,4 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "ruby.format": "rubocop"
4
+ }
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  gemspec
data/Rakefile CHANGED
@@ -1,3 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler/gem_tasks'
3
- task default: :spec
4
+ task default: :test
5
+
6
+ task :test do
7
+ sh 'bin/test'
8
+ end
data/bin/run ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd)"
4
+ exec ruby -I"$PROJECT_ROOT/lib" "$PROJECT_ROOT/exe/bundle-only" "$@"
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd)"
4
+
5
+ cd "$PROJECT_ROOT/test/workspace"
6
+ git clean -dxf .
7
+ "$PROJECT_ROOT/bin/run" special
@@ -1,6 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
- lib = File.expand_path('../lib', __FILE__)
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'bundle-only/version'
6
6
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_runtime_dependency 'bundler', '~> 1.11'
26
+ spec.add_runtime_dependency 'bundler', '>= 1.11'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
28
28
  spec.add_development_dependency 'rubocop', '>= 0.36.0'
29
29
  end
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Exit cleanly from an early interrupt
5
+ Signal.trap('INT') do
6
+ Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler)
7
+ exit 1
8
+ end
9
+
4
10
  require 'bundle-only/messages'
5
11
 
6
12
  install_only = ARGV.to_a.map(&:to_sym)
@@ -33,9 +39,6 @@ Bundler.ui = Bundler::UI::Shell.new
33
39
 
34
40
  installer = Bundler::Installer.install(Bundler.root, definition, system: true)
35
41
 
36
- BundleOnly::Messages.print_installation_complete(definition)
37
- BundleOnly::Messages.confirm_without_groups
38
-
39
- installer.post_install_messages.each do |name, message|
40
- BundleOnly::Messages.print_post_install_message(name, message)
41
- end
42
+ BundleOnly::Messages::Install.output_installation_complete_message(definition)
43
+ BundleOnly::Messages::Common.output_without_groups_message(:install)
44
+ BundleOnly::Messages::Common.output_post_install_messages installer.post_install_messages
@@ -1,2 +1,3 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundle-only/version'
@@ -1,37 +1,55 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module BundleOnly
3
4
  module Messages
4
- module_function
5
+ module Install
6
+ # Ref: https://github.com/bundler/bundler/blob/d0d3f2786149cbaca6506b95e4be91be98161c15/lib/bundler/cli/install.rb
5
7
 
6
- def without_groups_message(groups)
7
- group_list = [groups[0...-1].join(', '), groups[-1..-1]]
8
- .reject { |s| s.to_s.empty? }.join(' and ')
9
- group_str = groups.size == 1 ? 'group' : 'groups'
10
- "Gems in the #{group_str} #{group_list} were not installed."
11
- end
8
+ def self.dependencies_count_for(definition)
9
+ count = definition.dependencies.count
10
+ "#{count} Gemfile #{count == 1 ? 'dependency' : 'dependencies'}"
11
+ end
12
12
 
13
- def confirm_without_groups
14
- groups = Bundler.settings.without
15
- Bundler.ui.confirm without_groups_message(groups) if groups.any?
16
- end
13
+ def self.gems_installed_for(definition)
14
+ count = definition.specs.count
15
+ "#{count} #{count == 1 ? 'gem' : 'gems'} now installed"
16
+ end
17
17
 
18
- def dependencies_count_for(definition)
19
- count = definition.dependencies.count
20
- "#{count} Gemfile #{count == 1 ? 'dependency' : 'dependencies'}"
18
+ def self.output_installation_complete_message(definition)
19
+ Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
20
+ end
21
21
  end
22
22
 
23
- def gems_installed_for(definition)
24
- count = definition.specs.count
25
- "#{count} #{count == 1 ? 'gem' : 'gems'} now installed"
26
- end
23
+ module Common
24
+ # Ref: https://github.com/bundler/bundler/blob/d0d3f2786149cbaca6506b95e4be91be98161c15/lib/bundler/cli/common.rb
27
25
 
28
- def print_post_install_message(name, msg)
29
- Bundler.ui.confirm "Post-install message from #{name}:"
30
- Bundler.ui.info msg
31
- end
26
+ def self.output_post_install_messages(messages)
27
+ return if Bundler.settings['ignore_messages']
28
+
29
+ messages.to_a.each do |name, msg|
30
+ print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"]
31
+ end
32
+ end
33
+
34
+ def self.print_post_install_message(name, msg)
35
+ Bundler.ui.confirm "Post-install message from #{name}:"
36
+ Bundler.ui.info msg
37
+ end
38
+
39
+ def self.output_without_groups_message(command)
40
+ return if Bundler.settings[:without].empty?
41
+
42
+ Bundler.ui.confirm without_groups_message(command)
43
+ end
32
44
 
33
- def print_installation_complete(definition)
34
- Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
45
+ def self.without_groups_message(command)
46
+ command_in_past_tense = command == :install ? 'installed' : 'updated'
47
+ groups = Bundler.settings[:without]
48
+ group_list = [groups[0...-1].join(', '), groups[-1..-1]]
49
+ .reject { |s| s.to_s.empty? }.join(' and ')
50
+ group_str = groups.size == 1 ? 'group' : 'groups'
51
+ "Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}."
52
+ end
35
53
  end
36
54
  end
37
55
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module BundleOnly
3
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
4
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundle-only
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MOZGIII
@@ -14,14 +14,14 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.11'
27
27
  - !ruby/object:Gem::Dependency
@@ -67,9 +67,13 @@ files:
67
67
  - ".gitignore"
68
68
  - ".rubocop.yml"
69
69
  - ".rubocop_todo.yml"
70
+ - ".travis.yml"
71
+ - ".vscode/settings.json"
70
72
  - Gemfile
71
73
  - README.md
72
74
  - Rakefile
75
+ - bin/run
76
+ - bin/test
73
77
  - bundle-only.gemspec
74
78
  - exe/bundle-only
75
79
  - lib/bundle-only.rb