rsql 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --private
2
+ --no-private
3
+ -r README.rdoc
4
+ lib/**/*.rb
5
+ -
6
+ LICENSE
7
+ example.rsqlrc.rdoc
data/README.rdoc CHANGED
@@ -87,14 +87,12 @@ directly from the console (without echoing the characters typed):
87
87
 
88
88
  == GETTING STARTED
89
89
 
90
- This example walks through many features of RSQL including how to build up
91
- recipes:
90
+ Try out the {file:example.rsqlrc.rdoc} for a painless introduction on how to
91
+ leverage RSQL.
92
92
 
93
- Try out the simple examples in rdoc-ref:example.rsqlrc.rdoc for a painless
94
- introduciton for how to leverage RSQL.
95
-
96
- The file is available as example.rsqlrc installed with the gem or downloaded
97
- with the source.
93
+ The file is available as
94
+ {<tt>example.rsqlrc</tt>}[https://raw.github.com/bradrf/rsql/master/example.rsqlrc]
95
+ installed with the gem or downloaded with the source.
98
96
 
99
97
  == LICENSE
100
98
 
data/bin/rsql CHANGED
@@ -277,7 +277,7 @@ if opts.ssh_host
277
277
 
278
278
  password_retry_cnt = 0
279
279
 
280
- unless opts.batch_input
280
+ unless opts.batch_output
281
281
  print "SSH #{opts.ssh_user}#{opts.ssh_user ? '@' : ''}#{opts.ssh_host}..."
282
282
  $stdout.flush
283
283
  end
@@ -297,7 +297,7 @@ if opts.ssh_host
297
297
  ssh_enabled = false
298
298
  Signal.trap('INT', 'IGNORE')
299
299
  Signal.trap('TERM') do
300
- $stderr.puts 'Closing SSH connection...' unless opts.batch_input
300
+ $stderr.puts 'Closing SSH connection...' unless opts.batch_output
301
301
  ssh_enabled = false
302
302
  end
303
303
  ssh_opts = {:timeout => 15}
@@ -313,7 +313,7 @@ if opts.ssh_host
313
313
  ssh = Net::SSH.start(opts.ssh_host, opts.ssh_user, ssh_opts)
314
314
  ssh_opts.delete(:password)
315
315
  ssh_enabled = true
316
- printf "connected (#{$$})..." unless opts.batch_input
316
+ printf "connected (#{$$})..." unless opts.batch_output
317
317
  $stdout.flush
318
318
  rescue Net::SSH::AuthenticationFailed
319
319
  if 2 < password_retry_cnt
@@ -337,7 +337,7 @@ if opts.ssh_host
337
337
  ensure
338
338
  if ssh_enabled
339
339
  ssh.forward.local(opts.mysql_port, opts.mysql_host, opts.remote_mysql_port)
340
- unless opts.batch_input
340
+ unless opts.batch_output
341
341
  puts(opts.verbose ? "ready (#{opts.mysql_port} => #{opts.remote_mysql_port})" : 'ready')
342
342
  end
343
343
  File.open(ipc_fn,'w'){|f| f.puts('ready')}
@@ -393,7 +393,7 @@ if opts.ssh_host
393
393
  opts.mysql_host = '127.0.0.1'
394
394
  end
395
395
 
396
- unless opts.batch_input
396
+ unless opts.batch_output
397
397
  print "MySQL #{opts.mysql_user}@#{opts.remote_mysql_host}..."
398
398
  $stdout.flush
399
399
  end
@@ -403,7 +403,7 @@ begin
403
403
  MySQLResults.conn = Mysql.new(opts.mysql_host, opts.mysql_user, opts.mysql_password,
404
404
  MySQLResults.database_name, opts.mysql_port)
405
405
  MySQLResults.conn.reconnect = true
406
- puts 'connected' unless opts.batch_input
406
+ puts 'connected' unless opts.batch_output
407
407
  rescue Mysql::Error => ex
408
408
  if ex.message.include?('Client does not support authentication')
409
409
  $stderr.puts "failed to connect to #{mysql_conn} mysql server: unknown credentials?"
data/example.rsqlrc CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  # To use this file, change directory to the one containing this file and run
15
15
  # RSQL connecting to your MySQL server (run rsql with no arguments for
16
- # usage--see rdoc-ref:README.rdoc for more details on command line parameters).
16
+ # usage--see {file:README.rdoc} for more details on command line parameters).
17
17
  #
18
18
  # rsql> .load 'example.rsqlrc';
19
19
 
@@ -34,7 +34,7 @@
34
34
 
35
35
  ################################################################################
36
36
 
37
- # Use of RSQL::EvalContext#register_init allows a block to be automatically
37
+ # Use of {RSQL::EvalContext#register_init} allows a block to be automatically
38
38
  # invoked when this file is loaded. Often, this is useful to run set up routines
39
39
  # like setting MySQL variables for different read levels (e.g. <b><tt>SET
40
40
  # SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED</tt></b>). Any number of
@@ -51,7 +51,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS #{@rsql_table} (
51
51
  }, :desc => 'Sets up example table for trying out RSQL.'
