thor_tasks 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tasks/mongo.thor +13 -2
- data/lib/thor_tasks/version.rb +1 -1
- data/spec/tasks/mongo.thor_spec.rb +2 -1
- metadata +3 -3
data/lib/tasks/mongo.thor
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
class Mongo < Thor
|
2
2
|
include Thor::Actions
|
3
3
|
|
4
|
-
|
4
|
+
DEFAULT_DB_PATH = "/var/lib/mongodb"
|
5
|
+
DEFAULT_LOG_PATH = "/var/log/mongodb.log"
|
6
|
+
|
7
|
+
desc "start [DBPATH] [LOGPATH]", "starts mongodb"
|
8
|
+
method_option :dbpath, :type => :string, :default => DEFAULT_DB_PATH
|
9
|
+
method_option :logpath, :type => :string, :default => DEFAULT_LOG_PATH
|
5
10
|
def start
|
6
11
|
if mongod_pid.nil?
|
7
12
|
puts "Starting MongoDB . . ."
|
8
|
-
run
|
13
|
+
run "sudo mongod --dbpath #{options[:dbpath]} --fork --logpath #{options[:logpath]} --logappend"
|
9
14
|
else
|
10
15
|
puts "MongoDB is already running!"
|
11
16
|
end
|
@@ -30,6 +35,12 @@ class Mongo < Thor
|
|
30
35
|
invoke :start
|
31
36
|
end
|
32
37
|
|
38
|
+
desc "repair [DBPATH]", "runs a repair on all databases"
|
39
|
+
method_option :dbpath, :type => :string, :default => DEFAULT_DB_PATH
|
40
|
+
def repair
|
41
|
+
run "sudo mongod --dbpath #{options[:dbpath]} --repair"
|
42
|
+
end
|
43
|
+
|
33
44
|
private
|
34
45
|
|
35
46
|
def mongod_pid
|
data/lib/thor_tasks/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Travis Haynes
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-06-
|
17
|
+
date: 2011-06-22 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|