mrd 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a85fe439b91ca1806126a922e387d1660e6f36f6
4
- data.tar.gz: 1a59b7a533dc5df2c6d006e52d0628d71a896de2
3
+ metadata.gz: 364fd55cd8c15cc660400b7969a23a987fabc6f3
4
+ data.tar.gz: 9c950b027b1f0c3bfb3cf74ad860f7c3e5df4e55
5
5
  SHA512:
6
- metadata.gz: ce8721449dea7d66a1720dcb231a32f2fc3db9436e8f1440e3dc884a5d878078178a84381c2a56dcdcaa89aa7e6271fae36b461239a6d6d4a7775a0ac0aa74a4
7
- data.tar.gz: 84a9f5f563ac2408bb744c5347b24e089a678ece9b8d00e4738fd46d97012746565c9eab68daab366b1d991c18c00954e312f47f7040abff5efca85b2db82d9b
6
+ metadata.gz: e501413fcf0ec244a7e9cdce72a4860c29191044c6817836db452086119a9e781973ef7204c730a59704abe6b1e1e1798252752163130eb6ec86649f4c668a4c
7
+ data.tar.gz: 2c874b52b711949c399c8ba72aad9774f91e904f6e4a58abd0db731b7828028350f27a6004168dcc2173b2dca7aa4002ce15d55e24c435905a44519359df848d
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source ENV.fetch('GEM_SOURCE', 'https://rubygems.org')
2
2
 
3
3
  # Specify your gem's dependencies in mrd.gemspec
4
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mrd (0.0.5)
4
+ mrd (0.0.6)
5
5
  term-ansicolor
6
6
 
7
7
  GEM
8
- remote: https://rubygems.org/
8
+ remote: http://yarp.dev/
9
9
  specs:
10
10
  rake (10.1.0)
11
11
  term-ansicolor (1.2.2)
12
12
  tins (~> 0.8)
13
- tins (0.8.3)
13
+ tins (0.9.0)
14
14
 
15
15
  PLATFORMS
16
16
  ruby
data/README.md CHANGED
@@ -37,6 +37,7 @@ Then, if using Rails, point your `database.yml` to the temporary SQL server:
37
37
  Usage: [options]
38
38
  -v, --verbose Run verbosely
39
39
  -s, --size SIZE Size of RAM disk in MB (default 1024)
40
+ -p, --port PORT Run MySQL listening on specified port
40
41
  -l, --log Create mysql.log
41
42
 
42
43
  ## Contributing
data/bin/mrd CHANGED
@@ -107,12 +107,14 @@ class App
107
107
  include Runner
108
108
 
109
109
  attr :socket
110
+ attr :port
110
111
 
111
- def initialize(ramdisk, log = false)
112
+ def initialize(ramdisk, log = false, port = 0)
112
113
  @ramdisk = ramdisk
113
114
  @install_db = find_command! %w(mysql_install_db5 mysql_install_db)
114
115
  @mysqld = find_command! %w(mysqld_safe5 mysqld_safe)
115
116
  @log = log
117
+ @port = port
116
118
  end
117
119
 
118
120
  def start
@@ -121,6 +123,13 @@ class App
121
123
  fd.write %Q{
122
124
  [client]
123
125
  socket = #{socket}
126
+ }.gsub(/^\s+/,'')
127
+ if @port > 0
128
+ fd.write %Q{
129
+ port = #{port}
130
+ }.gsub(/^\s+/,'')
131
+ end
132
+ fd.write %Q{
124
133
  [mysqld]
125
134
  socket = #{socket}
126
135
  thread_concurrency = 4
@@ -133,7 +142,12 @@ class App
133
142
  log_output = FILE
134
143
  general_log = 1
135
144
  general_log_file = "#{@ramdisk.mountpoint}/mysql.log"
136
- }
145
+ }.gsub(/^\s+/,'')
146
+ end
147
+ if @port > 0
148
+ fd.write %Q{
149
+ port = #{port}
150
+ }.gsub(/^\s+/,'')
137
151
  end
138
152
  end
139
153
 
@@ -145,8 +159,14 @@ class App
145
159
 
146
160
  # Start server in another thread
147
161
  Logger.info 'Starting MySQL server'
148
- @thread = Thread.new do
149
- run!("#{@mysqld} --defaults-file='#{configfile}' --socket='#{socket}' --datadir='#{@ramdisk.mountpoint}' --pid-file='#{pidfile}' --skip-networking")
162
+ @thread = Thread.new do
163
+ command = "#{@mysqld} --defaults-file='#{configfile}' --datadir='#{@ramdisk.mountpoint}' --pid-file='#{pidfile}' --socket='#{socket}'"
164
+ if @port > 0
165
+ command += " --port=#{port}"
166
+ else
167
+ command += " --skip-networking"
168
+ end
169
+ run!(command)
150
170
  end
151
171
 
152
172
  # Wait for PID file
@@ -202,7 +222,7 @@ class App
202
222
 
203
223
 
204
224
  def initialize(argv)
205
- @options = OpenStruct.new(:verbose => false, :size => 1024, :log => false)
225
+ @options = OpenStruct.new(:verbose => false, :size => 1024, :log => false, :port => 0)
206
226
  option_parser.parse(argv)
207
227
 
208
228
  Logger.level = options.verbose ?
@@ -213,7 +233,7 @@ class App
213
233
 
214
234
  def main
215
235
  @ramdisk = Ramdisk.new(options.size)
216
- @server = MySQLServer.new(@ramdisk, options.log)
236
+ @server = MySQLServer.new(@ramdisk, options.log, options.port)
217
237
  rd,wr = IO.pipe
218
238
 
219
239
  if pid = Process.fork
@@ -249,6 +269,7 @@ class App
249
269
  # Log and wait for user input
250
270
  Logger.info "MySQL is now running."
251
271
  Logger.info "A query log can be found at '#{@ramdisk.mountpoint}/mysql.log'" if options.log
272
+ Logger.info "MySQL is listening on port '#{options.port}'" if options.port > 0
252
273
  Logger.info "Configure you client to use the root user, no password, and the socket at '#{@server.socket}'."
253
274
  Logger.info "Just close this terminal or press ^C when you no longer need it."
254
275
  wait_forever
@@ -285,6 +306,10 @@ class App
285
306
  opts.on("-l", "--log", "Create mysql.log") do |v|
286
307
  options.log = v
287
308
  end
309
+
310
+ opts.on("-p", "--port PORT", Integer, "Run MySQL listening on specified port") do |v|
311
+ options.port = v
312
+ end
288
313
  end
289
314
  end
290
315
 
data/lib/mrd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mrd
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-21 00:00:00.000000000 Z
11
+ date: 2013-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake