Skip to content

Commit ebf2eeb

Browse files
committed
Add basic binstubs
Normally for gems we do not include binstubs to allow developers to decide for themselves how to setup their environment. However, in order to add reviewdog we use a `bin/ci-code-review` custom script. Placing that in `bin` is standard across our repos. It is also standard for us to have these common binstubs. This includes them to prep for our CI scripts. As we do not include any executables, if we did they would go in `exe/`, there is no conflict to be concerned about. However, just to be safe, this also updates the gemspec to be explicit about where executables live.
1 parent dfb33c7 commit ebf2eeb

File tree

4 files changed

+90
-1
lines changed

4 files changed

+90
-1
lines changed

bin/rake

Lines changed: 29 additions & 0 deletions
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 'rake' 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", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 150) =~ /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("rake", "rake")

bin/rspec

Lines changed: 29 additions & 0 deletions
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 'rspec' 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", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 150) =~ /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("rspec-core", "rspec")

bin/rubocop

Lines changed: 29 additions & 0 deletions
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 'rubocop' 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", __FILE__)
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("rubocop", "rubocop")

kracken.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ Gem::Specification.new do |s|
1515
s.summary = 'Rails engine that consumes the Kracken'
1616
s.description = 'Rails engine for use with the Radius Networks Account Server.'
1717

18-
s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
18+
s.files = Dir['{app,exe,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
19+
s.bindir = "exe"
20+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
1921

2022
s.add_dependency 'rails', [">= 4.0", "< 6.0"]
2123
s.add_dependency 'omniauth', '~> 1.0'

0 commit comments

Comments
 (0)