lib/ronin/ui/console/commands.rb in ronin-1.4.0 vs lib/ronin/ui/console/commands.rb in ronin-1.4.1
- old
+ new
@@ -15,11 +15,12 @@
#
# You should have received a copy of the GNU General Public License
# along with Ronin. If not, see <http://www.gnu.org/licenses/>.
#
-require 'env'
+require 'ronin/config'
+
require 'set'
require 'tempfile'
module Ronin
module UI
@@ -32,14 +33,14 @@
# @api private
#
module Commands
# Names and statuses of executables.
EXECUTABLES = Hash.new do |hash,key|
- hash[key] = Env.paths.any? do |dir|
- path = dir.join(key)
+ hash[key] = Config::BIN_DIRS.any? do |dir|
+ path = File.join(dir,key)
- (path.file? && path.executable?)
+ (File.file?(path) && File.executable?(path))
end
end
# Prefixes that denote a command, instead of Ruby code.
PREFIXES = Set['!', '.']
@@ -88,11 +89,11 @@
#
def Commands.cd(*arguments)
old_pwd = Dir.pwd
new_cwd = if arguments.empty?
- Env.home
+ Config::HOME
elsif arguments.first == '-'
unless ENV['OLDPWD']
print_warning 'cd: OLDPWD not set'
return false
end
@@ -133,13 +134,13 @@
# Specifies whether the code was successfully re-loaded.
#
def Commands.edit(*arguments)
path = arguments.first
- if Env.editor
+ if ENV['EDITOR']
path ||= Tempfile.new(['ronin-console', '.rb']).path
- system(Env.editor,path) && load(path)
+ system(ENV['EDITOR'],path) && load(path)
else
print_error "Please set the EDITOR env variable"
return false
end
end