navilocal 0.0.3 → 0.0.4
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.
- checksums.yaml +5 -5
- data/application/ui/navi/installer_assistant.rb +1 -1
- data/application/ui/navi/main_runner.rb +50 -43
- data/application/ui/navi/navi_install.rb +1 -1
- data/application/ui/navi/splash.rb +15 -11
- data/bin/navilocal +9 -9
- data/gresource.bin +0 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 01acea63a13f94dff965dfb6b9eaf14bece6efd7dc5c281886ba7253bb66b2b8
|
4
|
+
data.tar.gz: 7ba99210a1cac7193d24146e7973cf1b20e5d66627130f2b84dce5a62e706c76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9deeafa41a93a3ad8bf636cf45ca4fed863c029941adc3f84ca404e427cb48a4affc60e2e70dbbbbba1870de70e1ea26d247cc076f29a19633ad8a236e530c9c
|
7
|
+
data.tar.gz: 3b765eff5404307afd857010f3c623c2f30c50128f6cc2a90ad9fe42d2b7ff4eaa8a5aa66af4dc14ba2fbfb472a8986aa60cf319740fab977493ee28c28ff861
|
@@ -78,7 +78,7 @@ module NaviClientInstaller
|
|
78
78
|
|
79
79
|
resp = @splash.validate_email( @settings.username, @settings.hash)
|
80
80
|
|
81
|
-
if(@settings.hash && resp.code == 200)
|
81
|
+
if(resp && @settings.hash && resp.code == 200)
|
82
82
|
@current_window = @runner_window
|
83
83
|
@runner_window.set_token resp["access_token"]
|
84
84
|
@runner_window.start
|
@@ -17,7 +17,10 @@ module NaviClientInstaller
|
|
17
17
|
@log_display = builder.get_object("tv_runner_logs")
|
18
18
|
@scroll_control = builder.get_object("scrollview_runner_logs")
|
19
19
|
@notifier = builder.get_object("label_progress_notifier")
|
20
|
-
@email_indicator = builder.get_object("
|
20
|
+
@email_indicator = builder.get_object("label_email_indicator")
|
21
|
+
@spinner_indicator = builder.get_object("spinner_indicator")
|
22
|
+
@stop_btn = builder.get_object("process_stop_btn")
|
23
|
+
@refresh_btn = builder.get_object("process_refresh_btn")
|
21
24
|
|
22
25
|
image = builder.get_object("app_logo")
|
23
26
|
image.set_from_resource('/com/navi/navi-client/images/navi-logo-small.png')
|
@@ -35,39 +38,52 @@ module NaviClientInstaller
|
|
35
38
|
adj.set_value( adj.upper - adj.page_size )
|
36
39
|
end
|
37
40
|
|
41
|
+
@stop_btn.signal_connect 'clicked' do |button|
|
42
|
+
terminate_worker_thread
|
43
|
+
@logger.debug "Process terminated"
|
44
|
+
button.set_sensitive false
|
45
|
+
@spinner_indicator.active = false
|
46
|
+
@notifier.label = "Terminated.."
|
47
|
+
end
|
38
48
|
|
49
|
+
@refresh_btn.signal_connect 'clicked' do |button|
|
50
|
+
terminate_worker_thread
|
51
|
+
@logger.debug "Restarting the process"
|
52
|
+
@stop_btn.set_sensitive true
|
53
|
+
start
|
54
|
+
@notifier.label = "Restarting.."
|
55
|
+
end
|
39
56
|
|
40
|
-
|
57
|
+
@window_ui.signal_connect("destroy") {|button|
|
58
|
+
terminate_worker_thread
|
59
|
+
}
|
41
60
|
|
42
61
|
end
|
43
62
|
|
44
63
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
while true
|
54
|
-
select([f])
|
55
|
-
puts "Found it!" unless f.gets.nil?
|
64
|
+
def start
|
65
|
+
@worker_thread = Thread.new do
|
66
|
+
@spinner_indicator.active = true
|
67
|
+
@refresh_btn.sensitive = true
|
68
|
+
@stop_btn.sensitive = true
|
69
|
+
start_fetching
|
56
70
|
end
|
71
|
+
|
57
72
|
end
|
58
73
|
|
59
|
-
def
|
60
|
-
|
61
|
-
starts
|
62
|
-
end
|
74
|
+
def terminate_worker_thread
|
75
|
+
@worker_thread&.terminate if @worker_thread&.alive?
|
63
76
|
|
64
77
|
end
|
65
78
|
|
66
79
|
|
67
|
-
def
|
80
|
+
def start_fetching
|
68
81
|
|
69
82
|
env = "development"
|
70
|
-
|
83
|
+
sso_web_url = "https://signin.navihq.com"
|
84
|
+
gen_csv_url = "https://api2.navihq.com/v2/generate_csv_input"
|
85
|
+
|
86
|
+
@client = NaviClient::Local.new(sso_web_url, "local", gen_csv_url, true, env)
|
71
87
|
@client.set_token "Token: #{@token}##{@settings.username}"
|
72
88
|
@logger = CustomLogger.new @log_display.buffer, @iter_log, @client.logger
|
73
89
|
@client.override_logger @logger
|
@@ -82,10 +98,7 @@ module NaviClientInstaller
|
|
82
98
|
@logger.debug "Connecting to imap server with your local config."
|
83
99
|
|
84
100
|
@notifier.label = "Configuring the system.."
|
85
|
-
imap = @client.imap_connection(@settings.provider, @settings.username, @settings.password, false)
|
86
|
-
|
87
|
-
|
88
|
-
|
101
|
+
@imap = @client.imap_connection(@settings.provider, @settings.username, @settings.password, false) if @imap.nil?
|
89
102
|
|
90
103
|
if @client.errors.nil?
|
91
104
|
|
@@ -97,26 +110,23 @@ module NaviClientInstaller
|
|
97
110
|
@client.logToLoggly({event:"EMAIL_SYNC_STARTED", env: env, storage: "local", email: @settings.username})
|
98
111
|
|
99
112
|
sendEmailCompletedEvent = true
|
100
|
-
folder = "
|
101
|
-
|
113
|
+
folder = "Inbox"
|
102
114
|
|
103
115
|
#this block of code is repeated. Need to change in navi_client gem for that
|
104
|
-
imap.examine folder
|
105
|
-
total = imap.uid_search(['ALL']).size
|
116
|
+
@imap.examine folder
|
117
|
+
total = @imap.uid_search(['ALL']).size
|
106
118
|
downloaded = @client.getMessageUUIds("#{@settings.download_path}#{@settings.username}/meta/").size
|
107
119
|
downloaded = downloaded - 2 if downloaded > 1
|
108
120
|
|
109
121
|
@email_indicator.label = "#{downloaded}/#{total}"
|
110
122
|
|
111
|
-
|
112
|
-
|
113
123
|
begin
|
114
124
|
start_naviai
|
115
125
|
@notifier.label = "Checking for previous failures.."
|
116
126
|
|
117
127
|
@client.parse_prev_failed_emails
|
118
128
|
@notifier.label = "Fetching emails..."
|
119
|
-
@client.retrieve_emails(imap, ['ALL'], folder) do |mail, index, isLast, id|
|
129
|
+
@client.retrieve_emails(@imap, ['ALL'], folder) do |mail, index, isLast, id|
|
120
130
|
|
121
131
|
@logger.debug "processing email##{index + 1} with id #{mail.__id__.to_s} and uuid #{id}"
|
122
132
|
|
@@ -126,13 +136,13 @@ module NaviClientInstaller
|
|
126
136
|
|
127
137
|
@logger.debug "Processing Complete. OK..."
|
128
138
|
|
129
|
-
if filenames.size ==
|
139
|
+
if filenames.size == 50 || isLast
|
130
140
|
sendEmailCompletedEvent = !sendEmailCompletedEvent
|
131
141
|
|
132
|
-
@logger.debug "Sending Bulk Request for #{isLast ? filenames.size :
|
142
|
+
@logger.debug "Sending Bulk Request for #{isLast ? filenames.size : 50} emails to Navi AI."
|
133
143
|
@notifier.label = "Parsing the emails..."
|
134
144
|
|
135
|
-
@client.send_request(filenames)
|
145
|
+
p @client.send_request(filenames)
|
136
146
|
|
137
147
|
@logger.debug "Complete Ok... continue email sync"
|
138
148
|
@notifier.label = "Fetching emails..."
|
@@ -154,8 +164,6 @@ module NaviClientInstaller
|
|
154
164
|
end
|
155
165
|
end
|
156
166
|
|
157
|
-
|
158
|
-
|
159
167
|
@logger.debug "All emails sync and parse completed."
|
160
168
|
|
161
169
|
@notifier.label = "Finalizing..."
|
@@ -163,18 +171,17 @@ module NaviClientInstaller
|
|
163
171
|
@client.initate_csv_generation(@settings.username)
|
164
172
|
|
165
173
|
@notifier.label = "Waiting for the new emails.."
|
166
|
-
@client.idle_loop(imap, ['UNSEEN'], folder, @settings.provider, @settings.username, @settings.password)
|
167
|
-
|
168
|
-
imap.logout
|
169
|
-
imap.disconnect
|
170
|
-
|
174
|
+
@client.idle_loop(@imap, ['UNSEEN'], folder, @settings.provider, @settings.username, @settings.password)
|
171
175
|
|
176
|
+
@imap.logout
|
177
|
+
@imap.disconnect
|
172
178
|
|
173
179
|
rescue => e
|
180
|
+
@imap&.logout
|
181
|
+
@imap&.disconnect
|
174
182
|
@logger.debug "#{e.message}"
|
175
183
|
end
|
176
184
|
|
177
|
-
|
178
185
|
else
|
179
186
|
@logger.debug "Failed to connect with your email. Please recheck the configuration."
|
180
187
|
end
|
@@ -211,13 +218,13 @@ class CustomLogger
|
|
211
218
|
end
|
212
219
|
|
213
220
|
def info msg
|
214
|
-
p msg
|
221
|
+
# p msg
|
215
222
|
@buffer.insert_markup(@iter, "#{msg}\n")
|
216
223
|
@logger_custom.info msg
|
217
224
|
end
|
218
225
|
|
219
226
|
def debug msg
|
220
|
-
p msg
|
227
|
+
# p msg
|
221
228
|
@buffer.insert_markup(@iter, "#{msg}\n")
|
222
229
|
@logger_custom.debug msg
|
223
230
|
end
|
@@ -217,7 +217,7 @@ module NaviClientInstaller
|
|
217
217
|
if %x(echo $NAVI_PATH).strip.length == 0
|
218
218
|
%x(echo "export NAVI_PATH=$HOME/.navi" >> ~/.bashrc)
|
219
219
|
%x(echo "export NAVI_ENV=local" >> ~/.bashrc)
|
220
|
-
system("source
|
220
|
+
system("source $HOME/.bashrc")
|
221
221
|
end
|
222
222
|
|
223
223
|
end
|
@@ -32,14 +32,18 @@ module NaviClientInstaller
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def validate_email(email, pass)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
# need to remove this hardcoded code
|
36
|
+
begin
|
37
|
+
HTTParty.post("https://signin.navihq.com/oauth/token",
|
38
|
+
body: {
|
39
|
+
email: email, # get from sso_web application
|
40
|
+
password: pass,
|
41
|
+
grant_type: "password"
|
42
|
+
}
|
43
|
+
)
|
44
|
+
rescue
|
45
|
+
false
|
46
|
+
end
|
43
47
|
end
|
44
48
|
|
45
49
|
def initiate_signup callback
|
@@ -65,13 +69,13 @@ module NaviClientInstaller
|
|
65
69
|
@spinner.active = false
|
66
70
|
@password_entry.sensitive = true
|
67
71
|
|
68
|
-
if response.code
|
69
|
-
@error_label.set_opacity 1
|
70
|
-
else
|
72
|
+
if response && response.code == 200
|
71
73
|
@error_label.set_opacity 0
|
72
74
|
@settings.hash = widget.text
|
73
75
|
@settings.save_settings
|
74
76
|
callback.call response["access_token"]
|
77
|
+
else
|
78
|
+
@error_label.set_opacity 1
|
75
79
|
end
|
76
80
|
end
|
77
81
|
}
|
data/bin/navilocal
CHANGED
@@ -5,7 +5,8 @@ require 'fileutils'
|
|
5
5
|
|
6
6
|
|
7
7
|
# Require all ruby files in the application folder recursively
|
8
|
-
application_root_path = File.expand_path(
|
8
|
+
application_root_path = File.expand_path('../', __dir__)
|
9
|
+
|
9
10
|
Dir[File.join(application_root_path, '**', 'ui/navi/*.rb')].each { |file| require file }
|
10
11
|
Dir[File.join(application_root_path, '**', 'application/models/settings.rb')].each { |file| require file }
|
11
12
|
|
@@ -14,25 +15,24 @@ Dir[File.join(application_root_path, '**', 'application/models/settings.rb')].ea
|
|
14
15
|
|
15
16
|
resource_bin = File.join(application_root_path, 'gresource.bin')
|
16
17
|
|
18
|
+
# the commented block below is required to generate resources folder or update if any changes
|
17
19
|
|
18
20
|
# resource_xml = File.join(application_root_path, 'resources', 'gresources.xml')
|
19
|
-
# # Build the binary
|
21
|
+
# # # Build the binary
|
20
22
|
# system("glib-compile-resources",
|
21
23
|
# "--target", resource_bin,
|
22
24
|
# "--sourcedir", File.dirname(resource_xml),
|
23
25
|
# resource_xml)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
resource = Gio::Resource.load(resource_bin)
|
26
|
+
#
|
27
|
+
#
|
28
|
+
#
|
29
|
+
# resource = Gio::Resource.load(resource_bin)
|
28
30
|
Gio::Resources.register(resource)
|
29
31
|
|
30
32
|
at_exit do
|
31
|
-
# Before existing, please remove the binary we prodNced, thanks.
|
33
|
+
# Before existing, please remove the binary we prodNced, thanks. ## only for the development
|
32
34
|
# FileUtils.rm_f(resource_bin)
|
33
35
|
end
|
34
36
|
|
35
|
-
|
36
|
-
|
37
37
|
app = NaviClientInstaller::Application.new
|
38
38
|
app.run
|
data/gresource.bin
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navilocal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Msanjib
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.3.
|
47
|
+
version: 1.3.10
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.3.
|
54
|
+
version: 1.3.10
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: httparty
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,7 +88,7 @@ files:
|
|
88
88
|
- gresource.bin
|
89
89
|
homepage: http://rubygems.org/gems/navilocal
|
90
90
|
licenses:
|
91
|
-
-
|
91
|
+
- NAVI
|
92
92
|
metadata: {}
|
93
93
|
post_install_message:
|
94
94
|
rdoc_options: []
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.7.3
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Navi Local
|