Sha256: 6589495312d3327896cdbfc9b1a7993e78a1bf64035453149b97c0133585ac86

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

require 'trollop'
require 'aws-sdk'

module SimplePerf
  module CLI
    class GatlingResults
      include Shared

      def execute
        opts = Trollop::options do
          version SimplePerf::VERSION
          banner <<-EOS

Moves simulations logs from  EC2 simple_perf instances to s3 bucket for respective project.

Usage:
      simple_perf gatling_results -e ENVIRONMENT -p PROJECT_NAME
          EOS
          opt :help, "Display Help"
          opt :environment, "Set the target environment", :type => :string
          opt :project, "Stack name to manage", :type => :string
        end
        Trollop::die :environment, "is required but not specified" unless opts[:environment]
        Trollop::die :project, "is required but not specified" unless opts[:project]


        config = Config.new.environment opts[:environment]

        ENV['SIMPLE_DEPLOY_SSH_KEY'] = config['local_pem']
        ENV['SIMPLE_DEPLOY_SSH_USER'] = config['user']

        AWS.config(
            :access_key_id => config['access_key'],
            :secret_access_key => config['secret_key'])

        command = 'simple_deploy list' +
            ' -e ' + opts[:environment] +
            ' | grep ' + opts[:project] + '-s3'
        bucket_stack = `#{command}`

        command = 'simple_deploy outputs' +
            ' -e ' + opts[:environment] +
            ' -n ' + bucket_stack
        bucket_name = `#{command}`
        bucket_name = bucket_name.split(' ')[1]


        command = 'simple_deploy execute' +
            ' -e ' + opts[:environment] +
            ' -n ' + 'simple-perf-' + opts[:project] +
            ' -c "~/sync_to_s3.sh "' + bucket_name +
            ' -l debug -x'

        Shared::pretty_print `#{command}`

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_perf-0.0.18 lib/simple_perf/cli/gatling_results.rb
simple_perf-0.0.17 lib/simple_perf/cli/gatling_results.rb