bundler_bash_completion 0.5.1 → 0.6.2

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
- SHA1:
3
- metadata.gz: c195ac6aaf2fdcf3f11d7fd56148da6dc3f3506a
4
- data.tar.gz: fbc88c479be129b7fabf7f7d51d467ef5967a445
2
+ SHA256:
3
+ metadata.gz: 143492f6ab2521be599802b485c28bee213415848ae192373885893ba496c691
4
+ data.tar.gz: 0a386ab26e4ad85cf9213fe928b21cfc20a112beaf518ddd7eecb28b049f6dd1
5
5
  SHA512:
6
- metadata.gz: 7072280c477d91a9402cc27482f8156ddfef4618c7904f23cefbfb42bb432e5bfd2a61b5399d9b07c210095c71cd9bda49fd27a72f6f174397b6345f49dae015
7
- data.tar.gz: 8fdbdc33772822114f506b2d4962f9fb17a72364ee5a952dbdeddc92abdd7eadf1261ad2289cd83bff8c6cec5f09c1e95c726c2a094a0b1c44ce8b4c4397a08c
6
+ metadata.gz: 8d210e88ae0e55a6463d1aef9fdd3add996ad327134195ce3178d6a3335d4faa39997a3d27a0e871da30a66e4a2bd8116a2973d562e4514fbad8876f53befa0e
7
+ data.tar.gz: bb25d0b8746b3284d745d1998cb9730978196930966fbbf5c619642a52fca0deaa099caf04fcb28a60fd94e1dd46f90462713b8d1dbf106202e9ec8bb848e86e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.6.2
@@ -10,7 +10,7 @@ _bundler_bash_completion() {
10
10
  COMPREPLY=($(compgen -W "$completion"))
11
11
  fi
12
12
  }
13
- complete -F _bundler_bash_completion bundle
13
+ complete -o filenames -F _bundler_bash_completion bundle
14
14
  }
15
15
  elsif ARGV[0] == 'complete' && ARGV.size == 2
16
16
  require File.expand_path("#{__dir__}/../lib/bundler_bash_completion")
@@ -9,14 +9,16 @@ Gem::Specification.new do |s|
9
9
  s.description = 'Provides bash completion for bundle command'
10
10
  s.license = 'MIT'
11
11
 
