dtk-network-client 1.0.2 → 1.0.2.1

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: 6069940b8ecc824b0299134430a145129da1c280
4
- data.tar.gz: 7ed0dbd9e76fe0651db5e92683078c11db7b8411
3
+ metadata.gz: f1ff40ca24da3d17fc294c77cbed86bb7e479e03
4
+ data.tar.gz: a6cd9e86c645434e2a4951927a152e709151eb2c
5
5
  SHA512:
6
- metadata.gz: 011c0fb261444f334079b68d7330bd8a04dd84c1ae791e1db35df7584908f6d67f0ef40d7ebb5421622e92d3ab2659c866639464251e0baa7f3b92390b77e5f5
7
- data.tar.gz: 64c5ec2c1516fb0e32e2b1655a4954fd1fda1ae0d9662e4d1a603a71d48874562f87628bb8d03dd1a6e425cf7a92487808a09f69bc6500863c9b2cce96b63b23
6
+ metadata.gz: 1fac71eae8b356c399112583fd573fcad603789a55437fc25156946fb8e05ab56e128ba2afeab5d8195de70d0d7c380057d7db0b63a30e7953958a9308deade1
7
+ data.tar.gz: d79b3d329737bdae2db3d11c0e96355f8c443b7dfb6ba8d3bdc3ed7de910060840b47d3f9f8e6fb46829903331d66cf8f2b03b48fc8fba7ce2f0154f81c879bc
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.require_paths = ['lib']
15
15
  spec.files = `git ls-files`.split("\n")
16
16
 
17
- spec.add_dependency 'git', '1.2.9'
17
+ spec.add_dependency 'git', '1.4.0'
18
18
  spec.add_dependency 'semverly', '~> 1.0'
19
19
  spec.add_dependency 'rest-client', '~> 1.7.3'
20
20
  # spec.add_dependency 'aws-sdk', '~> 3'
@@ -32,7 +32,6 @@ module DTK::Network::Client
32
32
 
33
33
  (modules_info || []).each do |module_info|
34
34
  dep_module_list = module_info['module_list']
35
- # credentials = module_info.dig('credentails', 'credentials')
36
35
  credentials = (module_info['credentails']||{})['credentials']
37
36
 
38
37
  raise Error.new('Unexpected that repoman did not return any credentials') unless credentials
@@ -82,7 +81,6 @@ module DTK::Network::Client
82
81
  end
83
82
 
84
83
  ModuleDir.create_file_with_content("#{module_location}/#{DependencyTree::LOCK_FILE}", YAML.dump(convert_to_module_ref_lock_format(@dependency_tree)))
85
- # print "Main module installed in '#{module_location}'.\n"
86
84
  end
87
85
 
88
86
  def ret_main_module_install_info(modules_info = [])
@@ -96,7 +94,6 @@ module DTK::Network::Client
96
94
 
97
95
  if main_module_info
98
96
  module_list.delete(main_module_info)
99
- # credentials = module_info.dig('credentails', 'credentials')
100
97
  credentials = (module_info['credentails']||{})['credentials']
101
98
  main_module_info.merge!('credentials' => credentials)
102
99
  end
@@ -122,7 +119,6 @@ module DTK::Network::Client
122
119
 
123
120
  FileUtils.mkdir_p(install_location)
124
121
  `tar xC #{install_location} -f #{object_location_on_disk}`
125
- # ModuleDir.ungzip_and_untar(object_location_on_disk, install_location)
126
122
  FileUtils.remove_entry(object_location_on_disk)
127
123
 
128
124
  @ret << module_info.merge(location: install_location)
@@ -147,7 +143,6 @@ module DTK::Network::Client
147
143
  bucket = nil
148
144
  object_name = nil
149
145
 
150
- # if meta = module_info['meta']
151
146
  if catalog_uri = module_info['uri']
152
147
  if match = catalog_uri.match(/.*amazonaws.com\/([^\/]*)\/(.*.gz)/)
153
148
  bucket = match[1]
@@ -205,7 +200,6 @@ module DTK::Network::Client
205
200
  end
206
201
 
207
202
  lock_format
208
- # dep_tree.inject({}) { |h, dep| h.merge!({ "#{dep[:namespace]}/#{dep[:name]}" => { 'version' => (dep[:version] || dep['version']), 'modules' => (dep[:modules] || dep['modules']) }})}
209
203
  end
210
204
  end
211
205
  end
@@ -41,13 +41,9 @@ module DTK::Network::Client
41
41
  module_id = module_info['id']
42
42
  module_ref_version = @module_ref.version
43
43
  branch = rest_post("modules/#{module_id}/branch", { version: module_ref_version.str_version, dependencies: dependencies.to_json })
44
- # repo_url = ret_codecommit_url(module_info)
45
-
46
- # git_init_and_publish_to_remote(branch['name'], repo_url)
47
44
 
48
45
  published_response = rest_post("modules/#{module_id}/publish", { version: module_ref_version.str_version })
49
46
  bucket, object_name = S3Helper.ret_s3_bucket_info(published_response)
50
- # gz_body = ModuleDir.create_and_ret_tar_gz(@module_directory, exclude_git: true)
51
47
 
52
48
  resource_name = object_name.gsub('/','__')
53
49
  published_creds = published_response['publish_credentails']
@@ -61,17 +57,10 @@ module DTK::Network::Client
61
57
  session_token: published_creds['session_token']
62
58
  })
