dynamodb-ruby 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c257312be4a3b3beb1872f2dbd95b302cc07a5e4
4
- data.tar.gz: e6ae659246529009d91a8b53df17b557d0e4c628
3
+ metadata.gz: 13acc9105ae20762765fab21f6d8b783e08775c9
4
+ data.tar.gz: c82868b55994ae5574352fa256fdac0a1a682edf
5
5
  SHA512:
6
- metadata.gz: 7cd1c9e747783f8cad8b6c53df6281b8fabc1ded9641ec7504a41fc5c2c2a7002f7ce27800c6c62fee753ed1c0f24ffba3ac5df97bc19dfe840808df00bcacd0
7
- data.tar.gz: af53e9164e0d03f08eec079229378e534cce3ad09d4b7a3726e5ce2c6b1151c2f226ca922e492c532224ced578767dcc588917c1646eddc618309c190bf22ce8
6
+ metadata.gz: d2be0c56bfcaa1ee057e81b47c9f8c2fc668716130275b4951d9a793048a60fbb4134b40f62f03b518baed32aeae866d378d49e07245c7d4365cc50b4293b8a8
7
+ data.tar.gz: 4ef5670408ce6bbe95631134d4f091f42bea177bd0042fcefca8e2e6e85365f2f2a6ee20561fe9954122d6762a87d030a66c9197d790710281b51739ba2157a7
@@ -2,16 +2,16 @@ require "thor"
2
2
 
3
3
  module Dynamodb
4
4
  class CLI < Thor
5
- DIST_DIR = "vendor/DynamoDBLocal-latest"
5
+ DIST_DIR = "./vendor/DynamoDBLocal-latest"
6
6
  PIDFILE = "dynamodb.pid"
7
7
  PORT = 8000
8
8
  LOG_DIR = "logs"
9
9
 
10
10
  desc "start", "Starts Dynamodb Local"
11
- method_option :dist_dir, aliases: "-dd"
12
- method_option :pidfile, aliases: "-pf"
13
- method_option :port, aliases: "-p"
14
- method_option :log_dir, aliases: "-ld"
11
+ method_option :dist_dir, aliases: "-dd", default: DIST_DIR
12
+ method_option :pidfile, aliases: "-pf", default: PIDFILE
13
+ method_option :port, aliases: "-p", default: PORT
14
+ method_option :log_dir, aliases: "-ld", default: LOG_DIR
15
15
  def start
16
16
  %x(
17
17
  if [ -z $JAVA_HOME ]; then
@@ -27,24 +27,22 @@ module Dynamodb
27
27
  )
28
28
 
29
29
  dist_dir = options[:dist_dir] || DIST_DIR
30
- `cd #{dist_dir}`
30
+ `cd #{options[:dist_dir]}`
31
31
 
32
32
  %x(
33
33
  if [ ! -f DynamoDBLocal.jar ] || [ ! -d DynamoDBLocal_lib ]; then
34
- echo >&2 "ERROR: Could not find DynamoDBLocal files in #{dist_dir}."
34
+ echo >&2 "ERROR: Could not find DynamoDBLocal files in #{options[:dist_dir]}."
35
35
  exit 1
36
36
  fi
37
37
  )
38
38
 
39
- log_dir = options[:log_dir] || LOG_DIR
40
- `mkdir -p #{log_dir}`
39
+ `mkdir -p #{options[:log_dir]}`
41
40
 
42
- puts "DynamoDB Local output will save to #{dist_dir}/#{log_dir}/"
41
+ puts "DynamoDB Local output will save to #{options[:dist_dir]}/#{options[:log_dir]}/"
43
42
 
44
- port = options[:port] || PORT
45
- `hash lsof 2>/dev/null && lsof -i :#{port} && { echo >&2 "Something is already listening on port #{port}; I will not attempt to start DynamoDBLocal."; exit 1; }`
43
+ `hash lsof 2>/dev/null && lsof -i :#{options[:port]} && { echo >&2 "Something is already listening on port #{options[:port]}; I will not attempt to start DynamoDBLocal."; exit 1; }`
46
44
 
47
- `nohup $JAVA_HOME/bin/java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -delayTransientStatuses -port #{port} -inMemory 1>"#{log_dir}/output.log" 2>"#{log_dir}/error.log" &`
45
+ `nohup $JAVA_HOME/bin/java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -delayTransientStatuses -port #{options[:port]} -inMemory 1>"#{options[:log_dir]}/output.log" 2>"#{options[:log_dir]}/error.log" &`
48
46
  `PID=$!`
49
47
 
50
48
  puts "Verifying that DynamoDBLocal actually started..."
@@ -64,31 +62,28 @@ module Dynamodb
64
62
  done
65
63
  )
66
64
 
67
- puts "DynamoDB Local started with pid #{`$PID`} listening on port #{port}."
65
+ puts "DynamoDB Local started with pid #{`$PID`} listening on port #{options[:port]}."
68
66
 
69
- pidfile = options[:pidfile] || PIDFILE
70
- puts `$PID > #{pidfile}`
67
+ puts `$PID > #{options[:pidfile]}`
71
68
  end
72
69
 
73
70
  desc "stop", "Stops Dynamodb Local"
74
- method_option :dist_dir, aliases: "-dd"
75
- method_option :pidfile, aliases: "-pf"
76
- method_option :port, aliases: "-p"
77
- method_option :log_dir, aliases: "-ld"
71
+ method_option :dist_dir, aliases: "-dd", default: DIST_DIR
72
+ method_option :pidfile, aliases: "-pf", default: PIDFILE
73
+ method_option :port, aliases: "-p", default: PORT
74
+ method_option :log_dir, aliases: "-ld", default: LOG_DIR
78
75
  def stop
79
- dist_dir = options[:dist_dir] || DIST_DIR
80
- `cd #{dist_dir}`
76
+ `cd #{options[:dist_dir]}`
81
77
 
82
- pidfile = options[:pidfile] || PIDFILE
83
78
  %x(
84
- if [ ! -f #{pidfile} ]; then
79
+ if [ ! -f #{options[:pidfile]} ]; then
85
80
  echo 'ERROR: There is no pidfile, below is the list of DynamoDBLocal processes you may need to kill.'
86
81
  ps -e | grep DynamoDBLocal | grep -v grep
87
82
  exit 1
88
83
  fi
89
84
  )
90
85
 
91
- `pid=$(<#{pidfile})`
86
+ `pid=$(<#{options[:pidfile]})`
92
87
 
93
88
  `echo "Killing DynamoDBLocal at pid $pid..."`
94
89
  `kill $pid`
@@ -99,7 +94,7 @@ module Dynamodb
99
94
  kill -0 $pid 2>/dev/null
100
95
  if [ $? -ne 0 ]; then
101
96
  echo 'Successfully shut down DynamoDBLocal.'
102
- rm -f #{pidfile}
97
+ rm -f #{options[:pidfile]}
103
98
  exit 0
104
99
  else
105
100
  echo 'Still waiting for DynamoDBLocal to shut down...'
@@ -113,7 +108,7 @@ module Dynamodb
113
108
 
114
109
  `ps -e | grep DynamoDBLocal | grep -v grep`
115
110
 
116
- `rm -f #{pidfile}`
111
+ `rm -f #{options[:pidfile]}`
117
112
 
118
113
  `exit 1`
119
114
  end
@@ -1,3 +1,3 @@
1
1
  module Dynamodb
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamodb-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Farrow