#!/usr/bin/env ruby puts "\n----- Retrospectiva status report\n" puts "\n > Testing subversion support\n" libs = {} libs['Core'] = require 'svn/core' rescue nil libs['Fs'] = require 'svn/fs' rescue nil libs['Delta'] = require 'svn/delta' rescue nil libs['Repos'] = require 'svn/repos' rescue nil libs['Client'] = require 'svn/client' rescue nil subversion_ok = true libs.each_pair do |lib, loaded| subversion_ok = false if loaded.nil? code = loaded.nil? ? '-' : '+' msg = loaded.nil? ? 'NOT' : 'successfully' puts " [#{code}] Svn::#{lib} library was #{msg} loaded\n" end if subversion_ok puts " [=] All libraries were loaded. Subversion support will be fully ENABLED!\n" else puts " [E] At least one required library could not be loaded. Subversion support will be DISABLED!\n" end puts "\n > Loading production environment\n" loaded = false ENV['RAILS_ENV'] = 'production' begin require File.dirname(__FILE__) + '/../config/environment' loaded = true puts " [=] Retrospectiva was successfully loaded!\n" rescue puts " [E] Cannot load Retrospectiva:\n" puts " #{$!}\n" end if loaded puts "\n > Checking file access permissions for user '#{ENV['USER']}'\n" permissions_ok = true abs_root = File.expand_path(RAILS_ROOT) + '/' ['config/runtime/**', 'log', 'attachments', 'tmp/**', 'extensions'].each do |path| full_path = File.join(RAILS_ROOT, path) Dir.glob(full_path).each do |fs_obj| rel_path = File.expand_path(fs_obj).gsub(%r{#{Regexp.quote(abs_root)}}, '') if File.writable?(fs_obj) puts " [+] #{rel_path} - writable\n" else permissions_ok = false puts " [-] #{rel_path} - NOT writable\n" end end end Dir.glob(File.join(RAILS_ROOT, 'public', 'dispatch.*')).each do |fs_obj| rel_path = File.expand_path(fs_obj).gsub(%r{#{Regexp.quote(abs_root)}}, '') if File.executable?(fs_obj) puts " [+] #{rel_path} - executable\n" else permissions_ok = false puts " [-] #{rel_path} - NOT executable\n" end end if permissions_ok puts " [=] Congratulations! All your file system permissions are set correctly!\n" else puts " [E] Warning! At least one of your file system permissions IS NOT set correctly!\n" end end puts "\n----- Finished\n"