52
52
 
53
53
  # This next recipe is building up a string with a single variable interpolated
54
- # into it (our table name) through RSQL::EvalContext#register. The string will
54
+ # into it (our table name) through {RSQL::EvalContext#register}. The string will
55
55
  # then be used as if typed at the command line.
56
56
  #
57
57
  # rsql> .cleanup_example;
@@ -73,7 +73,7 @@ DROP TEMPORARY TABLE IF EXISTS #{@rsql_table}
73
73
  #
74
74
  # rsql> .fill_table;
75
75
  #
76
- # Notice the use of the RSQL::EvalContext#hexify and RSQL::EvalContext#squeeze!
76
+ # Notice the use of the {RSQL::EvalContext#hexify} and {RSQL::EvalContext#squeeze!}
77
77
  # helper methods.
78
78
  #
79
79
  register :fill_table, :desc => 'Populate the example table.' do
@@ -112,7 +112,7 @@ SELECT name, value FROM #{@rsql_table} WHERE #{val} <= value
112
112
 
113
113
  # Sometimes we make mistakes (never!). Normally, the command history kept in
114
114
  # RSQL only stores the last thing entered at the prompt--not any query that the
115
- # previous command may have generated and invoked. When writing a recipe that
115
+ # previous command may have generated and invoked. When writing a recipe that
116
116
  # generates a query that has an error reported by MySQL, it is really handy to
117
117
  # see the generated SQL.
118
118
  #
@@ -122,7 +122,7 @@ SELECT name, value FROM #{@rsql_table} WHERE #{val} <= value
122
122
  # rsql> .bad_query;
123
123
  #
124
124
  # So the command in our history is the recipe and not the query. To see the
125
- # query the RSQL::EvalContext#history has a helper method ready for us:
125
+ # query the {RSQL::EvalContext#history} has a helper method ready for us:
126
126
  #
127
127
  # rsql> .history;
128
128
  #
@@ -137,8 +137,8 @@ SELECT name, value FROM #{@rsql_table} WHERE valu < 10000
137
137
  #
138
138
  # rsql> select name, value from rsql_example ! value => humanize_bytes;
139
139
  #
140
- # The RSQL::EvalContext#humanize_bytes is another helper method. There are
141
- # several others available. Check out the RSQL::EvalContext class for details.
140
+ # The {RSQL::EvalContext#humanize_bytes} is another helper method. There are
141
+ # several others available. Check out the {RSQL::EvalContext} class for details.
142
142
  #
143
143
  # Additional mappings can be added, separated by commas.
144
144
  #
@@ -184,10 +184,10 @@ SELECT name FROM #{@rsql_table}
184
184
  #
185
185
  # rsql> select name, value from rsql_example | p @results;
186
186
  #
187
- # The RSQL::EvalContext class manages the results from a previous query in the
187
+ # The {RSQL::EvalContext} class manages the results from a previous query in the
188
188
  # <b><tt>@results</tt></b> member variable accessible by any Ruby recipe
189
- # code. This is an instance of the RSQL::MySQLResults class. Below we make use
190
- # of the RSQL::MySQLResults#each_hash method to walk over all rows. There are
189
+ # code. This is an instance of the {RSQL::MySQLResults} class. Below we make use
190
+ # of the {RSQL::MySQLResults#each_hash} method to walk over all rows. There are
191
191
  # other helpful routines available.
192
192
  #
193
193
  # Here's an example that writes a simple report of the data we are working
@@ -215,8 +215,9 @@ end
215
215
  #
216
216
  # After running this, a <b><tt>myobj.yml</tt></b> file should be created in the
217
217
  # local directory containing all the content from the query. To accomplish this,
218
- # the RSQL::EvalContext#safe_save method is invoked which serializes our object
219
- # so that we may later decided to run some post processing on the content.
218
+ # the {RSQL::EvalContext#safe_save} method is invoked which serializes our
219
+ # object so that we may later decided to run some post processing on the
220
+ # content.
220
221
  #
221
222
  # Inspect the YAML[http://www.yaml.org/] content written out:
222
223
  #
@@ -246,7 +247,7 @@ SELECT name, value
246
247
  # Sometimes it just isn't enough to be able to rely on generating SQL queries
247
248
  # and piping into handlers. Sometimes we just need to roll up our sleeves and
248
249
  # run queries directly so we can start processing results and dealing with
249
- # presentation all on our own. That's where the RSQL::EvalContext#query helper
250
+ # presentation all on our own. That's where the {RSQL::EvalContext#query} helper
250
251
  # comes in handy.
