Sha256: de1f69f768a378742897a4584dfba19334b74c17513cf083dd58e5b74189e202
Contents?: true
Size: 1.42 KB
Versions: 6
Compression:
Stored size: 1.42 KB
Contents
def puts_fail(msg) STDERR.puts "#{"Error: ".red}#{msg}" exit msg.length end def puts_verbose(msg) puts msg if $PRINT_VERBOSE end def print_verbose(msg) print msg if $PRINT_VERBOSE end def safe_require(&block) yield rescue Exception => e puts_fail %Q{This script use these gems: fog, slop. Make sure that you have them all. If you don't have, you may install them: $ gem install fog slop ruby-progressbar } end def try_create_dir(dir) begin FileUtils.mkdir_p dir unless Dir.exists? dir rescue Errno::EACCES puts_fail "Permission denied for #{dir.dark_green}" end end def check_mode(file, first, second) unless first == second puts_fail "Permission wasn't changed for #{file.dark_green}" end end def check_rights(file, first_uid, first_gid, second_uid, second_gid) unless first_uid == second_uid and first_gid == second_gid puts_fail "Group and user wasn't change for #{file.dark_green}" end end class String def red colorize(self, "\e[1m\e[31m") end def green colorize(self, "\e[1m\e[32m") end def dark_green colorize(self, "\e[32m") end def yellow colorize(self, "\e[1m\e[33m") end def blue colorize(self, "\e[1m\e[34m") end def dark_blue colorize(self, "\e[34m") end def pur colorize(self, "\e[1m\e[35m") end def colorize(text, color_code) if $COLORIZE "#{color_code}#{text}\e[0m" else text end end end
Version data entries
6 entries across 6 versions & 2 rubygems
Version | Path |
---|---|
encbs-0.1.3 | lib/helpers.rb |
encbs-0.1.2 | lib/helpers.rb |
encbs-0.1.1 | lib/helpers.rb |
encbs-0.1.0 | lib/helpers.rb |
palobr-0.1.0.1 | lib/helpers.rb |
palobr-0.1.0 | lib/helpers.rb |