claide-completion 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +18 -0
- data/.kick +29 -0
- data/.rubocop.yml +2 -0
- data/.rubocop_cocoapods.yml +115 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +24 -0
- data/Gemfile +23 -0
- data/Rakefile +57 -0
- data/claide-completion.gemspec +24 -0
- data/lib/claide_completion/gem_version.rb +1 -1
- data/spec/claide_plugin_spec.rb +10 -0
- data/spec/generator/zsh.rb +178 -0
- data/spec/generator_spec.rb +40 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/spec_helper/fixtures.rb +67 -0
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac2f3e970441766e957396933fcbbe69085a1139
|
4
|
+
data.tar.gz: 136bc322f46ca94f30126a36079b951b07e5e62d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0928929c46cdab39b234bff05bed21d7f7e375fed874c0f64def17a84f535693deb5ef109d9aecdc2a263d2bf151890915de90e2fe1774020ae760b7ea951e0b
|
7
|
+
data.tar.gz: 98f698dac6a104b228040d7e1cf45fb3d383c19e68fd4208195dd3a67e31eb366727b734929503b8e96e6bf55d484aee755fcf4ed070c90c5d3739b8e5df572c
|
data/.gitignore
ADDED
data/.kick
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
recipe :ruby
|
2
|
+
|
3
|
+
Kicker::Recipes::Ruby.runner_bin = 'bundle exec bacon --quiet'
|
4
|
+
|
5
|
+
process do |files|
|
6
|
+
specs = files.take_and_map do |file|
|
7
|
+
if file =~ %r{lib/[^/]*/(.+?)\.rb$}
|
8
|
+
s = Dir.glob("spec/**/#{File.basename(file, '.rb')}_spec.rb")
|
9
|
+
s.uniq unless s.empty?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
Kicker::Recipes::Ruby.run_tests(specs)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Have written this so many times, probably should make a recipe out of it.
|
16
|
+
process do |files|
|
17
|
+
files.each do |file|
|
18
|
+
case file
|
19
|
+
when 'Gemfile'
|
20
|
+
files.delete(file)
|
21
|
+
execute 'bundle install'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
recipe :ignore
|
27
|
+
ignore(/.*\/?tags/)
|
28
|
+
ignore(/.*\/?\.git/)
|
29
|
+
ignore(/^tmp/)
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- ./Rakefile
|
4
|
+
- ./Gemfile
|
5
|
+
- ./*.gemspec
|
6
|
+
Exclude:
|
7
|
+
- ./spec/fixtures/**/*
|
8
|
+
|
9
|
+
# At the moment not ready to be used
|
10
|
+
# https://github.com/bbatsov/rubocop/issues/947
|
11
|
+
Documentation:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
#- CocoaPods -----------------------------------------------------------------#
|
15
|
+
|
16
|
+
# We adopted raise instead of fail.
|
17
|
+
SignalException:
|
18
|
+
EnforcedStyle: only_raise
|
19
|
+
|
20
|
+
# They are idiomatic
|
21
|
+
AssignmentInCondition:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
# Allow backticks
|
25
|
+
AsciiComments:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
# Indentation clarifies logic branches in implementations
|
29
|
+
IfUnlessModifier:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# No enforced convention here.
|
33
|
+
SingleLineBlockParams:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
# We only add the comment when needed.
|
37
|
+
Encoding:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
# Having these make it easier to *not* forget to add one when adding a new
|
41
|
+
# value and you can simply copy the previous line.
|
42
|
+
TrailingComma:
|
43
|
+
EnforcedStyleForMultiline: comma
|
44
|
+
|
45
|
+
Style/MultilineOperationIndentation:
|
46
|
+
EnforcedStyle: indented
|
47
|
+
|
48
|
+
# Clashes with CLAide Command#validate!
|
49
|
+
GuardClause:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
# Not always desirable: lib/claide/command/plugins_helper.rb:12:15
|
53
|
+
Next:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
# Arbitrary max lengths for classes simply do not work and enabling this will
|
57
|
+
# lead to a never ending stream of annoyance and changes.
|
58
|
+
Metrics/ClassLength:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
# Arbitrary max lengths for methods simply do not work and enabling this will
|
62
|
+
# lead to a never ending stream of annoyance and changes.
|
63
|
+
Metrics/MethodLength:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
# No enforced convention here.
|
67
|
+
Metrics/BlockNesting:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
71
|
+
# rules for us.
|
72
|
+
Metrics/AbcSize:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
# It will be obvious which code is complex, Rubocop should only lint simple
|
76
|
+
# rules for us.
|
77
|
+
Metrics/CyclomaticComplexity:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
#- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
|
81
|
+
|
82
|
+
HashSyntax:
|
83
|
+
EnforcedStyle: hash_rockets
|
84
|
+
|
85
|
+
Lambda:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
DotPosition:
|
89
|
+
EnforcedStyle: trailing
|
90
|
+
|
91
|
+
EachWithObject:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Style/SpecialGlobalVars:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
#- CocoaPods specs -----------------------------------------------------------#
|
98
|
+
|
99
|
+
# Allow for `should.match /regexp/`.
|
100
|
+
AmbiguousRegexpLiteral:
|
101
|
+
Exclude:
|
102
|
+
- spec/**/*
|
103
|
+
|
104
|
+
# Allow `object.should == object` syntax.
|
105
|
+
Void:
|
106
|
+
Exclude:
|
107
|
+
- spec/**/*
|
108
|
+
|
109
|
+
ClassAndModuleChildren:
|
110
|
+
Exclude:
|
111
|
+
- spec/**/*
|
112
|
+
|
113
|
+
UselessComparison:
|
114
|
+
Exclude:
|
115
|
+
- spec/**/*
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup markdown --protected --charset=utf-8 lib
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# CLAide Completion Changelog
|
2
|
+
|
3
|
+
## 1.0.2
|
4
|
+
|
5
|
+
##### Bug Fixes
|
6
|
+
|
7
|
+
* Don't have warnings printed when the list of loaded CLAide specs is queried.
|
8
|
+
[Samuel Giddins](https://github.com/segiddins)
|
9
|
+
|
10
|
+
|
11
|
+
## 1.0.1
|
12
|
+
|
13
|
+
##### Bug Fixes
|
14
|
+
|
15
|
+
* Don't raise an exception on older Ruby versions.
|
16
|
+
[Samuel Giddins](https://github.com/segiddins)
|
17
|
+
|
18
|
+
|
19
|
+
## 1.0.0
|
20
|
+
|
21
|
+
* Initial port from Fabio's original CLAide code.
|
22
|
+
[Fabio Pelosin](https://github.com/fabiopelosin)
|
23
|
+
[Samuel Giddins](https://github.com/segiddins)
|
24
|
+
[CLAide#43](https://github.com/CocoaPods/CLAide/issues/43)
|
data/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'claide'
|
6
|
+
|
7
|
+
gem 'rake'
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem 'kicker'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :spec do
|
14
|
+
gem 'bacon'
|
15
|
+
gem 'mocha-on-bacon'
|
16
|
+
gem 'prettybacon'
|
17
|
+
|
18
|
+
if RUBY_VERSION >= '1.9.3'
|
19
|
+
gem 'rubocop'
|
20
|
+
gem 'codeclimate-test-reporter', :require => nil
|
21
|
+
gem 'simplecov'
|
22
|
+
end
|
23
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
#-- Bootstrap --------------------------------------------------------------#
|
4
|
+
|
5
|
+
desc 'Initializes your working copy to run the specs'
|
6
|
+
task :bootstrap do
|
7
|
+
if system('which bundle')
|
8
|
+
title 'Installing gems'
|
9
|
+
sh 'bundle install'
|
10
|
+
else
|
11
|
+
$stderr.puts "\033[0;31m" \
|
12
|
+
"[!] Please install the bundler gem manually:\n" \
|
13
|
+
' $ [sudo] gem install bundler' \
|
14
|
+
"\e[0m"
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
begin
|
20
|
+
require 'bundler/gem_tasks'
|
21
|
+
task :default => :spec
|
22
|
+
|
23
|
+
#-- Specs ------------------------------------------------------------------#
|
24
|
+
|
25
|
+
desc 'Run specs'
|
26
|
+
task :spec do
|
27
|
+
title 'Running Unit Tests'
|
28
|
+
files = FileList['spec/**/*_spec.rb'].shuffle.join(' ')
|
29
|
+
sh "bundle exec bacon #{files}"
|
30
|
+
|
31
|
+
Rake::Task['rubocop'].invoke if RUBY_VERSION >= '1.9.3'
|
32
|
+
end
|
33
|
+
|
34
|
+
#-- Rubocop ----------------------------------------------------------------#
|
35
|
+
|
36
|
+
desc 'Check code against RuboCop rules'
|
37
|
+
task :rubocop do
|
38
|
+
sh 'bundle exec rubocop'
|
39
|
+
end
|
40
|
+
|
41
|
+
rescue LoadError
|
42
|
+
$stderr.puts "\033[0;31m" \
|
43
|
+
'[!] Some Rake tasks haven been disabled because the environment' \
|
44
|
+
' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
|
45
|
+
"\e[0m"
|
46
|
+
end
|
47
|
+
|
48
|
+
#-- Helpers ------------------------------------------------------------------#
|
49
|
+
|
50
|
+
def title(title)
|
51
|
+
cyan_title = "\033[0;36m#{title}\033[0m"
|
52
|
+
puts
|
53
|
+
puts '-' * 80
|
54
|
+
puts cyan_title
|
55
|
+
puts '-' * 80
|
56
|
+
puts
|
57
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
3
|
+
require 'claide_completion/gem_version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'claide-completion'
|
7
|
+
s.version = CLAideCompletion::VERSION
|
8
|
+
s.license = 'MIT'
|
9
|
+
s.email = ['fabiopelosin@gmail.com']
|
10
|
+
s.homepage = 'https://github.com/CocoaPods/claide-completion'
|
11
|
+
s.authors = ['Fabio Pelosin']
|
12
|
+
|
13
|
+
s.summary = 'CLI completion plugin for CLAide.'
|
14
|
+
|
15
|
+
s.files = `git ls-files -z`.split("\0")
|
16
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
## Make sure you can build the gem on older versions of RubyGems too:
|
21
|
+
s.rubygems_version = '1.6.2'
|
22
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
23
|
+
s.specification_version = 3 if s.respond_to? :specification_version
|
24
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# rubocop:disable LineLength
|
3
|
+
|
4
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
5
|
+
|
6
|
+
module CLAideCompletion
|
7
|
+
describe Generator::Zsh do
|
8
|
+
before do
|
9
|
+
@subject = Generator::Zsh.new(Fixture::Command)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '::generate' do
|
13
|
+
it 'generates an auto-completion script' do
|
14
|
+
expected = <<-DOC.strip_margin('|')
|
15
|
+
|#compdef bin
|
16
|
+
|# setopt XTRACE VERBOSE
|
17
|
+
|# vim: ft=zsh sw=2 ts=2 et
|
18
|
+
|
|
19
|
+
|local -a _subcommands
|
20
|
+
|local -a _options
|
21
|
+
|
|
22
|
+
|case "$words[2]" in
|
23
|
+
| spec-file)
|
24
|
+
| case "$words[3]" in
|
25
|
+
| create)
|
26
|
+
| case "$words[4]" in
|
27
|
+
| *) # bin spec-file create
|
28
|
+
| _options=(
|
29
|
+
| "--help:Show help banner of specified command"
|
30
|
+
| "--no-ansi:Show output without ANSI codes"
|
31
|
+
| "--verbose:Show more debugging information"
|
32
|
+
| )
|
33
|
+
| _describe -t options "bin spec-file create options" _options
|
34
|
+
| ;;
|
35
|
+
| esac
|
36
|
+
| ;;
|
37
|
+
| lint)
|
38
|
+
| case "$words[4]" in
|
39
|
+
| repo)
|
40
|
+
| case "$words[5]" in
|
41
|
+
| *) # bin spec-file lint repo
|
42
|
+
| _options=(
|
43
|
+
| "--help:Show help banner of specified command"
|
44
|
+
| "--no-ansi:Show output without ANSI codes"
|
45
|
+
| "--only-errors:Skip warnings"
|
46
|
+
| "--verbose:Show more debugging information"
|
47
|
+
| )
|
48
|
+
| _describe -t options "bin spec-file lint repo options" _options
|
49
|
+
| ;;
|
50
|
+
| esac
|
51
|
+
| ;;
|
52
|
+
| *) # bin spec-file lint
|
53
|
+
| _subcommands=(
|
54
|
+
| "repo:Checks the validity of ALL specs in a repo."
|
55
|
+
| )
|
56
|
+
| _describe -t commands "bin spec-file lint subcommands" _subcommands
|
57
|
+
| _options=(
|
58
|
+
| "--help:Show help banner of specified command"
|
59
|
+
| "--no-ansi:Show output without ANSI codes"
|
60
|
+
| "--only-errors:Skip warnings"
|
61
|
+
| "--verbose:Show more debugging information"
|
62
|
+
| )
|
63
|
+
| _describe -t options "bin spec-file lint options" _options
|
64
|
+
| ;;
|
65
|
+
| esac
|
66
|
+
| ;;
|
67
|
+
| *) # bin spec-file
|
68
|
+
| _subcommands=(
|
69
|
+
| "create:Creates a spec file stub."
|
70
|
+
| "lint:Checks the validity of a spec file."
|
71
|
+
| )
|
72
|
+
| _describe -t commands "bin spec-file subcommands" _subcommands
|
73
|
+
| _options=(
|
74
|
+
| "--help:Show help banner of specified command"
|
75
|
+
| "--no-ansi:Show output without ANSI codes"
|
76
|
+
| "--verbose:Show more debugging information"
|
77
|
+
| )
|
78
|
+
| _describe -t options "bin spec-file options" _options
|
79
|
+
| ;;
|
80
|
+
| esac
|
81
|
+
| ;;
|
82
|
+
| *) # bin
|
83
|
+
| _subcommands=(
|
84
|
+
| "spec-file:"
|
85
|
+
| )
|
86
|
+
| _describe -t commands "bin subcommands" _subcommands
|
87
|
+
| _options=(
|
88
|
+
| "--completion-script:Print the auto-completion script"
|
89
|
+
| "--help:Show help banner of specified command"
|
90
|
+
| "--no-ansi:Show output without ANSI codes"
|
91
|
+
| "--verbose:Show more debugging information"
|
92
|
+
| "--version:Show the version of the tool"
|
93
|
+
| )
|
94
|
+
| _describe -t options "bin options" _options
|
95
|
+
| ;;
|
96
|
+
|esac
|
97
|
+
DOC
|
98
|
+
result = @subject.generate
|
99
|
+
expected_lines = expected.lines.to_a
|
100
|
+
result.lines.each_with_index do |line, index|
|
101
|
+
"#{index}:#{line}".should == "#{index}:#{expected_lines[index]}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe '::case_statement_fragment' do
|
107
|
+
it 'returns the case statement fragment for a command' do
|
108
|
+
expected = <<-DOC.strip_margin('|').rstrip
|
109
|
+
|case "$words[4]" in
|
110
|
+
| repo)
|
111
|
+
| case "$words[5]" in
|
112
|
+
| *) # bin spec-file lint repo
|
113
|
+
| _options=(
|
114
|
+
| "--help:Show help banner of specified command"
|
115
|
+
| "--no-ansi:Show output without ANSI codes"
|
116
|
+
| "--only-errors:Skip warnings"
|
117
|
+
| "--verbose:Show more debugging information"
|
118
|
+
| )
|
119
|
+
| _describe -t options "bin spec-file lint repo options" _options
|
120
|
+
| ;;
|
121
|
+
| esac
|
122
|
+
| ;;
|
123
|
+
| *) # bin spec-file lint
|
124
|
+
| _subcommands=(
|
125
|
+
| "repo:Checks the validity of ALL specs in a repo."
|
126
|
+
| )
|
127
|
+
| _describe -t commands "bin spec-file lint subcommands" _subcommands
|
128
|
+
| _options=(
|
129
|
+
| "--help:Show help banner of specified command"
|
130
|
+
| "--no-ansi:Show output without ANSI codes"
|
131
|
+
| "--only-errors:Skip warnings"
|
132
|
+
| "--verbose:Show more debugging information"
|
133
|
+
| )
|
134
|
+
| _describe -t options "bin spec-file lint options" _options
|
135
|
+
| ;;
|
136
|
+
|esac
|
137
|
+
DOC
|
138
|
+
result = @subject.send(:case_statement_fragment, Fixture::Command::SpecFile::Lint, 2)
|
139
|
+
expected_lines = expected.lines.to_a
|
140
|
+
result.lines.each_with_index do |line, index|
|
141
|
+
"[#{index}]#{line}".should == "[#{index}]#{expected_lines[index]}"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe '::case_statement_entries_fragment' do
|
147
|
+
it 'returns the entries fragment for a case statement' do
|
148
|
+
expected = <<-DOC.strip_margin('|')
|
149
|
+
|repo)
|
150
|
+
| case "$words[5]" in
|
151
|
+
| *) # bin spec-file lint repo
|
152
|
+
| _options=(
|
153
|
+
| "--help:Show help banner of specified command"
|
154
|
+
| "--no-ansi:Show output without ANSI codes"
|
155
|
+
| "--only-errors:Skip warnings"
|
156
|
+
| "--verbose:Show more debugging information"
|
157
|
+
| )
|
158
|
+
| _describe -t options "bin spec-file lint repo options" _options
|
159
|
+
| ;;
|
160
|
+
| esac
|
161
|
+
|;;
|
162
|
+
DOC
|
163
|
+
result = @subject.send(:case_statement_entries_fragment, Fixture::Command::SpecFile::Lint, 3)
|
164
|
+
expected_lines = expected.lines.to_a
|
165
|
+
result.lines.each_with_index do |line, index|
|
166
|
+
"[#{index}]#{line}".should == "[#{index}]#{expected_lines[index]}"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'generates an auto-completion script' do
|
171
|
+
command = Fixture::Command.dup
|
172
|
+
command.stubs(:options).returns([['--option', 'Some `code`']])
|
173
|
+
result = @subject.class.new(command).generate
|
174
|
+
result.should.include?('\`')
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path('../spec_helper', __FILE__)
|
4
|
+
|
5
|
+
module CLAideCompletion
|
6
|
+
describe Generator do
|
7
|
+
before do
|
8
|
+
@subject = Generator
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '::generate' do
|
12
|
+
it 'returns the completion helper for the given shell' do
|
13
|
+
result = @subject.generate(Fixture::Command, 'zsh')
|
14
|
+
result.should.start_with?('#compdef bin')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'infers the given shell is one is not provided' do
|
18
|
+
ENV.stubs(:[]).with('SHELL').returns('zsh')
|
19
|
+
@subject::Zsh.any_instance.expects(:generate).once
|
20
|
+
@subject.generate(Fixture::Command)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'raises if unable to support the shell' do
|
24
|
+
should.raise Generator::ShellCompletionNotFound do
|
25
|
+
@subject.generate(Fixture::Command, 'heheshell!')
|
26
|
+
end.message.should.include?('shell is not implemented')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '::indent' do
|
31
|
+
it 'indents the given string by the given amount' do
|
32
|
+
@subject.indent("line 1\nline 2", 1).should == "line 1\n line 2"
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'it does not indent the first line' do
|
36
|
+
@subject.indent("line 1\nline 2", 1).should.start_with?('line 1')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
if RUBY_VERSION >= '1.9.3'
|
4
|
+
require 'codeclimate-test-reporter'
|
5
|
+
|
6
|
+
CodeClimate::TestReporter.configure do |config|
|
7
|
+
config.logger.level = Logger::WARN
|
8
|
+
end
|
9
|
+
|
10
|
+
CodeClimate::TestReporter.start
|
11
|
+
end
|
12
|
+
|
13
|
+
#-----------------------------------------------------------------------------#
|
14
|
+
|
15
|
+
require 'pathname'
|
16
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
17
|
+
$LOAD_PATH.unshift((ROOT + 'lib').to_s)
|
18
|
+
$LOAD_PATH.unshift((ROOT + 'spec').to_s)
|
19
|
+
|
20
|
+
require 'bundler/setup'
|
21
|
+
require 'bacon'
|
22
|
+
require 'mocha-on-bacon'
|
23
|
+
require 'pretty_bacon'
|
24
|
+
require 'claide'
|
25
|
+
require 'claide_completion'
|
26
|
+
|
27
|
+
require 'spec_helper/fixtures'
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Fixture
|
4
|
+
class Error < StandardError
|
5
|
+
include CLAide::InformativeError
|
6
|
+
end
|
7
|
+
|
8
|
+
class Command < CLAide::Command
|
9
|
+
self.command = 'bin'
|
10
|
+
self.ansi_output = false
|
11
|
+
|
12
|
+
class << self
|
13
|
+
attr_accessor :latest_instance
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(*args)
|
17
|
+
self.class.latest_instance = self
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
class SpecFile < Command
|
22
|
+
self.abstract_command = true
|
23
|
+
self.description = 'Manage spec files.'
|
24
|
+
|
25
|
+
class CommonInvisibleCommand < SpecFile
|
26
|
+
self.ignore_in_command_lookup = true
|
27
|
+
end
|
28
|
+
|
29
|
+
class Lint < CommonInvisibleCommand
|
30
|
+
self.summary = 'Checks the validity of a spec file.'
|
31
|
+
self.arguments = [
|
32
|
+
CLAide::Argument.new('NAME', false),
|
33
|
+
]
|
34
|
+
|
35
|
+
def self.options
|
36
|
+
[['--only-errors', 'Skip warnings']].concat(super)
|
37
|
+
end
|
38
|
+
|
39
|
+
class Repo < Lint
|
40
|
+
self.summary = 'Checks the validity of ALL specs in a repo.'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Create < CommonInvisibleCommand
|
45
|
+
self.summary = 'Creates a spec file stub.'
|
46
|
+
self.description = <<-DESC
|
47
|
+
Creates a spec file called NAME
|
48
|
+
and populates it with defaults.
|
49
|
+
DESC
|
50
|
+
self.arguments = [
|
51
|
+
CLAide::Argument.new('NAME', false),
|
52
|
+
]
|
53
|
+
|
54
|
+
attr_reader :spec
|
55
|
+
def initialize(argv)
|
56
|
+
@spec = argv.shift_argument
|
57
|
+
super
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class CommandPluginable < CLAide::Command
|
64
|
+
plugin_prefixes << 'fixture'
|
65
|
+
self.ansi_output = false
|
66
|
+
end
|
67
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: claide-completion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Pelosin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -17,13 +17,28 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- ".kick"
|
22
|
+
- ".rubocop.yml"
|
23
|
+
- ".rubocop_cocoapods.yml"
|
24
|
+
- ".travis.yml"
|
25
|
+
- ".yardopts"
|
26
|
+
- CHANGELOG.md
|
27
|
+
- Gemfile
|
20
28
|
- LICENSE
|
21
29
|
- README.markdown
|
30
|
+
- Rakefile
|
31
|
+
- claide-completion.gemspec
|
22
32
|
- lib/claide_completion.rb
|
23
33
|
- lib/claide_completion/gem_version.rb
|
24
34
|
- lib/claide_completion/generator.rb
|
25
35
|
- lib/claide_completion/generator/zsh.rb
|
26
36
|
- lib/claide_plugin.rb
|
37
|
+
- spec/claide_plugin_spec.rb
|
38
|
+
- spec/generator/zsh.rb
|
39
|
+
- spec/generator_spec.rb
|
40
|
+
- spec/spec_helper.rb
|
41
|
+
- spec/spec_helper/fixtures.rb
|
27
42
|
homepage: https://github.com/CocoaPods/claide-completion
|
28
43
|
licenses:
|
29
44
|
- MIT
|
@@ -48,4 +63,9 @@ rubygems_version: 2.4.8
|
|
48
63
|
signing_key:
|
49
64
|
specification_version: 3
|
50
65
|
summary: CLI completion plugin for CLAide.
|
51
|
-
test_files:
|
66
|
+
test_files:
|
67
|
+
- spec/claide_plugin_spec.rb
|
68
|
+
- spec/generator/zsh.rb
|
69
|
+
- spec/generator_spec.rb
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
- spec/spec_helper/fixtures.rb
|