Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Show the db names that are replaced/replacing. Useful when setting th…

…e MONGO_URL locally
  • Loading branch information...
commit f5da690aef22a309c2e97a0884fa48fb65d2f903 1 parent adfe68b
Ole Morten Amundsen authored September 06, 2010

Showing 1 changed file with 11 additions and 3 deletions. Show diff stats Hide diff stats

  1. 14  lib/heroku/command/mongo.rb
14  lib/heroku/command/mongo.rb
@@ -9,14 +9,14 @@ def initialize(*args)
9 9
     end
10 10
 
11 11
     def push
12  
-      display "THIS WILL REPLACE ALL DATA for #{app} ON #{heroku_mongo_uri.host} WITH #{local_mongo_uri.host}"
  12
+      display "THIS WILL REPLACE ALL DATA for #{app} ON #{heroku_mongo_uri.host} WITH #{local_mongo_uri.host} db #{local_db_name}"
13 13
       display "Are you sure? (y/n) ", false
14 14
       return unless ask.downcase == 'y'
15 15
       transfer(local_mongo_uri, heroku_mongo_uri)
16 16
     end
17 17
 
18 18
     def pull
19  
-      display "Replacing the #{app} db at #{local_mongo_uri.host} with #{heroku_mongo_uri.host}"
  19
+      display "Replacing the #{local_db_name} db at #{local_mongo_uri.host} with #{heroku_mongo_uri.host} #{app}"
20 20
       transfer(heroku_mongo_uri, local_mongo_uri)
21 21
     end
22 22
 
@@ -56,8 +56,16 @@ def heroku_mongo_uri
56 56
         make_uri(url)
57 57
       end
58 58
 
  59
+      def local_db_name
  60
+        URI.parse(local_mongo_url).path.gsub("/","")
  61
+      end
  62
+
  63
+      def local_mongo_url
  64
+        ENV['MONGO_URL'] || "mongodb://localhost:27017/#{app}"
  65
+      end
  66
+
59 67
       def local_mongo_uri
60  
-        url = ENV['MONGO_URL'] || "mongodb://localhost:27017/#{app}"
  68
+        url = local_mongo_url
61 69
         make_uri(url)
62 70
       end
63 71
 

0 notes on commit f5da690

Please sign in to comment.
Something went wrong with that request. Please try again.