brightpearl-cli 1.9.0 → 1.10.0
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/lib/brightpearl_cli.rb +28 -18
- data/lib/core/config.rb +4 -0
- data/lib/core/config_unique.rb +0 -26
- data/lib/core/ebay.rb +37 -1
- data/lib/core/ebay_factory.rb +31 -17
- data/lib/core/git.rb +34 -9
- data/lib/core/terminal.rb +6 -2
- data/lib/routes/git_checkout.rb +11 -7
- data/lib/routes/git_merge.rb +57 -17
- data/lib/routes/git_update.rb +6 -6
- data/lib/routes/production_logs.rb +11 -19
- data/lib/routes/scripts_branch_cleaner.rb +2 -2
- data/lib/routes/scripts_sonar.rb +6 -0
- data/lib/routes/ssh.rb +80 -0
- data/lib/version.rb +1 -1
- metadata +5 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ae4119f560e1d2c52826ff48b55b943f5a45b2e2
         | 
| 4 | 
            +
              data.tar.gz: 36e6d9e050013d1ea168c3175e86b19579047d49
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f46eee364d52415d3dac658306739d24632c6782e65537fdb3a3e7ce321dd997a2a1211fa5e1c1dd8ad14a0ad7b2e628417d876c98d06eab40d5ce3fa4c493db
         | 
| 7 | 
            +
              data.tar.gz: b555efa6bdded5ba86e2151532985080483f8c38528979b5820ad034dbb02083f46e125ff9e06bacbc7e49a66d4a35207326a54e612841e633763fd4fa667967
         | 
    
        data/lib/brightpearl_cli.rb
    CHANGED
    
    | @@ -47,6 +47,7 @@ require 'core/utils_files' | |
| 47 47 | 
             
            require 'core/utils_routes'
         | 
| 48 48 | 
             
            require 'core/utils_strings'
         | 
| 49 49 | 
             
            require 'routes/setup'
         | 
| 50 | 
            +
            require 'routes/ssh'
         | 
| 50 51 |  | 
| 51 52 | 
             
            module App
         | 
| 52 53 |  | 
| @@ -58,17 +59,17 @@ module App | |
| 58 59 | 
             
                            App::Config.initialize
         | 
| 59 60 | 
             
                        end
         | 
| 60 61 |  | 
| 61 | 
            -
                        Convoy::App.create do | | 
| 62 | 
            +
                        Convoy::App.create do |app|
         | 
| 62 63 |  | 
| 63 64 | 
             
                            #  COLOR OF TITLE TEXT
         | 
| 64 65 | 
             
                            title_color = 255
         | 
| 65 66 |  | 
| 66 | 
            -
                             | 
| 67 | 
            -
                             | 
| 68 | 
            -
                             | 
| 67 | 
            +
                            app.version VERSION
         | 
| 68 | 
            +
                            app.summary "\x1B[38;5;166mBRIGHTPEARL-CLI\x1B[0m \x1B[38;5;240m\xe2\x80\x94 BETA\x1B[0m"
         | 
| 69 | 
            +
                            app.description "\x1B[38;5;#{title_color}mA command line utility for Brightpearl developers and QAs.\nUsed for automating daily work flows & completing repetitive tasks quicker with less errors.\nDesigned to work from anywhere on your workstation.\n\nUse #{App::Terminal::format_command('app')}\x1B[38;5;#{title_color}m or #{App::Terminal::format_command('bp')}\x1B[38;5;#{title_color}m to run.\x1B[0m"
         | 
| 69 70 |  | 
| 70 71 | 
             
                            # BUILD
         | 
| 71 | 
            -
                             | 
| 72 | 
            +
                            app.command :build, :aliases => [:b] do |build|
         | 
| 72 73 | 
             
                                build.summary 'Build (and deploy) Java services'
         | 
| 73 74 | 
             
                                build.options do |opts|
         | 
| 74 75 | 
             
                                    opts.opt :serviceOnly, 'Build service only (default)', :short => '-s', :long => '--service-only', :type => :boolean
         | 
| @@ -82,7 +83,7 @@ module App | |
| 82 83 | 
             
                            end
         | 
| 83 84 |  | 
| 84 85 | 
             
                            # DUMMY
         | 
| 85 | 
            -
                             | 
| 86 | 
            +
                            app.command :dummy, :aliases => [:d] do |dummy|
         | 
| 86 87 |  | 
| 87 88 | 
             
                                dummy.summary 'Insert dummy data into the App'
         | 
| 88 89 |  | 
| @@ -109,7 +110,7 @@ module App | |
| 109 110 | 
             
                            end
         | 
| 110 111 |  | 
| 111 112 | 
             
                            # FIX
         | 
| 112 | 
            -
                             | 
| 113 | 
            +
                            app.command :fix, :aliases => [:f] do |fix|
         | 
| 113 114 | 
             
                                fix.summary 'Quick fixes for common problems'
         | 
| 114 115 | 
             
                                fix.options do |opts|
         | 
| 115 116 | 
             
                                    opts.opt :login_sessions, 'LOGIN - Clear sessions to fix login problem(s)', :short => '-l', :long => '--login-sessions', :type => :boolean
         | 
| @@ -122,7 +123,7 @@ module App | |
| 122 123 |  | 
| 123 124 | 
             
                            # GIT
         | 
| 124 125 |  | 
| 125 | 
            -
                             | 
| 126 | 
            +
                            app.command :git, :aliases => [:g] do |git|
         | 
| 126 127 |  | 
| 127 128 | 
             
                                git.summary 'All git related functionality'
         | 
| 128 129 |  | 
| @@ -198,6 +199,7 @@ module App | |
| 198 199 | 
             
                                        opts.opt :from_file, 'Get branch names from file (1 branch per line)', :short => '-f', :long => '--from-file', :type => :boolean
         | 
| 199 200 | 
             
                                        opts.opt :delete_source_branches_local, "Delete all source branches (locally) in #{App::Terminal::format_directory(App::Enum::GIT_MERGE_DEFAULT_FILE)}", :short => '-d', :long => '--delete-local', :type => :boolean
         | 
| 200 201 | 
             
                                        opts.opt :delete_source_branches_remote, "Delete all source branches (remotely) in #{App::Terminal::format_directory(App::Enum::GIT_MERGE_DEFAULT_FILE)}", :short => '-D', :long => '--delete-remote', :type => :boolean
         | 
| 202 | 
            +
                                        opts.opt :sanity_check, 'Run sanity check. Submit source/target branches same as you would during a merge.', :short => '-s', :long => '--sanity-check', :type => :boolean
         | 
| 201 203 | 
             
                                    end
         | 
| 202 204 | 
             
                                    git_merge.action do |opts, args|
         | 
| 203 205 | 
             
                                        AppCommand::GitMerge.new(opts, args).execute
         | 
| @@ -247,7 +249,7 @@ module App | |
| 247 249 | 
             
                            end
         | 
| 248 250 |  | 
| 249 251 | 
             
                            # JIRA
         | 
| 250 | 
            -
                             | 
| 252 | 
            +
                            app.command :jira, :aliases => [:j] do |jira|
         | 
| 251 253 | 
             
                                jira.summary 'Access the Jira API'
         | 
| 252 254 |  | 
| 253 255 | 
             
                                # JIRA CARD
         | 
| @@ -265,7 +267,7 @@ module App | |
| 265 267 | 
             
                            end
         | 
| 266 268 |  | 
| 267 269 | 
             
                            # RESET
         | 
