Class: AppCommand::DynamoDB

Inherits:
Convoy::ActionCommand::Base
  • Object
show all
Defined in:
lib/routes/dynamo_db.rb

Constant Summary collapse

JAR_FILE =
'DynamoDBLocal.jar'

Instance Method Summary collapse

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/routes/dynamo_db.rb', line 7

def execute

    begin

        @opts = command_options
        @args = arguments

        @dynamo_db_path = Blufin::Config::get['DynamoDBPath']
        @dynamo_db_file = "#{@dynamo_db_path}/#{JAR_FILE}"

        opts_validate
        opts_routing

    rescue => e

        Blufin::Terminal::print_exception(e)

    end

end

#opts_routingObject



35
36
37
38
39
# File 'lib/routes/dynamo_db.rb', line 35

def opts_routing

    Blufin::Terminal::command("java -Djava.library.path=./DynamoDBLocal_lib -jar #{JAR_FILE} -sharedDb", @dynamo_db_path)

end

#opts_validateObject



28
29
30
31
32
33
# File 'lib/routes/dynamo_db.rb', line 28

def opts_validate

    # Make sure DynamoDB .jar file exists.
    Blufin::Terminal::error("File not found: #{Blufin::Terminal::format_directory(@dynamo_db_file)}", ['To download DynamoDB package, visit:', 'https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html'], true) unless Blufin::Files::file_exists(@dynamo_db_file)

end