dtk-client 0.7.7 → 0.7.8
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 +8 -8
 - data/dtk-client.gemspec +1 -1
 - data/lib/command_helpers/git_repo.rb +36 -0
 - data/lib/command_helpers/service_importer.rb +46 -17
 - data/lib/commands/common/thor/action_result_handler.rb +6 -1
 - data/lib/commands/common/thor/assembly_workspace.rb +3 -1
 - data/lib/commands/common/thor/clone.rb +29 -12
 - data/lib/commands/common/thor/common.rb +15 -6
 - data/lib/commands/common/thor/create_target.rb +8 -5
 - data/lib/commands/common/thor/edit.rb +3 -1
 - data/lib/commands/common/thor/module.rb +366 -52
 - data/lib/commands/common/thor/pull_from_remote.rb +5 -3
 - data/lib/commands/common/thor/push_clone_changes.rb +1 -0
 - data/lib/commands/thor/component_module.rb +48 -13
 - data/lib/commands/thor/developer.rb +3 -2
 - data/lib/commands/thor/service.rb +5 -1
 - data/lib/commands/thor/service_module.rb +118 -27
 - data/lib/commands/thor/target.rb +2 -2
 - data/lib/commands/thor/test_module.rb +3 -3
 - data/lib/domain/git_adapter.rb +8 -0
 - data/lib/dtk-client/version.rb +1 -1
 - data/lib/util/console.rb +27 -0
 - data/lib/util/os_util.rb +4 -3
 - data/lib/util/remote_dependency_util.rb +13 -3
 - metadata +4 -4
 
    
        data/lib/commands/thor/target.rb
    CHANGED
    
    | 
         @@ -93,7 +93,7 @@ module DTK::Client 
     | 
|
| 
       93 
93 
     | 
    
         
             
                method_option :security_group, :type => :string, :aliases => '--security-groups'
         
     | 
| 
       94 
94 
     | 
    
         
             
                def create_target_ec2_classic(context_params)
         
     | 
| 
       95 
95 
     | 
    
         
             
                  option_list = [:provider!, :region!, :keypair, :security_group]
         
     | 
| 
       96 
     | 
    
         
            -
                  response = Common::CreateTarget.new(self,context_params).execute(:ec2_classic,option_list)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  response = Common::CreateTarget.new(self, context_params).execute(:ec2_classic,option_list)
         
     | 
| 
       97 
97 
     | 
    
         
             
                  @@invalidate_map << :target
         
     | 
| 
       98 
98 
     | 
    
         
             
                  response
         
     | 
| 
       99 
99 
     | 
    
         
             
                end
         
     | 
| 
         @@ -106,7 +106,7 @@ module DTK::Client 
     | 
|
| 
       106 
106 
     | 
    
         
             
                method_option :security_group, :type => :string, :aliases => '--security-groups'
         
     | 
| 
       107 
107 
     | 
    
         
             
                def create_target_ec2_vpc(context_params)
         
     | 
| 
       108 
108 
     | 
    
         
             
                  option_list = [:provider!, :subnet!, :region!, :keypair, :security_group]
         
     | 
| 
       109 
     | 
    
         
            -
                  response = Common::CreateTarget.new(self,context_params).execute(:ec2_vpc,option_list)
         
     | 
| 
      
 109 
     | 
    
         
            +
                  response = Common::CreateTarget.new(self, context_params).execute(:ec2_vpc,option_list)
         
     | 
| 
       110 
110 
     | 
    
         
             
                  @@invalidate_map << :target
         
     | 
| 
       111 
111 
     | 
    
         
             
                  response
         
     | 
| 
       112 
112 
     | 
    
         
             
                end
         
     | 
| 
         @@ -150,7 +150,7 @@ module DTK::Client 
     | 
|
| 
       150 
150 
     | 
    
         
             
                  publish_module_aux(context_params)
         
     | 
| 
       151 
151 
     | 
    
         
             
                end
         
     | 
| 
       152 
152 
     | 
    
         | 
| 
       153 
     | 
    
         
            -
                desc "TEST-MODULE-NAME/ID  
     | 
| 
      
 153 
     | 
    
         
            +
                desc "TEST-MODULE-NAME/ID update [-n NAMESPACE] [--force]", "Update local test module from remote repository."
         
     | 
| 
       154 
154 
     | 
    
         
             
                method_option :namespace,:aliases => '-n',
         
     | 
| 
       155 
155 
     | 
    
         
             
                  :type   => :string,
         
     | 
| 
       156 
156 
     | 
    
         
             
                  :banner => "NAMESPACE",
         
     | 
| 
         @@ -159,8 +159,8 @@ module DTK::Client 
     | 
|
| 
       159 
159 
     | 
    
         
             
                  :type    => :boolean,
         
     | 
| 
       160 
160 
     | 
    
         
             
                  :desc   => "Force pull",
         
     | 
