sdbcli 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -1
- data/bin/sdbcli +10 -10
- data/lib/sdbcli/sdb-runner.rb +14 -0
- metadata +6 -8
data/README
CHANGED
@@ -48,7 +48,13 @@ https://bitbucket.org/winebarrel/sdbcli
|
|
48
48
|
- [itemname1, {attr1: val1, attr2: val2}]
|
49
49
|
- [itemname2, {attr1: val1, attr2: val2}]
|
50
50
|
|
51
|
-
|
51
|
+
ap-northeast-1> select * from `test-2`
|
52
|
+
---
|
53
|
+
- [itemname1, {attr1: val1, attr2: val2}]
|
54
|
+
- [itemname2, {attr1: val1, attr2: val2}]
|
55
|
+
|
56
|
+
Attribute and domain names may appear without quotes if they contain only letters, numbers, underscores (_),
|
57
|
+
or dollar symbols ($) and do not start with a number.
|
52
58
|
You must quote all other attribute and domain names with the backtick (`).
|
53
59
|
see http://docs.amazonwebservices.com/AmazonSimpleDB/latest/DeveloperGuide/QuotingRulesSelect.html
|
54
60
|
|
data/bin/sdbcli
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
$LOAD_PATH << File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib')
|
3
3
|
|
4
|
-
Version = '0.
|
4
|
+
Version = '0.2.0'
|
5
5
|
HISTORY_FILE = File.join((ENV['HOME'] || ENV['USERPROFILE'] || '.'), '.sdbcli_history')
|
6
6
|
|
7
7
|
require 'rubygems'
|
@@ -48,14 +48,14 @@ def execute(query)
|
|
48
48
|
end
|
49
49
|
|
50
50
|
unless $stdin.tty?
|
51
|
-
|
52
|
-
exit 0
|
53
|
-
end
|
51
|
+
queries = $stdin.read
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
queries.split(';').each do |query|
|
54
|
+
next if /\A\s*\Z/ =~ query
|
55
|
+
execute(query)
|
56
|
+
end
|
57
|
+
|
58
|
+
exit 0
|
59
59
|
end
|
60
60
|
|
61
61
|
def help
|
@@ -100,14 +100,14 @@ at_exit do
|
|
100
100
|
unless Readline::HISTORY.empty?
|
101
101
|
open(HISTORY_FILE, 'a') do |f|
|
102
102
|
Readline::HISTORY.each do |line|
|
103
|
-
|
103
|
+
next if /\A\s*\Z/ =~ line
|
104
104
|
f.puts line
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
while buf = Readline.readline("#{region}> ", true)
|
110
|
+
while buf = Readline.readline("#{$runner.region || 'unknown'}> ", true)
|
111
111
|
if /\A\s*\Z/ =~ buf
|
112
112
|
Readline::HISTORY.pop
|
113
113
|
next
|
data/lib/sdbcli/sdb-runner.rb
CHANGED
@@ -4,6 +4,16 @@ require 'sdbcli/sdb-parser.tab'
|
|
4
4
|
module SimpleDB
|
5
5
|
class Error < StandardError; end
|
6
6
|
|
7
|
+
REGIONS = {
|
8
|
+
'sdb.amazonaws.com' => 'us-east-1',
|
9
|
+
'sdb.us-west-1.amazonaws.com' => 'us-west-1',
|
10
|
+
'sdb.us-west-2.amazonaws.com' => 'us-west-2',
|
11
|
+
'sdb.eu-west-1.amazonaws.com' => 'eu-west-1',
|
12
|
+
'sdb.ap-southeast-1.amazonaws.com' => 'ap-southeast-1',
|
13
|
+
'sdb.ap-northeast-1.amazonaws.com' => 'ap-northeast-1',
|
14
|
+
'sdb.sa-east-1.amazonaws.com' => 'sa-east-1',
|
15
|
+
}
|
16
|
+
|
7
17
|
class Runner
|
8
18
|
def initialize(accessKeyId, secretAccessKey, endpoint = 'sdb.amazonaws.com')
|
9
19
|
@driver = Driver.new(accessKeyId, secretAccessKey, endpoint)
|
@@ -17,6 +27,10 @@ module SimpleDB
|
|
17
27
|
@driver.endpoint = v
|
18
28
|
end
|
19
29
|
|
30
|
+
def region
|
31
|
+
REGIONS[endpoint]
|
32
|
+
end
|
33
|
+
|
20
34
|
def execute(query, inline = true)
|
21
35
|
parsed = Parser.parse(query)
|
22
36
|
command = parsed.class.name.split('::').last.to_sym
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdbcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- winebarrel
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-17 00:00:00
|
19
|
-
default_executable:
|
18
|
+
date: 2012-01-17 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: nokogiri
|
@@ -49,7 +48,6 @@ files:
|
|
49
48
|
- lib/sdbcli/sdb-parser.y
|
50
49
|
- lib/sdbcli/sdb-runner.rb
|
51
50
|
- lib/sdbcli.rb
|
52
|
-
has_rdoc: true
|
53
51
|
homepage: https://bitbucket.org/winebarrel/sdbcli
|
54
52
|
licenses: []
|
55
53
|
|
@@ -79,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
77
|
requirements: []
|
80
78
|
|
81
79
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
80
|
+
rubygems_version: 1.8.11
|
83
81
|
signing_key:
|
84
82
|
specification_version: 3
|
85
83
|
summary: sdbcli is an interactive command-line client of Amazon SimpleDB.
|