cnvrg 0.0.4 → 0.0.5
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 +1 -1
- data/lib/cnvrg/cli.rb +19 -6
- data/lib/cnvrg/files.rb +1 -1
- 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: d03fefa80d9bf903d426a4881be28f77bcc4d97a
|
4
|
+
data.tar.gz: eb27c1b447f2cb7da15157676e9e1f458f4fa9de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c01b9e13f6e99323da1fec7b9430c8c6c628fabe55cd2bc257a4f1ad11f902091e65b719cf72af810353316078bae5aef4f373199298d5e23603b4789f4b2339
|
7
|
+
data.tar.gz: 192c3cba43713c61b1592ceb36975390e79162a42833a0e0cfb227329cb73ce0c1f0954f05bd9186727baf0a8143a7036823ceab890352efae9938fa03363cf9
|
data/lib/cnvrg/api.rb
CHANGED
@@ -7,7 +7,7 @@ require 'cnvrg/helpers'
|
|
7
7
|
module Cnvrg
|
8
8
|
class API
|
9
9
|
USER_AGENT = "CnvrgCLI/#{Cnvrg::VERSION}"
|
10
|
-
#ENDPOINT = 'http://localhost:3000/api'
|
10
|
+
# ENDPOINT = 'http://localhost:3000/api'
|
11
11
|
ENDPOINT = 'https://cnvrg.io/api'
|
12
12
|
ENDPOINT_VERSION = 'v1'
|
13
13
|
URL = "#{ENDPOINT}/#{ENDPOINT_VERSION}"
|
data/lib/cnvrg/cli.rb
CHANGED
@@ -17,6 +17,8 @@ require 'cnvrg/auth'
|
|
17
17
|
require 'cnvrg/project'
|
18
18
|
require 'cnvrg/files'
|
19
19
|
require 'cnvrg/experiment'
|
20
|
+
require 'etc'
|
21
|
+
|
20
22
|
# DEV VERSION
|
21
23
|
#
|
22
24
|
module Cnvrg
|
@@ -32,7 +34,15 @@ module Cnvrg
|
|
32
34
|
desc 'set default owner', 'set default owner'
|
33
35
|
|
34
36
|
def set_default_owner
|
35
|
-
|
37
|
+
|
38
|
+
path = File.expand_path('~')+"/.cnvrg/config.yml"
|
39
|
+
if !File.exist?(path)
|
40
|
+
say "Couldn't find ~/.cnvrg/config.yml file, please logout and login again" ,Thor::Shell::Color::RED
|
41
|
+
|
42
|
+
exit(0)
|
43
|
+
end
|
44
|
+
config = YAML.load_file(path)
|
45
|
+
|
36
46
|
username = config.to_h[:username]
|
37
47
|
res = Cnvrg::API.request("/users/#{username}/get_possible_owners", 'GET')
|
38
48
|
if Cnvrg::CLI.is_response_success(res)
|
@@ -631,15 +641,17 @@ module Cnvrg
|
|
631
641
|
|
632
642
|
no_tasks do
|
633
643
|
def set_owner(owner, username)
|
644
|
+
home_dir = File.expand_path('~')
|
645
|
+
|
634
646
|
begin
|
635
|
-
if !File.directory? "
|
636
|
-
FileUtils.mkdir_p("
|
647
|
+
if !File.directory? home_dir+"/.cnvrg"
|
648
|
+
FileUtils.mkdir_p(home_dir+"/.cnvrg")
|
637
649
|
end
|
638
|
-
if !File.exist?("
|
639
|
-
FileUtils.touch ["
|
650
|
+
if !File.exist?(home_dir+"/.cnvrg/config.yml")
|
651
|
+
FileUtils.touch [home_dir+"/.cnvrg/config.yml"]
|
640
652
|
end
|
641
653
|
config = {owner: owner, username: username}
|
642
|
-
File.open("
|
654
|
+
File.open(home_dir+"/.cnvrg/config.yml", "w+") { |f| f.write config.to_yaml }
|
643
655
|
return true
|
644
656
|
rescue
|
645
657
|
return false
|
@@ -674,6 +686,7 @@ module Cnvrg
|
|
674
686
|
end
|
675
687
|
|
676
688
|
def self.is_response_success(response, should_exit=true)
|
689
|
+
puts response
|
677
690
|
if response["status"]!= 200
|
678
691
|
error = response['message']
|
679
692
|
if response["status"] == 500
|
data/lib/cnvrg/files.rb
CHANGED
@@ -14,7 +14,7 @@ module Cnvrg
|
|
14
14
|
file_name = File.basename relative_path
|
15
15
|
file_size = File.size(relative_path).to_f
|
16
16
|
mime_type = MimeMagic.by_path(relative_path)
|
17
|
-
content_type = !mime_type.nil? ? mime_type.type : ""
|
17
|
+
content_type = !mime_type.nil? ? mime_type.type : "text/plain"
|
18
18
|
upload_resp = Cnvrg::API.request(@base_resource + "upload_file", 'POST_FILE', { absolute_path: absolute_path, relative_path: relative_path,
|
19
19
|
commit_sha1: commit_sha1, file_name: file_name ,
|
20
20
|
file_size:file_size,file_content_type:content_type})
|
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.5
|
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: 2016-12-
|
12
|
+
date: 2016-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
230
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.5.
|
231
|
+
rubygems_version: 2.5.1
|
232
232
|
signing_key:
|
233
233
|
specification_version: 4
|
234
234
|
summary: A CLI tool for interacting with cnvrg.io.
|