cnvrg 1.0 → 1.2
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 +15 -6
- data/lib/cnvrg/project.rb +26 -3
- data/lib/cnvrg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c521807a89abc0d51041110af1d5af2b4a2c6248
|
4
|
+
data.tar.gz: 7643390b264154d01393199803d10496695e8589
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a1e4275786314861824511a4baccb864e17a14990950743a0ddf1c686b09cc7b801bf6851a758feb0ff99b8331171d201ac137ac6d35746101895c13e14065
|
7
|
+
data.tar.gz: b272efe2c50d66423320b378ef6bb7a7cfd1394d2dfa6231c4aec68872051f26b4407a1c00024460ac0e0933fe9af758760972615b5453643fd9b0c43400da34
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -655,6 +655,7 @@ module Cnvrg
|
|
655
655
|
method_option :sync, :type => :boolean, :aliases => ["-s"], :default => false
|
656
656
|
method_option :docker_image, :type => :string, :aliases => ["-d"], :default => ""
|
657
657
|
method_option :git, :type => :boolean, :aliases => ["-g","--git"], :default => false
|
658
|
+
method_option :title, :type => :string, :aliases => ["-t","--title"], :default => nil
|
658
659
|
|
659
660
|
def link
|
660
661
|
begin
|
@@ -669,8 +670,8 @@ module Cnvrg
|
|
669
670
|
|
670
671
|
sync = options["sync"]
|
671
672
|
git = options["git"] || false
|
672
|
-
|
673
|
-
project_name
|
673
|
+
project_name = options['title']
|
674
|
+
project_name ||= File.basename(Dir.getwd)
|
674
675
|
log_message("Linking #{project_name}", Thor::Shell::Color::BLUE)
|
675
676
|
if File.directory?(Dir.getwd + "/.cnvrg")
|
676
677
|
config = YAML.load_file("#{Dir.getwd}/.cnvrg/config.yml")
|
@@ -679,11 +680,11 @@ module Cnvrg
|
|
679
680
|
end
|
680
681
|
working_dir = Dir.getwd
|
681
682
|
owner = CLI.get_owner
|
682
|
-
if Project.link(owner, project_name, docker
|
683
|
+
if Project.link(owner, project_name, docker,git)
|
683
684
|
path = Dir.pwd
|
684
685
|
@project = Project.new(path)
|
685
|
-
@project.generate_idx()
|
686
686
|
if sync
|
687
|
+
@project.generate_idx() #DEV-741
|
687
688
|
log_message("Syncing project", Thor::Shell::Color::BLUE)
|
688
689
|
upload(true)
|
689
690
|
end
|
@@ -2135,7 +2136,7 @@ module Cnvrg
|
|
2135
2136
|
commit_msg = ""
|
2136
2137
|
end
|
2137
2138
|
return_id = options["return_id"]
|
2138
|
-
@files = Cnvrg::Files.new(@project.owner, @project.slug, project_home: get_project_home)
|
2139
|
+
@files = Cnvrg::Files.new(@project.owner, @project.slug, project_home: get_project_home, project: @project)
|
2139
2140
|
ignore = options[:ignore] || ""
|
2140
2141
|
force = options[:force] || force || false
|
2141
2142
|
spec_files_to_upload = options["files"]
|
@@ -3040,7 +3041,7 @@ module Cnvrg
|
|
3040
3041
|
real: real_time
|
3041
3042
|
}
|
3042
3043
|
if print_log
|
3043
|
-
puts
|
3044
|
+
puts line
|
3044
3045
|
end
|
3045
3046
|
log << cur_log
|
3046
3047
|
if log.size >= 5
|
@@ -5592,12 +5593,20 @@ module Cnvrg
|
|
5592
5593
|
end
|
5593
5594
|
end
|
5594
5595
|
if is_cnvrg
|
5596
|
+
self.update_project_config(current_dir)
|
5595
5597
|
return current_dir
|
5596
5598
|
else
|
5597
5599
|
return false
|
5598
5600
|
end
|
5599
5601
|
end
|
5600
5602
|
|
5603
|
+
|
5604
|
+
|
5605
|
+
def update_project_config(current_dir)
|
5606
|
+
@project = Cnvrg::Project.new(current_dir)
|
5607
|
+
@project.fetch_project
|
5608
|
+
end
|
5609
|
+
|
5601
5610
|
def data_dir_include()
|
5602
5611
|
all_dirs = Dir.glob("**/*/", File::FNM_DOTMATCH)
|
5603
5612
|
all_dirs.flatten!
|
data/lib/cnvrg/project.rb
CHANGED
@@ -317,8 +317,21 @@ module Cnvrg
|
|
317
317
|
return config[:new_branch]
|
318
318
|
rescue => e
|
319
319
|
return false
|
320
|
+
end
|
321
|
+
end
|
320
322
|
|
323
|
+
def get_config
|
324
|
+
YAML.load_file(@working_dir + "/.cnvrg/config.yml") rescue {}
|
325
|
+
end
|
326
|
+
|
327
|
+
def set_config(config)
|
328
|
+
slug = config[:project_slug] rescue nil
|
329
|
+
owner = config[:owner] rescue nil
|
330
|
+
name = config[:project_name] rescue nil
|
331
|
+
if slug.blank? or owner.blank? or name.blank?
|
332
|
+
raise StandardError.new("Cant change config without mendatory values")
|
321
333
|
end
|
334
|
+
File.open(@working_dir + "/.cnvrg/config.yml", "w+") {|f| f.write config.to_yaml}
|
322
335
|
end
|
323
336
|
|
324
337
|
def remove_new_branch
|
@@ -382,10 +395,10 @@ module Cnvrg
|
|
382
395
|
list_ignore.flatten!
|
383
396
|
end
|
384
397
|
|
398
|
+
|
385
399
|
Parallel.map(list, in_threads: IDXParallelThreads) do |e|
|
386
400
|
label = e.gsub(self.local_path + "/", "")
|
387
|
-
|
388
|
-
if list_ignore.include? ignore_label
|
401
|
+
if list_ignore.include? label
|
389
402
|
next
|
390
403
|
end
|
391
404
|
if File.directory? e
|
@@ -404,7 +417,6 @@ module Cnvrg
|
|
404
417
|
end
|
405
418
|
|
406
419
|
old_idx[:tree] = tree_idx
|
407
|
-
|
408
420
|
File.open("#{self.local_path}/.cnvrg/idx.yml", 'w') {|f| f.write old_idx.to_yaml}
|
409
421
|
return YAML.load_file("#{self.local_path}/.cnvrg/idx.yml")
|
410
422
|
end
|
@@ -607,5 +619,16 @@ module Cnvrg
|
|
607
619
|
end
|
608
620
|
|
609
621
|
|
622
|
+
def fetch_project
|
623
|
+
resp = Cnvrg::API.request("users/#{@owner}/projects/#{@slug}/get_project", "GET")
|
624
|
+
res = JSON.parse(resp['result']) rescue nil
|
625
|
+
raise SignalException.new("Cant Find project in the server") if res.blank?
|
626
|
+
config = self.get_config
|
627
|
+
config[:is_git] = res['git']
|
628
|
+
config[:project_name] = res['title']
|
629
|
+
self.set_config(config)
|
630
|
+
end
|
631
|
+
|
632
|
+
|
610
633
|
end
|
611
634
|
end
|
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: '1.
|
4
|
+
version: '1.2'
|
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: 2019-01-
|
12
|
+
date: 2019-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|