navi_client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/console +12 -0
- data/bin/setup +8 -0
- data/lib/cloud/navi_cloud_client.rb +41 -0
- data/lib/http_service/naviai.rb +18 -0
- data/lib/local/navi_local_client.rb +42 -0
- data/lib/navi_client.rb +233 -0
- data/lib/navi_client/version.rb +3 -0
- data/navi_client.gemspec +35 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c81b98bb01a60261d75449187beb49f986fe5af3
|
4
|
+
data.tar.gz: cb3385e25d0cd29605db7f10d9698d8d40fecd2a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f1f23ff98f9ed4414541ced6fce1ac1f09235f07e34ed8b44bb7a4f684f8da97676695034f6940199326b7e01e5cdeb7f4821f0d66d597a04eb7317305e26cab
|
7
|
+
data.tar.gz: 330fa50bf6cf2f955319d6872574f7172bac85846fb91c36f11ed005cfedbaf1de584870b2f4f312546d95aba9598149642c754d2933744c9085383bd17f1cca
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at surya@whitehatengineering.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Surya
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# NaviClient
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/navi_client`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'navi_client'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install navi_client
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/navi_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
5
|
+
# with your gem easier. You can also use a different console, if you like.
|
6
|
+
|
7
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
8
|
+
# require "pry"
|
9
|
+
# Pry.start
|
10
|
+
|
11
|
+
require "irb"
|
12
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
module Navi
|
2
|
+
class CloudClient
|
3
|
+
include NaviClient
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
# flag to print Ruby library debug info (very detailed)
|
7
|
+
@net_imap_debug = false
|
8
|
+
|
9
|
+
# flag to mark email as read after gets downloaded.
|
10
|
+
@mark_as_read = false
|
11
|
+
|
12
|
+
# flag to turn on/off debug mode.
|
13
|
+
@debug = false
|
14
|
+
|
15
|
+
# override the log file
|
16
|
+
mkdir_if_not_exist(config['client_log_file'])
|
17
|
+
@logger = Logger.new(config['client_log_file'])
|
18
|
+
|
19
|
+
# naviai command
|
20
|
+
@cmd = 'naviai'
|
21
|
+
|
22
|
+
# authentication token received from sso_web used to authenticate the request to database_api
|
23
|
+
@token = nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def download(message, custom_uid)
|
27
|
+
download_path = config[:s3_download_folder]
|
28
|
+
if ['text/plain', 'text/html'].include? message.mime_type
|
29
|
+
|
30
|
+
h = Hash.new
|
31
|
+
out_file = download_path + "/" + message.mime_type + "/"+custom_uid
|
32
|
+
|
33
|
+
s3_filepath = upload_to_s3(out_file, encrypt(message.decoded))
|
34
|
+
key = message.mime_type.split("/").join("_")
|
35
|
+
|
36
|
+
h[key] = s3_filepath
|
37
|
+
return h
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "httparty"
|
2
|
+
|
3
|
+
GO_SERVER_URL = 'http://localhost:9090'
|
4
|
+
|
5
|
+
CLIENT_TYPE = 'locallockbox'
|
6
|
+
|
7
|
+
module HTTPService
|
8
|
+
class NaviAI
|
9
|
+
|
10
|
+
def self.start(start_time, end_time)
|
11
|
+
HTTParty.post(GO_SERVER_URL, body: {
|
12
|
+
client_type: CLIENT_TYPE,
|
13
|
+
start_time: start_time,
|
14
|
+
end_time: end_time
|
15
|
+
})
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Navi
|
2
|
+
class LocalClient
|
3
|
+
include NaviClient
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
# flag to print Ruby library debug info (very detailed)
|
7
|
+
@net_imap_debug = false
|
8
|
+
|
9
|
+
# flag to mark email as read after gets downloaded.
|
10
|
+
@mark_as_read = false
|
11
|
+
|
12
|
+
# flag to turn on/off debug mode.
|
13
|
+
@debug = false
|
14
|
+
|
15
|
+
# override the log file
|
16
|
+
mkdir_if_not_exist(config['client_log_file'])
|
17
|
+
@logger = Logger.new(config['client_log_file'])
|
18
|
+
|
19
|
+
# naviai command
|
20
|
+
@cmd = 'naviai'
|
21
|
+
|
22
|
+
# authentication token received from sso_web used to authenticate the request to database_api
|
23
|
+
@token = nil
|
24
|
+
end
|
25
|
+
|
26
|
+
def download(message, custom_uid)
|
27
|
+
download_path = config['download_path']
|
28
|
+
if ['text/plain', 'text/html'].include? message.mime_type
|
29
|
+
|
30
|
+
h = Hash.new
|
31
|
+
out_file = download_path + message.mime_type + "/"+custom_uid
|
32
|
+
mkdir_if_not_exist(out_file)
|
33
|
+
|
34
|
+
File.open(out_file, 'w') { |file| file.write(encrypt(message.decoded)) }
|
35
|
+
key = message.mime_type.split("/").join("_")
|
36
|
+
|
37
|
+
h[key] = out_file
|
38
|
+
return h
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/navi_client.rb
ADDED
@@ -0,0 +1,233 @@
|
|
1
|
+
navi_client_path = `pwd`
|
2
|
+
navi_client_path.strip!
|
3
|
+
navi_client_path = "#{navi_client_path}/lib"
|
4
|
+
require "#{navi_client_path}/navi_client/version"
|
5
|
+
|
6
|
+
require "net/imap"
|
7
|
+
require "mail"
|
8
|
+
require "time"
|
9
|
+
|
10
|
+
require 'base64'
|
11
|
+
require 'fileutils'
|
12
|
+
require 'yaml'
|
13
|
+
|
14
|
+
require "pry"
|
15
|
+
require "logger"
|
16
|
+
|
17
|
+
require "httparty"
|
18
|
+
require "#{navi_client_path}/local/navi_local_client"
|
19
|
+
require "#{navi_client_path}/cloud/navi_cloud_client"
|
20
|
+
require "#{navi_client_path}/http_service/NaviAI"
|
21
|
+
|
22
|
+
module NaviClient
|
23
|
+
|
24
|
+
def logger
|
25
|
+
@logger
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# login
|
30
|
+
#
|
31
|
+
# login to the navi-cloud and get the authentication token
|
32
|
+
#
|
33
|
+
def login
|
34
|
+
provider_url = "http://localhost:3008/oauth/token"
|
35
|
+
@token = HTTParty.post(provider_url,
|
36
|
+
body: {
|
37
|
+
client_id: config["uid"], # get from sso_web application
|
38
|
+
client_secret: config["secret_key"],
|
39
|
+
grant_type: "client_credentials"
|
40
|
+
}
|
41
|
+
)['access_token']
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# imap_connection
|
46
|
+
#
|
47
|
+
# connect the app with imap server
|
48
|
+
#
|
49
|
+
def imap_connection(server, username, password)
|
50
|
+
# connect to IMAP server
|
51
|
+
imap = Net::IMAP.new server, ssl: true, certs: nil, verify: false
|
52
|
+
|
53
|
+
Net::IMAP.debug = @net_imap_debug
|
54
|
+
|
55
|
+
# http://ruby-doc.org/stdlib-2.1.5/libdoc/net/imap/rdoc/Net/IMAP.html#method-i-capability
|
56
|
+
capabilities = imap.capability
|
57
|
+
|
58
|
+
@logger.debug("imap capabilities: #{capabilities.join(',')}") if @debug
|
59
|
+
|
60
|
+
unless capabilities.include? "IDLE"
|
61
|
+
@logger.info "'IDLE' IMAP capability not available in server: #{server}"
|
62
|
+
imap.disconnect
|
63
|
+
exit
|
64
|
+
end
|
65
|
+
|
66
|
+
# login
|
67
|
+
imap.login username, password
|
68
|
+
|
69
|
+
# return IMAP connection handler
|
70
|
+
imap
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# retrieve_emails
|
75
|
+
#
|
76
|
+
# retrieve any mail from a folder, followin specified serach condition
|
77
|
+
# for any mail retrieved call a specified block
|
78
|
+
#
|
79
|
+
def retrieve_emails(imap, search_condition, folder, &process_email_block)
|
80
|
+
|
81
|
+
# select folder
|
82
|
+
imap.select folder
|
83
|
+
|
84
|
+
message_ids = imap.search(search_condition)
|
85
|
+
|
86
|
+
if @debug
|
87
|
+
if message_ids.empty?
|
88
|
+
@logger.debug "\nno messages found.\n"
|
89
|
+
return
|
90
|
+
else
|
91
|
+
@logger.debug "\nProcessing #{message_ids.count} mails.\n"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
message_ids.each_with_index do |message_id, i|
|
96
|
+
# fetch all the email contents
|
97
|
+
data = imap.fetch(message_id, "RFC822")
|
98
|
+
|
99
|
+
data.each do |d|
|
100
|
+
msg = d.attr['RFC822']
|
101
|
+
# instantiate a Mail object to avoid further IMAP parameters nightmares
|
102
|
+
mail = Mail.read_from_string msg
|
103
|
+
|
104
|
+
# call the block with mail object as param
|
105
|
+
start = (i == 0)
|
106
|
+
last = (i == message_ids-1)
|
107
|
+
process_email_block.call mail, start, last
|
108
|
+
|
109
|
+
# mark as read
|
110
|
+
if @mark_as_read
|
111
|
+
imap.store(message_id, "+FLAGS", [:Seen])
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
#
|
118
|
+
# idle_loop
|
119
|
+
#
|
120
|
+
# check for any further mail with "real-time" responsiveness.
|
121
|
+
# retrieve any mail from a folder, following specified search condition
|
122
|
+
# for any mail retrieved call a specified block
|
123
|
+
#
|
124
|
+
def idle_loop(imap, search_condition, folder, server, username, password)
|
125
|
+
|
126
|
+
@logger.info "\nwaiting new mails (IDLE loop)..."
|
127
|
+
|
128
|
+
loop do
|
129
|
+
begin
|
130
|
+
imap.select folder
|
131
|
+
imap.idle do |resp|
|
132
|
+
|
133
|
+
# You'll get all the things from the server. For new emails (EXISTS)
|
134
|
+
if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS"
|
135
|
+
|
136
|
+
@logger.debug resp.inspect if @debug
|
137
|
+
# Got something. Send DONE. This breaks you out of the blocking call
|
138
|
+
imap.idle_done
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# We're out, which means there are some emails ready for us.
|
143
|
+
# Go do a search for UNSEEN and fetch them.
|
144
|
+
retrieve_emails(imap, search_condition, folder) { |mail| process_email mail }
|
145
|
+
@logger.debug "Process Completed." if @debug
|
146
|
+
|
147
|
+
rescue SignalException => e
|
148
|
+
# http://stackoverflow.com/questions/2089421/capturing-ctrl-c-in-ruby
|
149
|
+
@logger.info "Signal received at #{time_now}: #{e.class}. #{e.message}"
|
150
|
+
shutdown imap
|
151
|
+
|
152
|
+
rescue Net::IMAP::Error => e
|
153
|
+
@logger.error "Net::IMAP::Error at #{time_now}: #{e.class}. #{e.message}"
|
154
|
+
|
155
|
+
# timeout ? reopen connection
|
156
|
+
imap = imap_connection(server, username, password) #if e.message == 'connection closed'
|
157
|
+
@logger.info "reconnected to server: #{server}"
|
158
|
+
|
159
|
+
rescue Exception => e
|
160
|
+
@logger.error "Something went wrong at #{time_now}: #{e.class}. #{e.message}"
|
161
|
+
|
162
|
+
imap = imap_connection(server, username, password)
|
163
|
+
@logger.info "reconnected to server: #{server}"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def process_email(mail, start, last)
|
169
|
+
meta = Hash.new
|
170
|
+
custom_uid = (Time.now.to_f * 1000).to_s + "_" + mail.__id__.to_s
|
171
|
+
|
172
|
+
meta["from"] = mail.from.first
|
173
|
+
meta["to"] = mail.to.join(";") unless mail.to.nil?
|
174
|
+
meta["cc"] = mail.cc.join(";") unless mail.cc.nil?
|
175
|
+
meta["subject"] = mail.subject
|
176
|
+
meta["date"] = mail.date.to_s
|
177
|
+
|
178
|
+
if mail.multipart?
|
179
|
+
for i in 0...mail.parts.length
|
180
|
+
m = @local_flag ? download_local(mail, custom_uid) : download_s3(mail, custom_uid)
|
181
|
+
meta.merge!(m) unless m.nil?
|
182
|
+
end
|
183
|
+
else
|
184
|
+
m = @local_flag ? download_local(mail, custom_uid) : download_s3(mail, custom_uid)
|
185
|
+
meta.merge!(m) unless m.nil?
|
186
|
+
end
|
187
|
+
|
188
|
+
meta_file_path = save(meta, "meta/#{custom_uid}")
|
189
|
+
pid = Process.spawn(@cmd+" -f=#{meta_file_path} -t=#{@token}")
|
190
|
+
|
191
|
+
HTTPService::NaviAI.start(start, last)
|
192
|
+
end
|
193
|
+
|
194
|
+
private
|
195
|
+
|
196
|
+
def save(data={}, filename)
|
197
|
+
download_path = config['download_path']
|
198
|
+
filepath = download_path + filename + ".yml"
|
199
|
+
|
200
|
+
mkdir_if_not_exist(filepath)
|
201
|
+
|
202
|
+
File.write(filepath, data.to_yaml)
|
203
|
+
return filepath
|
204
|
+
end
|
205
|
+
|
206
|
+
def encrypt(data)
|
207
|
+
Base64.encode64(data)
|
208
|
+
end
|
209
|
+
|
210
|
+
def mkdir_if_not_exist(filepath)
|
211
|
+
dirname = File.dirname(filepath)
|
212
|
+
unless File.directory?(dirname)
|
213
|
+
FileUtils.mkdir_p(dirname)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def time_now
|
218
|
+
Time.now.utc.iso8601(3)
|
219
|
+
end
|
220
|
+
|
221
|
+
def shutdown(imap)
|
222
|
+
imap.idle_done
|
223
|
+
imap.logout unless imap.disconnected?
|
224
|
+
imap.disconnect
|
225
|
+
|
226
|
+
@logger.info "#{$0} has ended (crowd applauds)"
|
227
|
+
exit 0
|
228
|
+
end
|
229
|
+
|
230
|
+
def config
|
231
|
+
YAML.load_file('/var/navi/config.yml')
|
232
|
+
end
|
233
|
+
end
|
data/navi_client.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'navi_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "navi_client"
|
8
|
+
spec.version = NaviClient::VERSION
|
9
|
+
spec.authors = ["Surya"]
|
10
|
+
spec.email = ["surya@whitehatengineering.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{ Write a short summary, because Rubygems requires one.}
|
13
|
+
spec.description = %q{ Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "http://navihq.com"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "Set to 'https://rubygems.org'"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
spec.add_runtime_dependency "httparty"
|
34
|
+
spec.add_runtime_dependency "mail"
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: navi_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Surya
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-12-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mail
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: " Write a longer description or delete this line."
|
84
|
+
email:
|
85
|
+
- surya@whitehatengineering.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".DS_Store"
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
|
+
- CODE_OF_CONDUCT.md
|
95
|
+
- Gemfile
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- lib/cloud/navi_cloud_client.rb
|
102
|
+
- lib/http_service/naviai.rb
|
103
|
+
- lib/local/navi_local_client.rb
|
104
|
+
- lib/navi_client.rb
|
105
|
+
- lib/navi_client/version.rb
|
106
|
+
- navi_client.gemspec
|
107
|
+
homepage: http://navihq.com
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.5.1
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Write a short summary, because Rubygems requires one.
|
131
|
+
test_files: []
|
132
|
+
has_rdoc:
|