dtk-shell 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +5 -0
  3. data/Gemfile_dev +13 -0
  4. data/README.md +121 -0
  5. data/bin/dtk-execute +32 -0
  6. data/bin/dtk-run +92 -0
  7. data/bin/dtk-shell +31 -0
  8. data/dtk-shell.gemspec +50 -0
  9. data/lib/auxiliary.rb +61 -0
  10. data/lib/bundler_monkey_patch.rb +26 -0
  11. data/lib/client.rb +58 -0
  12. data/lib/command_helper.rb +33 -0
  13. data/lib/command_helpers/git_repo.rb +589 -0
  14. data/lib/command_helpers/git_repo/merge.rb +153 -0
  15. data/lib/command_helpers/jenkins_client.rb +106 -0
  16. data/lib/command_helpers/jenkins_client/config_xml.rb +288 -0
  17. data/lib/command_helpers/service_importer.rb +251 -0
  18. data/lib/command_helpers/service_link.rb +33 -0
  19. data/lib/command_helpers/test_module_creator.rb +69 -0
  20. data/lib/command_helpers/test_module_templates/dtk.model.yaml.eruby +10 -0
  21. data/lib/command_helpers/test_module_templates/spec_helper.rb.eruby +10 -0
  22. data/lib/command_helpers/test_module_templates/temp_component_spec.rb.eruby +5 -0
  23. data/lib/commands.rb +57 -0
  24. data/lib/commands/common/thor/access_control.rb +133 -0
  25. data/lib/commands/common/thor/action_result_handler.rb +74 -0
  26. data/lib/commands/common/thor/assembly_template.rb +92 -0
  27. data/lib/commands/common/thor/assembly_workspace.rb +1801 -0
  28. data/lib/commands/common/thor/base_command_helper.rb +59 -0
  29. data/lib/commands/common/thor/clone.rb +82 -0
  30. data/lib/commands/common/thor/common.rb +88 -0
  31. data/lib/commands/common/thor/common_base.rb +49 -0
  32. data/lib/commands/common/thor/create_target.rb +70 -0
  33. data/lib/commands/common/thor/edit.rb +255 -0
  34. data/lib/commands/common/thor/inventory_parser.rb +98 -0
  35. data/lib/commands/common/thor/list_diffs.rb +128 -0
  36. data/lib/commands/common/thor/module.rb +1011 -0
  37. data/lib/commands/common/thor/module/import.rb +210 -0
  38. data/lib/commands/common/thor/node.rb +53 -0
  39. data/lib/commands/common/thor/poller.rb +65 -0
  40. data/lib/commands/common/thor/pull_clone_changes.rb +28 -0
  41. data/lib/commands/common/thor/pull_from_remote.rb +152 -0
  42. data/lib/commands/common/thor/puppet_forge.rb +72 -0
  43. data/lib/commands/common/thor/purge_clone.rb +101 -0
  44. data/lib/commands/common/thor/push_clone_changes.rb +162 -0
  45. data/lib/commands/common/thor/push_to_remote.rb +94 -0
  46. data/lib/commands/common/thor/remotes.rb +71 -0
  47. data/lib/commands/common/thor/reparse.rb +40 -0
  48. data/lib/commands/common/thor/set_required_attributes.rb +46 -0
  49. data/lib/commands/thor/account.rb +239 -0
  50. data/lib/commands/thor/assembly.rb +356 -0
  51. data/lib/commands/thor/attribute.rb +79 -0
  52. data/lib/commands/thor/component.rb +70 -0
  53. data/lib/commands/thor/component_module.rb +501 -0
  54. data/lib/commands/thor/component_template.rb +174 -0
  55. data/lib/commands/thor/dependency.rb +34 -0
  56. data/lib/commands/thor/developer.rb +144 -0
  57. data/lib/commands/thor/dtk.rb +152 -0
  58. data/lib/commands/thor/library.rb +125 -0
  59. data/lib/commands/thor/node.rb +504 -0
  60. data/lib/commands/thor/node_template.rb +94 -0
  61. data/lib/commands/thor/project.rb +34 -0
  62. data/lib/commands/thor/provider.rb +233 -0
  63. data/lib/commands/thor/remotes.rb +49 -0
  64. data/lib/commands/thor/service.rb +941 -0
  65. data/lib/commands/thor/service_module.rb +914 -0
  66. data/lib/commands/thor/state_change.rb +25 -0
  67. data/lib/commands/thor/target.rb +250 -0
  68. data/lib/commands/thor/task.rb +116 -0
  69. data/lib/commands/thor/test_module.rb +310 -0
  70. data/lib/commands/thor/utils.rb +21 -0
  71. data/lib/commands/thor/workspace.rb +685 -0
  72. data/lib/config/cacert.pem +3785 -0
  73. data/lib/config/client.conf.header +20 -0
  74. data/lib/config/configuration.rb +99 -0
  75. data/lib/config/default.conf +16 -0
  76. data/lib/config/disk_cacher.rb +80 -0
  77. data/lib/configurator.rb +176 -0
  78. data/lib/context_router.rb +44 -0
  79. data/lib/core.rb +497 -0
  80. data/lib/domain/git_adapter.rb +412 -0
  81. data/lib/domain/git_error_handler.rb +64 -0
  82. data/lib/domain/response.rb +285 -0
  83. data/lib/domain/response/error_handler.rb +86 -0
  84. data/lib/dtk-shell/version.rb +20 -0
  85. data/lib/dtk_constants.rb +40 -0
  86. data/lib/dtk_error.rb +114 -0
  87. data/lib/dtk_logger.rb +126 -0
  88. data/lib/dtk_shell.rb +31 -0
  89. data/lib/error.rb +85 -0
  90. data/lib/execute.rb +29 -0
  91. data/lib/execute/cli_pure/cli_rerouter.rb +102 -0
  92. data/lib/execute/command.rb +40 -0
  93. data/lib/execute/command/api_call.rb +60 -0
  94. data/lib/execute/command/api_call/map.rb +60 -0
  95. data/lib/execute/command/api_call/service.rb +91 -0
  96. data/lib/execute/command/api_call/translation_term.rb +119 -0
  97. data/lib/execute/command/rest_call.rb +37 -0
  98. data/lib/execute/command_processor.rb +30 -0
  99. data/lib/execute/command_processor/rest_call.rb +59 -0
  100. data/lib/execute/error_usage.rb +21 -0
  101. data/lib/execute/execute_context.rb +86 -0
  102. data/lib/execute/execute_context/result_store.rb +37 -0
  103. data/lib/execute/script.rb +64 -0
  104. data/lib/execute/script/add_tenant.rb +121 -0
  105. data/lib/git-logs/git.log +0 -0
  106. data/lib/parser/adapters/option_parser.rb +70 -0
  107. data/lib/parser/adapters/thor.rb +555 -0
  108. data/lib/parser/adapters/thor/common_option_defs.rb +40 -0
  109. data/lib/require_first.rb +104 -0
  110. data/lib/search_hash.rb +44 -0
  111. data/lib/shell.rb +261 -0
  112. data/lib/shell/context.rb +1065 -0
  113. data/lib/shell/context_aux.rb +46 -0
  114. data/lib/shell/domain/active_context.rb +186 -0
  115. data/lib/shell/domain/context_entity.rb +89 -0
  116. data/lib/shell/domain/context_params.rb +223 -0
  117. data/lib/shell/domain/override_tasks.rb +88 -0
  118. data/lib/shell/domain/shadow_entity.rb +76 -0
  119. data/lib/shell/header_shell.rb +44 -0
  120. data/lib/shell/help_monkey_patch.rb +283 -0
  121. data/lib/shell/interactive_wizard.rb +225 -0
  122. data/lib/shell/message_queue.rb +63 -0
  123. data/lib/shell/parse_monkey_patch.rb +39 -0
  124. data/lib/shell/status_monitor.rb +124 -0
  125. data/lib/task_status.rb +83 -0
  126. data/lib/task_status/refresh_mode.rb +77 -0
  127. data/lib/task_status/snapshot_mode.rb +28 -0
  128. data/lib/task_status/stream_mode.rb +48 -0
  129. data/lib/task_status/stream_mode/element.rb +101 -0
  130. data/lib/task_status/stream_mode/element/format.rb +101 -0
  131. data/lib/task_status/stream_mode/element/hierarchical_task.rb +100 -0
  132. data/lib/task_status/stream_mode/element/hierarchical_task/result.rb +72 -0
  133. data/lib/task_status/stream_mode/element/hierarchical_task/result/action.rb +93 -0
  134. data/lib/task_status/stream_mode/element/hierarchical_task/result/components.rb +26 -0
  135. data/lib/task_status/stream_mode/element/hierarchical_task/result/node_level.rb +26 -0
  136. data/lib/task_status/stream_mode/element/hierarchical_task/steps.rb +34 -0
  137. data/lib/task_status/stream_mode/element/hierarchical_task/steps/action.rb +53 -0
  138. data/lib/task_status/stream_mode/element/hierarchical_task/steps/components.rb +53 -0
  139. data/lib/task_status/stream_mode/element/hierarchical_task/steps/node_level.rb +42 -0
  140. data/lib/task_status/stream_mode/element/no_results.rb +26 -0
  141. data/lib/task_status/stream_mode/element/render.rb +59 -0
  142. data/lib/task_status/stream_mode/element/stage.rb +84 -0
  143. data/lib/task_status/stream_mode/element/stage/render.rb +76 -0
  144. data/lib/task_status/stream_mode/element/task_end.rb +35 -0
  145. data/lib/task_status/stream_mode/element/task_start.rb +37 -0
  146. data/lib/util/common_util.rb +37 -0
  147. data/lib/util/console.rb +235 -0
  148. data/lib/util/dtk_puppet.rb +65 -0
  149. data/lib/util/module_util.rb +66 -0
  150. data/lib/util/os_util.rb +385 -0
  151. data/lib/util/permission_util.rb +31 -0
  152. data/lib/util/remote_dependency_util.rb +84 -0
  153. data/lib/util/ssh_util.rb +94 -0
  154. data/lib/view_processor.rb +129 -0
  155. data/lib/view_processor/augmented_simple_list.rb +44 -0
  156. data/lib/view_processor/hash_pretty_print.rb +123 -0
  157. data/lib/view_processor/simple_list.rb +156 -0
  158. data/lib/view_processor/table_print.rb +309 -0
  159. data/lib/violation.rb +86 -0
  160. data/lib/violation/attribute.rb +76 -0
  161. data/lib/violation/fix.rb +26 -0
  162. data/lib/violation/fix/result.rb +73 -0
  163. data/lib/violation/fix/result/error.rb +34 -0
  164. data/lib/violation/fix/set_attribute.rb +41 -0
  165. data/lib/violation/sub_classes.rb +60 -0
  166. data/puppet/manifests/init.pp +72 -0
  167. data/puppet/manifests/params.pp +16 -0
  168. data/puppet/r8meta.puppet.yml +35 -0
  169. data/puppet/templates/bash_profile.erb +2 -0
  170. data/puppet/templates/client.conf.erb +1 -0
  171. data/puppet/templates/dtkclient.erb +2 -0
  172. data/spec/component_module_spec.rb +34 -0
  173. data/spec/dependency_spec.rb +6 -0
  174. data/spec/dtk_shell_spec.rb +13 -0
  175. data/spec/dtk_spec.rb +33 -0
  176. data/spec/lib/spec_helper.rb +10 -0
  177. data/spec/lib/spec_thor.rb +108 -0
  178. data/spec/node_template_spec.rb +24 -0
  179. data/spec/project_spec.rb +6 -0
  180. data/spec/repo_spec.rb +7 -0
  181. data/spec/response_spec.rb +52 -0
  182. data/spec/service_module_spec.rb +38 -0
  183. data/spec/service_spec.rb +50 -0
  184. data/spec/state_change_spec.rb +7 -0
  185. data/spec/table_print_spec.rb +48 -0
  186. data/spec/target_spec.rb +57 -0
  187. data/spec/task_spec.rb +28 -0
  188. data/views/assembly/augmented_simple_list.rb +12 -0
  189. data/views/assembly_template/augmented_simple_list.rb +12 -0
  190. data/views/list_task/augmented_simple_list.rb +12 -0
  191. metadata +421 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9fc92cd4c2d740a82221151ccefcd5df15e59a0f
