Add option to skip binstubs for older apps

This commit is contained in:
David Heinemeier Hansson
2023-01-14 11:44:16 +01:00
parent fed64ef244
commit c44e224587

View File

@@ -42,6 +42,7 @@ class Mrsk::Cli::Main < Mrsk::Cli::Base
end end
desc "install", "Create config stub in config/deploy.yml and binstub in bin/mrsk" desc "install", "Create config stub in config/deploy.yml and binstub in bin/mrsk"
option :skip_binstub, type: :boolean, default: false, desc: "Skip adding MRSK to the Gemfile and creating bin/mrsk binstub"
def install def install
require "fileutils" require "fileutils"
@@ -52,11 +53,14 @@ class Mrsk::Cli::Main < Mrsk::Cli::Base
puts "Created configuration file in config/deploy.yml" puts "Created configuration file in config/deploy.yml"
end end
if (binstub = Pathname.new(File.expand_path("bin/mrsk"))).exist? unless options[:skip_binstub]
puts "Binstub already exists in bin/mrsk (remove first to create a new one)" if (binstub = Pathname.new(File.expand_path("bin/mrsk"))).exist?
else puts "Binstub already exists in bin/mrsk (remove first to create a new one)"
`bundle binstubs mrsk` else
puts "Created binstub file in bin/mrsk" `bundle add mrsk`
`bundle binstubs mrsk`
puts "Created binstub file in bin/mrsk"
end
end end
end end