cnvrg 0.0.10 → 0.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5356c9b6d15b9420d34a2de292ff4f4603cba459
4
- data.tar.gz: 3551dd77cb7f4a530be06e362d4775abf9f68ede
3
+ metadata.gz: 745fd9b806d9e5d46b4ba24212e06f5a426447f3
4
+ data.tar.gz: c950e20258da5c1243765572b6b7f4c93d0cad1a
5
5
  SHA512:
6
- metadata.gz: a151a8e04c64d7e5950ac3b2673deb0a1c4785b2742831ab676865988cddf88a94d9c115c73206ee37151652d1687bb3edb217d4eed1c5c55c217931fdbc4aad
7
- data.tar.gz: b96a3fba90aece28aef6b494db1624e5ffd2f4dc934657f19fb38c9f14e470c4b1f4a50c5948e8131c65fcabb66550a60d223ce59af7e6cfb417bd96f1a76652
6
+ metadata.gz: f60cd3a8cbb4d9bb6c53beac4faf0b76d5db9db469e4474dabe36787985b7d601a07d0029dcb797b7ede238ec2fa3e96beaaa56497b39fc05380dd05f54981fb
7
+ data.tar.gz: 6587fe66cf021518dc9249a3c0eb936ccfb126b51b6b6cc605d1e44b09cbee30b55bb590cc7420bec05951077d63f452bb9a88a7466a78bd1281d51ccd334b1f
@@ -235,7 +235,14 @@ module Cnvrg
235
235
  # docker_image_local = local_images.map{|x| x.info["RepoTags"]}.select{|y| y[0].include? docker_image}.flatten
236
236
  # if docker_image_local.size == 0
237
237
  # if yes? "Image wasn't found locally, pull image from cnvrg repository?"
238
- # pull_image(docker_image)
238
+ # image = pull_image(docker_image)
239
+ # if image
240
+ # say "downloaded image: #{docker_image_local[0]}, creating a container.."
241
+ # @container = Docker::Container.create('Image' => '#{docker_image_local[0]}')
242
+ # if @container.nil?
243
+ # say "could not create container with image #{docker_image_local[0]}"
244
+ # end
245
+ # end
239
246
  # else
240
247
  # say "Could not create a new project with docker, image was not found", Thor::Shell::Color::RED
241
248
  # exit(1)
@@ -243,14 +250,12 @@ module Cnvrg
243
250
  # end
244
251
  # elsif docker_image_local.size == 1
245
252
  # say "found image: #{docker_image_local[0]}, creating a container.."
246
- # container = Docker::Container.create('Image' => '#{docker_image_local[0]}')
247
- #
248
- #
249
- #
250
- #
253
+ # @container = Docker::Container.create('Image' => '#{docker_image_local[0]}')
254
+ # if @container.nil?
255
+ # say "could not create container with image #{docker_image_local[0]}"
256
+ # end
251
257
  #
252
258
  # end
253
- pull_image(docker_image)
254
259
  end
255
260
  say "Creating #{project_name}", Thor::Shell::Color::BLUE
256
261
  if Dir.exists? project_name or File.exists? project_name
@@ -281,7 +286,7 @@ module Cnvrg
281
286
  exit(1)
282
287
  end
283
288
  end
284
-
289
+
285
290
 
286
291
 
287
292
  desc 'link', 'Link current directory to a cnvrg project'
@@ -1158,22 +1163,23 @@ module Cnvrg
1158
1163
 
1159
1164
  end
1160
1165
  end
1161
- path = Dir.pwd+"/#{owner}_#{image_name}.tar.gz"
1166
+ path = Dir.pwd+"/#{image_name}.tar.gz"
1162
1167
  @files = Cnvrg::Files.new(owner, "")
1163
1168
 
1164
1169
  say "Downloading image file", Thor::Shell::Color::BLUE
1165
1170
  begin
1166
- res = @files.download_image(path, image_id, owner)
1167
- if res
1168
- checks = Helpers.checkmark()
1169
- say "#{checks} Done", Thor::Shell::Color::GREEN
1170
- log_end(0)
1171
- return true
1172
- else
1173
- say "Couldn't download image #{image_name}", Thor::Shell::Color::RED
1174
- log_end(1,"can't download image")
1175
- return false
1176
- end
1171
+ image_path = @files.download_image(path, image_id, owner)
1172
+ return image_path
1173
+ # if res
1174
+ # checks = Helpers.checkmark()
1175
+ # say "#{checks} Done", Thor::Shell::Color::GREEN
1176
+ # log_end(0)
1177
+ # return true
1178
+ # else
1179
+ # say "Couldn't download image #{image_name}", Thor::Shell::Color::RED
1180
+ # log_end(1,"can't download image")
1181
+ # return false
1182
+ # end
1177
1183
  rescue Interrupt
1178
1184
  log_end(-1)
1179
1185
  say "The user has exited to process, aborting", Thor::Shell::Color::BLUE
@@ -1224,15 +1230,16 @@ module Cnvrg
1224
1230
  verify_logged_in(false)
1225
1231
  log_start(__method__,args,options)
1226
1232
 
1227
- if download_image(image_name)
1228
- path = Dir.pwd+"/#{owner}_#{image_name}.tar.gz"
1229
- loadRes = system("docker load < #{path}")
1230
- if loadRes.include? "Loaded image"
1231
- say loadRes, Thor::Shell::Color::GREEN
1233
+ path = download_image(image_name)
1234
+ if path
1235
+ image = Docker::Image.import(path)
1236
+ if not image.nil?
1237
+ return image
1232
1238
  log_end(0)
1233
1239
  else
1234
- say loadRes, Thor::Shell::Color::RED
1240
+ say "Could not download image", Thor::Shell::Color::RED
1235
1241
  log_end(1,loadRes)
1242
+ retunr false
1236
1243
  end
1237
1244
 
1238
1245
  end
@@ -86,15 +86,15 @@ module Cnvrg
86
86
  path = download_resp["result"]["path"]
87
87
 
88
88
  if Cnvrg::CLI.is_response_success(download_resp, false)
89
- begin
90
- open(file_path_to_store, 'wb') do |file|
91
- file << open(path).read
92
- end
93
- rescue
94
- return false
95
- end
96
-
97
- return true
89
+ # begin
90
+ # open(file_path_to_store, 'wb') do |file|
91
+ # file << open(path).read
92
+ # end
93
+ # rescue
94
+ # return false
95
+ # end
96
+
97
+ return path
98
98
  else
99
99
  return false
100
100
  end
@@ -1,7 +1,6 @@
1
1
  require 'mimemagic'
2
2
  require 'aws-sdk'
3
3
  require 'URLcrypt'
4
- require 'pry'
5
4
 
6
5
  require 'sucker_punch'
7
6
  module Cnvrg
@@ -1,4 +1,4 @@
1
1
  module Cnvrg
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
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.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yochay Ettun