cknife 1.4.2 → 1.4.3
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/VERSION +1 -1
- data/cknife.gemspec +2 -2
- data/lib/cknife/cknife_aws.rb +3 -3
- data/lib/cknife/cknife_mysql.rb +2 -2
- data/lib/cknife/cknife_pg.rb +6 -6
- data/lib/cknife/command_line.rb +4 -4
- data/lib/cknife/config.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: fbda2da8223f32fe1d3250ead8641131f82eb6a4a1817ac551dba5bc893b51ae
         | 
| 4 | 
            +
              data.tar.gz: 2a73bcc9951d14af26f7d052b6f231e077a4bbbff2dd293d0ec2e1f4c3808fdc
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 89de8ea5059fb7cdb10e0ebcf5f3e25333c0625907121feca83cdd5e400cae7037dc0404d491aed1710f469718ba2f1af9b096d5953f9fd674c2dd5de2416b3d
         | 
| 7 | 
            +
              data.tar.gz: e3fa7ac99424eae5adad7e3a1ea89b5c992839362c9f2e2e0a86931dbee41c248a3a149496ae63b9868cb6f2304ee762a439e5b256c79bb02ca76d20f3a23122
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.4. | 
| 1 | 
            +
            1.4.3
         | 
    
        data/cknife.gemspec
    CHANGED
    
    | @@ -2,11 +2,11 @@ | |
| 2 2 | 
             
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 3 | 
             
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            -
            # stub: cknife 1.4. | 
| 5 | 
            +
            # stub: cknife 1.4.3 ruby lib
         | 
| 6 6 |  | 
| 7 7 | 
             
            Gem::Specification.new do |s|
         | 
| 8 8 | 
             
              s.name = "cknife".freeze
         | 
| 9 | 
            -
              s.version = "1.4. | 
| 9 | 
            +
              s.version = "1.4.3".freeze
         | 
| 10 10 |  | 
| 11 11 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
         | 
| 12 12 | 
             
              s.require_paths = ["lib".freeze]
         | 
    
        data/lib/cknife/cknife_aws.rb
    CHANGED
    
    | @@ -26,7 +26,7 @@ class CKnifeAws < Thor | |
| 26 26 | 
             
                    config_file = [["cknife.yml"], ["tmp", "cknife.yml"]].map { |args|
         | 
| 27 27 | 
             
                      here.join(*args)
         | 
| 28 28 | 
             
                    }.select { |path|
         | 
| 29 | 
            -
                      File. | 
| 29 | 
            +
                      File.file?(path)
         | 
| 30 30 | 
             
                    }.first
         | 
| 31 31 | 
             
                  end
         | 
| 32 32 |  | 
| @@ -312,7 +312,7 @@ class CKnifeAws < Thor | |
| 312 312 |  | 
| 313 313 | 
             
                say("This is a dry run.") if options[:dry_run]
         | 
| 314 314 |  | 
| 315 | 
            -
                if !File. | 
| 315 | 
            +
                if !File.directory?(directory)
         | 
| 316 316 | 
             
                  say("'#{directory} does not exist or is not a directory.")
         | 
| 317 317 | 
             
                  return
         | 
| 318 318 | 
             
                end
         | 
| @@ -512,7 +512,7 @@ class CKnifeAws < Thor | |
| 512 512 | 
             
                  return
         | 
| 513 513 | 
             
                end
         | 
| 514 514 |  | 
| 515 | 
            -
                if !File. | 
| 515 | 
            +
                if !File.file?(file_name)
         | 
| 516 516 | 
             
                  say("Found no such file #{file_name} on the local disk.")
         | 
| 517 517 | 
             
                  return
         | 
| 518 518 | 
             
                end
         | 
    
        data/lib/cknife/cknife_mysql.rb
    CHANGED
    
    | @@ -43,7 +43,7 @@ module CKnife | |
| 43 43 | 
             
                desc "console", "Launch mysql console."
         | 
| 44 44 | 
             
                method_option :myfile, :type => :boolean, :default => false, :desc => "Write my.cnf file if it doesn't exist."
         | 
| 45 45 | 
             
                def console
         | 
| 46 | 
            -
                  if !File. | 
| 46 | 
            +
                  if !File.file?(option_file)
         | 
| 47 47 | 
             
                    if !options[:myfile]
         | 
| 48 48 | 
             
                      say("You must prepare a #{option_file} file for this command, or use --myfile to have this tool create it for you. Alternatively, you can create a #{option_file} file with the myfile command and delete it later with the dmyfile command.")
         | 
| 49 49 | 
             
                      return
         | 
| @@ -70,7 +70,7 @@ module CKnife | |
| 70 70 | 
             
                def capture
         | 
| 71 71 | 
             
                  file_name = "db" + Time.now.strftime("%Y%m%d%H%M%S") + ".sql"
         | 
| 72 72 |  | 
| 73 | 
            -
                  if File. | 
| 73 | 
            +
                  if File.file?(file_name)
         | 
| 74 74 | 
             
                    say("File already exists: #{file_name}.", :red)
         | 
| 75 75 | 
             
                  end
         | 
| 76 76 |  | 
    
        data/lib/cknife/cknife_pg.rb
    CHANGED
    
    | @@ -88,7 +88,7 @@ class CKnifePg < Thor | |
| 88 88 | 
             
                  @session_ok = true
         | 
| 89 89 |  | 
| 90 90 | 
             
                  existing_pgpass = false
         | 
| 91 | 
            -
                  if File. | 
| 91 | 
            +
                  if File.file?(pg_pass_file)
         | 
| 92 92 | 
             
                    existing_pgpass = true
         | 
| 93 93 | 
             
                    s = File.read(pg_pass_file)
         | 
| 94 94 | 
             
                    if s != pg_str
         | 
