cnvrg 0.2.5 → 0.2.6
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 +4 -4
- data/lib/cnvrg/cli.rb +27 -16
- data/lib/cnvrg/project.rb +15 -0
- data/lib/cnvrg/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad8ca6c9d3a841de5937e2491c0c457456e1c4d3
|
4
|
+
data.tar.gz: 5f1764f5dad22d28863300db640971789cd4b7ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bafe792da2bf576945486186cdd0d15b3773b41262cf34daf5d012d38f0d7c508f759466aad9ede194943c6cfca1db7902f20cd1dd870562d8c4c87d64c1062f
|
7
|
+
data.tar.gz: 13f386cfcfcd8fd006ce846880a7ef5c0bb985034d3e8e1208f6dc213c0b12fe1ddc77f46c2f57620da307dc10157f3c9c45793dd78d989a9d1a498cdccbebe4
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -206,34 +206,43 @@ module Cnvrg
|
|
206
206
|
if !File.exist?(home_dir+"/.cnvrg/config.yml")
|
207
207
|
FileUtils.touch [home_dir+"/.cnvrg/config.yml"]
|
208
208
|
end
|
209
|
-
config = YAML.load_file(home_dir+"/.cnvrg/config.yml")
|
210
|
-
owner = config.to_h[:owner]
|
211
209
|
compression_path = "#{File.expand_path('~')}/.cnvrg/tmp"
|
212
210
|
|
211
|
+
begin
|
212
|
+
config = YAML.load_file(home_dir+"/.cnvrg/config.yml")
|
213
|
+
if !config
|
214
|
+
config = {owner: "", username: "", version_last_check: get_start_day(), api: url, compression_path: compression_path, }
|
215
|
+
|
216
|
+
end
|
217
|
+
rescue
|
218
|
+
config = {owner: "", username: "", version_last_check: get_start_day(), api: url, compression_path: compression_path }
|
219
|
+
end
|
220
|
+
owner = config.to_h[:owner]
|
221
|
+
|
213
222
|
say "Setting default api to be: #{url}", Thor::Shell::Color::BLUE
|
214
223
|
if config.empty?
|
215
|
-
config = {owner: "", username: "", version_last_check: get_start_day(), api: url, compression_path: compression_path}
|
224
|
+
config = {owner: "", username: "", version_last_check: get_start_day(), api: url, compression_path: compression_path }
|
216
225
|
else
|
217
226
|
if !config.to_h[:compression_path].nil?
|
218
227
|
compression_path = config.to_h[:compression_path]
|
219
228
|
end
|
220
229
|
config = {owner: config.to_h[:owner], username: config.to_h[:username], version_last_check: config.to_h[:version_last_check], api: url, compression_path: compression_path}
|
221
230
|
end
|
222
|
-
res = Cnvrg::API.request("/users/#{owner}/custom_api", 'POST', {custom_api: url})
|
223
|
-
if Cnvrg::CLI.is_response_success(res, false)
|
224
|
-
|
225
|
-
checks = Helpers.checkmark
|
231
|
+
# res = Cnvrg::API.request("/users/#{owner}/custom_api", 'POST', {custom_api: url})
|
232
|
+
# if Cnvrg::CLI.is_response_success(res, false)
|
226
233
|
|
234
|
+
checks = Helpers.checkmark
|
227
235
|
|
228
|
-
File.open(home_dir+"/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
229
|
-
say "#{checks} Done", Thor::Shell::Color::GREEN
|
230
|
-
else
|
231
|
-
say "Couldn't set default api, contact help@cnvrg.io", Thor::Shell::Color::RED
|
232
|
-
exit(1)
|
233
236
|
|
234
|
-
|
237
|
+
File.open(home_dir+"/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
238
|
+
say "#{checks} Done", Thor::Shell::Color::GREEN
|
239
|
+
# else
|
240
|
+
# say "Couldn't set default api, contact help@cnvrg.io", Thor::Shell::Color::RED
|
241
|
+
# exit(1)
|
242
|
+
#
|
243
|
+
# end
|
235
244
|
|
236
|
-
rescue
|
245
|
+
rescue => e
|
237
246
|
say "Couldn't set default api, contact help@cnvrg.io", Thor::Shell::Color::RED
|
238
247
|
end
|
239
248
|
end
|
@@ -1733,7 +1742,7 @@ module Cnvrg
|
|
1733
1742
|
result = @project.compare_idx(new_branch,force:force)
|
1734
1743
|
commit = result["result"]["commit"]
|
1735
1744
|
if !link
|
1736
|
-
if commit != @project.last_local_commit and !@project.last_local_commit.nil? and !result["result"]["tree"]["updated_on_server"].empty?
|
1745
|
+
if ((commit != @project.last_local_commit and !@project.last_local_commit.nil? and !result["result"]["tree"]["updated_on_server"].empty?) and !force )
|
1737
1746
|
|
1738
1747
|
log_message("Remote server has an updated version, please run `cnvrg download` first, or alternatively: `cnvrg sync`", Thor::Shell::Color::BLUE)
|
1739
1748
|
exit(1)
|
@@ -2324,9 +2333,11 @@ module Cnvrg
|
|
2324
2333
|
log_start(__method__, args, options)
|
2325
2334
|
log_message('Checking for new updates from remote version', Thor::Shell::Color::BLUE, options["verbose"])
|
2326
2335
|
log_message('Syncing project', Thor::Shell::Color::BLUE, !options["verbose"])
|
2336
|
+
if !options[:force]
|
2337
|
+
invoke :download, [], :new_branch => options["new_branch"], :verbose => options["verbose"], :sync => true
|
2338
|
+
end
|
2327
2339
|
|
2328
2340
|
|
2329
|
-
invoke :download, [], :new_branch => options["new_branch"], :verbose => options["verbose"], :sync => true
|
2330
2341
|
invoke :upload, [link=false, sync=true, direct=direct], :new_branch => options["new_branch"], :verbose => options["verbose"], :sync => true,
|
2331
2342
|
:ignore => options[:ignore], :force=> options[:force]
|
2332
2343
|
|
data/lib/cnvrg/project.rb
CHANGED
@@ -359,6 +359,21 @@ module Cnvrg
|
|
359
359
|
def compare_idx(new_branch, commit:last_local_commit,force:false)
|
360
360
|
local_idx = self.generate_idx
|
361
361
|
ignore_list = self.send_ignore_list()
|
362
|
+
if force
|
363
|
+
added = []
|
364
|
+
if local_idx[:tree]
|
365
|
+
added << local_idx[:tree].keys
|
366
|
+
added.flatten!
|
367
|
+
end
|
368
|
+
|
369
|
+
response ={"result"=> {"commit"=>nil,"tree"=> {"added"=> added,
|
370
|
+
"updated_on_server"=> [],
|
371
|
+
"updated_on_local"=> [],
|
372
|
+
"deleted"=> [],
|
373
|
+
"conflicts"=> []} } }
|
374
|
+
return response
|
375
|
+
|
376
|
+
end
|
362
377
|
response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/status", 'POST', {idx: local_idx, new_branch: new_branch,
|
363
378
|
current_commit: commit,ignore:ignore_list, force:force})
|
364
379
|
CLI.is_response_success(response,false)
|
data/lib/cnvrg/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cnvrg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yochay Ettun
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-12-
|
12
|
+
date: 2017-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -416,7 +416,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
416
416
|
version: '0'
|
417
417
|
requirements: []
|
418
418
|
rubyforge_project:
|
419
|
-
rubygems_version: 2.
|
419
|
+
rubygems_version: 2.6.12
|
420
420
|
signing_key:
|
421
421
|
specification_version: 4
|
422
422
|
summary: A CLI tool for interacting with cnvrg.io.
|