class Shakapacker::Utils::Misc
Public Class Methods
object_to_boolean(value)
click to toggle source
# File lib/shakapacker/utils/misc.rb, line 26 def self.object_to_boolean(value) [true, "true", "yes", 1, "1", "t"].include?(value.instance_of?(String) ? value.downcase : value) end
sh_in_dir(dir, *shell_commands)
click to toggle source
Executes a string or an array of strings in a shell in the given directory in an unbundled environment
# File lib/shakapacker/utils/misc.rb, line 31 def self.sh_in_dir(dir, *shell_commands) shell_commands.flatten.each { |shell_command| sh %(cd #{dir} && #{shell_command.strip}) } end
uncommitted_changes?(message_handler)
click to toggle source
# File lib/shakapacker/utils/misc.rb, line 11 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