flydata 0.0.3.4 → 0.0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/flydata.gemspec +3 -3
- data/lib/flydata/api_client.rb +18 -1
- data/lib/flydata/command/setup.rb +18 -16
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.3.
|
1
|
+
0.0.3.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.3.
|
8
|
+
s.version = "0.0.3.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 = "
|
12
|
+
s.date = "2013-01-10"
|
13
13
|
s.description = "FlyData Command Line Interface"
|
14
14
|
s.email = "sysadmin@flydata.co"
|
15
15
|
s.executables = ["flydata"]
|
@@ -52,7 +52,7 @@ Gem::Specification.new do |s|
|
|
52
52
|
s.homepage = "http://flydata.co/"
|
53
53
|
s.licenses = ["All right reserved."]
|
54
54
|
s.require_paths = ["lib"]
|
55
|
-
s.rubygems_version = "1.8.
|
55
|
+
s.rubygems_version = "1.8.23"
|
56
56
|
s.summary = "FlyData CLI"
|
57
57
|
|
58
58
|
if s.respond_to? :specification_version then
|
data/lib/flydata/api_client.rb
CHANGED
@@ -6,11 +6,13 @@ module Flydata
|
|
6
6
|
|
7
7
|
class ApiClient
|
8
8
|
include Singleton
|
9
|
+
include Helpers
|
9
10
|
attr_reader :response
|
10
11
|
attr_accessor :credentials
|
11
12
|
|
12
13
|
def initialize
|
13
14
|
@credentials = Flydata::Credentials.new
|
15
|
+
read_flydata_api_host
|
14
16
|
end
|
15
17
|
|
16
18
|
# row level api
|
@@ -42,6 +44,21 @@ module Flydata
|
|
42
44
|
def respond_to_missing?(method_name, include_private=false); true end
|
43
45
|
|
44
46
|
private
|
47
|
+
def read_flydata_api_host
|
48
|
+
if FileTest.exist?(flydata_api_host_file)
|
49
|
+
File.open(flydata_api_host_file, 'r') do |f|
|
50
|
+
@flydata_api_host = f.gets.chomp
|
51
|
+
@flydata_api_host = FLYDATA_API_HOST unless @flydata_api_host and not @flydata_api_host.empty?
|
52
|
+
end
|
53
|
+
else
|
54
|
+
@flydata_api_host = FLYDATA_API_HOST
|
55
|
+
end
|
56
|
+
# delete the '/'
|
57
|
+
@flydata_api_host = @flydata_api_host[0..-2] if @flydata_api_host =~ /\/$/
|
58
|
+
end
|
59
|
+
def flydata_api_host_file
|
60
|
+
File.join(home_directory, '.flydata', 'flydata_api_host')
|
61
|
+
end
|
45
62
|
def handle_response(response)
|
46
63
|
json_response = JSON.parse(response)
|
47
64
|
if json_response.class == Hash and json_response["success"] == false
|
@@ -60,7 +77,7 @@ module Flydata
|
|
60
77
|
def generate_auth_url(path)
|
61
78
|
token = @credentials.token
|
62
79
|
token = '' unless token
|
63
|
-
"#{
|
80
|
+
"#{@flydata_api_host}#{path}?auth_token=#{token}"
|
64
81
|
end
|
65
82
|
end
|
66
83
|
end
|
@@ -30,22 +30,22 @@ module Flydata
|
|
30
30
|
# choose entries
|
31
31
|
unless (shown = show_registered_entries)
|
32
32
|
list = build_recommended_entries
|
33
|
-
|
34
|
-
|
35
|
-
puts(" No common log paths found. This may be because you are not root user.")
|
36
|
-
puts(" If you have access to the root user, try the command below")
|
37
|
-
puts(" $ sudo ~/.flydata/bin/flydata setup")
|
38
|
-
puts(" Otherwise, please input log path below")
|
39
|
-
else
|
40
|
-
print_recommended(list)
|
41
|
-
register_all(list) if ask_yes_no("Register all of these common entries?")
|
42
|
-
end
|
33
|
+
print_recommended(list)
|
34
|
+
register_all(list) if ask_yes_no("Register all of these common entries?")
|
43
35
|
end
|
44
36
|
unless (shown ||= show_registered_entries) and not more_entry?
|
45
37
|
begin
|
46
38
|
show_registered_entries unless shown
|
47
39
|
shown = false
|
48
|
-
|
40
|
+
<<<<<<< HEAD
|
41
|
+
path = choose_log_path_from_examples
|
42
|
+
case path
|
43
|
+
when OTHER; ask_log_path
|
44
|
+
else; create_log_entry(path)
|
45
|
+
end
|
46
|
+
=======
|
47
|
+
choose_log_selection(list)
|
48
|
+
>>>>>>> feature/auto_scan_logs
|
49
49
|
newline
|
50
50
|
end while more_entry?
|
51
51
|
end
|
@@ -103,6 +103,8 @@ module Flydata
|
|
103
103
|
newline
|
104
104
|
end
|
105
105
|
create_log_entry(path)
|
106
|
+
<<<<<<< HEAD
|
107
|
+
=======
|
106
108
|
end
|
107
109
|
def build_recommended_entries
|
108
110
|
path_options=[]
|
@@ -130,9 +132,10 @@ module Flydata
|
|
130
132
|
}
|
131
133
|
list.reject!{|x| x}
|
132
134
|
end
|
133
|
-
def choose_log_selection
|
135
|
+
def choose_log_selection(list)
|
134
136
|
path = nil
|
135
|
-
|
137
|
+
list = build_recommended_entries unless list
|
138
|
+
path_options = list
|
136
139
|
|
137
140
|
loop do
|
138
141
|
if path_options.empty?
|
@@ -142,9 +145,7 @@ module Flydata
|
|
142
145
|
print_recommended(path_options, true)
|
143
146
|
choice = Readline.readline("Here are some common logs, enter the number next to the logs to add the log. Input nothing to cancel.")
|
144
147
|
return if choice.empty?
|
145
|
-
if
|
146
|
-
puts("Not a valid entry, please try again");
|
147
|
-
elsif choice.to_i==path_options.length+1
|
148
|
+
if choice.to_i==path_options.length+1
|
148
149
|
ask_log_path
|
149
150
|
return
|
150
151
|
elsif (path_options[choice.to_i-1] != nil )
|
@@ -156,6 +157,7 @@ module Flydata
|
|
156
157
|
end
|
157
158
|
end
|
158
159
|
create_log_entry(path)
|
160
|
+
>>>>>>> feature/auto_scan_logs
|
159
161
|
end
|
160
162
|
def ask_log_deletion(path)
|
161
163
|
unless File.writable?(path)
|
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.3.
|
4
|
+
version: 0.0.3.5
|
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:
|
12
|
+
date: 2013-01-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: -
|
278
|
+
hash: -3676718197553447961
|
279
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
280
|
none: false
|
281
281
|
requirements:
|
@@ -284,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
284
|
version: '0'
|
285
285
|
requirements: []
|
286
286
|
rubyforge_project:
|
287
|
-
rubygems_version: 1.8.
|
287
|
+
rubygems_version: 1.8.23
|
288
288
|
signing_key:
|
289
289
|
specification_version: 3
|
290
290
|
summary: FlyData CLI
|