| 268 | 
            -
                             | 
| 270 | 
            +
                            app.command :reset, :aliases => [:R] do |reset|
         | 
| 269 271 | 
             
                                reset.summary 'Reset various things within the App'
         | 
| 270 272 | 
             
                                reset.options do |opts|
         | 
| 271 273 | 
             
                                    opts.opt :fitnesseDump, 'Reset the Fitnesse Dump on your VM', :short => '-f', :long => '--fitnesse-dump', :type => :boolean
         | 
| @@ -276,7 +278,7 @@ module App | |
| 276 278 | 
             
                            end
         | 
| 277 279 |  | 
| 278 280 | 
             
                            # PRODUCTION
         | 
| 279 | 
            -
                             | 
| 281 | 
            +
                            app.command :production, :aliases => [:p] do |production|
         | 
| 280 282 |  | 
| 281 283 | 
             
                                production.summary 'Everything to do with production servers'
         | 
| 282 284 |  | 
| @@ -303,7 +305,7 @@ module App | |
| 303 305 | 
             
                            end
         | 
| 304 306 |  | 
| 305 307 | 
             
                            # REVIEW
         | 
| 306 | 
            -
                             | 
| 308 | 
            +
                            app.command :review, :aliases => [:r] do |review|
         | 
| 307 309 | 
             
                                review.summary 'Perform a quick code review'
         | 
| 308 310 | 
             
                                review.action do |opts, args|
         | 
| 309 311 | 
             
                                    AppCommand::Review.new(opts, args).execute
         | 
| @@ -311,7 +313,7 @@ module App | |
| 311 313 | 
             
                            end
         | 
| 312 314 |  | 
| 313 315 | 
             
                            # SCRIPTS
         | 
| 314 | 
            -
                             | 
| 316 | 
            +
                            app.command :scripts, :aliases => [:s] do |scripts|
         | 
| 315 317 |  | 
| 316 318 | 
             
                                scripts.summary 'Quick & dirty scripts'
         | 
| 317 319 |  | 
| @@ -378,8 +380,16 @@ module App | |
| 378 380 |  | 
| 379 381 | 
             
                            end
         | 
| 380 382 |  | 
| 383 | 
            +
                            # SSH - SSH
         | 
| 384 | 
            +
                            app.command :ssh, :aliases => [:s] do |ssh|
         | 
| 385 | 
            +
                                ssh.summary 'SSH into various stuff.'
         | 
| 386 | 
            +
                                ssh.action do |opts, args|
         | 
| 387 | 
            +
                                    AppCommand::SSH.new(opts, args).execute
         | 
| 388 | 
            +
                                end
         | 
| 389 | 
            +
                            end
         | 
| 390 | 
            +
             | 
| 381 391 | 
             
                            # TAIL
         | 
| 382 | 
            -
                             | 
| 392 | 
            +
                            app.command :tail, :aliases => [:T] do |tail|
         | 
| 383 393 | 
             
                                tail.summary 'Tail various logs (all catalina.out by default)'
         | 
| 384 394 | 
             
                                tail.action do |opts, args|
         | 
| 385 395 | 
             
                                    AppCommand::Tail.new(opts, args).execute
         | 
| @@ -387,7 +397,7 @@ module App | |
| 387 397 | 
             
                            end
         | 
| 388 398 |  | 
| 389 399 | 
             
                            # TEST
         | 
| 390 | 
            -
                             | 
| 400 | 
            +
                            app.command :test, :aliases => [:t] do |test|
         | 
| 391 401 | 
             
                                test.summary 'Run various tests (PHPUnit by default)'
         | 
| 392 402 | 
             
                                test.options do |opts|
         | 
| 393 403 | 
             
                                    opts.opt :cucumber, 'Run Cucumber tests', :short => '-c', :long => '--cucumber', :type => :boolean
         | 
| @@ -402,7 +412,7 @@ module App | |
| 402 412 | 
             
                            end
         | 
| 403 413 |  | 
| 404 414 | 
             
                            # UPDATE
         | 
| 405 | 
            -
                             | 
| 415 | 
            +
                            app.command :update, :aliases => [:u] do |update|
         | 
| 406 416 | 
             
                                update.summary 'Check for updates'
         | 
| 407 417 | 
             
                                update.action do |opts, args|
         | 
| 408 418 | 
             
                                    AppCommand::Update.new(opts, args).execute
         | 
| @@ -410,7 +420,7 @@ module App | |
| 410 420 | 
             
                            end
         | 
| 411 421 |  | 
| 412 422 | 
             
                            # X - SETUP
         | 
| 413 | 
            -
                             | 
| 423 | 
            +
                            app.command :setup, :aliases => [:x] do |setup|
         | 
| 414 424 | 
             
                                setup.summary 'Setup your configuration file'
         | 
| 415 425 | 
             
                                setup.action do |opts, args|
         | 
| 416 426 | 
             
                                    AppCommand::Setup.new(opts, args).execute
         | 
| @@ -418,7 +428,7 @@ module App | |
| 418 428 | 
             
                            end
         | 
| 419 429 |  | 
| 420 430 | 
             
                            # BRIGHTPEARL/BP (DEFAULT)
         | 
| 421 | 
            -
                             | 
| 431 | 
            +
                            app.action do
         | 
| 422 432 | 
             
                                system('bp -h')
         | 
| 423 433 | 
             
                            end
         | 
| 424 434 |  | 
    
        data/lib/core/config.rb
    CHANGED
    
    
    
        data/lib/core/config_unique.rb
    CHANGED
    
    | @@ -32,9 +32,6 @@ module ConfigUnique | |
| 32 32 | 
             
                EC2_PASS = 'ec2_pass'
         | 
| 33 33 |  | 
| 34 34 | 
             
                def param(param_name)
         | 
| 35 | 
            -
                    unless all_available_config_keys.include?(param_name)
         | 
| 36 | 
            -
                        App::Terminal::error("#{App::Terminal::format_highlight(param_name)} is not a valid config parameter", true)
         | 
| 37 | 
            -
                    end
         | 
| 38 35 | 
             
                    @params[param_name]
         | 
| 39 36 | 
             
                end
         | 
| 40 37 |  | 
| @@ -87,27 +84,4 @@ module ConfigUnique | |
| 87 84 | 
             
                    ]
         | 
| 88 85 | 
             
                end
         | 
| 89 86 |  | 
| 90 | 
            -
                def all_available_config_keys
         | 
| 91 | 
            -
                    [
         | 
| 92 | 
            -
                        WORKSTATION_IP,
         | 
| 93 | 
            -
                        WORKSTATION_OS,
         | 
| 94 | 
            -
                        WORKSTATION_PATH_TO_BP_CODE,
         | 
| 95 | 
            -
                        WORKSTATION_PATH_TO_BP_DB,
         | 
| 96 | 
            -
                        VM_IP,
         | 
| 97 | 
            -
                        VM_USER,
         | 
| 98 | 
            -
                        VM_USER_PASSWORD,
         | 
| 99 | 
            -
                        VM_ROOT,
         | 
| 100 | 
            -
                        VM_ROOT_PASSWORD,
         | 
| 101 | 
            -
                        VM_MYSQL_USER,
         | 
| 102 | 
            -
                        VM_MYSQL_PASSWORD,
         | 
| 103 | 
            -
                        PREFERRED_TEXT_EDITOR,
         | 
| 104 | 
            -
                        GIT_USERNAME,
         | 
| 105 | 
            -
                        CRYPT_KEY,
         | 
| 106 | 
            -
                        CRYPT_HEX,
         | 
| 107 | 
            -
                        EC2_HOST,
         | 
| 108 | 
            -
                        EC2_USER,
         | 
| 109 | 
            -
                        EC2_PASS
         | 
| 110 | 
            -
                    ]
         | 
