Sha256: 7c093551e30b847a892b9f5d4bb1a5b7e2407e4d95907e60e98e8538e715d590
Contents?: true
Size: 1.12 KB
Versions: 29
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require "English" require "rake/file_utils" module Shakapacker module Utils class Misc extend FileUtils def self.uncommitted_changes?(message_handler) return false if ENV["COVERAGE"] == "true" status = `git status --porcelain` return false if $CHILD_STATUS.success? && status.empty? error = if $CHILD_STATUS.success? "You have uncommitted code. Please commit or stash your changes before continuing" else "You do not have Git installed. Please install Git, and commit your changes before continuing" end message_handler.add_error(error) true end def self.object_to_boolean(value) [true, "true", "yes", 1, "1", "t"].include?(value.instance_of?(String) ? value.downcase : value) end # Executes a string or an array of strings in a shell in the given directory in an unbundled environment def self.sh_in_dir(dir, *shell_commands) shell_commands.flatten.each { |shell_command| sh %(cd #{dir} && #{shell_command.strip}) } end end end end
Version data entries
29 entries across 29 versions & 1 rubygems