magic_recipes 0.0.8 → 0.0.9
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.
- data/lib/magic_recipes/db.rb +4 -3
- data/lib/tasks/magic_db_tasks.rake +29 -0
- metadata +3 -2
data/lib/magic_recipes/db.rb
CHANGED
@@ -32,17 +32,18 @@ module MagicRecipes
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
desc "delete all
|
35
|
+
desc "delete all Tables of the Database!"
|
36
36
|
task :delete_tables do
|
37
37
|
if use_rvm
|
38
38
|
run <<-CMD
|
39
39
|
#{rvm_cmd} &&
|
40
40
|
cd #{latest_release} &&
|
41
|
-
ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
|
41
|
+
rails runner "ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }"
|
42
42
|
CMD
|
43
43
|
else
|
44
|
-
run "cd #{latest_release} && ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }"
|
44
|
+
run "cd #{latest_release} && rails runner 'ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }'"
|
45
45
|
end
|
46
|
+
# => ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
|
46
47
|
end
|
47
48
|
|
48
49
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
namespace :db do
|
2
|
+
namespace :stuff do
|
3
|
+
|
4
|
+
desc "dump the tables holding seed data to db/RAILS_ENV_seed.sql. SEED_TABLES need to be defined in config/environment.rb!!!"
|
5
|
+
task :dump => :environment do
|
6
|
+
config = ActiveRecord::Base.configurations[RAILS_ENV]
|
7
|
+
dump_cmd = "mysqldump --user=#{config['username']} --password=#{config['password']} #{config['database']} #{SEED_TABLES.join(" ")} > db/#{RAILS_ENV}_data.sql"
|
8
|
+
system(dump_cmd)
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "load the dumped seed data from db/development_seed.sql into the test database"
|
12
|
+
task :load => :environment do
|
13
|
+
config = ActiveRecord::Base.configurations[RAILS_ENV]
|
14
|
+
system("mysql --user=#{config['username']} --password=#{config['password']} #{config['database']} < db/#{RAILS_ENV}_data.sql")
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "load the dumped seed data from db/development_seed.sql into the test database"
|
18
|
+
task :testload => :environment do
|
19
|
+
config = ActiveRecord::Base.configurations['test']
|
20
|
+
system("mysql --user=#{config['username']} --password=#{config['password']} #{config['database']} < db/test_data.sql")
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "drop the dumped seed data from db/development_seed.sql into the test database"
|
24
|
+
task :drop => :environment do
|
25
|
+
ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.drop_table t }
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magic_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- lib/magic_recipes/thin.rb
|
209
209
|
- lib/magic_recipes/unicorn.rb
|
210
210
|
- lib/magic_recipes.rb
|
211
|
+
- lib/tasks/magic_db_tasks.rake
|
211
212
|
- lib/tasks/magic_recipes_tasks.rake
|
212
213
|
- spec/dummy/app/assets/javascripts/application.js
|
213
214
|
- spec/dummy/app/assets/stylesheets/application.css
|