lynx 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of lynx might be problematic. Click here for more details.

@@ -31,7 +31,7 @@ module Lynx
31
31
 
32
32
  instruct(:mysql){ |c| c.config.mysql }
33
33
  instruct(:dump){ |c| c.config.dump }
34
- instruct(:with_database){ |c| c.config.database }
34
+ instruct(:with_database){ |c| "--database=#{c.config.database}" }
35
35
  instruct(:sql){ |c, sql| "--execute='#{sql}'" }
36
36
  instruct(:batch){ '--batch' }
37
37
  instruct(:no_names){ '--skip-column-names' }
@@ -6,25 +6,29 @@ module Lynx
6
6
  def initialize(*args)
7
7
  super(*args)
8
8
 
9
+ @database = '--all-databases'
10
+ @tables = []
11
+
9
12
  dump
10
13
  end
11
14
 
12
15
  instruct(:where){ |c,condition| "--where='#{condition}'" }
13
- instruct(:with_database){ |c| c.database(c.config.database) }
14
16
 
15
- def database(*args)
16
- @command << '--databases' unless args.empty?
17
- @command += args
17
+ def with_database
18
+ @database = @config.database
18
19
 
19
20
  self
20
21
  end
21
22
 
22
23
  def table(*args)
23
- @command << '--tables' unless args.empty?
24
- @command += args
24
+ @tables += args
25
25
 
26
26
  self
27
27
  end
28
+
29
+ def to_s
30
+ "#{super} #{@database} #{@tables.join(' ')}"
31
+ end
28
32
  end
29
33
  end
30
34
  end
data/lib/lynx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lynx
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -19,7 +19,7 @@ describe Lynx::Command::Basic do
19
19
  end
20
20
 
21
21
  def test_with_database
22
- assert_equal 'mysql foo', @command.mysql.with_database.to_s
22
+ assert_equal 'mysql --database=foo', @command.mysql.with_database.to_s
23
23
  end
24
24
 
25
25
  def test_batch
@@ -8,13 +8,10 @@ describe Lynx::Command::Dump do
8
8
  end
9
9
 
10
10
  def test_command
11
+ @command.with_database
11
12
  @command.table('bar')
12
13
  @command.where('1=1')
13
14
 
14
- assert_equal "dump --tables bar --where='1=1'", @command.to_s
15
- end
16
-
17
- def test_with_database
18
- assert_equal "dump --databases foo", @command.with_database.to_s
15
+ assert_equal "dump --where='1=1' foo bar", @command.to_s
19
16
  end
20
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lynx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-17 00:00:00.000000000 Z
12
+ date: 2013-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest