mink 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/mink CHANGED
@@ -129,8 +129,8 @@ END_OF_USAGE
129
129
  end
130
130
 
131
131
  def check_mongod
132
- mongod_path = @config.fetch(:mongod_path, "")
133
- if mongod_path.strip.length == 0 || !system(mongod_path + " --version")
132
+ @mongod_path = @config.fetch(:mongod_path, "")
133
+ if @mongod_path.strip.length == 0 || !system(@mongod_path + " --version")
134
134
  raise ArgumentError, "mongod not found! Please check your mongod path in #{CONFIG_NAME}"
135
135
  end
136
136
  end
@@ -32,7 +32,7 @@ module Mink
32
32
  end
33
33
 
34
34
  def start_set
35
- puts "** Starting a replica set with #{@count} nodes"
35
+ puts "[RS #{@name}] Starting a replica set with #{@count} nodes\n"
36
36
  kill_existing_mongods
37
37
 
38
38
  n = 0
@@ -159,7 +159,7 @@ module Mink
159
159
  print "."
160
160
  if status['members'].all? { |m| m['health'] == 1 && [1, 2, 7].include?(m['state']) } &&
161
161
  status['members'].any? { |m| m['state'] == 1 }
162
- print "all members up!\n\n"
162
+ print "[RS #{@name}] all members up!\n"
163
163
  return status
164
164
  else
165
165
  raise Mongo::OperationFailure
@@ -50,18 +50,21 @@ module Mink
50
50
  add_shards
51
51
  enable_sharding
52
52
  if shard_collection
53
- STDOUT << "Shard cluster initiated!\nEnter the following to connect:\n mongo localhost:#{@mongos_port}"
53
+ STDOUT << "\nShard cluster initiated!\nEnter the following to connect:\n mongo localhost:#{@mongos_port}\n\n"
54
54
  end
55
55
  end
56
56
 
57
57
  def enable_sharding
58
- mongos['admin'].command({:enablesharding => @shard_db})
58
+ cmd = {:enablesharding => @shard_db}
59
+ STDOUT << "Command: #{cmd.inspect}\n"
60
+ mongos['admin'].command(cmd)
59
61
  end
60
62
 
61
63
  def shard_collection
62
64
  cmd = BSON::OrderedHash.new
63
65
  cmd[:shardcollection] = "#{@shard_db}.#{@shard_coll}"
64
66
  cmd[:key] = {:tid => 1}
67
+ STDOUT << "Command: #{cmd.inspect}\n"
65
68
  mongos['admin'].command(cmd)
66
69
  end
67
70
 
@@ -69,6 +72,7 @@ module Mink
69
72
  @shards.each do |shard|
70
73
  cmd = {:addshard => shard.shard_string}
71
74
  cmd
75
+ STDOUT << "Command: #{cmd.inspect}\n"
72
76
  p mongos['admin'].command(cmd)
73
77
  end
74
78
  p mongos['admin'].command({:listshards => 1})
@@ -189,7 +193,7 @@ module Mink
189
193
  def start(set, node)
190
194
  system(set[node]['start'])
191
195
  set[node]['up'] = true
192
- sleep(0.5)
196
+ sleep(0.75)
193
197
  set[node]['pid'] = File.open(File.join(set[node]['db_path'], 'mongod.lock')).read.strip
194
198
  end
195
199
  alias :restart :start
data/lib/mink.rb CHANGED
@@ -4,6 +4,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
5
  require 'mongo'
6
6
  require 'thread'
7
+ require 'rbconfig'
7
8
 
8
9
  require 'mink/helpers/manager_helper'
9
10
  require 'mink/managers/repl_set_manager'
@@ -11,5 +12,10 @@ require 'mink/managers/auth_repl_set_manager'
11
12
  require 'mink/managers/sharding_manager'
12
13
 
13
14
  module Mink
14
- VERSION = "0.1"
15
+ VERSION = "0.1.1"
16
+ end
17
+
18
+ if Config::CONFIG['host_os'] =~ /mswin|windows/i
19
+ STDERR << "Sorry, but mink doesn't work on Windows yet. Stay tuned."
20
+ exit
15
21
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mink
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- version: "0.1"
9
+ - 1
10
+ version: 0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Kyle Banker