Skip to content

Commit

Permalink
Add binstubs
Browse files Browse the repository at this point in the history
Moved dev/test dependencies into proper Bundler groups. I also added
binstubs for rspec and rubocop - this ensures we're running the right
versions of those tools locally.
  • Loading branch information
stevenharman committed May 13, 2024
1 parent 1c5cd10 commit 3e38980
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
run: bundle install

- name: Lint with Rubocop
run: bundle exec rubocop
run: bin/rubocop

- name: Run tests
run: bundle exec rspec
run: bin/rspec

- name: Build gem
run: bundle exec rake build
run: bin/rake build
2 changes: 1 addition & 1 deletion .github/workflows/release-gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
bundle exec rake build
bin/rake build
gem push pkg/*.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
1 change: 1 addition & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'app/controllers/letter_opener_web/application_controller.rb'
- 'app/controllers/letter_opener_web/letters_controller.rb'
- 'app/controllers/letter_opener_web/application_controller.rb'
- 'app/models/letter_opener_web/letter.rb'
Expand Down
17 changes: 12 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ source 'http://rubygems.org'
# development dependencies will be added by default to the :development group.
gemspec

gem 'rails', '~> 6.1'
gem 'rspec-rails', '~> 5.0'
gem 'rubocop', '~> 1.22'
gem 'rubocop-rails', '~> 2.12'
gem 'rubocop-rspec', '~> 2.5'
group :development do
gem 'rails', '~> 6.1'
gem 'rspec-rails', '~> 5.0'
gem 'rubocop', '~> 1.22'
gem 'rubocop-rails', '~> 2.12'
gem 'rubocop-rspec', '~> 2.5'
end

group :development, :test do
gem 'pry-byebug'
gem 'pry-rails'
end
27 changes: 27 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rake', 'rake')
27 changes: 27 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rspec-core', 'rspec')
27 changes: 27 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rubocop' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require 'rubygems'
require 'bundler/setup'

load Gem.bin_path('rubocop', 'rubocop')

0 comments on commit 3e38980

Please sign in to comment.