cnvrg 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb4b853a67475534a61610e890c94802f3b39c3b
4
- data.tar.gz: adc7c333392de2f38b0312a44486bbc407f96595
3
+ metadata.gz: 17942c336608306042bc9744c306d7761dc7e641
4
+ data.tar.gz: 3e931700b1a8c96abf593077d585980fcb89afc1
5
5
  SHA512:
6
- metadata.gz: 8b4e0264f34a93148eb9050c5ac6d49803551ca8fa6f7c42a08f8ca3538b5d25244834489083620f46977ca162e835320d7f4bea13a09cd32c28de05f946c283
7
- data.tar.gz: c110cdf4315e1c723b4724e7d8c1fbdef3034467e0f917b4ad3aa06c05e2f9faa167a6c4564358af218f42824df4376582e231abbca5fd2b5621c90793cf71e4
6
+ metadata.gz: 64ae69b8efac75486edc8911f99db1c5563c84e38f2eeb33e0dcc24b75ae470782b7a3352c4b8f4e7aaf6dae3261ec71b2bd287963c396998dd1e0e876fd41d7
7
+ data.tar.gz: 2fecd443628c87027559088293215ef007d144a5b9dd7aef3a1ff791f3391b33f4e4b426f2b890f32a60d31ec352f2e1c0851ef8b5c1a32fd3f671b575e8cf37
data/lib/cnvrg/cli.rb CHANGED
@@ -1234,9 +1234,10 @@ module Cnvrg
1234
1234
  exit(1)
1235
1235
  end
1236
1236
  log_message("Checking dataset", Thor::Shell::Color::BLUE)
1237
- local_idx = @dataset.generate_idx
1238
- result = @dataset.compare_idx(false, commit=@dataset.last_local_commit, local_idx= local_idx)
1237
+ ignore_list = @dataset.get_ignore_list()
1238
+ local_idx = @dataset.generate_idx(ignore_list)
1239
1239
 
1240
+ result = @dataset.compare_idx(false, commit=@dataset.last_local_commit, local_idx= local_idx)
1240
1241
 
1241
1242
  commit = result["result"]["commit"]
1242
1243
  if commit != @dataset.last_local_commit and !@dataset.last_local_commit.nil? and !result["result"]["tree"]["updated_on_server"].empty?
@@ -1287,11 +1288,18 @@ module Cnvrg
1287
1288
  tar_files_path = "#{home_dir}/.cnvrg/tmp/#{@dataset.slug}_#{commit_sha1}.txt"
1288
1289
  tar_files = (result["added"] + result["updated_on_local"]).join("\n")
1289
1290
  File.open(tar_files_path, 'w') { |f| f.write tar_files }
1290
- is_tar = create_tar(dataset_dir, tar_path, tar_files_path, no_compression)
1291
+ ignore_files_path = nil
1292
+ if !ignore_list.nil?
1293
+ ignore_files_path = "#{home_dir}/.cnvrg/tmp/#{@dataset.slug}_#{commit_sha1}_ignore.txt"
1294
+ File.open(ignore_files_path, 'w') { |f| f.write ignore_list.join("\n") }
1295
+ end
1296
+ is_tar = create_tar(dataset_dir, tar_path, tar_files_path, no_compression,ignore_files_path)
1291
1297
  if !is_tar
1292
1298
  log_message("ERROR: Couldn't compress data", Thor::Shell::Color::RED)
1293
1299
  FileUtils.rm_rf([tar_path]) if File.exist? tar_path
1294
1300
  FileUtils.rm_rf([tar_files_path]) if File.exist? tar_files_path
1301
+ FileUtils.rm_rf([ignore_files_path]) if !ignore_files_path.nil? and File.exist? ignore_files_path
1302
+
1295
1303
  @files.rollback_commit(commit_sha1)
1296
1304
  log_message("Rolling Back all changes.", Thor::Shell::Color::RED)
1297
1305
  exit(1)
@@ -5548,13 +5556,17 @@ module Cnvrg
5548
5556
  return $?.success?
5549
5557
  end
5550
5558
 
5551
- def create_tar(path_in, path_out, tar_files, no_compression=false)
5559
+ def create_tar(path_in, path_out, tar_files, no_compression=false,ignore_files_path)
5552
5560
  #The cd is meant for cases when running cnvrg data uplaod not in the main folder
5553
5561
  begin
5562
+ ignore=""
5563
+ if !ignore_files_path.nil?
5564
+ ignore="--exclude-from=#{ignore_files_path}"
5565
+ end
5554
5566
  if no_compression
5555
- `cd #{path_in} && tar -cf #{path_out} -T #{tar_files}`
5567
+ `cd #{path_in} && tar -cf #{path_out} -T #{tar_files} #{ignore}`
5556
5568
  else
5557
- `cd #{path_in} && tar -czf #{path_out} -T #{tar_files}`
5569
+ `cd #{path_in} && tar -czf #{path_out} -T #{tar_files} #{ignore}`
5558
5570
  end
5559
5571
  rescue => e
5560
5572
  puts "Exception while compressing data: #{e.message}"
data/lib/cnvrg/dataset.rb CHANGED
@@ -178,7 +178,7 @@ module Cnvrg
178
178
  url = Cnvrg::Helpers.remote_url
179
179
  "#{url}/#{self.owner}/datasets/#{self.slug}"
180
180
  end
181
- def generate_idx
181
+ def generate_idx(list_ignore)
182
182
  if File.exists? "#{self.local_path}/.cnvrg/idx.yml"
183
183
  old_idx = YAML.load_file("#{self.local_path}/.cnvrg/idx.yml")
184
184
  else
@@ -188,7 +188,10 @@ module Cnvrg
188
188
  tree_idx = Hash.new(0)
189
189
 
190
190
  list = Dir.glob("#{self.local_path}/**/**", File::FNM_DOTMATCH).reject { |x| (x =~ /\/\.{1,2}$/) or (x =~ /^#{self.local_path}\/\.cnvrg\/*/) }
191
+ if list_ignore.nil?
191
192
  list_ignore = self.get_ignore_list()
193
+ end
194
+
192
195
  list.each do |e|
193
196
  label = e.gsub(self.local_path + "/", "")
194
197
  if File.directory? e
data/lib/cnvrg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Cnvrg
2
- VERSION = '0.2.9'
2
+ VERSION = '0.3.0'
3
3
  end
4
4
 
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.9
4
+ version: 0.3.0
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: 2018-01-14 00:00:00.000000000 Z
12
+ date: 2018-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler