Sha256: 0829d60bbe83bb3b374f5dd766218b4ef91efe1485d5aa933de1b06de66fc29d

Contents?: true

Size: 1.8 KB

Versions: 11

Compression:

Stored size: 1.8 KB

Contents

require 'trollop'

module SimplePerf
  module CLI
    class CreateJmeter
      include Shared

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

Creates CloudFormation stack for JMeter instances.

Usage:
      simple_perf create_jmeter -e ENVIRONMENT -p PROJECT_NAME -a AMI -i INSTANCE_TYPE -s S3_BUCKET
EOS
          opt :help, "Display Help"
          opt :environment, "Set the target environment", :type => :string
          opt :project, "Project name to manage", :type => :string
          opt :ami, "AWS ami", :type => :string
          opt :instancetype, "AWS instance type", :type => :string
          opt :s3bucket, "AWS s3 bucket", :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]
        Trollop::die :ami, "is required but not specified" unless opts[:ami]
        Trollop::die :instancetype, "is required but not specified" unless opts[:instancetype]
        Trollop::die :s3bucket, "is required but not specified" unless opts[:s3bucket]

        gem_root = File.expand_path '../..', __FILE__

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

        command = 'simple_deploy create' +
            ' -e ' + opts[:environment] +
            ' -n ' + 'simple-perf-' + opts[:project] +
            ' -t '+ gem_root + '/cloud_formation_templates/instance_group.json' +
            ' -a Description="EC2 JMeter Instance"' +
            ' -a KeyName=' +  config['aws_keypair'] +
            ' -a AmiId=' +  opts[:ami] +
            ' -a S3BucketName=' + opts[:s3bucket] +
            ' -a InstanceType=' + opts[:instancetype]

        Shared::pretty_print `#{command}`
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
simple_perf-0.0.17 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.15 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.14 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.13 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.12 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.11 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.10 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.9 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.8 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.7 lib/simple_perf/cli/create_jmeter.rb
simple_perf-0.0.6 lib/simple_perf/cli/create_jmeter.rb