cnvrg 0.0.1580000 → 0.0.1590000
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/api.rb +6 -0
- data/lib/cnvrg/cli.rb +21 -13
- data/lib/cnvrg/datafiles.rb +2 -2
- data/lib/cnvrg/files.rb +5 -3
- data/lib/cnvrg/project.rb +64 -9
- 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: 2f25836d94af8c999a3372dc304469a713573a0d
|
4
|
+
data.tar.gz: 46586b98e20bac8c5d2383affcdc93414af80353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7e94582a9d8d0c5bad912811fab469a999d4816d9ff8ef9a1b22f437724560ea91e9bbebe2a9fe60a94f946b37117f37e51e65bc7792f406fb56336366e8763
|
7
|
+
data.tar.gz: 27aecbee164da64c0ec32047e21921c7fa1dcaff240a13e143ee514f039ce480a168c2298994cae2df2251ed5a396f933ec449f24ffc559739151efaf80c0889
|
data/lib/cnvrg/api.rb
CHANGED
@@ -73,10 +73,13 @@ module Cnvrg
|
|
73
73
|
fr.headers['User-Agent'] = "#{Cnvrg::API::USER_AGENT}"
|
74
74
|
fr.headers["Content-Type"] = "multipart/form-data"
|
75
75
|
|
76
|
+
|
76
77
|
fr.request :multipart
|
77
78
|
fr.request :url_encoded
|
78
79
|
fr.adapter :net_http
|
79
80
|
end
|
81
|
+
conn.options.timeout = 420
|
82
|
+
conn.options.open_timeout =420
|
80
83
|
|
81
84
|
|
82
85
|
# what if windows?
|
@@ -111,6 +114,9 @@ module Cnvrg
|
|
111
114
|
rescue => e
|
112
115
|
puts e
|
113
116
|
return nil
|
117
|
+
rescue SignalException
|
118
|
+
return false
|
119
|
+
|
114
120
|
end
|
115
121
|
|
116
122
|
end
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -1520,6 +1520,7 @@ module Cnvrg
|
|
1520
1520
|
# dir
|
1521
1521
|
if @files.download_dir(f[0], relative_path, project_home)
|
1522
1522
|
f
|
1523
|
+
successful_changes << relative_path
|
1523
1524
|
else
|
1524
1525
|
log_message("Could not create directory: #{f[0]}", Thor::Shell::Color::RED)
|
1525
1526
|
raise Parallel::Kill
|
@@ -1547,10 +1548,15 @@ module Cnvrg
|
|
1547
1548
|
|
1548
1549
|
|
1549
1550
|
end
|
1551
|
+
successful_changes = response["result"]["tree"]
|
1552
|
+
if !successful_changes.nil?
|
1553
|
+
Project.verify_cnvrgignore_exist(project_name)
|
1554
|
+
log_message("Done.\nDownloaded #{successful_changes.size}/#{response["result"]["tree"].size} files", Thor::Shell::Color::GREEN)
|
1555
|
+
else
|
1556
|
+
log_message("Couldn't download some files", Thor::Shell::Color::RED)
|
1550
1557
|
|
1551
|
-
|
1558
|
+
end
|
1552
1559
|
|
1553
|
-
log_message("Done.\nDownloaded total of #{successful_changes.size} files", Thor::Shell::Color::GREEN)
|
1554
1560
|
else
|
1555
1561
|
|
1556
1562
|
log_message("Error: Couldn't create directory: #{project_name}", Thor::Shell::Color::RED)
|
@@ -1757,7 +1763,7 @@ module Cnvrg
|
|
1757
1763
|
absolute_path = "#{@project.local_path}/#{f}"
|
1758
1764
|
relative_path = f.gsub(/^#{@project.local_path + "/"}/, "")
|
1759
1765
|
if File.directory?(absolute_path)
|
1760
|
-
log_message("uploading dir: #{f}", Thor::Shell::Color::
|
1766
|
+
log_message("uploading dir: #{f}", Thor::Shell::Color::BLUE, options["verbose"])
|
1761
1767
|
|
1762
1768
|
resDir = @files.create_dir(absolute_path, relative_path, commit_sha1)
|
1763
1769
|
if resDir
|
@@ -1772,7 +1778,7 @@ module Cnvrg
|
|
1772
1778
|
end
|
1773
1779
|
|
1774
1780
|
else
|
1775
|
-
log_message("uploading: #{f}", Thor::Shell::Color::
|
1781
|
+
log_message("uploading: #{f}", Thor::Shell::Color::BLUE, options["verbose"])
|
1776
1782
|
|
1777
1783
|
res = @files.upload_file(absolute_path, relative_path, commit_sha1)
|
1778
1784
|
if res
|
@@ -1788,7 +1794,7 @@ module Cnvrg
|
|
1788
1794
|
end
|
1789
1795
|
end
|
1790
1796
|
end
|
1791
|
-
rescue
|
1797
|
+
rescue SignalException
|
1792
1798
|
log_message("Couldn't upload, Rolling Back all changes.", Thor::Shell::Color::RED)
|
1793
1799
|
@files.rollback_commit(commit_sha1)
|
1794
1800
|
|
@@ -1799,6 +1805,7 @@ module Cnvrg
|
|
1799
1805
|
|
1800
1806
|
successful_updates = upload_result.to_a
|
1801
1807
|
|
1808
|
+
|
1802
1809
|
# delete
|
1803
1810
|
|
1804
1811
|
deleted = update_deleted(result["deleted"])
|
@@ -1880,11 +1887,14 @@ module Cnvrg
|
|
1880
1887
|
if options["verbose"]
|
1881
1888
|
log_message("#{check} Done", Thor::Shell::Color::BLUE)
|
1882
1889
|
if successful_updates.size >0
|
1890
|
+
successful_updates.flatten!
|
1883
1891
|
log_message("Updated:", Thor::Shell::Color::GREEN)
|
1884
1892
|
suc = successful_updates.map { |x| x=Helpers.checkmark() +" "+x }
|
1885
1893
|
log_message(suc.join("\n"), Thor::Shell::Color::GREEN)
|
1886
1894
|
end
|
1887
1895
|
if successful_deletions.size >0
|
1896
|
+
successful_deletions.flatten!
|
1897
|
+
|
1888
1898
|
log_message("Deleted:", Thor::Shell::Color::GREEN)
|
1889
1899
|
del = successful_updates.map { |x| x=Helpers.checkmark() +" "+x }
|
1890
1900
|
log_message(del.join("\n"), Thor::Shell::Color::GREEN)
|
@@ -1908,13 +1918,12 @@ module Cnvrg
|
|
1908
1918
|
else
|
1909
1919
|
log_message("Error: uploaded only: #{update_count} / #{update_total}, \n Rolling back", Thor::Shell::Color::RED)
|
1910
1920
|
|
1911
|
-
@files.rollback_commit(commit_sha1)
|
1912
1921
|
end
|
1913
1922
|
rescue => e
|
1914
1923
|
|
1915
1924
|
log_message("Error occurred, \nAborting", Thor::Shell::Color::RED)
|
1916
1925
|
log_error(e)
|
1917
|
-
@files.rollback_commit(commit_sha1)
|
1926
|
+
@files.rollback_commit(commit_sha1) unless commit_sha1.nil?
|
1918
1927
|
puts e.message
|
1919
1928
|
|
1920
1929
|
exit(1)
|
@@ -1922,7 +1931,7 @@ module Cnvrg
|
|
1922
1931
|
|
1923
1932
|
say "\nAborting", Thor::Shell::Color::BLUE
|
1924
1933
|
say "\nRolling back all changes", Thor::Shell::Color::BLUE
|
1925
|
-
@files.rollback_commit(commit_sha1)
|
1934
|
+
@files.rollback_commit(commit_sha1) unless commit_sha1.nil?
|
1926
1935
|
exit(1)
|
1927
1936
|
end
|
1928
1937
|
|
@@ -1957,7 +1966,6 @@ module Cnvrg
|
|
1957
1966
|
log_message("Couldn't append new ignore files to .cnvrgignore", Thor::Shell::Color::YELLOW)
|
1958
1967
|
end
|
1959
1968
|
new_branch = options["new_branch"] || false
|
1960
|
-
|
1961
1969
|
res = @project.compare_idx(new_branch)["result"]
|
1962
1970
|
|
1963
1971
|
result = res["tree"]
|
@@ -2014,7 +2022,7 @@ module Cnvrg
|
|
2014
2022
|
conflicts_result = Parallel.map(result["conflicts"], in_processes: ParallelProcesses, in_thread: ParallelThreads) do |f|
|
2015
2023
|
|
2016
2024
|
relative_path = f.gsub(/^#{@project.local_path}/, "")
|
2017
|
-
log_message("downloading: #{f}.conflict", Thor::Shell::Color::
|
2025
|
+
log_message("downloading: #{f}.conflict", Thor::Shell::Color::BLUE, options["verbose"])
|
2018
2026
|
|
2019
2027
|
if @files.download_file_s3(f, relative_path, project_home, commit_sha1=nil, conflict=true)
|
2020
2028
|
f
|
@@ -2042,12 +2050,12 @@ module Cnvrg
|
|
2042
2050
|
relative_path = f.gsub(/^#{@project.local_path}/, "")
|
2043
2051
|
if f.end_with? "/"
|
2044
2052
|
# dir
|
2045
|
-
log_message("downloading dir: #{f}", Thor::Shell::Color::
|
2053
|
+
log_message("downloading dir: #{f}", Thor::Shell::Color::BLUE, options["verbose"])
|
2046
2054
|
|
2047
2055
|
if @files.download_dir(f, relative_path, project_home)
|
2048
2056
|
f
|
2049
2057
|
else
|
2050
|
-
log_message("Couldn't
|
2058
|
+
log_message("Couldn't create directory: #{f}", Thor::Shell::Color::RED)
|
2051
2059
|
raise Parallel::Kill
|
2052
2060
|
|
2053
2061
|
|
@@ -2055,7 +2063,7 @@ module Cnvrg
|
|
2055
2063
|
|
2056
2064
|
else
|
2057
2065
|
# blob
|
2058
|
-
log_message("downloading file: #{f}", Thor::Shell::Color::
|
2066
|
+
log_message("downloading file: #{f}", Thor::Shell::Color::BLUE, options["verbose"])
|
2059
2067
|
|
2060
2068
|
if @files.download_file_s3(f, relative_path, project_home)
|
2061
2069
|
f
|
data/lib/cnvrg/datafiles.rb
CHANGED
@@ -578,8 +578,8 @@ module Cnvrg
|
|
578
578
|
return response
|
579
579
|
end
|
580
580
|
|
581
|
-
def end_commit(commit_sha1
|
582
|
-
response = Cnvrg::API.request("#{base_resource}/commit/end", 'POST', {commit_sha1: commit_sha1
|
581
|
+
def end_commit(commit_sha1)
|
582
|
+
response = Cnvrg::API.request("#{base_resource}/commit/end", 'POST', {commit_sha1: commit_sha1})
|
583
583
|
return response
|
584
584
|
end
|
585
585
|
|
data/lib/cnvrg/files.rb
CHANGED
@@ -292,8 +292,10 @@ module Cnvrg
|
|
292
292
|
puts e
|
293
293
|
puts e.backtrace
|
294
294
|
return false
|
295
|
+
rescue SignalException
|
296
|
+
return false
|
295
297
|
|
296
|
-
|
298
|
+
end
|
297
299
|
return true
|
298
300
|
|
299
301
|
end
|
@@ -444,10 +446,10 @@ module Cnvrg
|
|
444
446
|
begin
|
445
447
|
if !conflicted_changes.nil? and !conflicted_changes.empty?
|
446
448
|
conflicted_changes.each do |c|
|
447
|
-
FileUtils.rm_rf(c+".conflict")
|
449
|
+
# FileUtils.rm_rf(c+".conflict")
|
448
450
|
end
|
449
451
|
end
|
450
|
-
FileUtils.rm_rf(downloaded_changes) unless (downloaded_changes.nil? or downloaded_changes.empty?)
|
452
|
+
# FileUtils.rm_rf(downloaded_changes) unless (downloaded_changes.nil? or downloaded_changes.empty?)
|
451
453
|
rescue => e
|
452
454
|
return false
|
453
455
|
end
|
data/lib/cnvrg/project.rb
CHANGED
@@ -50,6 +50,9 @@ module Cnvrg
|
|
50
50
|
|
51
51
|
def get_ignore_list
|
52
52
|
ignore_list = []
|
53
|
+
if !File.exist? self.local_path+"/.cnvrgignore"
|
54
|
+
return ignore_list
|
55
|
+
end
|
53
56
|
File.open(self.local_path+"/.cnvrgignore", "r").each_line do |line|
|
54
57
|
line = line.strip
|
55
58
|
if line.start_with? "#" or ignore_list.include? line or line.empty?
|
@@ -87,6 +90,31 @@ module Cnvrg
|
|
87
90
|
|
88
91
|
end
|
89
92
|
|
93
|
+
def send_ignore_list()
|
94
|
+
begin
|
95
|
+
ignore_list = []
|
96
|
+
File.open(self.local_path+"/.cnvrgignore", "r").each_line do |line|
|
97
|
+
line = line.strip
|
98
|
+
if line.start_with? "#" or ignore_list.include? line or line.empty?
|
99
|
+
next
|
100
|
+
end
|
101
|
+
if line.end_with? "/"
|
102
|
+
ignore_list << line.gsub("/","")
|
103
|
+
ignore_list << line+"."
|
104
|
+
elsif line.include? "*"
|
105
|
+
line = line.gsub("*",".*")
|
106
|
+
ignore_list << line
|
107
|
+
else
|
108
|
+
ignore_list << line
|
109
|
+
end
|
110
|
+
end
|
111
|
+
return ignore_list.flatten
|
112
|
+
rescue
|
113
|
+
return []
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
90
118
|
# Create project
|
91
119
|
|
92
120
|
def self.create(project_name, clean, with_docker=false)
|
@@ -141,12 +169,16 @@ module Cnvrg
|
|
141
169
|
end
|
142
170
|
|
143
171
|
def self.link(owner, project_name, path=nil, docker=false)
|
172
|
+
ignore_exits = File.exist? ".cnvrgignore"
|
144
173
|
list_dirs = [".cnvrg"
|
145
174
|
]
|
146
175
|
list_files = [
|
147
|
-
".cnvrgignore",
|
148
176
|
".cnvrg/config.yml"
|
149
177
|
]
|
178
|
+
if !ignore_exits
|
179
|
+
list_files <<
|
180
|
+
".cnvrgignore"
|
181
|
+
end
|
150
182
|
|
151
183
|
cnvrgreadme = Helpers.readme_content
|
152
184
|
cnvrgignore = Helpers.cnvrgignore_content
|
@@ -162,13 +194,14 @@ module Cnvrg
|
|
162
194
|
FileUtils.mkdir_p list_dirs
|
163
195
|
FileUtils.touch list_files
|
164
196
|
File.open(".cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
165
|
-
File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore }
|
197
|
+
File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore } unless ignore_exits
|
166
198
|
if !File.exist? "README" and !File.exist? "README.md"
|
167
199
|
FileUtils.touch [ "README.md" ]
|
168
200
|
File.open("README.md", "w+") { |f| f.write cnvrgreadme }
|
169
201
|
end
|
170
202
|
|
171
203
|
rescue => e
|
204
|
+
puts e
|
172
205
|
return false
|
173
206
|
end
|
174
207
|
return true
|
@@ -182,7 +215,7 @@ module Cnvrg
|
|
182
215
|
|
183
216
|
list_files = [
|
184
217
|
project_name + "/.cnvrg/config.yml",
|
185
|
-
project_name+"/.cnvrgignore",
|
218
|
+
# project_name+"/.cnvrgignore",
|
186
219
|
]
|
187
220
|
begin
|
188
221
|
config = {project_name: project_name,
|
@@ -190,17 +223,39 @@ module Cnvrg
|
|
190
223
|
owner: project_owner}
|
191
224
|
FileUtils.mkdir_p list_dirs
|
192
225
|
FileUtils.touch list_files
|
193
|
-
cnvrgignore = Helpers.cnvrgignore_content
|
226
|
+
# cnvrgignore = Helpers.cnvrgignore_content
|
194
227
|
|
195
228
|
|
196
229
|
File.open(project_name + "/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
197
|
-
File.open(project_name+"/.cnvrgignore", "w+") { |f| f.write cnvrgignore }
|
230
|
+
# File.open(project_name+"/.cnvrgignore", "w+") { |f| f.write cnvrgignore }
|
198
231
|
|
199
232
|
rescue
|
200
233
|
return false
|
201
234
|
end
|
202
235
|
return true
|
203
236
|
end
|
237
|
+
def self.verify_cnvrgignore_exist(project_name)
|
238
|
+
ignore_exits = File.exist? "#{project_name}/.cnvrgignore"
|
239
|
+
if !ignore_exits
|
240
|
+
begin
|
241
|
+
list_files = [
|
242
|
+
project_name+"/.cnvrgignore",
|
243
|
+
]
|
244
|
+
FileUtils.touch list_files
|
245
|
+
cnvrgignore = Helpers.cnvrgignore_content
|
246
|
+
File.open(project_name+"/.cnvrgignore", "w+") { |f| f.write cnvrgignore }
|
247
|
+
rescue => e
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
end
|
204
259
|
|
205
260
|
def self.clone_dir_remote(project_slug, project_owner, project_name)
|
206
261
|
list_dirs = [
|
@@ -210,7 +265,7 @@ module Cnvrg
|
|
210
265
|
|
211
266
|
list_files = [
|
212
267
|
".cnvrg/config.yml",
|
213
|
-
".cnvrgignore",
|
268
|
+
# ".cnvrgignore",
|
214
269
|
|
215
270
|
]
|
216
271
|
begin
|
@@ -219,11 +274,11 @@ module Cnvrg
|
|
219
274
|
owner: project_owner}
|
220
275
|
FileUtils.mkdir_p list_dirs
|
221
276
|
FileUtils.touch list_files
|
222
|
-
cnvrgignore = Helpers.cnvrgignore_content
|
277
|
+
# cnvrgignore = Helpers.cnvrgignore_content
|
223
278
|
|
224
279
|
|
225
280
|
File.open(".cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
226
|
-
File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore }
|
281
|
+
# File.open(".cnvrgignore", "w+") { |f| f.write cnvrgignore }
|
227
282
|
|
228
283
|
rescue
|
229
284
|
return false
|
@@ -299,7 +354,7 @@ module Cnvrg
|
|
299
354
|
def compare_idx(new_branch, commit=last_local_commit)
|
300
355
|
|
301
356
|
local_idx = self.generate_idx
|
302
|
-
ignore_list = self.
|
357
|
+
ignore_list = self.send_ignore_list()
|
303
358
|
response = Cnvrg::API.request("users/#{self.owner}/projects/#{self.slug}/status", 'POST', {idx: local_idx, new_branch: new_branch,
|
304
359
|
current_commit: commit,ignore:ignore_list})
|
305
360
|
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.0.
|
4
|
+
version: 0.0.1590000
|
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-08-
|
12
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|