Sha256: 6dbfd57d507363eea4eab49280d0a56503770bb0387e9695e404319463d9cb09
Contents?: true
Size: 1.12 KB
Versions: 6
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
6 entries across 6 versions & 1 rubygems