| @@ -105,7 +105,7 @@ class CKnifePg < Thor | |
| 105 105 | 
             
                  ensure
         | 
| 106 106 | 
             
                    if !existing_pgpass
         | 
| 107 107 | 
             
                      FileUtils.rm(pg_pass_file)
         | 
| 108 | 
            -
                      if File. | 
| 108 | 
            +
                      if File.file?(pg_pass_file)
         | 
| 109 109 | 
             
                        say("Failed to remove .pgpass file. Please remove it for your infrastructure's security.")
         | 
| 110 110 | 
             
                      end
         | 
| 111 111 | 
             
                    else
         | 
| @@ -255,7 +255,7 @@ AND | |
| 255 255 | 
             
              desc "fexec [FILE]", "Execute a SQL script from a file on disk."
         | 
| 256 256 | 
             
              method_option :verbose, :default => false, :type => :boolean, :desc => "Show which commands are invoked, any input given to them, and any output they give back."
         | 
| 257 257 | 
             
              def fexec(file)
         | 
| 258 | 
            -
                if !File. | 
| 258 | 
            +
                if !File.file?(file)
         | 
| 259 259 | 
             
                  say("'#{file}' does not exist.")
         | 
| 260 260 | 
             
                  return
         | 
| 261 261 | 
             
                end
         | 
| @@ -299,7 +299,7 @@ AND | |
| 299 299 | 
             
              desc "passfile", "Write a .pgpass file in $CWD. Useful for starting a psql session on your own."
         | 
| 300 300 | 
             
              def passfile
         | 
| 301 301 | 
             
                connect_msg = "Connect command: PGPASSFILE=.pgpass #{psql_easy}"
         | 
| 302 | 
            -
                if File. | 
| 302 | 
            +
                if File.file?(pg_pass_file)
         | 
| 303 303 | 
             
                  say("A .pgpass file is already present.")
         | 
| 304 304 | 
             
                  say(connect_msg)
         | 
| 305 305 | 
             
                  return
         | 
| @@ -313,7 +313,7 @@ AND | |
| 313 313 |  | 
| 314 314 | 
             
              desc "dpassfile", "Delete the .pgpass file in $CWD, assuming it exactly matches what would be generated by this tool."
         | 
| 315 315 | 
             
              def dpassfile
         | 
| 316 | 
            -
                if !File. | 
| 316 | 
            +
                if !File.file?(pg_pass_file)
         | 
| 317 317 | 
             
                  say("No .pgpass file to delete.")
         | 
| 318 318 | 
             
                  return
         | 
| 319 319 | 
             
                end
         | 
| @@ -331,7 +331,7 @@ AND | |
| 331 331 | 
             
              method_option :passfile, :type => :boolean, :default => false, :desc => "Write .pgpass file if it doesn't exist."
         | 
| 332 332 | 
             
              method_option :verbose, :default => false, :type => :boolean, :desc => "Show which commands are invoked, any input given to them, and any output they give back."
         | 
| 333 333 | 
             
              def psql
         | 
| 334 | 
            -
                if !File. | 
| 334 | 
            +
                if !File.file?(pg_pass_file)
         | 
| 335 335 | 
             
                  if !options[:passfile]
         | 
| 336 336 | 
             
                    say("You must prepare a .pgpass file for this command, or use --passfile to have this tool create it for you. Alternatively, you can create a .pgpass file with the passfile command and delete it later with the dpassfile command.")
         | 
| 337 337 | 
             
                    return
         | 
    
        data/lib/cknife/command_line.rb
    CHANGED
    
    | @@ -20,7 +20,7 @@ module CKnife | |
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| 22 22 | 
             
                def delete_opt_file
         | 
| 23 | 
            -
                  if !File. | 
| 23 | 
            +
                  if !File.file?(option_file)
         | 
| 24 24 | 
             
                    thor_output.say("No #{option_file} file to delete.")
         | 
| 25 25 | 
             
                    return
         | 
| 26 26 | 
             
                  end
         | 
| @@ -35,7 +35,7 @@ module CKnife | |
| 35 35 | 
             
                end
         | 
| 36 36 |  | 
| 37 37 | 
             
                def create_opt_file(connect_msg)
         | 
| 38 | 
            -
                  if File. | 
| 38 | 
            +
                  if File.file?(option_file)
         | 
| 39 39 | 
             
                    thor_output.say("A #{option_file} file is already present.")
         | 
| 40 40 | 
             
                    thor_output.say(connect_msg)
         | 
| 41 41 | 
             
                    return
         | 
| @@ -83,7 +83,7 @@ module CKnife | |
| 83 83 | 
             
                  @session_ok = true
         | 
| 84 84 |  | 
| 85 85 | 
             
                  existing_option_file = false
         | 
| 86 | 
            -
                  if File. | 
| 86 | 
            +
                  if File.file?(option_file)
         | 
| 87 87 | 
             
                    existing_option_file = true
         | 
| 88 88 | 
             
                    s = File.read(option_file)
         | 
| 89 89 | 
             
                    if s != option_file_contents
         | 
| @@ -100,7 +100,7 @@ module CKnife | |
| 100 100 | 
             
                  ensure
         | 
| 101 101 | 
             
                    if !existing_option_file
         | 
| 102 102 | 
             
                      FileUtils.rm(option_file)
         | 
| 103 | 
            -
                      if File. | 
| 103 | 
            +
                      if File.file?(option_file)
         | 
| 104 104 | 
             
                        thor_output.say("Failed to remove #{option_file} file. Please remove it for your infrastructure's security.")
         | 
| 105 105 | 
             
                      end
         | 
| 106 106 | 
             
                    else
         | 
    
        data/lib/cknife/config.rb
    CHANGED