| 111 | 
            -
                end
         | 
| 112 | 
            -
             | 
| 113 87 | 
             
            end
         | 
    
        data/lib/core/ebay.rb
    CHANGED
    
    | @@ -2,7 +2,43 @@ module App | |
| 2 2 |  | 
| 3 3 | 
             
                class Ebay
         | 
| 4 4 |  | 
| 5 | 
            -
                     | 
| 5 | 
            +
                    SANDBOX = 'sandbox'
         | 
| 6 | 
            +
                    SANDBOX_URL = 'https://api.sandbox.ebay.com/ws/api.dll'
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                    PRODUCTION = 'production'
         | 
| 9 | 
            +
                    PRODUCTION_URL = 'https://api.ebay.com/ws/api.dll'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def initialize(app_key, dev_key, cert_key, runame, api_url, api_token)
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                        @app_key = app_key
         | 
| 14 | 
            +
                        @dev_key = dev_key
         | 
| 15 | 
            +
                        @cert_key = cert_key
         | 
| 16 | 
            +
                        @runame = runame
         | 
| 17 | 
            +
                        @api_url = api_url
         | 
| 18 | 
            +
                        @api_token = api_token
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                    end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    # findItemsByKeywordsRequest
         | 
| 23 | 
            +
                    def find(search_term = nil)
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                        if search_term.nil?
         | 
| 26 | 
            +
                            raise RuntimeError, 'Search term cannot be nil.'
         | 
| 27 | 
            +
                        end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                        payload = "<?xml version=\"1.0\" encoding=\"utf-8\"?><findItemsByKeywordsRequest xmlns=\"http://www.ebay.com/marketplace/search/v1/services\"><keywords>#{search_term}</keywords></findItemsByKeywordsRequest>"
         | 
| 30 | 
            +
                        headers = {
         | 
| 31 | 
            +
                            'X-EBAY-SOA-SERVICE-NAME' => 'FindingService',
         | 
| 32 | 
            +
                            'X-EBAY-SOA-OPERATION-NAME' => 'findItemsByKeywords',
         | 
| 33 | 
            +
                            'X-EBAY-SOA-SERVICE-VERSION' => '1.13.0',
         | 
| 34 | 
            +
                            'X-EBAY-SOA-GLOBAL-ID' => 'EBAY-GB',
         | 
| 35 | 
            +
                            'X-EBAY-SOA-SECURITY-APPNAME' => @app_key,
         | 
| 36 | 
            +
                            'X-EBAY-SOA-REQUEST-DATA-FORMAT' => 'XML'
         | 
| 37 | 
            +
                        }
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                        response = RestClient.post(@api_url, payload, headers)
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                        puts response.inspect
         | 
| 6 42 |  | 
| 7 43 | 
             
                    end
         | 
| 8 44 |  | 
    
        data/lib/core/ebay_factory.rb
    CHANGED
    
    | @@ -2,30 +2,44 @@ module App | |
| 2 2 |  | 
| 3 3 | 
             
                class EbayFactory
         | 
| 4 4 |  | 
| 5 | 
            -
                     | 
| 5 | 
            +
                    CONFIGURATION_PREFIX = 'ebay_'
         | 
| 6 6 |  | 
| 7 7 | 
             
                    @credentials = {}
         | 