| 
       161 
161 
     | 
    
         
             
                  :default => false
         
     | 
| 
       162 
     | 
    
         
            -
                def  
     | 
| 
       163 
     | 
    
         
            -
                   
     | 
| 
      
 162 
     | 
    
         
            +
                def update(context_params)
         
     | 
| 
      
 163 
     | 
    
         
            +
                  update_aux(context_params)
         
     | 
| 
       164 
164 
     | 
    
         
             
                end
         
     | 
| 
       165 
165 
     | 
    
         | 
| 
       166 
166 
     | 
    
         
             
                desc "TEST-MODULE-NAME/ID chmod PERMISSION-SELECTOR", "Update remote permissions e.g. ug+rw , user and group get RW permissions"
         
     | 
    
        data/lib/domain/git_adapter.rb
    CHANGED
    
    | 
         @@ -187,6 +187,14 @@ module DTK 
     | 
|
| 
       187 
187 
     | 
    
         
             
                    end
         
     | 
| 
       188 
188 
     | 
    
         
             
                  end
         
     | 
| 
       189 
189 
     | 
    
         | 
| 
      
 190 
     | 
    
         
            +
                  def delete_branch(branch, opts = {})
         
     | 
| 
      
 191 
     | 
    
         
            +
                    @git_repo.branch(branch).delete
         
     | 
| 
      
 192 
     | 
    
         
            +
                  end
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
                  def checkout(branch, opts = {})
         
     | 
| 
      
 195 
     | 
    
         
            +
                    @git_repo.checkout(branch, opts)
         
     | 
| 
      
 196 
     | 
    
         
            +
                  end
         
     | 
| 
      
 197 
     | 
    
         
            +
             
     | 
| 
       190 
198 
     | 
    
         
             
                  def push(remote_branch_ref, opts={})
         
     | 
| 
       191 
199 
     | 
    
         
             
                    remote, remote_branch = remote_branch_ref.split('/')
         
     | 
| 
       192 
200 
     | 
    
         
             
                    push_with_remote(remote, remote_branch, opts)
         
     | 
    
        data/lib/dtk-client/version.rb
    CHANGED
    
    
    
        data/lib/util/console.rb
    CHANGED
    
    | 
         @@ -76,6 +76,33 @@ module DTK::Client 
     | 
|
| 
       76 
76 
     | 
    
         
             
                    end
         
     | 
| 
       77 
77 
     | 
    
         
             
                  end
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
      
 79 
     | 
    
         
            +
                  # multiple choice
         
     | 
| 
      
 80 
     | 
    
         
            +
                  # e.g.
         
     | 
| 
      
 81 
     | 
    
         
            +
                  # Select version to delete:
         
     | 
| 
      
 82 
     | 
    
         
            +
                  # 1. base
         
     | 
| 
      
 83 
     | 
    
         
            +
                  # 2. 0.0.1
         
     | 
| 
      
 84 
     | 
    
         
            +
                  # 3. 0.0.2
         
     | 
| 
      
 85 
     | 
    
         
            +
                  # 4. all
         
     | 
| 
      
 86 
     | 
    
         
            +
                  # > 2
         
     | 
| 
      
 87 
     | 
    
         
            +
                  def confirmation_prompt_multiple_choice(message, opts_array)
         
     | 
| 
      
 88 
     | 
    
         
            +
                    indexes = opts_array.map{ |opt| "#{opts_array.index(opt)+1}" }
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                    trap("INT", "SIG_IGN")
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                    message << "\n"
         
     | 
| 
      
 93 
     | 
    
         
            +
                    opts_array.each {|opt| message << "#{opts_array.index(opt)+1}. #{opt}\n" }
         
     | 
| 
      
 94 
     | 
    
         
            +
                    message << "> "
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                    while line = Readline.readline("#{message}", true)
         
     | 
| 
      
 97 
     | 
    
         
            +
                      if indexes.include?(line)
         
     | 
| 
      
 98 
     | 
    
         
            +
                        trap("INT",false)
         
     | 
| 
      
 99 
     | 
    
         
            +
                        return opts_array[line.to_i-1]
         
     | 
| 
      
 100 
     | 
    
         
            +
                      elsif line.eql?('exit')
         
     | 
| 
      
 101 
     | 
    
         
            +
                        return nil
         
     | 
| 
      
 102 
     | 
    
         
            +
                      end
         
     | 
| 
      
 103 
     | 
    
         
            +
                    end
         
     | 
| 
      
 104 
     | 
    
         
            +
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
       79 
106 
     | 
    
         
             
                  # Loading output used to display waiting status
         
     | 
| 
       80 
107 
     | 
    
         
             
                  def wait_animation(message, time_seconds)
         
     | 
| 
       81 
108 
     | 
    
         
             
                    print message
         
     | 
    
        data/lib/util/os_util.rb
    CHANGED
    
    | 
         @@ -127,9 +127,10 @@ module DTK 
     | 
