flydata 0.0.5.4 → 0.0.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,21 +1,18 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rest-client"
4
- gem "i18n"
5
- gem "activesupport"
6
- gem "json"
7
- gem "highline"
3
+ gem "rest-client", "~> 1.6.7"
4
+ gem "i18n", "~> 0.6.5"
5
+ gem "activesupport", "~> 4.0.0"
6
+ gem "json", "~> 1.8.0"
7
+ gem "highline", "~> 1.6.19"
8
8
  gem "fluentd", "0.10.35"
9
9
 
10
10
  group :development do
11
11
  gem "bundler"
12
12
  gem "jeweler"
13
13
  gem "rspec"
14
- gem "autotest"
15
- gem "autotest-standalone"
16
- gem "autotest-notification"
17
- gem "ZenTest"
18
- gem "activemodel"
19
- gem "activerecord"
14
+ #gem "autotest"
15
+ #gem "autotest-standalone"
16
+ #gem "autotest-notification"
20
17
  gem "sqlite3"
21
18
  end
data/Gemfile.lock CHANGED
@@ -1,82 +1,97 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- ZenTest (4.8.2)
5
- activemodel (3.2.8)
6
- activesupport (= 3.2.8)
7
- builder (~> 3.0.0)
8
- activerecord (3.2.8)
9
- activemodel (= 3.2.8)
10
- activesupport (= 3.2.8)
11
- arel (~> 3.0.2)
12
- tzinfo (~> 0.3.29)
13
- activesupport (3.2.8)
14
- i18n (~> 0.6)
15
- multi_json (~> 1.0)
16
- arel (3.0.2)
17
- autotest (4.4.6)
18
- ZenTest (>= 4.4.1)
19
- autotest-notification (2.3.4)
20
- autotest-standalone (~> 4.5)
21
- autotest-standalone (4.5.9)
22
- builder (3.0.4)
4
+ activesupport (4.0.0)
5
+ i18n (~> 0.6, >= 0.6.4)
6
+ minitest (~> 4.2)
7
+ multi_json (~> 1.3)
8
+ thread_safe (~> 0.1)
9
+ tzinfo (~> 0.3.37)
10
+ addressable (2.3.5)
11
+ atomic (1.1.14)
12
+ builder (3.2.2)
23
13
  cool.io (1.1.1)
24
14
  iobuffer (>= 1.0.0)
25
- diff-lcs (1.1.3)
15
+ diff-lcs (1.2.4)
16
+ faraday (0.8.8)
17
+ multipart-post (~> 1.2.0)
26
18
  fluentd (0.10.35)
27
19
  cool.io (~> 1.1.0)
28
20
  http_parser.rb (~> 0.5.1)
29
21
  json (>= 1.4.3)
30
22
  msgpack (>= 0.4.4, < 0.6.0, != 0.5.3, != 0.5.2, != 0.5.1, != 0.5.0)
31
23
  yajl-ruby (~> 1.0)
32
- git (1.2.5)
33
- highline (1.6.15)
24
+ git (1.2.6)
25
+ github_api (0.10.1)
26
+ addressable
27
+ faraday (~> 0.8.1)
28
+ hashie (>= 1.2)
29
+ multi_json (~> 1.4)
30
+ nokogiri (~> 1.5.2)
31
+ oauth2
32
+ hashie (2.0.5)
33
+ highline (1.6.19)
34
34
  http_parser.rb (0.5.3)
35
- i18n (0.6.1)
35
+ httpauth (0.2.0)
36
+ i18n (0.6.5)
36
37
  iobuffer (1.1.2)
37
- jeweler (1.8.4)
38
+ jeweler (1.8.8)
39
+ builder
38
40
  bundler (~> 1.0)
39
41
  git (>= 1.2.5)
42
+ github_api (= 0.10.1)
43
+ highline (>= 1.6.15)
44
+ nokogiri (= 1.5.10)
40
45
  rake
41
46
  rdoc
42
- json (1.7.5)
43
- mime-types (1.19)
44
- msgpack (0.5.5)
45
- multi_json (1.3.6)
46
- rake (0.9.2.2)
47
- rdoc (3.12)
47
+ json (1.8.0)
48
+ jwt (0.1.8)
49
+ multi_json (>= 1.5)
50
+ mime-types (1.25)
51
+ minitest (4.7.5)
52
+ msgpack (0.5.6)
53
+ multi_json (1.8.2)
54
+ multi_xml (0.5.5)
55
+ multipart-post (1.2.0)
56
+ nokogiri (1.5.10)
57
+ oauth2 (0.9.2)
58
+ faraday (~> 0.8)
59
+ httpauth (~> 0.2)
60
+ jwt (~> 0.1.4)
61
+ multi_json (~> 1.0)
62
+ multi_xml (~> 0.5)
63
+ rack (~> 1.2)
64
+ rack (1.5.2)
65
+ rake (10.1.0)
66
+ rdoc (4.0.1)
48
67
  json (~> 1.4)