251
252
  #
252
253
  # The intention here is to just create a series of sentences out of two separate
@@ -262,7 +263,7 @@ register :show_sentences, :desc => 'Show results as sentences.' do
262
263
  end
263
264
  end
264
265
 
265
- # The RSQL::MySQLResults class built in to RSQL handles binary content
266
+ # The {RSQL::MySQLResults} class built in to RSQL handles binary content
266
267
  # gracefully, automatically converting it to something a little nicer to our
267
268
  # consoles than just dumping it. It converts it into a hexadecimal string.
268
269
  #
@@ -280,7 +281,7 @@ SELECT * FROM #{@rsql_table} WHERE stuff=#{hexify stuff}
280
281
  }, :desc => 'Find some hex stuff.'
281
282
 
282
283
  # There are many other things to try out left as an "exercise for the
283
- # reader". Browsing the RSQL::EvalContext and RSQL::MySQLResults classes would
284
- # be an excellent start.
284
+ # reader". Browsing the {RSQL::EvalContext} and {RSQL::MySQLResults} classes
285
+ # would be an excellent start.
285
286
 
286
287
  # vi: set filetype=ruby
data/example.rsqlrc.rdoc CHANGED
@@ -13,7 +13,7 @@ this temporary table.
13
13
 
14
14
  To use this file, change directory to the one containing this file and run
15
15
  RSQL connecting to your MySQL server (run rsql with no arguments for
16
- usage--see rdoc-ref:README.rdoc for more details on command line parameters).
16
+ usage--see {file:README.rdoc} for more details on command line parameters).
17
17
 
18
18
  <tt>rsql> .load 'example.rsqlrc';</tt>
19
19
 
@@ -34,7 +34,7 @@ period on a command.
34
34
 
35
35
  ---
36
36
 
37
- Use of RSQL::EvalContext#register_init allows a block to be automatically
37
+ Use of {RSQL::EvalContext#register_init} allows a block to be automatically
38
38
  invoked when this file is loaded. Often, this is useful to run set up routines
39
39
  like setting MySQL variables for different read levels (e.g. <b><tt>SET
40
40
  SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED</tt></b>). Any number of
@@ -51,7 +51,7 @@ Here we are merely setting up the example table.
51
51
  }, :desc => 'Sets up example table for trying out RSQL.'
52
52
 
53
53
  This next recipe is building up a string with a single variable interpolated
