console_util 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module ConsoleUtil
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/console_util.rb CHANGED
@@ -20,6 +20,15 @@ module ConsoleUtil
20
20
 
21
21
  true
22
22
  end
23
+
24
+ # Import a MySQL dump file.
25
+ # [This may work with other databases, but has only been tested with MySQL.]
26
+ def import_mysql_dump(filename)
27
+ sql_dump_file = File.open(Rails.root.join('sql', "#{filename}.sql"))
28
+ while sql_statement = sql_dump_file.gets(";\n") do
29
+ ActiveRecord::Base.connection.execute(sql_statement) unless sql_statement.blank?
30
+ end
31
+ end
23
32
 
24
33
  # Load all models into the environment
25
34
  def load_all_models
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console_util
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Clyde Law
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-20 00:00:00 Z
18
+ date: 2011-06-02 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails