Skip to content

Commit 86dd726

Browse files
committed
Use rspec and rubocop fixes
1 parent 5d27a6c commit 86dd726

35 files changed

+1462
-686
lines changed

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--require spec_helper

.rubocop.yml

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ inherit_from: .rubocop_todo.yml
22

33
AllCops:
44
NewCops: enable
5+
Exclude:
6+
- 'sample-app/**/*'
7+
- 'bin/*'

Gemfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
source 'https://rubygems.org'
44

5-
gem 'bacon'
6-
5+
gem 'binding_of_caller'
6+
gem 'pry-byebug', '~> 3.9.0', platform: :mri
77
gem 'rake'
8+
9+
gem 'rspec', '~> 3.0'
10+
811
gem 'rubocop'
912
gem 'rubocop-performance'
1013
gem 'rubocop-rake'
1114
gem 'rubocop-rspec'
1215

13-
gem 'pry-byebug', '~> 3.9.0', platform: :mri
14-
gem 'binding_of_caller'
15-
1616
gemspec

Rakefile

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
# frozen_string_literal: true
22

33
require 'bundler/gem_tasks'
4-
5-
desc 'Run all the specs'
6-
task :spec do
7-
sh "bundle exec bacon -q #{FileList['spec/*_spec.rb'].join(' ')}"
8-
end
9-
task default: :spec
10-
task test: :spec

bin/bundle

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'bundle' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'rubygems'
12+
13+
m = Module.new do
14+
module_function
15+
16+
def invoked_as_script?
17+
File.expand_path($0) == File.expand_path(__FILE__)
18+
end
19+
20+
def env_var_version
21+
ENV['BUNDLER_VERSION']
22+
end
23+
24+
def cli_arg_version
25+
return unless invoked_as_script? # don't want to hijack other binstubs
26+
return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update`
27+
28+
bundler_version = nil
29+
update_index = nil
30+
ARGV.each_with_index do |a, i|
31+
bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
32+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
33+
34+
bundler_version = Regexp.last_match(1) || '>= 0.a'
35+
update_index = i
36+
end
37+
bundler_version
38+
end
39+
40+
def gemfile
41+
gemfile = ENV['BUNDLE_GEMFILE']
42+
return gemfile if gemfile && !gemfile.empty?
43+
44+
File.expand_path('../Gemfile', __dir__)
45+
end
46+
47+
def lockfile
48+
lockfile =
49+
case File.basename(gemfile)
50+
when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile)
51+
else "#{gemfile}.lock"
52+
end
53+
File.expand_path(lockfile)
54+
end
55+
56+
def lockfile_version
57+
return unless File.file?(lockfile)
58+
59+
lockfile_contents = File.read(lockfile)
60+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
61+
62+
Regexp.last_match(1)
63+
end
64+
65+
def bundler_version
66+
@bundler_version ||= env_var_version || cli_arg_version ||
67+
lockfile_version || "#{Gem::Requirement.default}.a"
68+
end
69+
70+
def load_bundler!
71+
ENV['BUNDLE_GEMFILE'] ||= gemfile
72+
73+
# must dup string for RG < 1.8 compatibility
74+
activate_bundler(bundler_version.dup)
75+
end
76+
77+
def activate_bundler(bundler_version)
78+
bundler_version = '< 2' if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new('2.0')
79+
gem_error = activation_error_handling do
80+
gem 'bundler', bundler_version
81+
end
82+
return if gem_error.nil?
83+
84+
require_error = activation_error_handling do
85+
require 'bundler/version'
86+
end
87+
return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
88+
89+
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
90+
exit 42
91+
end
92+
93+
def activation_error_handling
94+
yield
95+
nil
96+
rescue StandardError, LoadError => e
97+
e
98+
end
99+
end
100+
101+
m.load_bundler!
102+
103+
load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?

bin/byebug

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'byebug' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path('bundle', __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require 'rubygems'
27+
require 'bundler/setup'
28+
29+
load Gem.bin_path('byebug', 'byebug')

bin/coderay

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'coderay' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path('bundle', __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require 'rubygems'
27+
require 'bundler/setup'
28+
29+
load Gem.bin_path('coderay', 'coderay')

bin/fuzzy_match

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'fuzzy_match' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path('bundle', __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require 'rubygems'
27+
require 'bundler/setup'
28+
29+
load Gem.bin_path('fuzzy_match', 'fuzzy_match')

bin/htmldiff

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'htmldiff' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path('bundle', __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require 'rubygems'
27+
require 'bundler/setup'
28+
29+
load Gem.bin_path('diff-lcs', 'htmldiff')

bin/httpclient

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'httpclient' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path('bundle', __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require 'rubygems'
27+
require 'bundler/setup'
28+
29+
load Gem.bin_path('httpclient', 'httpclient')

bin/ldiff

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'ldiff' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path('bundle', __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require 'rubygems'
27+
require 'bundler/setup'
28+
29+
load Gem.bin_path('diff-lcs', 'ldiff')

bin/pod

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'pod' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path('bundle', __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require 'rubygems'
27+
require 'bundler/setup'
28+
29+
load Gem.bin_path('cocoapods', 'pod')

bin/pry

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'pry' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path('bundle', __dir__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require 'rubygems'
27+
require 'bundler/setup'
28+
29+
load Gem.bin_path('pry', 'pry')

0 commit comments

Comments
 (0)