flydata 0.0.4.2 → 0.0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4.2
1
+ 0.0.4.3
data/flydata.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "flydata"
8
- s.version = "0.0.4.2"
8
+ s.version = "0.0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Koichi Fujikawa"]
12
- s.date = "2013-06-05"
12
+ s.date = "2013-06-10"
13
13
  s.description = "FlyData Command Line Interface"
14
14
  s.email = "sysadmin@flydata.co"
15
15
  s.executables = ["flydata"]
@@ -53,6 +53,20 @@ module Flydata
53
53
  end
54
54
  choice
55
55
  end
56
+ def ask_input_table_name
57
+ input = nil
58
+ loop do
59
+ say("Input a table name.")
60
+ say(">> ")
61
+ input = gets.strip
62
+ if input =~ /^[a-zA-Z0-9_]+$/
63
+ break
64
+ else
65
+ puts "Please enter a valid table name."
66
+ end
67
+ end
68
+ input
69
+ end
56
70
  end
57
71
  end
58
72
  end
@@ -8,6 +8,7 @@ module Flydata
8
8
  /var/log/messages /var/log/maillog /var/log/mysql/error.log
9
9
  /home/*/deploy/shared/log/*.log)
10
10
  OTHER = '-- None of above --'
11
+ ENTER_TABLE_NAME = '-- Create a table on Redshift from your logs --'
11
12
 
12
13
  # readline settings for asking log path
13
14
  Readline.completion_append_character = "/"
@@ -80,7 +81,7 @@ module Flydata
80
81
  newline
81
82
  # enter the log path
82
83
  puts "[Enter a Local Log Path]"
83
- puts "Enter the absolute path of your local log that you want to upload to the '#{table_name}' table on Redshift."
84
+ puts "Enter the absolute path of your local log that you want to upload to the '#{table_name} (#{table_name}_dev)' table on Redshift."
84
85
  log_path = ask_log_path("Log path (tab:completion, return:cancel) >> ")
85
86
  return unless log_path and not log_path.empty?
86
87
  newline
@@ -112,7 +113,7 @@ module Flydata
112
113
  dev_tables = ret['table_list'].select {|tn| tn.end_with?('_dev')}
113
114
 
114
115
  if all_tables.size < 1
115
- raise "Could not find tables on Redshift. Please create some tables on your Redshift cluster."
116
+ return ask_enter_table_name
116
117
  end
117
118
 
118
119
  if development?
@@ -140,9 +141,14 @@ module Flydata
140
141
  menu_str_list = format_menu_list(menu_list)
141
142
  message = " !PRODUCTION MODE!"
142
143
  end
144
+ menu_str_list << ENTER_TABLE_NAME
143
145
  menu_str = choose_one("Please select the table on Redshift that you want to use to store your local data. \n#{message}", nil, menu_str_list)
144
- if menu_str
146
+ if menu_str == ENTER_TABLE_NAME
147
+ ask_enter_table_name
148
+ elsif menu_str
145
149
  menu_str.split.first
150
+ else
151
+ nil
146
152
  end
147
153
  end
148
154
 
@@ -304,6 +310,24 @@ module Flydata
304
310
  ask_yes_no("Do you want to add another log path?")
305
311
  end
306
312
 
313
+ def ask_enter_table_name
314
+ input = nil
315
+ loop do
316
+ say("Enter a table name for Redshift to store your logs. This table will be created automatically.")
317
+ say(">> ")
318
+ input = gets.strip
319
+ if input =~ /^[a-zA-Z0-9_]+$/
320
+ break
321
+ else
322
+ puts "!Please enter the valid table name."
323
+ end
324
+ end
325
+ if development?
326
+ input = input.gsub(/_dev$/, '')
327
+ end
328
+ input
329
+ end
330
+
307
331
  def ask_log_path(message = nil)
308
332
  path = nil
309
333
  message = "Enter the absolute path of your log (return to cancel): " unless message
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flydata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.2
4
+ version: 0.0.4.3
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-06-05 00:00:00.000000000 Z
12
+ date: 2013-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -275,7 +275,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
275
275
  version: '0'
276
276
  segments:
277
277
  - 0
278
- hash: 258014642818965093
278
+ hash: 1466505871354072558
279
279
  required_rubygems_version: !ruby/object:Gem::Requirement
280
280
  none: false
281
281
  requirements: