td 0.10.54 → 0.10.55
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +8 -2
- data/lib/td/command/job.rb +1 -1
- data/lib/td/command/list.rb +1 -0
- data/lib/td/command/table.rb +13 -0
- data/lib/td/command/user.rb +30 -8
- data/lib/td/version.rb +1 -1
- data/td.gemspec +1 -1
- metadata +4 -4
data/ChangeLog
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
|
2
|
+
== 2012-10-09 version 0.10.55
|
3
|
+
|
4
|
+
* Added table:swap subcommand
|
5
|
+
* user:create supports -G option to create an organization at the same time
|
6
|
+
|
7
|
+
|
2
8
|
== 2012-10-04 version 0.10.54
|
3
9
|
|
4
|
-
*
|
5
|
-
console
|
10
|
+
* job:result checks invalid byte sequence in UTF-8 string before rendering
|
11
|
+
results on console
|
6
12
|
|
7
13
|
|
8
14
|
== 2012-10-02 version 0.10.53
|
data/lib/td/command/job.rb
CHANGED
@@ -270,7 +270,7 @@ module Command
|
|
270
270
|
# b) to display multi-byte characters as it is
|
271
271
|
# c) encoding from UTF-8 to UTF-8 doesn't check/replace invalid chars
|
272
272
|
# d) UTF-16LE was slightly faster than UTF-16BE, UTF-32LE or UTF-32BE
|
273
|
-
s = s.encode('UTF-16LE', 'UTF-8', :invalid=>:replace, :undef=>:replace).encode('UTF-8') if s.respond_to?(:encode)
|
273
|
+
s = s.encode('UTF-16LE', 'UTF-8', :invalid=>:replace, :undef=>:replace).encode!('UTF-8') if s.respond_to?(:encode)
|
274
274
|
s
|
275
275
|
}
|
276
276
|
}
|
data/lib/td/command/list.rb
CHANGED
@@ -225,6 +225,7 @@ module List
|
|
225
225
|
add_list 'table:delete', %w[db table], 'Delete a table', 'table:delete example_db table1'
|
226
226
|
add_list 'table:import', %w[db table files_], 'Parse and import files to a table', 'table:import example_db table1 --apache access.log', 'table:import example_db table1 --json -t time - < test.json'
|
227
227
|
add_list 'table:export', %w[db table], 'Dump logs in a table to the specified storage', 'table:export example_db table1 --s3-bucket mybucket -k KEY_ID -s SECRET_KEY'
|
228
|
+
add_list 'table:swap', %w[db table1 table2], 'Swap names of two tables', 'table:swap example_db table1 table2'
|
228
229
|
add_list 'table:tail', %w[db table], 'Get recently imported logs', 'table:tail example_db table1', 'table:tail example_db table1 -t "2011-01-02 03:04:05" -n 30'
|
229
230
|
add_list 'table:partial_delete', %w[db table], 'Delete logs from the table within the specified time range', 'table:partial_delete example_db table1 --from 1341000000 --to 1341003600'
|
230
231
|
|
data/lib/td/command/table.rb
CHANGED
@@ -109,6 +109,19 @@ module Command
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
+
def table_swap(op)
|
113
|
+
db_name, table_name1, table_name2 = op.cmd_parse
|
114
|
+
|
115
|
+
client = get_client
|
116
|
+
|
117
|
+
table1 = get_table(client, db_name, table_name1)
|
118
|
+
table2 = get_table(client, db_name, table_name2)
|
119
|
+
|
120
|
+
client.swap_table(db_name, table_name1, table_name2)
|
121
|
+
|
122
|
+
$stderr.puts "'#{db_name}.#{table_name1}' and '#{db_name}.#{table_name2}' are swapped."
|
123
|
+
end
|
124
|
+
|
112
125
|
def table_show(op)
|
113
126
|
db_name, table_name = op.cmd_parse
|
114
127
|
|
data/lib/td/command/user.rb
CHANGED
@@ -45,11 +45,16 @@ module Command
|
|
45
45
|
org = nil
|
46
46
|
email = nil
|
47
47
|
random_password = false
|
48
|
+
create_org = nil
|
48
49
|
|
49
50
|
op.on('-g', '--org ORGANIZATION', "create the user under this organization") {|s|
|
50
51
|
org = s
|
51
52
|
}
|
52
53
|
|
54
|
+
op.on('-G', "create the user under the a new organization", TrueClass) {|b|
|
55
|
+
create_org = b
|
56
|
+
}
|
57
|
+
|
53
58
|
op.on('-e', '--email EMAIL', "Use this email address to identify the user") {|s|
|
54
59
|
email = s
|
55
60
|
}
|
@@ -123,21 +128,38 @@ module Command
|
|
123
128
|
|
124
129
|
client = get_client(:ssl => true)
|
125
130
|
|
126
|
-
|
131
|
+
if create_org
|
132
|
+
org ||= name
|
133
|
+
client.create_organization(org)
|
134
|
+
end
|
127
135
|
|
128
136
|
ok = false
|
129
137
|
begin
|
130
|
-
client.
|
131
|
-
|
132
|
-
|
133
|
-
|
138
|
+
client.add_user(name, org)
|
139
|
+
|
140
|
+
begin
|
141
|
+
client.change_email(name, email)
|
142
|
+
client.change_password(name, password)
|
143
|
+
client.add_apikey(name)
|
144
|
+
ok = true
|
145
|
+
|
146
|
+
ensure
|
147
|
+
if !ok
|
148
|
+
client.remove_user(name)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
134
152
|
ensure
|
135
|
-
|
136
|
-
client.
|
153
|
+
if create_org && !ok
|
154
|
+
client.delete_organization(org)
|
137
155
|
end
|
138
156
|
end
|
139
157
|
|
140
|
-
|
158
|
+
if create_org
|
159
|
+
$stderr.puts "Organization '#{org}' and user '#{name}' are created."
|
160
|
+
else
|
161
|
+
$stderr.puts "User '#{name}' is created."
|
162
|
+
end
|
141
163
|
$stderr.puts "Use '#{$prog} user:apikeys #{name}' to show the API key."
|
142
164
|
end
|
143
165
|
|
data/lib/td/version.rb
CHANGED
data/td.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency "msgpack", "~> 0.4.4"
|
20
20
|
gem.add_dependency "json", ">= 1.4.3"
|
21
21
|
gem.add_dependency "hirb", ">= 0.4.5"
|
22
|
-
gem.add_dependency "td-client", "~> 0.8.
|
22
|
+
gem.add_dependency "td-client", "~> 0.8.32"
|
23
23
|
gem.add_dependency "td-logger", "~> 0.3.12"
|
24
24
|
gem.add_development_dependency "rake", "~> 0.9"
|
25
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: td
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.55
|
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: 2012-10-
|
12
|
+
date: 2012-10-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.8.
|
69
|
+
version: 0.8.32
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.8.
|
77
|
+
version: 0.8.32
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: td-logger
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|