Skip to content

Instantly share code, notes, and snippets.

View infews's full-sized avatar

Davis W. Frank infews

View GitHub Profile
source_paths = ArchivablePathname.from(Dir.glob(File.join(options[:source], "*")))
Archiver.new(source_paths, destination)
.move_unless { |path| File.exist?(File.join(destination, path.archive_path)) }
.collect { |path| path.move = Prompts::ConfirmPrompt.ask(label: "File #{path.archive_path} exists. Overwrite?") }
.move_if { |path| path.move? }
@infews
infews / be.rb
Last active July 5, 2021 22:51
a "better" be "alias" for bundle exec, prioritizing local binstubs
#!/usr/bin/env ruby
# Smarter be for ruby projects that prioritizes local project binstubs
# - uses zsh when needed, assuming MacOS Catalina or later
# - save on your path
# - drop the .rb
# - chmod +x
# - always type `be <command>` and the right thing should happen
#
# - inspired by Justin Searls (@searls)