54
- into it (our table name) through RSQL::EvalContext#register. The string will
54
+ into it (our table name) through {RSQL::EvalContext#register}. The string will
55
55
  then be used as if typed at the command line.
56
56
 
57
57
  <tt>rsql> .cleanup_example;</tt>
@@ -73,7 +73,7 @@ Here we are just populating the table (if it isn't already).
73
73
 
74
74
  <tt>rsql> .fill_table;</tt>
75
75
 
76
- Notice the use of the RSQL::EvalContext#hexify and RSQL::EvalContext#squeeze!
76
+ Notice the use of the {RSQL::EvalContext#hexify} and {RSQL::EvalContext#squeeze!}
77
77
  helper methods.
78
78
 
79
79
  register :fill_table, :desc => 'Populate the example table.' do
@@ -112,7 +112,7 @@ passed in.
112
112
 
113
113
  Sometimes we make mistakes (never!). Normally, the command history kept in
114
114
  RSQL only stores the last thing entered at the prompt--not any query that the
115
- previous command may have generated and invoked. When writing a recipe that
115
+ previous command may have generated and invoked. When writing a recipe that
116
116
  generates a query that has an error reported by MySQL, it is really handy to
117
117
  see the generated SQL.
118
118
 
@@ -122,7 +122,7 @@ arrow" key to see the previous command.
122
122
  <tt>rsql> .bad_query;</tt>
123
123
 
124
124
  So the command in our history is the recipe and not the query. To see the
125
- query the RSQL::EvalContext#history has a helper method ready for us:
125
+ query the {RSQL::EvalContext#history} has a helper method ready for us:
126
126
 
127
127
  <tt>rsql> .history;</tt>
128
128
 
@@ -137,8 +137,8 @@ humanize? Try this command:
137
137
 
138
138
  <tt>rsql> select name, value from rsql_example ! value => humanize_bytes;</tt>
139
139
 
140
- The RSQL::EvalContext#humanize_bytes is another helper method. There are
141
- several others available. Check out the RSQL::EvalContext class for details.
140
+ The {RSQL::EvalContext#humanize_bytes} is another helper method. There are
141
+ several others available. Check out the {RSQL::EvalContext} class for details.
142
142
 
143
143
  Additional mappings can be added, separated by commas.
144
144
 
@@ -184,10 +184,10 @@ this:
184
184
 
185
185
  <tt>rsql> select name, value from rsql_example | p @results;</tt>
186
186
 
187
- The RSQL::EvalContext class manages the results from a previous query in the
187
+ The {RSQL::EvalContext} class manages the results from a previous query in the
188
188
  <b><tt>@results</tt></b> member variable accessible by any Ruby recipe
189
- code. This is an instance of the RSQL::MySQLResults class. Below we make use
190
- of the RSQL::MySQLResults#each_hash method to walk over all rows. There are
189
+ code. This is an instance of the {RSQL::MySQLResults} class. Below we make use
190
+ of the {RSQL::MySQLResults#each_hash} method to walk over all rows. There are
191
191
  other helpful routines available.
192
192
 
193
193
  Here's an example that writes a simple report of the data we are working
@@ -215,8 +215,9 @@ want to process results and keep our data around in a file.
215
215
 
216
216
  After running this, a <b><tt>myobj.yml</tt></b> file should be created in the
217
217
  local directory containing all the content from the query. To accomplish this,
218
- the RSQL::EvalContext#safe_save method is invoked which serializes our object
219
- so that we may later decided to run some post processing on the content.
218
+ the {RSQL::EvalContext#safe_save} method is invoked which serializes our
219
+ object so that we may later decided to run some post processing on the
220
+ content.
220
221
 
221
222
  Inspect the YAML[http://www.yaml.org/] content written out:
222
223
 
@@ -246,7 +247,7 @@ Here we simply expand the arguments.
246
247
  Sometimes it just isn't enough to be able to rely on generating SQL queries
247
248
  and piping into handlers. Sometimes we just need to roll up our sleeves and
248
249
  run queries directly so we can start processing results and dealing with
249
- presentation all on our own. That's where the RSQL::EvalContext#query helper
250
+ presentation all on our own. That's where the {RSQL::EvalContext#query} helper
250
251
  comes in handy.
251
252
 
252
253
  The intention here is to just create a series of sentences out of two separate
@@ -262,7 +263,7 @@ queries.
262
263
  end
263
264
  end
264
265
 
265
- The RSQL::MySQLResults class built in to RSQL handles binary content
266
+ The {RSQL::MySQLResults} class built in to RSQL handles binary content
266
267
  gracefully, automatically converting it to something a little nicer to our
267
268
  consoles than just dumping it. It converts it into a hexadecimal string.
268
269
 
@@ -280,7 +281,7 @@ RSQL makes querying for hex strings from within a recipe easy too.
280
281
  }, :desc => 'Find some hex stuff.'
281
282
 
282
283
  There are many other things to try out left as an "exercise for the
283
- reader". Browsing the RSQL::EvalContext and RSQL::MySQLResults classes would
284
- be an excellent start.
284
+ reader". Browsing the {RSQL::EvalContext} and {RSQL::MySQLResults} classes
285
+ would be an excellent start.
285
286
 
286
287
 
@@ -24,6 +24,7 @@
24
24
  #
25
25
  require 'mysqlplus'
26
26
 
27
+ # @private
27
28
  class Mysql # :nodoc:
28
29
  alias :query :async_query
29
30
  end
data/lib/rsql.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # A module encapsulating classes to manage MySQLResults and process
2
2
  # Commands using an EvalContext for handling recipes.
3
3
  #
4
- # See the rdoc-ref:example.rsqlrc.rdoc file for a simple tutorial and usage
4
+ # See the {file:example.rsqlrc.rdoc} file for a simple tutorial and usage
5
5
  # information.
6
6
  #
7
7
  module RSQL
8
- VERSION = '0.2.9'
8
+ VERSION = '0.2.10'
9
9
 
10
10
  require 'rsql/mysql_results'
11
11
  require 'rsql/eval_context'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsql
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 9
10
- version: 0.2.9
9
+ - 10
10
+ version: 0.2.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brad Robel-Forrest
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-15 00:00:00 Z
18
+ date: 2012-02-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: net-ssh
@@ -118,10 +118,12 @@ extra_rdoc_files:
118
118
  - LICENSE
119
119
  - example.rsqlrc.rdoc
120
120
  files:
121
+ - .yardopts
121
122
  - LICENSE
122
123
  - README.rdoc
123
124
  - bin/rsql
124
125
  - example.rsqlrc
126
+ - example.rsqlrc.rdoc
125
127
  - extra/mysql-client-5.1.59-1.tgz
126
128
  - lib/rsql.rb
127
129
  - lib/rsql/commands.rb
@@ -130,7 +132,6 @@ files:
130
132
  - test/test_commands.rb
131
133
  - test/test_eval_context.rb
132
134
  - test/test_mysql_results.rb
133
- - example.rsqlrc.rdoc
134
135
  homepage: https://rubygems.org/gems/rsql
135
136
  licenses: []
136
137