49
68
  rest-client (1.6.7)
50
69
  mime-types (>= 1.16)
51
- rspec (2.11.0)
52
- rspec-core (~> 2.11.0)
53
- rspec-expectations (~> 2.11.0)
54
- rspec-mocks (~> 2.11.0)
55
- rspec-core (2.11.1)
56
- rspec-expectations (2.11.3)
57
- diff-lcs (~> 1.1.3)
58
- rspec-mocks (2.11.3)
59
- sqlite3 (1.3.7)
60
- tzinfo (0.3.37)
70
+ rspec (2.14.1)
71
+ rspec-core (~> 2.14.0)
72
+ rspec-expectations (~> 2.14.0)
73
+ rspec-mocks (~> 2.14.0)
74
+ rspec-core (2.14.5)
75
+ rspec-expectations (2.14.3)
76
+ diff-lcs (>= 1.1.3, < 2.0)
77
+ rspec-mocks (2.14.3)
78
+ sqlite3 (1.3.8)
79
+ thread_safe (0.1.3)
80
+ atomic
81
+ tzinfo (0.3.38)
61
82
  yajl-ruby (1.1.0)
62
83
 
63
84
  PLATFORMS
64
85
  ruby
65
86
 
66
87
  DEPENDENCIES
67
- ZenTest
68
- activemodel
69
- activerecord
70
- activesupport
71
- autotest
72
- autotest-notification
73
- autotest-standalone
88
+ activesupport (~> 4.0.0)
74
89
  bundler
75
90
  fluentd (= 0.10.35)
76
- highline
77
- i18n
91
+ highline (~> 1.6.19)
92
+ i18n (~> 0.6.5)
78
93
  jeweler
79
- json
80
- rest-client
94
+ json (~> 1.8.0)
95
+ rest-client (~> 1.6.7)
81
96
  rspec
82
97
  sqlite3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5.4
1
+ 0.0.5.5
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.5.4"
8
+ s.version = "0.0.5.5"
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-10-11"
12
+ s.date = "2013-10-18"
13
13
  s.description = "FlyData Command Line Interface"
14
14
  s.email = "sysadmin@flydata.co"
15
15
  s.executables = ["flydata"]
@@ -66,56 +66,38 @@ Gem::Specification.new do |s|
66
66
  s.specification_version = 3
67
67
 
68
68
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
- s.add_runtime_dependency(%q<rest-client>, [">= 0"])
70
- s.add_runtime_dependency(%q<i18n>, [">= 0"])
71
- s.add_runtime_dependency(%q<activesupport>, [">= 0"])
72
- s.add_runtime_dependency(%q<json>, [">= 0"])
73
- s.add_runtime_dependency(%q<highline>, [">= 0"])
69
+ s.add_runtime_dependency(%q<rest-client>, ["~> 1.6.7"])
70
+ s.add_runtime_dependency(%q<i18n>, ["~> 0.6.5"])
71
+ s.add_runtime_dependency(%q<activesupport>, ["~> 4.0.0"])
72
+ s.add_runtime_dependency(%q<json>, ["~> 1.8.0"])
73
+ s.add_runtime_dependency(%q<highline>, ["~> 1.6.19"])
74
74
  s.add_runtime_dependency(%q<fluentd>, ["= 0.10.35"])
75
75
  s.add_development_dependency(%q<bundler>, [">= 0"])
76
76
  s.add_development_dependency(%q<jeweler>, [">= 0"])
77
77
  s.add_development_dependency(%q<rspec>, [">= 0"])
78
- s.add_development_dependency(%q<autotest>, [">= 0"])
79
- s.add_development_dependency(%q<autotest-standalone>, [">= 0"])
80
- s.add_development_dependency(%q<autotest-notification>, [">= 0"])
81
- s.add_development_dependency(%q<ZenTest>, [">= 0"])
82
- s.add_development_dependency(%q<activemodel>, [">= 0"])
83
- s.add_development_dependency(%q<activerecord>, [">= 0"])
84
78
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
85
79
  else
