thor_tasks 0.0.6 → 0.0.7

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/tasks/mongo.thor CHANGED
@@ -1,11 +1,16 @@
1
1
  class Mongo < Thor
2
2
  include Thor::Actions
3
3
 
4
- desc "start", "starts mongodb"
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 'sudo mongod --dbpath /var/lib/mongodb --fork --logpath /var/log/mongodb.log --logappend'
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
@@ -1,3 +1,3 @@
1
1
  module ThorTasks
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -1,7 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Spork do
3
+ describe Mongo do
4
4
  it { should respond_to :start }
5
5
  it { should respond_to :restart }
6
6
  it { should respond_to :stop }
7
+ it { should respond_to :repair }
7
8
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- version: 0.0.6
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-10 00:00:00 -07:00
17
+ date: 2011-06-22 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20