From ec02fa7e647d7cd2b8b93a779fd16c655abf38ab Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 1 Feb 2011 14:07:24 -0200 Subject: Moving Fs to backend --- lib/backend.rb | 1 + lib/backend/fs.rb | 32 ++++++++++++++++++++++++++++++++ lib/keyring.rb | 1 - lib/keyring/crypt.rb | 2 +- lib/keyring/fs.rb | 32 -------------------------------- 5 files changed, 34 insertions(+), 34 deletions(-) create mode 100644 lib/backend/fs.rb delete mode 100644 lib/keyring/fs.rb diff --git a/lib/backend.rb b/lib/backend.rb index 6275bcb..76abd01 100644 --- a/lib/backend.rb +++ b/lib/backend.rb @@ -25,6 +25,7 @@ require 'git' # internal requires $:.unshift File.dirname(__FILE__) +require 'backend/fs' require 'backend/git' require 'backend/crypt' require 'backend/recipients_store' diff --git a/lib/backend/fs.rb b/lib/backend/fs.rb new file mode 100644 index 0000000..b657ec9 --- /dev/null +++ b/lib/backend/fs.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby +# +# Keyringer secret management system. +# +# Copyright (C) 2011 Keyringer Development Team. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +module Backend + class Fs + def get_as_string(filename) + data = '' + f = File.open(filename, "r") + f.each_line do |line| + data += line + end + return data + end + end +end diff --git a/lib/keyring.rb b/lib/keyring.rb index 31d9e11..65927dd 100644 --- a/lib/keyring.rb +++ b/lib/keyring.rb @@ -22,6 +22,5 @@ $:.unshift File.dirname(__FILE__) require 'backend' require 'keyring/crypt' -require 'keyring/fs' require 'keyring/recipients' require 'keyring/user_config' diff --git a/lib/keyring/crypt.rb b/lib/keyring/crypt.rb index 06b8ad7..8f0ac5d 100644 --- a/lib/keyring/crypt.rb +++ b/lib/keyring/crypt.rb @@ -21,7 +21,7 @@ module Keyring class Crypt def decrypt(filename) - file = Fs.new() + file = Backend::Fs.new() content = file.get_as_string(filename) crypt = Backend::Crypt.new(nil) return crypt.decrypt(content) diff --git a/lib/keyring/fs.rb b/lib/keyring/fs.rb deleted file mode 100644 index 26bdcb8..0000000 --- a/lib/keyring/fs.rb +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env ruby -# -# Keyringer secret management system. -# -# Copyright (C) 2011 Keyringer Development Team. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -module Keyring - class Fs - def get_as_string(filename) - data = '' - f = File.open(filename, "r") - f.each_line do |line| - data += line - end - return data - end - end -end -- cgit v1.2.3