csv_db 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/csv_db.gemspec +1 -1
- data/lib/tasks/csv_db.rake +4 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= csv_db
|
2
2
|
is a gem for rails apps that adds to rake db tasks. The command rake db:csv_to_db pushes csv content to a db table
|
3
|
-
and the command rake db:db_to_csv pulls a
|
3
|
+
and the command rake db:db_to_csv pulls a database table into a csv
|
4
4
|
|
5
5
|
== Install
|
6
6
|
gem install csv_db
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('csv_db', '1.0.
|
5
|
+
Echoe.new('csv_db', '1.0.2') do |p|
|
6
6
|
p.description = "Backup a db table to a csv or push csv content to a database table"
|
7
7
|
p.url = "http://github.com/phongsi/csv_db"
|
8
8
|
p.author = "Phong Si"
|
data/csv_db.gemspec
CHANGED
data/lib/tasks/csv_db.rake
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# code by Phong Si
|
1
2
|
require 'csv'
|
2
3
|
|
3
4
|
namespace :db do
|
5
|
+
desc "pulls database table into a csv file"
|
4
6
|
task :db_to_csv => :environment do
|
5
7
|
model_dir = Dir['**/models/**/*.rb'].detect {|f| ENV['model'] == File.basename(f, '.*').camelize}
|
6
8
|
if !model_dir.eql?(nil)
|
@@ -21,6 +23,8 @@ namespace :db do
|
|
21
23
|
puts "Table #{ENV['model']} could not be found"
|
22
24
|
end
|
23
25
|
end
|
26
|
+
|
27
|
+
desc "pushes csv content into a database table"
|
24
28
|
task :csv_to_db => :environment do
|
25
29
|
model = ENV['csv'].constantize
|
26
30
|
columns = Array.new
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|