Skip to content

Commit

Permalink
rename Importable => Importer
Browse files Browse the repository at this point in the history
  • Loading branch information
spaghetticode committed Feb 16, 2013
1 parent 775cdaf commit 242f8eb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 31 deletions.
2 changes: 1 addition & 1 deletion lib/dbmanager.rb
Expand Up @@ -8,7 +8,7 @@ module Dbmanager
autoload :Environment, 'dbmanager/environment'
autoload :YmlParser, 'dbmanager/yml_parser'
autoload :Runnable, 'dbmanager/runnable'
autoload :Importable, 'dbmanager/importable'
autoload :Importer, 'dbmanager/importer'
autoload :Dumper, 'dbmanager/dumper'
autoload :Loader, 'dbmanager/loader'
autoload :Adapters, 'dbmanager/adapters'
Expand Down
22 changes: 8 additions & 14 deletions lib/dbmanager/dumper.rb
@@ -1,28 +1,22 @@
# Extends the runner with database dumping capabilities.
#
# The user will be prompted to enter the target filename path, pressing enter
# will set it to the default which is the value returned by #default_filename.
#
# The dump process happens in the #run method, and is eventually delegated to
# the specific database adapter which must implement the #run method.

module Dbmanager
class Dumper
include Runnable

def run
self.source = get_env('source')
self.filename = get_filename('target', default_filename)
attr_accessor :filename, :source

def run
get_data
dumper.run
output.puts "Database successfully dumped in #{filename} file."
end

attr_accessor :filename, :source


private

def get_data
self.source = get_env('source')
self.filename = get_filename('target', default_filename)
end

def dumper
adapter::Dumper.new(source, filename)
end
Expand Down
13 changes: 1 addition & 12 deletions lib/dbmanager/importable.rb → lib/dbmanager/importer.rb
@@ -1,16 +1,5 @@
# Extends the runner with database importing capabilities.
#
# The import process happens in the #run method, and is eventually delegated to
# the specific database adapter which must implement the #run method. This
# adapter will receive the source and target environment plus the path for the
# sql dump file.
#
# The source and target environment must use the same adapter, ie you cannot
# import a mysql database on a sqlite3 database. For that purpose you can use
# the taps gem.

module Dbmanager
class Importable
class Importer
include Runnable

def run
Expand Down
4 changes: 2 additions & 2 deletions lib/dbmanager/loader.rb
Expand Up @@ -5,14 +5,14 @@ class Loader
attr_accessor :filename, :target

def run
set_data
get_data
dumper.run
output.puts "Database successfully loaded from #{filename}."
end

private

def set_data
def get_data
self.target = get_env('target')
self.filename = get_filename('source', default_filename)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/importable_spec.rb → spec/lib/importer_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'

module Dbmanager
describe Importable do
subject { Importable.new }
describe Importer do
subject { described_class.new }

before do
stub_rails_root
Expand Down

0 comments on commit 242f8eb

Please sign in to comment.