|
| 
       127 
127 
     | 
    
         
             
                    end
         
     | 
| 
       128 
128 
     | 
    
         | 
| 
       129 
129 
     | 
    
         
             
                    def module_version_locations(module_type,module_name,version=nil,opts={})
         
     | 
| 
       130 
     | 
    
         
            -
                      base_path = module_location_parts(module_type,module_name,version,opts) 
     | 
| 
       131 
     | 
    
         
            -
                       
     | 
| 
       132 
     | 
    
         
            -
                      module_versions. 
     | 
| 
      
 130 
     | 
    
         
            +
                      base_path, namespace, name = module_location_parts(module_type,module_name,version,opts) #.first
         
     | 
| 
      
 131 
     | 
    
         
            +
                      namespace_path = "#{base_path}/#{namespace}"
         
     | 
| 
      
 132 
     | 
    
         
            +
                      module_versions = Dir.entries(namespace_path).select{|a| a.match(/^#{name}-\d{1,2}.\d{1,2}.\d{1,2}$/)}
         
     | 
| 
      
 133 
     | 
    
         
            +
                      module_versions.map{ |version|"#{namespace_path}/#{version}" }
         
     | 
| 
       133 
134 
     | 
    
         
             
                    end
         
     | 
| 
       134 
135 
     | 
    
         | 
| 
       135 
136 
     | 
    
         
             
                    def module_clone_location(module_type)
         
     | 
| 
         @@ -33,14 +33,24 @@ module DTK 
     | 
|
| 
       33 
33 
     | 
    
         
             
                      if dependency_warnings && !dependency_warnings.empty?
         
     | 
| 
       34 
34 
     | 
    
         
             
                        no_permissions = dependency_warnings.select { |warning| warning['error_type'].eql?('no_permission') }
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
                        unless no_permissions.empty?
         
     | 
| 
      
 37 
     | 
    
         
            +
                          errors << "\n\nYou do not have (R) permissions for modules:\n\n"
         
     | 
| 
      
 38 
     | 
    
         
            +
                          no_permissions.each { |np| errors << "  - #{np['module_namespace']}:#{np['module_name']} (owner: #{np['module_owner']})\n" }
         
     | 
| 
      
 39 
     | 
    
         
            +
                          errors << "\nPlease contact owner(s) to change permissions for those modules."
         
     | 
| 
      
 40 
     | 
    
         
            +
                        end
         
     | 
| 
       39 
41 
     | 
    
         
             
                      end
         
     | 
| 
       40 
42 
     | 
    
         | 
| 
       41 
43 
     | 
    
         
             
                      raise DtkError, errors unless errors.empty?
         
     | 
| 
       42 
44 
     | 
    
         
             
                    end
         
     | 
| 
       43 
45 
     | 
    
         | 
| 
      
 46 
     | 
    
         
            +
                    # check if all dependent modules are frozen; if they are don't display prompt for update
         
     | 
| 
      
 47 
     | 
    
         
            +
                    def check_for_frozen_modules(required_modules)
         
     | 
| 
      
 48 
     | 
    
         
            +
                      return true if required_modules.nil? || required_modules.empty?
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                      modules_to_update = required_modules.select{ |md| (md['frozen'].nil? || md['frozen'] == false)}
         
     | 
| 
      
 51 
     | 
    
         
            +
                      return modules_to_update.empty?
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
       44 
54 
     | 
    
         
             
                    def module_ref_content(location)
         
     | 
| 
       45 
55 
     | 
    
         
             
                      abs_location = File.join(location, MODULE_REF_FILE)
         
     | 
| 
       46 
56 
     | 
    
         
             
                      File.exists?(abs_location) ? File.read(abs_location) : nil
         
     | 
    
        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.7. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Rich PELAVIN
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-12-10 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: mime-types
         
     | 
| 
         @@ -128,14 +128,14 @@ dependencies: 
     | 
|
| 
       128 
128 
     | 
    
         
             
                requirements:
         
     | 
| 
       129 
129 
     | 
    
         
             
                - - '='
         
     | 
| 
       130 
130 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       131 
     | 
    
         
            -
                    version: 1.2. 
     | 
| 
      
 131 
     | 
    
         
            +
                    version: 1.2.9
         
     | 
| 
       132 
132 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       133 
133 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       134 
134 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       135 
135 
     | 
    
         
             
                requirements:
         
     | 
| 
       136 
136 
     | 
    
         
             
                - - '='
         
     | 
| 
       137 
137 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       138 
     | 
    
         
            -
                    version: 1.2. 
     | 
| 
      
 138 
     | 
    
         
            +
                    version: 1.2.9
         
     | 
| 
       139 
139 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       140 
140 
     | 
    
         
             
              name: colorize
         
     | 
| 
       141 
141 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |