Permalink
Browse files

fix error in application_database.rb

  • Loading branch information...
1 parent 0028c2d commit d3705b9e0c12ccf5a4881a2ef69aca0638dd028a @lazylester committed Mar 21, 2013
Showing with 133 additions and 7 deletions.
  1. +126 −0 Gemfile.lock
  2. +7 −4 app/models/application_database.rb
  3. +0 −3 spec/models/application_database_spec.rb
View
@@ -0,0 +1,126 @@
+PATH
+ remote: .
+ specs:
+ get_back (0.0.1)
+ rails (~> 3.2.12)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.2.13)
+ actionpack (= 3.2.13)
+ mail (~> 2.5.3)
+ actionpack (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.4)
+ rack (~> 1.4.5)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.2.1)
+ activemodel (3.2.13)
+ activesupport (= 3.2.13)
+ builder (~> 3.0.0)
+ activerecord (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
+ activesupport (3.2.13)
+ i18n (= 0.6.1)
+ multi_json (~> 1.0)
+ archive-tar-minitar (0.5.2)
+ arel (3.0.2)
+ builder (3.0.4)
+ columnize (0.3.6)
+ diff-lcs (1.2.1)
+ erubis (2.7.0)
+ hike (1.2.1)
+ i18n (0.6.1)
+ journey (1.0.4)
+ jquery-rails (2.2.1)
+ railties (>= 3.0, < 5.0)
+ thor (>= 0.14, < 2.0)
+ json (1.7.7)
+ linecache19 (0.5.13)
+ ruby_core_source (>= 0.1.4)
+ mail (2.5.3)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.21)
+ multi_json (1.7.1)
+ mysql2 (0.3.11)
+ polyglot (0.3.3)
+ rack (1.4.5)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.3)
+ rack
+ rack-test (0.6.2)
+ rack (>= 1.0)
+ rails (3.2.13)
+ actionmailer (= 3.2.13)
+ actionpack (= 3.2.13)
+ activerecord (= 3.2.13)
+ activeresource (= 3.2.13)
+ activesupport (= 3.2.13)
+ bundler (~> 1.0)
+ railties (= 3.2.13)
+ railties (3.2.13)
+ actionpack (= 3.2.13)
+ activesupport (= 3.2.13)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (10.0.3)
+ rdoc (3.12.2)
+ json (~> 1.4)
+ rspec-core (2.13.1)
+ rspec-expectations (2.13.0)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.13.0)
+ rspec-rails (2.13.0)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 2.13.0)
+ rspec-expectations (~> 2.13.0)
+ rspec-mocks (~> 2.13.0)
+ ruby-debug-base19 (0.11.26)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby_core_source (0.1.5)
+ archive-tar-minitar (>= 0.5.2)
+ sprockets (2.2.2)
+ hike (~> 1.2)
+ multi_json (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ thor (0.17.0)
+ tilt (1.3.6)
+ treetop (1.4.12)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.37)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ get_back!
+ jquery-rails
+ mysql2
+ rspec-rails
+ ruby-debug19
@@ -27,13 +27,15 @@ def self.restore_from_file(backfile)
def self.sql_dump_to_file(file)
sql_cmd =<<-SQL
#{@@db_config['path']}mysqldump\
- -u #{@@db_config['username']} #{@@password}\
+ --user=#{@@db_config['username']}\
+ --password=#{@@password}\
--single-transaction\
--quote-names\
--add-drop-table\
--add-locks=FALSE\
--lock-tables=FALSE\
- --hex-blob #{@@db_config['database']} > #{file}
+ --hex-blob\
+ #{@@db_config['database']} > #{file}
SQL
end
@@ -42,8 +44,9 @@ def self.sql_restore(filename)
#{@@db_config['path']}mysql\
--database #{@@db_config['database']}\
--host=#{@@db_config['host']}\
- --user=#{@@db_config['username']} #{@@password}\
- -e "source #{filename}";
+ --user=#{@@db_config['username']}\
+ --password=#{@@password}\
+ -e \"source #{filename}\";
SQL
end
@@ -36,9 +36,6 @@
SQL
file = Rails.root.join('tmp','sql_test.sql')
File.write(file, sql)
- #ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS `test`;")
- #ActiveRecord::Base.connection.execute("create table test ( foo varchar(255))")
- #ActiveRecord::Base.connection.execute("insert into test set foo = 'bar'")
ApplicationDatabase.restore_from_file(BackupFile.new(:filename => file))
end

0 comments on commit d3705b9

Please sign in to comment.