63
59
  s3 = Aws::S3::Resource.new(s3_args)
64
- # storage = Storage.new(:s3, s3_args)
65
60
 
66
61
  obj = s3.bucket(bucket).object(object_name)
67
62
  obj.upload_file("/tmp/#{resource_name}")
68
63
  FileUtils.remove_entry("/tmp/#{resource_name}")
69
- # upload_args = Args.new({
70
- # body: gz_body,
71
- # bucket: bucket,
72
- # key: object_name
73
- # })
74
- # storage.upload(upload_args)
75
64
 
76
65
  rest_post("modules/update_status", { branch_id: branch['id'], status: 'published' })
77
66
  end
@@ -21,9 +21,15 @@ module DTK::Network::Client
21
21
  git_args = Args.new({
22
22
  repo_dir: @module_directory,
23
23
  branch: @module_ref.version.str_version,
24
- remote_url: remote_url
24
+ remote_url: remote_url,
25
+ force: @options[:force]
25
26
  })
26
- GitRepo.push_to_remote(git_args)
27
+
28
+ begin
29
+ GitRepo.push_to_remote(git_args)
30
+ rescue Git::GitExecuteError => e
31
+ raise "Unable to do fast-forward push. You can use '--force' option to force push you changes to remote!"
32
+ end
27
33
 
28
34
  dependencies = []
29
35
  if @parsed_module
@@ -53,7 +53,6 @@ module DTK::Network
53
53
  def compute
54
54
  dependencies = (ret_dependencies || []).map do |pm_ref|
55
55
  ModuleRef::Dependency.create_local_or_remote(pm_ref)
56
- # ModuleRef::Dependency.new({ name: pm_ref['module'], namespace: pm_ref['namespace'], version: pm_ref['version'] })
57
56
  end
58
57
 
59
58
  activate_dependencies(dependencies)
@@ -274,7 +273,7 @@ module DTK::Network
274
273
  matches_source = (source == top_level_dependency['source'])
275
274
 
276
275
  if yaml_dep = module_yaml_dependencies[nd_name]
277
- matches_version_new = module_ref_version.satisfied_by?(yaml_dep['version'])
276
+ matches_version_new = module_ref_version.satisfied_by?(yaml_dep['version']) || module_ref_version.full_version == yaml_dep['version']
278
277
  matches_source_new = (source == yaml_dep['source'])
279
278
  next if (matches_version_new && matches_source_new)
280
279
  end
@@ -26,6 +26,7 @@ module DTK::Network::Client
26
26
  remote_branch = git_args[:remote_branch] || local_branch
27
27
  remote = git_args[:remote] || 'origin'
28
28
  commit_msg = git_args[:commit_msg] || "Push from dtkn client"
29
+ force = git_args[:force]
29
30
 
30
31
  repo = git_repo.new(repo_dir, :branch => local_branch)
31
32
  create_if_missing = local_branch_exist?(repo, local_branch) ? false : git_args[:create_if_missing]
@@ -35,9 +36,9 @@ module DTK::Network::Client
35
36
  repo.commit(commit_msg, :allow_empty => true)
36
37
 
37
38
  if repo.is_there_remote?(remote)
38
- push_when_there_is_remote(repo, remote, remote_url, remote_branch)
39
+ push_when_there_is_remote(repo, remote, remote_url, remote_branch, { force: force })
39
40
  else
40
- add_remote_and_push(repo, remote, remote_url, remote_branch)
41
+ add_remote_and_push(repo, remote, remote_url, remote_branch, { force: force })
41
42
  end
42
43
  end
43
44
  end
@@ -83,9 +84,9 @@ module DTK::Network::Client
83
84
  repo.fetch(remote_name)
84
85
  end
85
86
 
86
- def self.push_when_there_is_remote(repo, remote, remote_url, remote_branch)
87
+ def self.push_when_there_is_remote(repo, remote, remote_url, remote_branch, opts = {})
87
88
  repo.remove_remote(remote)
88
- add_remote_and_push(repo, remote, remote_url, remote_branch)
89
+ add_remote_and_push(repo, remote, remote_url, remote_branch, opts)
89
90
  end
90
91
 
91
92
  def self.pull_when_there_is_remote(repo, remote, remote_url, remote_branch)
@@ -93,9 +94,9 @@ module DTK::Network::Client
93
94
  add_remote_and_pull(repo, remote, remote_url, remote_branch)
94
95
  end
95
96
 
96
- def self.add_remote_and_push(repo, remote, remote_url, remote_branch)
97
+ def self.add_remote_and_push(repo, remote, remote_url, remote_branch, opts = {})
97
98
  repo.add_remote(remote, remote_url)
98
- repo.push(remote, remote_branch)
99
+ repo.push(remote, remote_branch, opts)
99
100
  end
100
101
 
101
102
  def self.add_remote_and_pull(repo, remote, remote_url, remote_branch)
@@ -1,7 +1,7 @@
1
1
  module DTK
2
2
  module Network
3
3
  module Client
4
- VERSION="1.0.2"
4
+ VERSION="1.0.2.1"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtk-network-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reactor8
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-07 00:00:00.000000000 Z
11
+ date: 2018-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.9
19
+ version: 1.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.9
26
+ version: 1.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: semverly
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  version: '0'
177
177
  requirements: []
178
178
  rubyforge_project:
179
- rubygems_version: 2.4.1
179
+ rubygems_version: 2.6.11
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: Library for interaction with dtk network.