| 8 8 |  | 
| 9 | 
            -
                    def self.get( | 
| 9 | 
            +
                    def self.get(sandbox_production = App::Ebay::SANDBOX, api_token = nil)
         | 
| 10 10 |  | 
| 11 | 
            -
                        if  | 
| 11 | 
            +
                        if api_token.nil?
         | 
| 12 | 
            +
                            raise RuntimeError, 'You must provide an API token.'
         | 
| 13 | 
            +
                        end
         | 
| 12 14 |  | 
| 13 | 
            -
             | 
| 14 | 
            -
                             | 
| 15 | 
            -
             | 
| 16 | 
            -
                             | 
| 17 | 
            -
             | 
| 18 | 
            -
                            #     App::Terminal::error('EC2 access data not found', ["The command you're trying to run requires access to an EC2 database.", "In order for this to work you will need valid #{App::Terminal::format_highlight('access data')}.", "Please speak to #{App::Terminal::format_highlight('Albert')} (or team Raptor) for more info."], true)
         | 
| 19 | 
            -
                            # end
         | 
| 20 | 
            -
                            # @ec2_connection = Mysql2::Client.new(
         | 
| 21 | 
            -
                            #     :host => encrypter.decrypt(host),
         | 
| 22 | 
            -
                            #     :username => encrypter.decrypt(user),
         | 
| 23 | 
            -
                            #     :password => encrypter.decrypt(pass),
         | 
| 24 | 
            -
                            #     :database => schema
         | 
| 25 | 
            -
                            # )
         | 
| 15 | 
            +
                        if api_token =~ /\Aebay_\S+\z/i
         | 
| 16 | 
            +
                            api_token_final = api_token
         | 
| 17 | 
            +
                        else
         | 
| 18 | 
            +
                            api_token_final = "#{CONFIGURATION_PREFIX}#{api_token}"
         | 
| 19 | 
            +
                        end
         | 
| 26 20 |  | 
| 21 | 
            +
                        if api_token.nil? || App::Config::param_exists(api_token_final) == false
         | 
| 22 | 
            +
                            App::Terminal::error('Invalid API Token', "The #{App::Terminal::format_highlight('config parameter')} #{App::Terminal::format_invalid(api_token_final)} doesn't exist in: #{App::Terminal::format_directory(ConfigUnique::CONFIG_FILE)}", true)
         | 
| 27 23 | 
             
                        end
         | 
| 28 | 
            -
             | 
| 24 | 
            +
             | 
| 25 | 
            +
                        case sandbox_production
         | 
| 26 | 
            +
                            when App::Ebay::SANDBOX
         | 
| 27 | 
            +
                                app_key = App::Config.param(ConfigUnique::EBAY_SANDBOX_APP)
         | 
| 28 | 
            +
                                dev_key = App::Config.param(ConfigUnique::EBAY_SANDBOX_DEV)
         | 
| 29 | 
            +
                                cert_key = App::Config.param(ConfigUnique::EBAY_SANDBOX_CERT)
         | 
| 30 | 
            +
                                runame = App::Config.param(ConfigUnique::EBAY_SANDBOX_RUNAME)
         | 
| 31 | 
            +
                                api_url = App::Ebay::SANDBOX_URL
         | 
| 32 | 
            +
                            when App::Ebay::PRODUCTION
         | 
| 33 | 
            +
                                app_key = App::Config.param(ConfigUnique::EBAY_PRODUCTION_APP)
         | 
| 34 | 
            +
                                dev_key = App::Config.param(ConfigUnique::EBAY_PRODUCTION_DEV)
         | 
| 35 | 
            +
                                cert_key = App::Config.param(ConfigUnique::EBAY_PRODUCTION_CERT)
         | 
| 36 | 
            +
                                runame = App::Config.param(ConfigUnique::EBAY_PRODUCTION_RUNAME)
         | 
| 37 | 
            +
                                api_url = App::Ebay::PRODUCTION_URL
         | 
| 38 | 
            +
                            else
         | 
| 39 | 
            +
                                raise RuntimeError, "Must specify either '#{App::Ebay::SANDBOX}' or '#{App::Ebay::PRODUCTION}', you passed: #{sandbox_production}"
         | 
| 40 | 
            +
                        end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                        App::Ebay.new(app_key, dev_key, cert_key, runame, api_url, api_token)
         | 
| 29 43 |  | 
| 30 44 | 
             
                    end
         | 
| 31 45 |  | 
    
        data/lib/core/git.rb
    CHANGED
    
    | @@ -597,16 +597,16 @@ module App | |
| 597 597 | 
             
                            case display
         | 
| 598 598 | 
             
                                when SAME_BRANCH_WARNING
         | 
| 599 599 | 
             
                                    App::Terminal::warning("You're on #{App::Terminal::format_highlight('2 different branches')}", [
         | 
| 600 | 
            -
             | 
| 601 | 
            -
             | 
| 602 | 
            -
             | 
| 600 | 
            +
                                                                                                                                     "#{App::Terminal::format_directory(get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE)))} is on #{App::Terminal::format_branch(branch_code)}",
         | 
| 601 | 
            +
                                                                                                                                     "#{App::Terminal::format_directory(get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_DB)))}   is on #{App::Terminal::format_branch(branch_db)}"
         | 
| 602 | 
            +
                                                                                                                                 ])
         | 
| 603 603 | 
             
                                when SAME_BRANCH_ERROR
         | 
| 604 604 | 
             
                                    App::Terminal::error("You're on #{App::Terminal::format_highlight('2 different branches')}", [
         | 
| 605 | 
            -
             | 
| 606 | 
            -
             | 
| 607 | 
            -
             | 
| 608 | 
            -
             | 
| 609 | 
            -
             | 
| 605 | 
            +
                                                                                                                                   "#{App::Terminal::format_directory(get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE)))} is on #{App::Terminal::format_branch(branch_code)}",
         | 
| 606 | 
            +
                                                                                                                                   "#{App::Terminal::format_directory(get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_DB)))}   is on #{App::Terminal::format_branch(branch_db)}",
         | 
| 607 | 
            +
                                                                                                                                   nil,
         | 
| 608 | 
            +
                                                                                                                                   'You cannot run this command unless both of your repos are on the same branch.'
         | 
| 609 | 
            +
                                                                                                                               ])
         | 
| 610 610 | 
             
                            end
         | 
| 611 611 | 
             
                            return false
         | 
| 612 612 | 
             
                        end
         | 
| @@ -792,7 +792,7 @@ module App | |
| 792 792 | 
             
                        possible_branches = []
         | 
| 793 793 | 
             
                        if jira_number =~ /\A\d{4,5}\z/
         | 
| 794 794 | 
             
                            get_all_branches_as_array.each do |possible_branch|
         | 
| 795 | 
            -
                                if possible_branch =~  | 
| 795 | 
            +
                                if possible_branch =~ /#{jira_number}/i
         | 
| 796 796 | 
             
                                    # If more than one possible branch exists, IE: bug-14145 & bp-14145
         | 
| 797 797 | 
             
                                    if possible_branches.any?
         | 
| 798 798 | 
             
                                        App::Terminal::error("More than one possible branch found for jira number: #{App::Terminal::format_highlight(jira_number)}", [App::Terminal::format_branch(possible_branches[0]), App::Terminal::format_branch(possible_branch), nil, "In this case, you must specify the branch name #{App::Terminal::format_highlight('explicitly')}."], true)
         | 
| @@ -824,6 +824,31 @@ module App | |
| 824 824 | 
             
                        changes_exist
         | 
| 825 825 | 
             
                    end
         | 
| 826 826 |  | 
| 827 | 
            +
                    # Pass the result of App::Terminal::command() and this should do the rest. Bombs out if you don't confirm.
         | 
| 828 | 
            +
                    # @return void
         | 
| 829 | 
            +
                    def check_for_conflicts(result, additional_info = nil)
         | 
| 830 | 
            +
                        final_info = []
         | 
| 831 | 
            +
                        unless additional_info.nil?
         | 
| 832 | 
            +
                            if additional_info.is_a? Array
         | 
| 833 | 
            +
                                additional_info.each do |info|
         | 
| 834 | 
            +
                                    final_info << info
         | 
| 835 | 
            +
                                end
         | 
| 836 | 
            +
                            else
         | 
| 837 | 
            +
                                if additional_info.is_a? String
         | 
| 838 | 
            +
                                    final_info << additional_info
         | 
| 839 | 
            +
                                else
         | 
| 840 | 
            +
                                    raise RuntimeError, "Expected String, got: #{additional_info.class}"
         | 
| 841 | 
            +
                                end
         | 
| 842 | 
            +
                            end
         | 
| 843 | 
            +
                        end
         | 
| 844 | 
            +
                        final_info << "Please #{App::Terminal::format_action('open an IDE')} and resolve your conflicts before continuing."
         | 
| 845 | 
            +
                        if result == false
         | 
| 846 | 
            +
                            unless App::Terminal::prompt_yes_no('Merge conflict occurred', final_info, "Have you #{App::Terminal::format_highlight('resolved your conflicts', true)}\x1B[38;5;89m and #{App::Terminal::format_action('committed')}\x1B[38;5;89m the changes?")
         | 
| 847 | 
            +
                                App::Terminal::abort(nil, nil, true, false)
         | 
| 848 | 
            +
                            end
         | 
| 849 | 
            +
                        end
         | 
| 850 | 
            +
                    end
         | 
| 851 | 
            +
             | 
| 827 852 | 
             
                    # Get list of files that have changed between 2 branches
         | 
| 828 853 | 
             
                    # @return Array
         | 
| 829 854 | 
             
                    def get_changed_files(repo_dir, branch_to_compare_to = "origin/#{App::Git::MASTER}")
         | 
    
        data/lib/core/terminal.rb
    CHANGED
    
    | @@ -199,8 +199,12 @@ module App | |
| 199 199 |  | 
| 200 200 | 
             
                    # Returns action text in consistent, uniform manner.
         | 
| 201 201 | 
             
                    # @return String
         | 
| 202 | 
            -
                    def self.format_highlight(highlighted_text)
         | 
| 203 | 
            -
                         | 
| 202 | 
            +
                    def self.format_highlight(highlighted_text, capitalize = false)
         | 
| 203 | 
            +
                        if capitalize
         | 
| 204 | 
            +
                            return "\x1B[38;5;117m#{highlighted_text.upcase}\x1B[0m"
         | 
| 205 | 
            +
                        else
         | 
| 206 | 
            +
                            return "\x1B[38;5;117m#{highlighted_text}\x1B[0m"
         | 
| 207 | 
            +
                        end
         | 
| 204 208 | 
             
                    end
         | 
| 205 209 |  | 
| 206 210 | 
             
                    # Returns invalid data in consistent, uniform manner.
         | 
    
        data/lib/routes/git_checkout.rb
    CHANGED
    
    | @@ -16,15 +16,12 @@ module AppCommand | |
| 16 16 | 
             
                    def opts_validate
         | 
| 17 17 |  | 
| 18 18 | 
             
                        unless @args.any?
         | 
| 19 | 
            -
             | 
| 20 19 | 
             
                            if @opts[:branch] || @opts[:branch_origin]
         | 
| 21 20 | 
             
                                App::Terminal::error('You must specify a branch name')
         | 
| 22 21 | 
             
                            else
         | 
| 23 22 | 
             
                                system('bp g co -h')
         | 
| 24 23 | 
             
                            end
         | 
| 25 | 
            -
             | 
| 26 24 | 
             
                            exit
         | 
| 27 | 
            -
             | 
| 28 25 | 
             
                        end
         | 
| 29 26 |  | 
| 30 27 | 
             
                    end
         | 
| @@ -145,14 +142,21 @@ module AppCommand | |
| 145 142 | 
             
                            unless branch_data_inner[:"#{App::Git::BRANCH_IS_CURRENT}"]
         | 
| 146 143 | 
             
                                commands << "git checkout #{branch_to_checkout}"
         | 
| 147 144 | 
             
                            end
         | 
| 145 | 
            +
                            App::Terminal::command(commands, repo_dir)
         | 
| 148 146 | 
             
                            if @opts[:update] || @opts[:updatePush]
         | 
| 149 | 
            -
                                commands  | 
| 150 | 
            -
             | 
| 147 | 
            +
                                commands = [
         | 
| 148 | 
            +
                                    'git pull',
         | 
| 149 | 
            +
                                    "git merge #{App::Git::MASTER} --no-edit"
         | 
| 150 | 
            +
                                ]
         | 
| 151 | 
            +
                                results = App::Terminal::command(commands, repo_dir, true, false)
         | 
| 152 | 
            +
                                @git.check_for_conflicts(results[1], "Unable to successfully merge #{App::Terminal::format_branch(App::Git::MASTER)} into #{App::Terminal::format_branch(branch_to_checkout)} on #{App::Terminal::format_directory(@git.get_repo_shorthand(repo_dir))}")
         | 
| 151 153 | 
             
                            end
         | 
| 152 154 | 
             
                            if @opts[:updatePush]
         | 
| 153 | 
            -
                                commands  | 
| 155 | 
            +
                                commands =[
         | 
| 156 | 
            +
                                    'git push'
         | 
| 157 | 
            +
                                ]
         | 
| 158 | 
            +
                                App::Terminal::command(commands, repo_dir, true, false)
         | 
| 154 159 | 
             
                            end
         | 
| 155 | 
            -
                            App::Terminal::command(commands, repo_dir)
         | 
| 156 160 | 
             
                            count = count + 1
         | 
| 157 161 | 
             
                        end
         | 
| 158 162 | 
             
                        @git.check_for_same_branch
         | 
    
        data/lib/routes/git_merge.rb
    CHANGED
    
    | @@ -23,13 +23,13 @@ module AppCommand | |
| 23 23 | 
             
                        end
         | 
| 24 24 |  | 
| 25 25 | 
             
                        unless @args.any?
         | 
| 26 | 
            -
                            unless @opts[:from_file] || @opts[:open_file] || @opts[:delete_source_branches_local] || @opts[:delete_source_branches_remote]
         | 
| 26 | 
            +
                            unless @opts[:from_file] || @opts[:open_file] || @opts[:delete_source_branches_local] || @opts[:delete_source_branches_remote] || @otps[:sanity_check]
         | 
| 27 27 | 
             
                                system('bp g m -h')
         | 
| 28 28 | 
             
                                exit
         | 
| 29 29 | 
             
                            end
         | 
| 30 30 | 
             
                        end
         | 
| 31 31 |  | 
| 32 | 
            -
                        if @args[0] == App::Git::MASTER
         | 
| 32 | 
            +
                        if @args[0] == App::Git::MASTER && !@opts[:from_file]
         | 
| 33 33 | 
             
                            App::Terminal::error('Not allowed', "You cannot merge #{App::Terminal::format_branch(App::Git::MASTER)}\x1B[38;5;240m to #{App::Terminal::format_branch(App::Git::MASTER)}", true)
         | 
| 34 34 | 
             
                        end
         | 
| 35 35 |  | 
| @@ -38,9 +38,7 @@ module AppCommand | |
| 38 38 | 
             
                                App::Terminal::error('Too many parameters', ["When using the #{App::Terminal::format_flag('f')}\x1B[38;5;240m the system only expects one #{App::Terminal::format_action('optional')}\x1B[38;5;240m parameter \xe2\x80\x94 the target branch.", "The amount of parameters you passed were: #{App::Terminal::format_highlight(@args.length)}"], true)
         | 
| 39 39 | 
             
                            end
         | 
| 40 40 | 
             
                            if @opts[:from_file] != '' && File.file?(App::Enum::GIT_MERGE_DEFAULT_FILE) == false
         | 
| 41 | 
            -
                                App::Terminal::error("File not found: #{App::Terminal::format_directory(App::Enum::GIT_MERGE_DEFAULT_FILE)}", [
         | 
| 42 | 
            -
                                                                                                                                                "To specify multiple #{App::Terminal::format_branch('source-branches')} try running #{App::Terminal::format_command('bp g m -o')} first."
         | 
| 43 | 
            -
                                                                                                                                            ], true)
         | 
| 41 | 
            +
                                App::Terminal::error("File not found: #{App::Terminal::format_directory(App::Enum::GIT_MERGE_DEFAULT_FILE)}", ["To specify multiple #{App::Terminal::format_branch('source-branches')} try running #{App::Terminal::format_command('bp g m -o')} first."], true)
         | 
| 44 42 | 
             
                            end
         | 
| 45 43 | 
             
                        end
         | 
| 46 44 |  | 
| @@ -51,7 +49,10 @@ module AppCommand | |
| 51 49 | 
             
                        retrieve_source_branches unless @opts[:open_file]
         | 
| 52 50 | 
             
                        retrieve_target_branches unless @opts[:open_file]
         | 
| 53 51 |  | 
| 54 | 
            -
                        if @opts[: | 
| 52 | 
            +
                        if @opts[:sanity_check]
         | 
| 53 | 
            +
                            sanity_check
         | 
| 54 | 
            +
                            exit
         | 
| 55 | 
            +
                        elsif @opts[:open_file]
         | 
| 55 56 | 
             
                            system("#{App::Config.param(App::Config::PREFERRED_TEXT_EDITOR)} #{App::Enum::GIT_MERGE_DEFAULT_FILE}")
         | 
| 56 57 | 
             
                            exit
         | 
| 57 58 | 
             
                        elsif @opts[:delete_source_branches_local]
         | 
| @@ -327,14 +328,7 @@ module AppCommand | |
| 327 328 |  | 
| 328 329 | 
             
                        App::Terminal::success('It seems as if everything ran smoothly', "#{@source_branches.count} #{(@source_branches.count) == 1 ? 'branch has' : 'branches have'} been successfully merged to #{App::Terminal::format_branch(@target_branch)}")
         | 
| 329 330 |  | 
| 330 | 
            -
                         | 
| 331 | 
            -
                        @source_branches.each do |x|
         | 
| 332 | 
            -
                            grep_string = x.split('-')
         | 
| 333 | 
            -
                            grep_string = "BP-#{grep_string[grep_string.count - 1]}"
         | 
| 334 | 
            -
                            puts "\x1B[38;5;39m#{x}\x1B[0m \xe2\x80\x94 (#{grep_string})"
         | 
| 335 | 
            -
                            system("cd #{App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE)} && git log | grep '#{grep_string}' --color=auto")
         | 
| 336 | 
            -
                            system("cd #{App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_DB)} && git log | grep '#{grep_string}' --color=auto")
         | 
| 337 | 
            -
                        end
         | 
| 331 | 
            +
                        sanity_check
         | 
| 338 332 | 
             
                        puts
         | 
| 339 333 |  | 
| 340 334 | 
             
                        @git.check_for_stash(true)
         | 
| @@ -367,6 +361,30 @@ module AppCommand | |
| 367 361 |  | 
| 368 362 | 
             
                    end
         | 
| 369 363 |  | 
| 364 | 
            +
                    def sanity_check
         | 
| 365 | 
            +
             | 
| 366 | 
            +
                        App::Terminal::info("Running sanity check against: #{App::Terminal::format_branch(@target_branch)}")
         | 
| 367 | 
            +
             | 
| 368 | 
            +
                        @source_branches.each do |source_branch|
         | 
| 369 | 
            +
             | 
| 370 | 
            +
                            jira_numbers = source_branch.scan(/\d{4,5}/i)
         | 
| 371 | 
            +
                            if jira_numbers.any?
         | 
| 372 | 
            +
                                jira_numbers.each do |jira_number|
         | 
| 373 | 
            +
                                    unless jira_number == ''
         | 
| 374 | 
            +
                                        sanity_check_grep(jira_number, source_branch, @target_branch)
         | 
| 375 | 
            +
                                    end
         | 
| 376 | 
            +
             | 
| 377 | 
            +
                                end
         | 
| 378 | 
            +
                            else
         | 
| 379 | 
            +
                                sanity_check_grep(source_branch, source_branch, @target_branch)
         | 
| 380 | 
            +
                            end
         | 
| 381 | 
            +
             | 
| 382 | 
            +
                        end
         | 
| 383 | 
            +
             | 
| 384 | 
            +
                        puts
         | 
| 385 | 
            +
             | 
| 386 | 
            +
                    end
         | 
| 387 | 
            +
             | 
| 370 388 | 
             
                    private
         | 
| 371 389 |  | 
| 372 390 | 
             
                    def retrieve_source_branches
         | 
| @@ -385,6 +403,8 @@ module AppCommand | |
| 385 403 |  | 
| 386 404 | 
             
                        @source_branches.uniq!
         | 
| 387 405 |  | 
| 406 | 
            +
                        return if @opts[:sanity_check]
         | 
| 407 | 
            +
             | 
| 388 408 | 
             
                        # If branch(es) was/were specified as '1234' or '12345', this code tries to resolve it automatically as bp-12345/bug-12345/feature-12345
         | 
| 389 409 | 
             
                        branches_to_resolve = {}
         | 
| 390 410 | 
             
                        @source_branches.each do |branch_name|
         | 
| @@ -402,7 +422,7 @@ module AppCommand | |
| 402 422 | 
             
                            end
         | 
| 403 423 | 
             
                            @git.get_all_branches_as_array.each do |possible_branch|
         | 
| 404 424 | 
             
                                branches_to_resolve.keys.each do |branch_to_resolve|
         | 
| 405 | 
            -
                                    if possible_branch =~  | 
| 425 | 
            +
                                    if possible_branch =~ /#{branch_to_resolve}/i
         | 
| 406 426 |  | 
| 407 427 | 
             
                                        # If more than one possible branch exists, IE: bug-14145 & bp-14145
         | 
| 408 428 | 
             
                                        unless branches_to_resolve[branch_to_resolve] == false
         | 
| @@ -411,14 +431,16 @@ module AppCommand | |
| 411 431 |  | 
| 412 432 | 
             
                                        branches_to_resolve[branch_to_resolve] = possible_branch
         | 
| 413 433 | 
             
                                        App::Terminal::output("Resolved branch #{App::Terminal::format_branch(possible_branch)} from jira number: #{App::Terminal::format_highlight(branch_to_resolve)}", App::Terminal::MSG_AUTOMATIC)
         | 
| 434 | 
            +
             | 
| 414 435 | 
             
                                    end
         | 
| 415 436 | 
             
                                end
         | 
| 416 437 | 
             
                            end
         | 
| 417 438 | 
             
                            branches_to_resolve.each do |branch_to_resolve|
         | 
| 418 | 
            -
                                if branch_to_resolve[1] == false
         | 
| 439 | 
            +
                                if branch_to_resolve[1] == false && !@opts[:sanity_check]
         | 
| 419 440 | 
             
                                    App::Terminal::error("No branch found for jira number: #{App::Terminal::format_highlight(branch_to_resolve[0])}", ['Please check your input and try again.'], true)
         | 
| 441 | 
            +
                                elsif branch_to_resolve[1] != false
         | 
| 442 | 
            +
                                    new_source_branches << branch_to_resolve[1] unless branch_to_resolve[1] == '' || branch_to_resolve[1].nil?
         | 
| 420 443 | 
             
                                end
         | 
| 421 | 
            -
                                new_source_branches << branch_to_resolve[1] unless branch_to_resolve[1] == '' || branch_to_resolve[1].nil?
         | 
| 422 444 | 
             
                            end
         | 
| 423 445 | 
             
                            @source_branches = new_source_branches
         | 
| 424 446 | 
             
                        end
         | 
| @@ -464,6 +486,24 @@ module AppCommand | |
| 464 486 | 
             
                        source_branch_text
         | 
| 465 487 | 
             
                    end
         | 
| 466 488 |  | 
| 489 | 
            +
                    def sanity_check_grep(grep_string, source_branch, target_branch)
         | 
| 490 | 
            +
             | 
| 491 | 
            +
                        puts "  \x1B[38;5;39m#{source_branch}\x1B[0m \xe2\x80\x94 (#{grep_string})"
         | 
| 492 | 
            +
                        results_cd = App::Terminal::command_capture("git log #{target_branch} | grep '#{grep_string}' --color=auto", App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE), false, false)
         | 
| 493 | 
            +
                        results_db = App::Terminal::command_capture("git log #{target_branch} | grep '#{grep_string}' --color=auto", App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_DB), false, false)
         | 
