rundock 1.0.7 → 1.0.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 +4 -4
- data/.rubocop.yml +3 -0
- data/lib/rundock.rb +1 -0
- data/lib/rundock/cli.rb +9 -0
- data/lib/rundock/configure.rb +56 -0
- data/lib/rundock/version.rb +1 -1
- data/rundock.gemspec +1 -0
- metadata +17 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 98f0161c6ca4ad171cede29edf9f91560ef25a28
         | 
| 4 | 
            +
              data.tar.gz: 8e6a81eac352b785e4684785619e5052c3b8c3cd
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6e514a919db53432ad753bcccd29b0697af2044928f1e6dede1deb0baa065f24f03f32997b0261219432178fe88b0f89023fc471b75100e642f7dabeebec58d3
         | 
| 7 | 
            +
              data.tar.gz: 05d7196e1b3f3d851d66bd7485f510ea6516c7d55ea9087eab17dfced86aa1ed1d2295ca509e9598f099f436ddcb913b8ebd4af43e83b10a062de105e2d6e00f
         | 
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/lib/rundock.rb
    CHANGED
    
    
    
        data/lib/rundock/cli.rb
    CHANGED
    
    | @@ -64,6 +64,15 @@ module Rundock | |
| 64 64 | 
             
                  Runner.run(opts.merge(options.deep_symbolize_keys))
         | 
| 65 65 | 
             
                end
         | 
| 66 66 |  | 
| 67 | 
            +
                desc 'configure [options]', 'Configure rundock options'
         | 
| 68 | 
            +
                option :ssh, type: :boolean, default: true
         | 
| 69 | 
            +
                option :ssh_config_path, type: :string, aliases: ['-s'], default: "#{Dir.home}/default_ssh.yml"
         | 
| 70 | 
            +
                def configure
         | 
| 71 | 
            +
                  opts = {}
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                  Configure.start(opts.merge(options.deep_symbolize_keys))
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
             | 
| 67 76 | 
             
                def method_missing(command, *args)
         | 
| 68 77 | 
             
                  help
         | 
| 69 78 | 
             
                end
         | 
| @@ -0,0 +1,56 @@ | |
| 1 | 
            +
            require 'highline'
         | 
| 2 | 
            +
            require 'yaml'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Rundock
         | 
| 5 | 
            +
              class Configure
         | 
| 6 | 
            +
                CONFIGURE_TYPE = %i[ssh]
         | 
| 7 | 
            +
                CONFIGURE_SSH_OPTIONS = %i[port user keys passphrase ssh_config]
         | 
| 8 | 
            +
                CONFIGURE_SSH_OPTIONS_QUESTION = [
         | 
| 9 | 
            +
                  'ssh port',
         | 
| 10 | 
            +
                  'user name',
         | 
| 11 | 
            +
                  'private key path',
         | 
| 12 | 
            +
                  'private key passphrase',
         | 
| 13 | 
            +
                  'ssh config file path'
         | 
| 14 | 
            +
                ]
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                class << self
         | 
| 17 | 
            +
                  def start(options)
         | 
| 18 | 
            +
                    Logger.debug 'Starting Configure:'
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                    configure = self.new(options)
         | 
| 21 | 
            +
                    CONFIGURE_TYPE.each do |type|
         | 
| 22 | 
            +
                      configure.send(type) if options[type]
         | 
| 23 | 
            +
                    end
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                def initialize(options)
         | 
| 28 | 
            +
                  @options = options
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                def ssh
         | 
| 32 | 
            +
                  cli = HighLine.new
         | 
| 33 | 
            +
                  ssh_opts = { paranoid: false }
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  CONFIGURE_SSH_OPTIONS.each_with_index do |opt, i|
         | 
| 36 | 
            +
                    ans = if opt == :port
         | 
| 37 | 
            +
                            cli.ask("#{CONFIGURE_SSH_OPTIONS_QUESTION[i]}:", Integer) { |q| q.in = 0..65535 }
         | 
| 38 | 
            +
                          elsif opt == :user
         | 
| 39 | 
            +
                            cli.ask("#{CONFIGURE_SSH_OPTIONS_QUESTION[i]}:") { |q| q.default = ENV['USER'] }
         | 
| 40 | 
            +
                          elsif opt == :keys
         | 
| 41 | 
            +
                            [cli.ask("#{CONFIGURE_SSH_OPTIONS_QUESTION[i]}:") { |q| q.default = '~/.ssh/id_rsa' }]
         | 
| 42 | 
            +
                          elsif opt == :passphrase
         | 
| 43 | 
            +
                            cli.ask("#{CONFIGURE_SSH_OPTIONS_QUESTION[i]}:") { |q| q.echo = '*' }
         | 
| 44 | 
            +
                          elsif opt == :ssh_config
         | 
| 45 | 
            +
                            cli.ask("#{CONFIGURE_SSH_OPTIONS_QUESTION[i]}:") { |q| q.default = '~/.ssh/config' }
         | 
| 46 | 
            +
                          else
         | 
| 47 | 
            +
                            cli.ask("#{CONFIGURE_SSH_OPTIONS_QUESTION[i]}:")
         | 
| 48 | 
            +
                          end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    ssh_opts[opt] = ans unless ans.blank?
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  YAML.dump(ssh_opts, File.open(@options[:ssh_config_path], 'w'))
         | 
| 54 | 
            +
                end
         | 
| 55 | 
            +
              end
         | 
| 56 | 
            +
            end
         | 
    
        data/lib/rundock/version.rb
    CHANGED
    
    
    
        data/rundock.gemspec
    CHANGED
    
    | @@ -23,6 +23,7 @@ Gem::Specification.new do |spec| | |
| 23 23 | 
             
              spec.add_development_dependency 'serverspec', '~> 2.1'
         | 
| 24 24 |  | 
| 25 25 | 
             
              spec.add_runtime_dependency 'ansi'
         | 
| 26 | 
            +
              spec.add_runtime_dependency 'highline'
         | 
| 26 27 | 
             
              spec.add_runtime_dependency 'net-ssh'
         | 
| 27 28 | 
             
              spec.add_runtime_dependency 'specinfra', ['>= 2.31.0', '< 3.0.0']
         | 
| 28 29 | 
             
              spec.add_runtime_dependency 'thor'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: rundock
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.8
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - hiracy
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-11-07 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -80,6 +80,20 @@ dependencies: | |
| 80 80 | 
             
                - - ">="
         | 
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 82 | 
             
                    version: '0'
         | 
| 83 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            +
              name: highline
         | 
| 85 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 | 
            +
                requirements:
         | 
| 87 | 
            +
                - - ">="
         | 
| 88 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            +
                    version: '0'
         | 
| 90 | 
            +
              type: :runtime
         | 
| 91 | 
            +
              prerelease: false
         | 
| 92 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 | 
            +
                requirements:
         | 
| 94 | 
            +
                - - ">="
         | 
| 95 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            +
                    version: '0'
         | 
| 83 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 98 | 
             
              name: net-ssh
         | 
| 85 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -165,6 +179,7 @@ files: | |
| 165 179 | 
             
            - lib/rundock/builder/target_group_builder.rb
         | 
| 166 180 | 
             
            - lib/rundock/builder/task_builder.rb
         | 
| 167 181 | 
             
            - lib/rundock/cli.rb
         | 
| 182 | 
            +
            - lib/rundock/configure.rb
         | 
| 168 183 | 
             
            - lib/rundock/ext/hash.rb
         | 
| 169 184 | 
             
            - lib/rundock/ext/object/blank.rb
         | 
| 170 185 | 
             
            - lib/rundock/ext/string.rb
         |