86
- s.add_dependency(%q<rest-client>, [">= 0"])
87
- s.add_dependency(%q<i18n>, [">= 0"])
88
- s.add_dependency(%q<activesupport>, [">= 0"])
89
- s.add_dependency(%q<json>, [">= 0"])
90
- s.add_dependency(%q<highline>, [">= 0"])
80
+ s.add_dependency(%q<rest-client>, ["~> 1.6.7"])
81
+ s.add_dependency(%q<i18n>, ["~> 0.6.5"])
82
+ s.add_dependency(%q<activesupport>, ["~> 4.0.0"])
83
+ s.add_dependency(%q<json>, ["~> 1.8.0"])
84
+ s.add_dependency(%q<highline>, ["~> 1.6.19"])
91
85
  s.add_dependency(%q<fluentd>, ["= 0.10.35"])
92
86
  s.add_dependency(%q<bundler>, [">= 0"])
93
87
  s.add_dependency(%q<jeweler>, [">= 0"])
94
88
  s.add_dependency(%q<rspec>, [">= 0"])
95
- s.add_dependency(%q<autotest>, [">= 0"])
96
- s.add_dependency(%q<autotest-standalone>, [">= 0"])
97
- s.add_dependency(%q<autotest-notification>, [">= 0"])
98
- s.add_dependency(%q<ZenTest>, [">= 0"])
99
- s.add_dependency(%q<activemodel>, [">= 0"])
100
- s.add_dependency(%q<activerecord>, [">= 0"])
101
89
  s.add_dependency(%q<sqlite3>, [">= 0"])
102
90
  end
103
91
  else
104
- s.add_dependency(%q<rest-client>, [">= 0"])
105
- s.add_dependency(%q<i18n>, [">= 0"])
106
- s.add_dependency(%q<activesupport>, [">= 0"])
107
- s.add_dependency(%q<json>, [">= 0"])
108
- s.add_dependency(%q<highline>, [">= 0"])
92
+ s.add_dependency(%q<rest-client>, ["~> 1.6.7"])
93
+ s.add_dependency(%q<i18n>, ["~> 0.6.5"])
94
+ s.add_dependency(%q<activesupport>, ["~> 4.0.0"])
95
+ s.add_dependency(%q<json>, ["~> 1.8.0"])
96
+ s.add_dependency(%q<highline>, ["~> 1.6.19"])
109
97
  s.add_dependency(%q<fluentd>, ["= 0.10.35"])
110
98
  s.add_dependency(%q<bundler>, [">= 0"])
111
99
  s.add_dependency(%q<jeweler>, [">= 0"])
112
100
  s.add_dependency(%q<rspec>, [">= 0"])
113
- s.add_dependency(%q<autotest>, [">= 0"])
114
- s.add_dependency(%q<autotest-standalone>, [">= 0"])
115
- s.add_dependency(%q<autotest-notification>, [">= 0"])
116
- s.add_dependency(%q<ZenTest>, [">= 0"])
117
- s.add_dependency(%q<activemodel>, [">= 0"])
118
- s.add_dependency(%q<activerecord>, [">= 0"])
119
101
  s.add_dependency(%q<sqlite3>, [">= 0"])
120
102
  end
121
103
  end
@@ -11,9 +11,10 @@ module Flydata
11
11
  ENTER_TABLE_NAME = '-- Create a table on Redshift from your logs --'
12
12
 
13
13
  # readline settings for asking log path
14
- Readline.completion_append_character = "/"
15
- Readline.completion_proc = Proc.new do |str|
16
- Dir[str+'*'].grep( /^#{Regexp.escape(str)}/ )
14
+ Readline.completion_append_character = nil
15
+ Readline.completion_proc = lambda do |prefix|
16
+ files = Dir["#{prefix}*"]
17
+ files.map { |f| File.expand_path(f) }.map { |f| File.directory?(f) ? f + "/" : f }
17
18
  end
18
19
 
19
20
  def initial_run
@@ -68,7 +69,10 @@ module Flydata
68
69
 
69
70
  def show_registered_redshift_entries
70
71
  show_registered_entries('RedshiftFileDataEntry') do |de|
71
- say(" - #{de['display_name']}: #{de['log_path']} -> #{de['redshift_table_name']} (#{de['redshift_table_name']}_dev)")
72
+ sn = de['redshift_schema_name']
73
+ tn = de['redshift_table_name']
74
+ table_name = sn.to_s.empty? ? tn : "#{sn}.#{tn}"
75
+ say(" - #{de['display_name']}: #{de['log_path']} -> #{table_name} (#{table_name}_dev)")
72
76
  end
73
77
  end
74
78
 
@@ -153,13 +157,18 @@ module Flydata
153
157
  end
154
158
  end
155
159
 
156
- def create_redshift_log_entry(log_path, log_file_type, redshift_table_name)
160
+ def create_redshift_log_entry(log_path, log_file_type, table_name)
161
+ if table_name.include?(".")
162
+ schema_name, table_name = table_name.split(".")
163
+ end
157
164
  data_port = flydata.data_port.get
158
165
  flydata.data_entry.create(
159
166
  data_port_id: data_port['id'],
160
167
  log_path: log_path,
161
168
  log_file_type: log_file_type,
162
- redshift_table_name: redshift_table_name)
169
+ redshift_table_name: table_name,
170
+ redshift_schema_name: schema_name,
171
+ )
163
172
  say("Process added successfuly!")