4
+ data.tar.gz: 9bed1b89456b7868369e82380aea8fb41d1950fd
5
+ SHA512:
6
+ metadata.gz: 226750e3ab5dc3bf90a381959e2c9e1634068bb005585be2b3385ccca05829eba7600b4b780d3f1bc850a7ab757700b931ea3518b71d769f5c342d202e1a49db
7
+ data.tar.gz: 91ae7a92aafd5721c30576dca54f3d8538fceb14bbeebfab5c311709d952b7b71e1cab0f42a9789e7558fe6a417e52a055ad4bcd0f394ce8d8c22105f0e18886
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # dependcies are defined in gemspec file since to avoid duplication
4
+ # gemspec :name => 'dtk-client'
5
+ gemspec
@@ -0,0 +1,13 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # dependcies are defined in gemspec file since to avoid duplication
4
+ # gemspec :name => 'dtk-shell'
5
+ gemspec
6
+
7
+ # development gems which are not included in production Gemfile
8
+ gem 'rspec','~>3.0.0'
9
+ gem 'awesome_print','~> 1.1.0'
10
+ gem 'looksee'
11
+
12
+ gem 'ruby-debug','0.10.4' if RUBY_VERSION == '1.8.7'
13
+ gem 'debugger','>= 1.6.5' if RUBY_VERSION == '1.9.3'
@@ -0,0 +1,121 @@
1
+ DTK Client
2
+ ==============================
3
+
4
+
5
+ #### Description
6
+
7
+
8
+ DTK Client is a Ruby based CLI interface for communication with the DTK Server.
9
+ It's main purpose is to provide an easy to use interface for importing modules, browsing modules repository and deploying assemblies and topologies.
10
+
11
+ ---
12
+ #### Sytstem requirements
13
+
14
+ - Ruby 1.9.3
15
+ - Unix OS
16
+
17
+ ---
18
+ #### Installation
19
+
20
+ For DTK Client to work, following steps have to be done:
21
+
22
+ - Git User set up
23
+ - RSA Keys Generated
24
+
25
+ To install DTK Client gem, execute:
26
+
27
+ `gem install dtk-client`
28
+
29
+ ---
30
+ #### Initial setup
31
+
32
+ There are two ways for DTK Client to run
33
+
34
+ - via an interactive shell (<tt>dtk-shell</tt>)
35
+ - by executing DTK Client commands (ie. <tt>dtk service list</tt>)
36
+
37
+ If it is the first time that the DTK Client is being used (by either of the ways), following prompts will appear:
38
+
39
+ ```
40
+ Please enter the DTK server address (example: instance.dtk.io)
41
+ Server address:
42
+
43
+ Please enter your DTK login details
44
+ Username:
45
+ Password:
46
+
47
+ ```
48
+ After entering the correct data, following message will appear:
49
+
50
+ `SSH key 'dtk-client' added successfully!`
51
+
52
+ This means that the DTK Server has successfully registered DTK Client and the client is ready for use.
53
+
54
+ ---
55
+ #### DTK Client configuration
56
+
57
+ All of the DTK Configuration, installed component and service modules as well as client logs are located in `~/dtk`.
58
+
59
+ DTK Client configuration options, such as development option, verbose calls to DTK Server, log options and Client user credentials, can be configured in `~/dtk/client.conf`:
60
+
61
+ ```
62
+ debug_task_frequency=5 # assembly - frequency between requests (seconds)
63
+ auto_commit_changes=false # autocommit for modules
64
+ verbose_rest_calls=false # logging of REST calls
65
+
66
+ module_location=component_modules
67
+ service_location=service_modules
68
+ test_module_location=test_modules
69
+ backups_location=backups
70
+
71
+
72
+ server_port=80
73
+ secure_connection_server_port=443
74
+ secure_connection=true
75
+ server_host=instance.dtk.io
76
+ ```
77
+
78
+
79
+ User credentials are located in `~/dtk/.connection`
80
+
81
+ Component and Service modules that are installed, or modules that are imported are located in `~/dtk/component_modules` and `~/dtk/service_modules/`
82
+
83
+ ---
84
+
85
+ ## Advanced features
86
+ #### Development mode
87
+
88
+ When using DTK Client in Development mode, gems from `Gemfile_dev` must be installed and used when running DTK Client or DTK Client Shell:
89
+
90
+ ```
91
+ bundle install --gemfile Gemfile_dev
92
+ BUNDLE_GEMFILE=Gemfile_dev bundle exec ruby ./bin/dtk-shell
93
+ ```
94
+
95
+ #### DTK Repoman
96
+
97
+ DTK Repoman is a Git based repository for publishing and installing component modules and service modules. DTK Repoman has it's own users, known as catalog users. The inital setup should register the DTK Client to the Public Catalog users.
98
+
99
+ Successfully registered DTK Client on DTK Repoman enables execution of commands such as:
100
+
101
+ `dtk service-module list --remote` - lists service moduels on remote visible to the catalog user
102
+
103
+ `dtk component-module install namespace/component-module-name` - install component module
104
+
105
+ Switching from public user to a commercial user can be done with `dtk account set-catalog-credentials`. This will initate a prompt for catalog username and password
106
+
107
+ ## License
108
+
109
+ dtk-client is copyright (C) 2010-2016 dtk contributors
110
+
111
+ Licensed under the Apache License, Version 2.0 (the "License");
112
+ you may not use this work except in compliance with the License.
113
+ You may obtain a copy of the License in the [LICENSE](LICENSE) file, or at:
114
+
115
+ http://www.apache.org/licenses/LICENSE-2.0
116
+
117
+ Unless required by applicable law or agreed to in writing, software
118
+ distributed under the License is distributed on an "AS IS" BASIS,
119
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120
+ See the License for the specific language governing permissions and
121
+ limitations under the License.
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2010-2016 dtk contributors
4
+ #
5
+ # This file is part of the dtk project.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ require File.expand_path('../lib/client', File.dirname(__FILE__))
21
+ require File.expand_path('../lib/execute', File.dirname(__FILE__))
22
+ require File.expand_path('../lib/configurator', File.dirname(__FILE__))
23
+
24
+ include DTK::Client
25
+
26
+ Configurator.check_config_exists
27
+
28
+ # if connection parameters are not set up properly, print warning and exit dtk_shell
29
+ conn = Session.get_connection()
30
+ exit if validate_connection(conn)
31
+
32
+ Execute::Script.execute()
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2010-2016 dtk contributors
4
+ #
5
+ # This file is part of the dtk project.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ # GLOBAL IDENTIFIER
21
+ $shell_mode = false
22
+
23
+ require File.expand_path('../lib/client', File.dirname(__FILE__))
24
+ require File.expand_path('../lib/configurator', File.dirname(__FILE__))
25
+ require File.expand_path('../lib/parser/adapters/thor', File.dirname(__FILE__))
26
+ require File.expand_path('../lib/shell/context', File.dirname(__FILE__))
27
+ require File.expand_path('../lib/shell/domain/context_entity', File.dirname(__FILE__))
28
+ require File.expand_path('../lib/shell/domain/active_context', File.dirname(__FILE__))
29
+ require File.expand_path('../lib/shell/domain/context_params', File.dirname(__FILE__))
30
+ require File.expand_path('../lib/shell/domain/override_tasks', File.dirname(__FILE__))
31
+ require File.expand_path('../lib/shell/domain/shadow_entity', File.dirname(__FILE__))
32
+ require File.expand_path('../lib/commands/thor/account', File.dirname(__FILE__))
33
+ require File.expand_path('../lib/shell/parse_monkey_patch', File.dirname(__FILE__))
34
+ require File.expand_path('../lib/shell/help_monkey_patch', File.dirname(__FILE__))
35
+ require File.expand_path('../lib/execute/cli_pure/cli_rerouter', File.dirname(__FILE__))
36
+
37
+ paths = []
38
+ paths << File.expand_path('../lib/commands/thor/*.rb', File.dirname(__FILE__))
39
+ paths << File.expand_path('../lib/commands/common/thor/*.rb', File.dirname(__FILE__))
40
+
41
+ paths.each do |path|
42
+ Dir[path].each do |thor_class_file|
43
+ require thor_class_file
44
+ end
45
+ end
46
+
47
+
48
+
49
+ require 'shellwords'
50
+ require 'json'
51
+
52
+ $: << "/usr/lib/ruby/1.8/" #TODO: put in to get around path problem in rvm 1.9.2 environment
53
+
54
+ config_exists = ::DTK::Client::Configurator.check_config_exists
55
+ ::DTK::Client::Configurator.check_git
56
+ ::DTK::Client::Configurator.create_missing_clone_dirs
57
+
58
+
59
+ # check if .add_direct_access file exists, if not then add direct access and create .add_direct_access file
60
+ resolve_direct_access(::DTK::Client::Configurator.check_direct_access, config_exists)
61
+ entries = []
62
+
63
+ if ARGV.size > 0
64
+ entries = ARGV
65
+ entries = DTK::Shell::Context.check_for_sym_link(entries)
66
+ entity_name = entries.shift
67
+ end
68
+
69
+ # special case for when no params are provided use help method
70
+ if (entity_name == 'help' || entity_name.nil?)
71
+ entity_name = 'dtk'
72
+ args = ['help']
73
+ else
74
+ args = entries
75
+ end
76
+
77
+ context = DTK::Shell::Context.new(true)
78
+
79
+ begin
80
+ if ::DTK::CLIRerouter.is_candidate?(entity_name, args)
81
+ response_obj = ::DTK::CLIRerouter.new(entity_name, args).run()
82
+ puts response_obj.to_json
83
+ else
84
+ # default execution
85
+ entity_name, method_name, context_params, thor_options = context.get_dtk_command_parameters(entity_name, args)
86
+ top_level_execute(entity_name, method_name, context_params, thor_options, false)
87
+ end
88
+ rescue DTK::Client::DtkError => e
89
+ DtkLogger.instance.error(e.message, true)
90
+ rescue Exception => e
91
+ DtkLogger.instance.error_pp(e.message, e.backtrace)
92
+ end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2010-2016 dtk contributors
4
+ #
5
+ # This file is part of the dtk project.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ require File.expand_path('../lib/shell', File.dirname(__FILE__))
20
+ require File.expand_path('../lib/commands/thor/account', File.dirname(__FILE__))
21
+
22
+ trap("INT", "SIG_IGN")
23
+
24
+ config_exists = ::DTK::Client::Configurator.check_config_exists
25
+ ::DTK::Client::Configurator.check_git
26
+ ::DTK::Client::Configurator.create_missing_clone_dirs
27
+
28
+ # check if .add_direct_access file exists, if not then add direct access and create .add_direct_access file
29
+ resolve_direct_access(::DTK::Client::Configurator.check_direct_access, config_exists)
30
+
31
+ run_shell_command()
@@ -0,0 +1,50 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/dtk-shell/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Rich PELAVIN"]
6
+ gem.email = ["rich@reactor8.com"]
7
+ gem.description = %q{The DTK Client is a command line tool to interact with your DTK Server and DTK Service Catalog instance(s).}
8
+ gem.summary = %q{DTK CLI client for DTK server interaction.}
9
+ gem.homepage = "https://github.com/rich-reactor8/dtk-shell"
10
+ gem.licenses = ["Apache-2.0"]
11
+
12
+ gem.files = %w(README.md Gemfile Gemfile_dev dtk-shell.gemspec)
13
+ gem.files += Dir.glob("bin/**/*")
14
+ gem.files += Dir.glob("lib/**/*")
15
+ gem.files += Dir.glob("puppet/**/*")
16
+ gem.files += Dir.glob("spec/**/*")
17
+ gem.files += Dir.glob("views/**/*")
18
+
19
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
20
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
+ gem.name = "dtk-shell"
22
+ gem.require_paths = ["lib"]
23
+ gem.version = DtkShell::VERSION
24
+
25
+ gem.add_dependency 'mime-types','~> 1.25'
26
+ gem.add_dependency 'bundler','>= 1.2.4'
27
+ gem.add_dependency 'json_pure' ,'1.7.4'
28
+ gem.add_dependency 'diff-lcs','1.2.0'
29
+ gem.add_dependency 'hirb','~> 0.7.0'
30
+ gem.add_dependency 'thor','~> 0.15.4'
31
+ gem.add_dependency 'erubis','~> 2.7.0'
32
+ gem.add_dependency 'dtk-common-core','0.10.0'
33
+ gem.add_dependency 'git','1.2.9'
34
+ # gem.add_dependency 'colorize','~> 0.5.8'
35
+ gem.add_dependency 'colorize', '0.7.7'
36
+ gem.add_dependency 'highline', '1.7.8'
37
+ gem.add_dependency 'awesome_print', '1.1.0'
38
+
39
+ # gem.add_dependency 'rb-readline', '0.5.0'
40
+ # gem.add_dependency 'activesupport','~> 3.2.12'
41
+ # gem.add_dependency 'i18n','0.6.1'
42
+ # gem.add_dependency 'puppet','~> 3.1.0'
43
+ # gem.add_dependency 'jenkins-client','~> 0.0.1'
44
+ # gem.add_dependency 'rspec','~> 2.12.0'
45
+ # gem.add_dependency 'awesome_print','~> 1.1.0'
46
+ # gem.add_dependency 'rdoc','= 3.12.1'l
47
+ # gem.add_development_dependency 'ruby-debug','>= 0.10.4'
48
+ # gem.add_development_dependency 'awesome_print','>= 1.1.0'
49
+ # gem.add_development_dependency 'rspec','~> 2.12.0'
50
+ end
@@ -0,0 +1,61 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module DTK
19
+ module Client
20
+ module Auxiliary
21
+ def cap_form(x)
22
+ x.gsub('-','_').to_s.split("_").map{|t|t.capitalize}.join("")
23
+ end
24
+
25
+ def snake_form(command_class,seperator="_")
26
+ command_class.to_s.gsub(/^.*::/, '').gsub(/Command$/,'').scan(/[A-Z][a-z]+/).map{|w|w.downcase}.join(seperator)
27
+ end
28
+ end
29
+
30
+ class PostBody < Hash
31
+ def initialize(raw={})
32
+ super()
33
+ unless raw.empty?
34
+ replace(convert(raw))
35
+ end
36
+ end
37
+ def merge(raw)
38
+ super(convert(raw))
39
+ end
40
+ def merge!(raw)
41
+ super(convert(raw))
42
+ end
43
+
44
+ private
45
+ def convert(raw)
46
+ raw.inject(Hash.new) do |h,(k,v)|
47
+ if non_null_var = is_only_non_null_var?(k)
48
+ v.nil? ? h : h.merge(non_null_var => v)
49
+ else
50
+ h.merge(k => v)
51
+ end
52
+ end
53
+ end
54
+ def is_only_non_null_var?(k)
55
+ if k.to_s =~ /\?$/
56
+ k.to_s.gsub(/\?$/,'').to_sym
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,26 @@
1
+ #
2
+ # Copyright (C) 2010-2016 dtk contributors
3
+ #
4
+ # This file is part of the dtk project.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ module Bundler
19
+ module SharedHelpers
20
+
21
+ private
22
+ def find_gemfile
23
+ File.expand_path('../Gemfile', File.dirname(__FILE__))
24
+ end
25
+ end
26
+ end