12
- s.rubyforge_project = 'bundler_bash_completion'
13
-
14
- s.files = `git ls-files`.split("\n")
15
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ s.files = %x(git ls-files | grep -vE '^(spec/|test/|\\.|Gemfile|Rakefile)').split("\n")
13
+ s.executables = %x(git ls-files -- bin/*).split("\n").map { |f| File.basename(f) }
17
14
  s.require_paths = ['lib']
18
15
 
19
- s.add_development_dependency 'byebug', '>= 9.0.0', '< 10.0.0'
20
- s.add_development_dependency 'rake', '>= 11.0.0', '< 12.0.0'
16
+ s.required_ruby_version = '>= 2.0.0'
17
+
18
+ s.add_development_dependency 'byebug', '>= 9.0.0', '< 12.0.0'
19
+ s.add_development_dependency 'rake', '>= 12.0.0', '< 14.0.0'
21
20
  s.add_development_dependency 'rspec', '>= 3.5.0', '< 4.0.0'
21
+ s.add_development_dependency 'rubocop', '>= 1.25.0', '< 2.0.0'
22
+ s.add_development_dependency 'rubocop-rake', '>= 0.6.0', '< 1.0.0'
23
+ s.add_development_dependency 'rubocop-rspec', '>= 2.8.0', '< 3.0.0'
22
24
  end
@@ -31,13 +31,13 @@ class BundlerBashCompletion
31
31
  '--verbose' => :continue,
32
32
  },
33
33
  'exec' => {
34
- :bin => :continue,
34
+ bin: :continue,
35
35
  },
36
36
  'gem' => {
37
37
  '--bin' => :block,
38
38
  },
39
39
  'help' => {
40
- :task => :continue,
40
+ task: :continue,
41
41
  },
42
42
  'init' => {
43
43
  '--no-color' => :continue,
@@ -87,7 +87,7 @@ class BundlerBashCompletion
87
87
  '--verbose' => :continue,
88
88
  },
89
89
  'open' => {
90
- :gem => :continue,
90
+ gem: :continue,
91
91
  },
92
92
  'outdated' => {
93
93
  '--local' => :continue,
@@ -117,9 +117,11 @@ class BundlerBashCompletion
117
117
  :gem => :continue,
118
118
  },
119
119
  'update' => {
120
+ '--bundler' => :block,
120
121
  '--no-color' => :continue,
121
122
  '--no-no-color' => :continue,
122
123
  '--no-verbose' => :continue,
124
+ '--quiet' => :continue,
123
125
  '--retry' => :block,
124
126
  '--source' => :block,
125
127
  '--verbose' => :continue,
@@ -139,9 +141,9 @@ class BundlerBashCompletion
139
141
  '--version' => :continue,
140
142
  '--without' => :block,
141
143
  },
142
- }
144
+ }.freeze
143
145
 
144
- CONFIG_PATH = '.bundle/config'
146
+ CONFIG_PATH = '.bundle/config'.freeze
145
147
 
146
148
  attr_reader :line
147
149
 
@@ -157,7 +159,7 @@ class BundlerBashCompletion
157
159
  @bins ||= begin
158
160
  gem_paths.map { |path| Dir.glob("#{path}/{bin,exe}/*") }.tap do |paths|
159
161
  paths.flatten!
160
- paths.reject! { |path| !File.executable?(path) }
162
+ paths.select! { |path| File.executable?(path) }
161
163
  paths.map! { |path| File.basename(path) }
162
164
  paths.push('gem', 'ruby')
163
165
  paths.sort!
@@ -171,7 +173,7 @@ class BundlerBashCompletion
171
173
  end
172
174
 
173
175
  def completion_word
174
- @completion_word ||= (line =~ /\s+$/) ? '' : arguments.last
176
+ @completion_word ||= line =~ /\s+$/ ? '' : arguments.last
175
177
  end
176
178
 
177
179
  def complete
@@ -182,7 +184,7 @@ class BundlerBashCompletion
182
184
 
183
185
  def gems
184
186
  @gems ||= begin
185
- gems = File.readlines("#{Dir.pwd}/Gemfile.lock").grep(/\(.+\)/).tap do |lines|
187
+ File.readlines("#{Dir.pwd}/Gemfile.lock").grep(/\(.+\)/).tap do |lines|
186
188
  lines.each do |line|
187
189
  line.gsub!(/\(.+/, '')
188
190
  line.gsub!(/\s+/, '')
@@ -193,17 +195,17 @@ class BundlerBashCompletion
193
195
  gems.sort!
194
196
  gems.uniq!
195
197
  end
196
- rescue Exception
198
+ rescue
197
199
  []
198
200
  end
199
201
  end
200
202
 
201
203
  def task
202
- @task ||= (completion_step > 1) ? arguments[1].to_s : ''
204
+ @task ||= completion_step > 1 ? arguments[1].to_s : ''
203
205
  end
204
206
 
205
207
  def task_options
206
- @task_options ||= (completion_step > 2) ? arguments[2..(completion_step - 1)] : []
208
+ @task_options ||= completion_step > 2 ? arguments[2..(completion_step - 1)] : []
207
209
  end
208
210
 
209
211
  private
@@ -214,7 +216,7 @@ class BundlerBashCompletion
214
216
 
215
217
  def bundle_path
216
218
  @bundle_path ||= begin
217
- if File.exists?(CONFIG_PATH)
219
+ if File.exist?(CONFIG_PATH)
218
220
  require 'yaml'
219
221
  path = YAML.load_file(CONFIG_PATH)['BUNDLE_PATH']
220
222
  path && File.expand_path(path)
@@ -252,13 +254,14 @@ class BundlerBashCompletion
252
254
  options = TASKS[task] || {}
253
255
  return [] if options[task_options.last] == :block
254
256
  completion = options.keys.map do |key|
255
- if key == :task
257
+ case key
258
+ when :task
256
259
  (task_options & TASKS.keys).empty? ? TASKS.keys : nil
257
- elsif key == :gem
260
+ when :gem
258
261
  task_options.empty? ? gems : nil
259
- elsif key == :gems
262
+ when :gems
260
263
  gems - task_options
261
- elsif key == :bin
264
+ when :bin
262
265
  task_options.empty? ? bins : nil
263
266
  else
264
267
  key
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler_bash_completion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-21 00:00:00.000000000 Z
11
+ date: 2022-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 9.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 10.0.0
22
+ version: 12.0.0
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,27 +29,27 @@ dependencies:
29
29
  version: 9.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 10.0.0
32
+ version: 12.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 11.0.0
39
+ version: 12.0.0
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: 12.0.0
42
+ version: 14.0.0
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 11.0.0
49
+ version: 12.0.0
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: 12.0.0
52
+ version: 14.0.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rspec
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -70,6 +70,66 @@ dependencies:
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: 4.0.0
73
+ - !ruby/object:Gem::Dependency
74
+ name: rubocop
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 1.25.0
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.0
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 1.25.0
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: 2.0.0
93
+ - !ruby/object:Gem::Dependency
94
+ name: rubocop-rake
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 0.6.0
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: 1.0.0
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 0.6.0
110
+ - - "<"
111
+ - !ruby/object:Gem::Version
112
+ version: 1.0.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: rubocop-rspec
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: 2.8.0
120
+ - - "<"
121
+ - !ruby/object:Gem::Version
122
+ version: 3.0.0
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 2.8.0
130
+ - - "<"
131
+ - !ruby/object:Gem::Version
132
+ version: 3.0.0
73
133
  description: Provides bash completion for bundle command
74
134
  email: al@alweb.org
75
135
  executables:
@@ -77,23 +137,17 @@ executables:
77
137
  extensions: []
78
138
  extra_rdoc_files: []
79
139
  files:
80
- - ".gitignore"
81
- - ".rspec"
82
- - Gemfile
83
140
  - MIT-LICENSE
84
141
  - README.mdown
85
- - Rakefile
86
142
  - VERSION
87
143
  - bin/complete_bundle_bash_command
88
144
  - bundler_bash_completion.gemspec
89
145
  - lib/bundler_bash_completion.rb
90
- - spec/bundler_bash_completion_spec.rb
91
- - spec/spec_helper.rb
92
146
  homepage: https://github.com/alexistoulotte/bundler_bash_completion
93
147
  licenses:
94
148
  - MIT
95
149
  metadata: {}
96
- post_install_message:
150
+ post_install_message:
97
151
  rdoc_options: []
98
152
  require_paths:
99
153
  - lib
@@ -101,18 +155,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
155
  requirements:
102
156
  - - ">="
103
157
  - !ruby/object:Gem::Version
104
- version: '0'
158
+ version: 2.0.0
105
159
  required_rubygems_version: !ruby/object:Gem::Requirement
106
160
  requirements:
107
161
  - - ">="
108
162
  - !ruby/object:Gem::Version
109
163
  version: '0'
110
164
  requirements: []
111
- rubyforge_project: bundler_bash_completion
112
- rubygems_version: 2.5.2
113
- signing_key:
165
+ rubygems_version: 3.3.3
166
+ signing_key:
114
167
  specification_version: 4
115
168
  summary: Bundler bash completion
116
- test_files:
117
- - spec/bundler_bash_completion_spec.rb
118
- - spec/spec_helper.rb
169
+ test_files: []
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- .DS_Store
2
- /.bundle/
3
- /.ruby-version
4
- /Gemfile.lock
5
- /pkg/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --colour
2
- --order random
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require 'bundler'
2
- require 'rspec/core/rake_task'
3
-
4
- Bundler::GemHelper.install_tasks
5
-
6
- desc 'Default: runs specs.'
7
- task :default => :spec
8
-
9
- desc 'Run all specs in spec directory.'
10
- RSpec::Core::RakeTask.new(:spec)
@@ -1,304 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe BundlerBashCompletion do
4
-
5
- def completion(line = nil)
6
- BundlerBashCompletion.new(line)
7
- end
8
-
9
- describe '#arguments' do
10
-
11
- subject { completion('bundle exec rails s').arguments }
12
-
13
- it { should eq(['bundle', 'exec', 'rails', 's']) }
14
-
15
- end
16
-
17
- describe '#bins' do
18
-
19
- subject { completion.bins }
20
-
21
- it { should include('gem', 'ldiff', 'rake', 'rspec') }
22
- it { should_not include('rails') }
23
- it { should include('ruby') }
24
-
25
- end
26
-
27
- describe '#command' do
28
-
29
- it 'is first argument' do
30
- expect(completion('bundle exec').command).to eq('bundle')
31
- expect(completion('rake').command).to eq('rake')
32
- end
33
-
34
- it 'is empty string if line is blank' do
35
- expect(completion(nil).command).to eq('')
36
- end
37
-
38
- end
39
-
40
- describe '#complete' do
41
-
42
- context 'with "foo"' do
43
-
44
- subject { completion('foo').complete }
45
-
46
- it { should eq([]) }
47
-
48
- end
49
-
50
- context 'with "bundle"' do
51
-
52
- subject { completion('bundle').complete }
53
-
54
- it { should eq([]) }
55
-
56
- end
57
-
58
- context 'with "bundle "' do
59
-
60
- subject { completion('bundle ').complete }
61
-
62
- it { should include('check', 'outdated', 'list', 'show') }
63
-
64
- end
65
-
66
- context 'with "bundle "' do
67
-
68
- subject { completion('bundle ').complete }
69
-
70
- it { should include('check', 'outdated', 'list', 'show') }
71
-
72
- end
73
-
74
- context 'with "bundle in"' do
75
-
76
- subject { completion('bundle in').complete }
77
-
78
- it { should eq(['init', 'install']) }
79
-
80
- end
81
-
82
- context 'with "bundle in "' do
83
-
84
- subject { completion('bundle in ').complete }
85
-
86
- it { should eq([]) }
87
-
88
- end
89
-
90
- context 'with "bundle foo"' do
91
-
92
- subject { completion('bundle foo').complete }
93
-
94
- it { should eq([]) }
95
-
96
- end
97
-
98
- context 'with "bundle foo "' do
99
-
100
- subject { completion('bundle foo ').complete }
101
-
102
- it { should eq([]) }
103
-
104
- end
105
-
106
- context 'with "bundle install "' do
107
-
108
- subject { completion('bundle install ').complete }
109
-
110
- it { should include('--local', '--path', '--verbose', '--without') }
111
-
112
- end
113
-
114
- context 'with "bundle install --p"' do
115
-
116
- subject { completion('bundle install --p').complete }
117
-
118
- it { should eq(['--path']) }
119
-
120
- end
121
-
122
- context 'with "bundle install --path "' do
123
-
124
- subject { completion('bundle install --path ').complete }
125
-
126
- it { should eq([]) }
127
-
128
- end
129
-
130
- context 'with "bundle install --local "' do
131
-
132
- subject { completion('bundle install ').complete }
133
-
134
- it { should include('--local', '--path', '--without') }
135
-
136
- end
137
-
138
- context 'with "bundle help in"' do
139
-
140
- subject { completion('bundle help in').complete }
141
-
142
- it { should eq(['init', 'install']) }
143
-
144
- end
145
-
146
- context 'with "bundle help install "' do
147
-
148
- subject { completion('bundle help install ').complete }
149
-
150
- it { should eq([]) }
151
-
152
- end
153
-
154
- context 'with "bundle lock "' do
155
-
156
- subject { completion('bundle lock ').complete }
157
-
158
- it { should include('--update', '--verbose') }
159
-
160
- end
161
-
162
- context 'with "bundle show "' do
163
-
164
- subject { completion('bundle show ').complete }
165
-
166
- it { should include('diff-lcs', 'rake', 'rspec', '--verbose') }
167
-
168
- end
169
-
170
- context 'with "bundle show rspec "' do
171
-
172
- subject { completion('bundle show rspec ').complete }
173
-
174
- it { should eq(['--no-color', '--no-no-color', '--no-outdated', '--no-paths', '--no-verbose', '--outdated', '--paths', '--retry', '--verbose']) }
175
-
176
- end
177
-
178
- context 'with "bundle show foo "' do
179
-
180
- subject { completion('bundle show foo ').complete }
181
-
182
- it { should eq(['--no-color', '--no-no-color', '--no-outdated', '--no-paths', '--no-verbose', '--outdated', '--paths', '--retry', '--verbose']) }
183
-
184
- end
185
-
186
- context 'with "bundle update "' do
187
-
188
- subject { completion('bundle update ').complete }
189
-
190
- it { should include('diff-lcs', 'rake', 'rspec', '--verbose') }
191
-
192
- end
193
-
194
- context 'with "bundle update rake rspec "' do
195
-
196
- subject { completion('bundle update rake rspec ').complete }
197
-
198
- it { should include('bundler', 'diff-lcs', 'rspec-core', '--verbose') }
199
- it { should_not include('rake', 'rspec') }
200
-
201
- end
202
-
203
- context 'with "bundle exec "' do
204
-
205
- subject { completion('bundle exec ').complete }
206
-
207
- it { should include('ldiff', 'rake', 'rspec') }
208
- it { should_not include('--verbose') }
209
- it { should include('gem', 'ruby') }
210
-
211
- end
212
-
213
- context 'with "bundle exec foo "' do
214
-
215
- subject { completion('bundle exec foo ').complete }
216
-
217
- it { should eq([]) }
218
-
219
- end
220
-
221
- context 'with "bundle exec rake "' do
222
-
223
- subject { completion('bundle exec rake ').complete }
224
-
225
- it { should eq([]) }
226
-
227
- end
228
-
229
- end
230
-
231
- describe '#completion_word' do
232
-
233
- it 'is last word on line' do
234
- expect(completion('bundle instal').completion_word).to eq('instal')
235
- end
236
-
237
- it 'is an empty string if line ends with a white space' do
238
- expect(completion('bundle install ').completion_word).to eq('')
239
- expect(completion('bundle install ').completion_word).to eq('')
240
- end
241
-
242
- end
243
-
244
- describe '#gems' do
245
-
246
- subject { completion.gems }
247
-
248
- it { should include('bundler', 'rake', 'rspec', 'rspec-core', 'rspec-expectations') }
249
- it { should_not include('rails') }
250
-
251
- end
252
-
253
- describe '#line' do
254
-
255
- it 'is line given at initializion' do
256
- expect(completion('hello').line).to eq('hello')
257
- end
258
-
259
- it 'is frozen' do
260
- expect {
261
- completion('hello').line.gsub!('l', 'w')
262
- }.to raise_error(/can't modify frozen String/)
263
- end
264
-
265
- it 'is converted to string' do
266
- expect(completion(:hello).line).to eq('hello')
267
- end
268
-
269
- it 'first whitespaces are removed' do
270
- expect(completion(' hello').line).to eq('hello')
271
- end
272
-
273
- it 'last whitespaces are preserved' do
274
- expect(completion('hello ').line).to eq('hello ')
275
- end
276
-
277
- end
278
-
279
- describe '#task' do
280
-
281
- it 'is an empty string when not ending with a whitespace' do
282
- expect(completion('bundle install').task).to eq('')
283
- end
284
-
285
- it 'is task given by second argument if ending with a whitespace' do
286
- expect(completion('bundle install ').task).to eq('install')
287
- expect(completion('bundle foo ').task).to eq('foo')
288
- expect(completion('bundle help install ').task).to eq('help')
289
- end
290
-
291
- end
292
-
293
- describe '#task_options' do
294
-
295
- it 'is correct' do
296
- expect(completion('bundle install --path').task_options).to eq([])
297
- expect(completion('bundle install ').task_options).to eq([])
298
- expect(completion('bundle install --path fo').task_options).to eq(['--path'])
299
- expect(completion('bundle install --path fo ').task_options).to eq(['--path', 'fo'])
300
- end
301
-
302
- end
303
-
304
- end
data/spec/spec_helper.rb DELETED
@@ -1,6 +0,0 @@
1
- require File.expand_path("#{__dir__}/../lib/bundler_bash_completion")
2
- require 'byebug'
3
-
4
- RSpec.configure do |config|
5
- config.raise_errors_for_deprecations!
6
- end