164
173
  return true
165
174
  end
@@ -315,9 +324,10 @@ module Flydata
315
324
  input = nil
316
325
  loop do
317
326
  say("Enter a table name for Redshift to store your logs. This table will be created automatically.")
327
+ say("Input format: [table-name] or [schema-name].[table-name]")
318
328
  say(">> ")
319
329
  input = gets.strip
320
- if input =~ /^[a-zA-Z0-9_]+$/
330
+ if input =~ /^([a-zA-Z0-9_][a-zA-Z0-9_$]*\.)?[a-zA-Z0-9_][a-zA-Z0-9_$]*$/
321
331
  break
322
332
  else
323
333
  puts "!Please enter the valid table name."
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.5.4
4
+ version: 0.0.5.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,88 +9,88 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-11 00:00:00.000000000 Z
12
+ date: 2013-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.6.7
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 1.6.7
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: i18n
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 0.6.5
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 0.6.5
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: activesupport
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ! '>='
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: 4.0.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ! '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 4.0.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: json
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ! '>='
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: 1.8.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ! '>='
75
+ - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: 1.8.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: highline
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ! '>='
83
+ - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 1.6.19
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ! '>='
91
+ - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: 1.6.19
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: fluentd
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -155,102 +155,6 @@ dependencies:
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
- - !ruby/object:Gem::Dependency
159
- name: autotest
160
- requirement: !ruby/object:Gem::Requirement
161
- none: false
162
- requirements:
163
- - - ! '>='
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- - !ruby/object:Gem::Dependency
175
- name: autotest-standalone
176
- requirement: !ruby/object:Gem::Requirement
177
- none: false
178
- requirements:
179
- - - ! '>='
180
- - !ruby/object:Gem::Version
181
- version: '0'
182
- type: :development
183
- prerelease: false
184
- version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
- requirements:
187
- - - ! '>='
188
- - !ruby/object:Gem::Version
189
- version: '0'
190
- - !ruby/object:Gem::Dependency
191
- name: autotest-notification
192
- requirement: !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ! '>='
196
- - !ruby/object:Gem::Version
197
- version: '0'
198
- type: :development
199
- prerelease: false
200
- version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
- requirements:
203
- - - ! '>='
204
- - !ruby/object:Gem::Version
205
- version: '0'
206
- - !ruby/object:Gem::Dependency
207
- name: ZenTest
208
- requirement: !ruby/object:Gem::Requirement
209
- none: false
210
- requirements:
211
- - - ! '>='
212
- - !ruby/object:Gem::Version
213
- version: '0'
214
- type: :development
215
- prerelease: false
216
- version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
- requirements:
219
- - - ! '>='
220
- - !ruby/object:Gem::Version
221
- version: '0'
222
- - !ruby/object:Gem::Dependency
223
- name: activemodel
224
- requirement: !ruby/object:Gem::Requirement
225
- none: false
226
- requirements:
227
- - - ! '>='
228
- - !ruby/object:Gem::Version
229
- version: '0'
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
- requirements:
235
- - - ! '>='
236
- - !ruby/object:Gem::Version
237
- version: '0'
238
- - !ruby/object:Gem::Dependency
239
- name: activerecord
240
- requirement: !ruby/object:Gem::Requirement
241
- none: false
242
- requirements:
243
- - - ! '>='
244
- - !ruby/object:Gem::Version
245
- version: '0'
246
- type: :development
247
- prerelease: false
248
- version_requirements: !ruby/object:Gem::Requirement
249
- none: false
250
- requirements:
251
- - - ! '>='
252
- - !ruby/object:Gem::Version
253
- version: '0'
254
158
  - !ruby/object:Gem::Dependency
255
159
  name: sqlite3
256
160
  requirement: !ruby/object:Gem::Requirement
@@ -330,7 +234,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
330
234
  version: '0'
331
235
  segments:
332
236
  - 0
333
- hash: 1029237572235561937
237
+ hash: 3003976243049248433
334
238
  required_rubygems_version: !ruby/object:Gem::Requirement
335
239
  none: false
336
240
  requirements: