dtk-client 0.10.0 → 0.10.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dtk-client.gemspec +2 -0
- data/lib/cli/version.rb +1 -1
- data/lib/client/operation/client_module_dir/git_repo.rb +31 -0
- data/lib/client/operation/module/install.rb +2 -1
- data/lib/client/operation/service/commit_and_push.rb +5 -28
- data/lib/client/operation/service/ssh.rb +2 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27c7da3e73bf4e15f1588363817bf3d31cce7eaa
|
4
|
+
data.tar.gz: 9b67c4994a0f8e4e4a2646fa18658f48d3c8a4f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed1c406eec37ae5326c0ec53e022168b380f2cf0e95c91c49017726883a1a0058d1e86f14da84f707b375fec1a8a78fb9cc430c0e71bf43314e7ae321b286420
|
7
|
+
data.tar.gz: d00b0993f3c444c435f0f1ddd1d4c7f23aeda34761fd689694ea087140902edc607b3390f2079edc396379d4a7f30b72adc8617253a20d570ca50b8ecc3e5df5
|
data/dtk-client.gemspec
CHANGED
data/lib/cli/version.rb
CHANGED
@@ -82,6 +82,13 @@ module DTK::Client
|
|
82
82
|
response_data_hash(:target_repo_dir => Internal.pull_from_remote(args))
|
83
83
|
end
|
84
84
|
end
|
85
|
+
|
86
|
+
def self.add_file(args)
|
87
|
+
wrap_operation(args) do |args|
|
88
|
+
response_data_hash(:repo => Internal.add_file(args))
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
85
92
|
|
86
93
|
def self.pull_from_service_repo(args)
|
87
94
|
wrap_operation(args) do |args|
|
@@ -276,6 +283,30 @@ module DTK::Client
|
|
276
283
|
repo.pull(Dtkn::GIT_REMOTE, remote_branch)
|
277
284
|
end
|
278
285
|
|
286
|
+
def self.add_file(args)
|
287
|
+
all_backup_file_paths = args.required(:backup_files).keys
|
288
|
+
final_path = args.required(:final_path)
|
289
|
+
if File.exists?(file_path = "#{final_path}/.gitignore")
|
290
|
+
has_backup = false
|
291
|
+
file = File.open(file_path, "r") do |f|
|
292
|
+
f.each_line do |line|
|
293
|
+
unless all_backup_file_paths.include?(line.strip)
|
294
|
+
write = File.open(file_path, "a")
|
295
|
+
write << line
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
else
|
300
|
+
File.open(".gitignore", "w") do |f|
|
301
|
+
all_backup_file_paths.each {|el| f.puts("#{el}\n")}
|
302
|
+
end
|
303
|
+
end
|
304
|
+
args[:backup_files].each_pair do |file_path, content|
|
305
|
+
File.open("#{final_path}/#{file_path}", "w") {|f| f.write(content)}
|
306
|
+
File.open("#{final_path}/dtk.service.yaml", "w") {|f| f.write(content)}
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
279
310
|
def self.git_repo
|
280
311
|
::DTK::Client::GitRepo
|
281
312
|
end
|
@@ -43,8 +43,9 @@ module DTK::Client
|
|
43
43
|
end
|
44
44
|
|
45
45
|
unless dependent_modules.empty?
|
46
|
-
OsUtil.print_info('Auto-importing
|
46
|
+
OsUtil.print_info('Auto-importing dependencies')
|
47
47
|
ExternalModule.install_dependent_modules(dependent_modules)
|
48
|
+
OsUtil.print_info("Successfully imported '#{@base_module_ref.namespace}:#{@base_module_ref.module_name}' version #{@base_module_ref.version}")
|
48
49
|
end
|
49
50
|
|
50
51
|
CommonModule.install(@base_module_ref, @file_obj)
|
@@ -70,36 +70,12 @@ module DTK::Client
|
|
70
70
|
def self.process_backup_files(response, opts = {})
|
71
71
|
backup_files = response.data(:backup_files) || {}
|
72
72
|
return if backup_files.empty?
|
73
|
-
|
74
73
|
service_instance_name = opts[:service_instance]
|
75
|
-
final_path = "#{OsUtil.dtk_local_folder}
|
76
|
-
|
77
|
-
|
78
|
-
if File.exists?(file_path = "#{final_path}/.gitignore")
|
79
|
-
has_backup = false
|
80
|
-
file = File.open(file_path, "r") do |f|
|
81
|
-
f.each_line do |line|
|
82
|
-
unless all_backup_file_paths.include?(line.strip)
|
83
|
-
write = File.open(file_path, "a")
|
84
|
-
write << line
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
else
|
89
|
-
File.open(".gitignore", "w") do |f|
|
90
|
-
all_backup_file_paths.each {|el| f.puts("#{el}\n")}
|
91
|
-
end
|
92
|
-
end
|
74
|
+
final_path = "#{OsUtil.dtk_local_folder}/#{service_instance_name}"
|
75
|
+
|
76
|
+
ClientModuleDir::GitRepo.add_file(:backup_files => backup_files, :final_path => final_path)
|
93
77
|
|
94
|
-
backup_files.each_pair do |file_path, content|
|
95
|
-
File.open("#{final_path}/#{file_path}", "a") {|f| f.write(content)}
|
96
|
-
File.open("#{final_path}/dtk.service.yaml", "w") {|f| f.write(content)}
|
97
|
-
# TODO: DTK-2663; write code that saves the content given by 'content' under 'file_path' which is a path relative to the service instance module.
|
98
|
-
end
|
99
78
|
response = ClientModuleDir::GitRepo.commit_and_push_to_service_repo(opts[:args])
|
100
|
-
|
101
|
-
# TODO: DTK-2663; write code that creates or updates .gitignore so that each file in all_backup_file_paths is aline in gitignore
|
102
|
-
# TODO: write code that commits these changes to the service instance module.
|
103
79
|
end
|
104
80
|
|
105
81
|
def self.process_semantic_diffs(response)
|
@@ -108,7 +84,8 @@ module DTK::Client
|
|
108
84
|
# TODO: DTK-2663; cleanup so pretty printed'
|
109
85
|
OsUtil.print_info("\nDiffs that were pushed:")
|
110
86
|
# TODO: get rid of use of STDOUT
|
111
|
-
STDOUT << hash_to_yaml(semantic_diffs).gsub("---\n", "")
|
87
|
+
#STDOUT << hash_to_yaml(semantic_diffs).gsub("---\n", "")
|
88
|
+
OsUtil.print(hash_to_yaml(semantic_diffs).gsub("---\n", ""))
|
112
89
|
end
|
113
90
|
|
114
91
|
PRINT_FN = {
|
@@ -108,9 +108,9 @@ module DTK::Client
|
|
108
108
|
raise Error::Usage, "No public key access or PEM provided, please grant access or provide valid PEM key"
|
109
109
|
end
|
110
110
|
|
111
|
-
OsUtil.
|
111
|
+
OsUtil.print_info("You are entering SSH terminal (#{connection_string}) ...")
|
112
112
|
Kernel.system(ssh_command)
|
113
|
-
OsUtil.
|
113
|
+
OsUtil.print_info("You are leaving SSH terminal, and returning to DTK Shell ...")
|
114
114
|
end
|
115
115
|
|
116
116
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtk-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.0
|
4
|
+
version: 0.10.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reactor8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dtk-common-core
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.7.3
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: mime-types
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.99.3
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.99.3
|
97
111
|
description: Command line tool to interact with a DTK Server and DTK Service Catalog.
|
98
112
|
email: support@reactor8.com
|
99
113
|
executables:
|