| 494 | 
            +
             | 
| 495 | 
            +
                        results_cd.push(*results_db).each do |block|
         | 
| 496 | 
            +
                            block.split("\n").each do |line|
         | 
| 497 | 
            +
                                if line.strip != ''
         | 
| 498 | 
            +
                                    if line =~ /\A\s*bp-\d{4,5}/i
         | 
| 499 | 
            +
                                        puts "  #{line.gsub(/#{grep_string}/i, "\x1B[38;5;196m#{grep_string}\x1B[0m")}"
         | 
| 500 | 
            +
                                    end
         | 
| 501 | 
            +
                                end
         | 
| 502 | 
            +
                            end
         | 
| 503 | 
            +
                        end
         | 
| 504 | 
            +
             | 
| 505 | 
            +
                    end
         | 
| 506 | 
            +
             | 
| 467 507 | 
             
                end
         | 
| 468 508 |  | 
| 469 509 | 
             
            end
         | 
    
        data/lib/routes/git_update.rb
    CHANGED
    
    | @@ -3,10 +3,14 @@ module AppCommand | |
| 3 3 | 
             
                class GitUpdate < ::Convoy::ActionCommand::Base
         | 
| 4 4 |  | 
| 5 5 | 
             
                    def execute
         | 
| 6 | 
            -
             | 
| 6 | 
            +
             | 
| 7 7 | 
             
                        @opts = command_options
         | 
| 8 | 
            +
                        @args = arguments
         | 
| 9 | 
            +
                        @git = App::Git.new
         | 
| 10 | 
            +
             | 
| 8 11 | 
             
                        opts_validate
         | 
| 9 12 | 
             
                        opts_routing
         | 
| 13 | 
            +
             | 
| 10 14 | 
             
                    end
         | 
| 11 15 |  | 
| 12 16 | 
             
                    def opts_validate
         | 
| @@ -39,11 +43,7 @@ module AppCommand | |
| 39 43 | 
             
                                if results[3] == false
         | 
| 40 44 | 
             
                                    @git.ask_to_setup_remote_tracking(current_branch, repo_dir)
         | 
| 41 45 | 
             
                                end
         | 
| 42 | 
            -
                                 | 
| 43 | 
            -
                                    unless App::Terminal::prompt_yes_no('Merge conflict occurred', ["Unable to successfully merge #{App::Terminal::format_branch(App::Git::MASTER)} into #{App::Terminal::format_branch(current_branch)} on #{App::Terminal::format_directory(@git.get_repo_shorthand(repo_dir))}", "Please #{App::Terminal::format_action('open an IDE')}\x1B[38;5;240m and resolve your conflicts as soon as this script has finished executing."])
         | 
| 44 | 
            -
                                        App::Terminal::abort(nil, nil, true, false)
         | 
| 45 | 
            -
                                    end
         | 
| 46 | 
            -
                                end
         | 
| 46 | 
            +
                                @git.check_for_conflicts(results[4], "Unable to successfully merge #{App::Terminal::format_branch(App::Git::MASTER)} into #{App::Terminal::format_branch(current_branch)} on #{App::Terminal::format_directory(@git.get_repo_shorthand(repo_dir))}")
         | 
| 47 47 | 
             
                            end
         | 
| 48 48 | 
             
                            if @opts[:push] && current_branch != App::Git::MASTER
         | 
| 49 49 | 
             
                                App::Terminal::command("git push origin #{current_branch}", repo_dir)
         | 
| @@ -7,15 +7,6 @@ module AppCommand | |
| 7 7 |  | 
| 8 8 | 
             
                    include Columnist
         | 
| 9 9 |  | 
| 10 | 
            -
                    LOG_URI_EUW1 = 'http://ec2-54-73-66-114.eu-west-1.compute.amazonaws.com:7777/php/php.log'
         | 
| 11 | 
            -
                    LOG_URI_EUW2 = 'http://ec2-54-73-26-152.eu-west-1.compute.amazonaws.com:7777/php/php.log'
         | 
| 12 | 
            -
                    LOG_URI_USE1 = 'http://ec2-174-129-36-164.compute-1.amazonaws.com:7777/php/php.log'
         | 
| 13 | 
            -
                    LOG_URI_USE2 = 'http://54.235.155.6:7777/php/php.log'
         | 
| 14 | 
            -
                    LOG_URI_USW1 = 'http://ec2-184-72-46-73.us-west-1.compute.amazonaws.com:7777/php/php.log'
         | 
| 15 | 
            -
                    LOG_URI_USW2 = 'http://ec2-184-72-49-68.us-west-1.compute.amazonaws.com:7777/php/php.log'
         | 
| 16 | 
            -
                    LOG_URI_STG1 = 'http://ec2-54-185-160-108.us-west-2.compute.amazonaws.com:7777/php/php.log'
         | 
| 17 | 
            -
                    LOG_URI_STG2 = 'http://ec2-54-190-109-53.us-west-2.compute.amazonaws.com:7777/php/php.log'
         | 
| 18 | 
            -
             | 
| 19 10 | 
             
                    def execute
         | 
| 20 11 |  | 
| 21 12 | 
             
                        @opts = command_options
         | 
| @@ -200,16 +191,17 @@ module AppCommand | |
| 200 191 | 
             
                    def php_log_data
         | 
| 201 192 |  | 
| 202 193 | 
             
                        raw_log_data = ''
         | 
| 203 | 
            -
                        raw_log_uris =  | 
| 204 | 
            -
                             | 
| 205 | 
            -
                             | 
| 206 | 
            -
                             | 
| 207 | 
            -
                             | 
| 208 | 
            -
                             | 
| 209 | 
            -
                             | 
| 210 | 
            -
                             | 
| 211 | 
            -
                             | 
| 212 | 
            -
             | 
| 194 | 
            +
                        raw_log_uris = %w(
         | 
| 195 | 
            +
                            http://54.235.155.6:7777/php/php.log
         | 
| 196 | 
            +
                            http://ec2-174-129-36-164.compute-1.amazonaws.com:7777/php/php.log
         | 
| 197 | 
            +
                            http://ec2-54-185-160-108.us-west-2.compute.amazonaws.com:7777/php/php.log
         | 
| 198 | 
            +
                            http://ec2-54-190-109-53.us-west-2.compute.amazonaws.com:7777/php/php.log
         | 
| 199 | 
            +
                            http://ec2-54-73-66-114.eu-west-1.compute.amazonaws.com:7777/php/php.log
         | 
| 200 | 
            +
                            http://ec2-54-73-26-152.eu-west-1.compute.amazonaws.com:7777/php/php.log
         | 
| 201 | 
            +
                            http://ec2-54-217-40-80.eu-west-1.compute.amazonaws.com:7777/php/php.log
         | 
| 202 | 
            +
                            http://ec2-184-72-46-73.us-west-1.compute.amazonaws.com:7777/php/php.log
         | 
| 203 | 
            +
                            http://ec2-184-72-49-68.us-west-1.compute.amazonaws.com:7777/php/php.log
         | 
| 204 | 
            +
                        )
         | 
| 213 205 | 
             
                        raw_log_uris.each do |log_uri|
         | 
| 214 206 | 
             
                            App::Terminal::output("Retrieving data from: #{log_uri}")
         | 
| 215 207 | 
             
                            raw_log_data << RestClient.get(log_uri)
         | 
| @@ -46,14 +46,14 @@ module AppCommand | |
| 46 46 | 
             
                        end
         | 
| 47 47 |  | 
| 48 48 | 
             
                        if atleast_one_error
         | 
| 49 | 
            -
                            unless App::Terminal::prompt_yes_no(' | 
| 49 | 
            +
                            unless App::Terminal::prompt_yes_no('Continue by skipping these branches?', ["The above branch(es) have unmerged commits and will be #{App::Terminal::format_action('skipped')} in the removal process.", "You #{App::Terminal::format_invalid('cannot delete', true)} these branches using this script, this must be done manually #{App::Terminal::format_highlight('afterwards')}."])
         | 
| 50 50 | 
             
                                App::Terminal::abort(nil, nil, true, false)
         | 
| 51 51 | 
             
                            end
         | 
| 52 52 | 
             
                        end
         | 
| 53 53 |  | 
| 54 54 | 
             
                        @git.show_branches_draw_table(fnl_branches_cd, fnl_branches_db)
         | 
| 55 55 |  | 
| 56 | 
            -
                        unless App::Terminal::prompt_yes_no('Remove these branches?', ["By continuing, the above branches will be #{App::Terminal::format_action('removed permanently')} both #{App::Terminal::format_highlight('locally & remotely')} | 
| 56 | 
            +
                        unless App::Terminal::prompt_yes_no('Remove these branches?', ["By continuing, the above branches will be #{App::Terminal::format_action('removed permanently')} both #{App::Terminal::format_highlight('locally & remotely')} (except release branches)."], 'Are you absolutely sure you want to continue?', false)
         | 
| 57 57 | 
             
                            App::Terminal::abort(nil, nil, true, false)
         | 
| 58 58 | 
             
                        end
         | 
| 59 59 |  | 
    
        data/lib/routes/scripts_sonar.rb
    CHANGED
    
    | @@ -56,6 +56,7 @@ module AppCommand | |
| 56 56 | 
             
                        end
         | 
| 57 57 |  | 
| 58 58 | 
             
                        found_results = false
         | 
| 59 | 
            +
                        found_warnings = false
         | 
| 59 60 | 
             
                        results_output = []
         | 
| 60 61 |  | 
| 61 62 | 
             
                        results.each do |result|
         | 
| @@ -65,6 +66,9 @@ module AppCommand | |
| 65 66 | 
             
                                        if line =~ /\AFILE:\s(.*).\w{3,5}/i
         | 
| 66 67 | 
             
                                            found_results = true
         | 
| 67 68 | 
             
                                            results_output << "\x1B[38;5;196m#{line}\x1B[0m"
         | 
| 69 | 
            +
                                        elsif line =~ /fatal error: (.*) on line \d+/i || line =~ /warning: (.*) on line \d+/i
         | 
| 70 | 
            +
                                            found_warnings = true
         | 
| 71 | 
            +
                                            results_output << "\x1B[38;5;250m#{line}\x1B[0m"
         | 
| 68 72 | 
             
                                        else
         | 
| 69 73 | 
             
                                            results_output << "\x1B[38;5;250m#{line}\x1B[0m"
         | 
| 70 74 | 
             
                                        end
         | 
| @@ -75,6 +79,8 @@ module AppCommand | |
| 75 79 |  | 
| 76 80 | 
             
                        if found_results
         | 
| 77 81 | 
             
                            App::Terminal::error('Found errors!', results_output)
         | 
| 82 | 
            +
                        elsif found_warnings
         | 
| 83 | 
            +
                            App::Terminal::warning('Found warnings!', results_output)
         | 
| 78 84 | 
             
                        else
         | 
| 79 85 | 
             
                            App::Terminal::success('No errors found.', nil, file_found_to_scan ? true : false)
         | 
| 80 86 | 
             
                        end
         | 
    
        data/lib/routes/ssh.rb
    ADDED
    
    | @@ -0,0 +1,80 @@ | |
| 1 | 
            +
            module AppCommand
         | 
| 2 | 
            +
             | 
| 3 | 
            +
                class SSH < ::Convoy::ActionCommand::Base
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                    CONFIGURATION_PREFIX = 'ssh_'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                    def execute
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                        @opts = command_options
         | 
| 10 | 
            +
                        @args = arguments
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                        opts_validate
         | 
| 13 | 
            +
                        opts_routing
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    def opts_validate
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                        if @args[0].nil?
         | 
| 20 | 
            +
                            App::Terminal::error('You must specify what server you want to SSH into', "This must be specified in: #{App::Terminal::format_directory(ConfigUnique::CONFIG_FILE)}", true)
         | 
| 21 | 
            +
                        end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                        if @args[0] =~ /\Assh_\S+\z/i
         | 
| 24 | 
            +
                            config_param = @args[0]
         | 
| 25 | 
            +
                        else
         | 
| 26 | 
            +
                            config_param = "#{CONFIGURATION_PREFIX}#{@args[0]}"
         | 
| 27 | 
            +
                        end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                        unless App::Config::param_exists(config_param)
         | 
| 30 | 
            +
                            App::Terminal::error('Invalid Config Parameter', "The #{App::Terminal::format_highlight('config parameter')} #{App::Terminal::format_invalid(config_param)} doesn't exist in: #{App::Terminal::format_directory(ConfigUnique::CONFIG_FILE)}", true)
         | 
| 31 | 
            +
                        end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                        ssh_parts = App::Config.param(config_param).split('|')
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                        @ssh_user = ssh_parts[0]
         | 
| 36 | 
            +
                        @ssh_host = ssh_parts[1]
         | 
| 37 | 
            +
                        @ssh_cert = ssh_parts[2].to_s.strip.length == 0 ? nil : ssh_parts[2]
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                        help_message = [
         | 
| 40 | 
            +
                            "The file: #{App::Terminal::format_directory(ConfigUnique::CONFIG_FILE)} must contain a line similar to the following:",
         | 
| 41 | 
            +
                            nil,
         | 
| 42 | 
            +
                            'ssh_ec2=ec2-user|ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com|~/.ssh/pem-key.pem',
         | 
| 43 | 
            +
                            'ssh_ec2=ec2-user|ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com',
         | 
| 44 | 
            +
                        ]
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                        if @ssh_user.nil? || @ssh_user == ''
         | 
| 47 | 
            +
                            App::Terminal::error("SSH #{App::Terminal::format_highlight('user')} required", help_message, true)
         | 
| 48 | 
            +
                        end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                        if @ssh_host.nil? || @ssh_host == ''
         | 
| 51 | 
            +
                            App::Terminal::error("SSH #{App::Terminal::format_highlight('host')} required", help_message, true)
         | 
| 52 | 
            +
                        end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                        unless @ssh_cert.nil?
         | 
| 55 | 
            +
                            unless App::UtilsFiles::file_exists(File.expand_path(@ssh_cert))
         | 
| 56 | 
            +
                                App::Terminal::error("PEM key not found: #{App::Terminal::format_directory(@ssh_cert)}")
         | 
| 57 | 
            +
                            end
         | 
| 58 | 
            +
                        end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                    end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                    def opts_routing
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                        ssh_into_server
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                    end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                    def ssh_into_server
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                        if @ssh_cert.nil?
         | 
| 71 | 
            +
                            App::Terminal::command("ssh #{@ssh_user}@#{@ssh_host}", nil, false, false)
         | 
| 72 | 
            +
                        else
         | 
| 73 | 
            +
                            App::Terminal::command("ssh -i #{@ssh_cert} #{@ssh_user}@#{@ssh_host}", nil, false, false)
         | 
| 74 | 
            +
                        end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                    end
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            end
         | 
    
        data/lib/version.rb
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            VERSION = '1. | 
| 1 | 
            +
            VERSION = '1.10.0'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: brightpearl-cli
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.10.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Albert Rannetsperger
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015- | 
| 11 | 
            +
            date: 2015-08-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: columnist
         | 
| @@ -157,6 +157,7 @@ files: | |
| 157 157 | 
             
            - lib/routes/scripts_sonar.rb
         | 
| 158 158 | 
             
            - lib/routes/scripts_sql_update.rb
         | 
| 159 159 | 
             
            - lib/routes/setup.rb
         | 
| 160 | 
            +
            - lib/routes/ssh.rb
         | 
| 160 161 | 
             
            - lib/routes/tail.rb
         | 
| 161 162 | 
             
            - lib/routes/test.rb
         | 
| 162 163 | 
             
            - lib/routes/update.rb
         | 
| @@ -174,9 +175,9 @@ require_paths: | |
| 174 175 | 
             
            - lib
         | 
| 175 176 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 176 177 | 
             
              requirements:
         | 
| 177 | 
            -
              - -  | 
| 178 | 
            +
              - - ~>
         | 
| 178 179 | 
             
                - !ruby/object:Gem::Version
         | 
| 179 | 
            -
                  version: '0'
         | 
| 180 | 
            +
                  version: '2.0'
         | 
| 180 181 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 181 182 | 
             
              requirements:
         | 
| 182 183 | 
             
              - - '>='
         |