fake_dynamo 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # FakeDynamo ![Build Status](https://secure.travis-ci.org/ananthakumaran/fake_dynamo.png)
1
+ # FakeDynamo [![Build Status](https://secure.travis-ci.org/ananthakumaran/fake_dynamo.png)](http://travis-ci.org/ananthakumaran/fake_dynamo)
2
2
 
3
3
  local hosted, inmemory dynamodb emulator.
4
4
 
data/bin/fake_dynamo CHANGED
@@ -4,19 +4,25 @@ $:.unshift(File.dirname(__FILE__) + '/../lib')
4
4
  require 'fake_dynamo'
5
5
  require 'optparse'
6
6
 
7
- options = {:port => 4567, :compact => false }
7
+ options = { :port => 4567, :compact => false, :db => '/usr/local/var/fake_dynamo/db.fdb' }
8
8
  OptionParser.new do |opts|
9
9
  opts.banner = "Usage: fake_dynamo [options]"
10
10
 
11
- opts.on("-p", "--port PORT") do |v|
11
+ opts.on("-p", "--port PORT", "Default: #{options[:port]}") do |v|
12
12
  options[:port] = v
13
13
  end
14
14
 
15
- opts.on("-c", "--compact") do |v|
15
+ opts.on("-d", "--db PATH", "Default: #{options[:db]}") do |v|
16
+ options[:db] = v
17
+ end
18
+
19
+ opts.on("-c", "--compact", "Default: #{options[:compact]}") do |v|
16
20
  options[:compact] = v
17
21
  end
18
22
  end.parse!
19
23
 
24
+ FakeDynamo::Storage.db_path = options[:db]
25
+
20
26
  if options[:compact]
21
27
  FakeDynamo::Storage.instance.load_aof
22
28
  FakeDynamo::Storage.instance.compact!
@@ -7,6 +7,8 @@ module FakeDynamo
7
7
  attr_accessor :compacted, :loaded
8
8
 
9
9
  class << self
10
+ attr_accessor :db_path
11
+
10
12
  def instance
11
13
  @storage ||= Storage.new
12
14
  end
@@ -25,7 +27,7 @@ module FakeDynamo
25
27
  end
26
28
 
27
29
  def db_path
28
- '/usr/local/var/fake_dynamo/db.fdb'
30
+ self.class.db_path
29
31
  end
30
32
 
31
33
  def init_db
@@ -1,3 +1,3 @@
1
1
  module FakeDynamo
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -20,9 +20,7 @@ module FakeDynamo
20
20
  delete_db
21
21
  init_db
22
22
  end
23
-
24
- def db_path
25
- '/tmp/test_db.fdb'
26
- end
27
23
  end
28
24
  end
25
+
26
+ FakeDynamo::Storage.db_path = '/tmp/test_db.fdb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-09 00:00:00.000000000 Z
12
+ date: 2012-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &70295629358120 !ruby/object:Gem::Requirement
16
+ requirement: &70171554944060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70295629358120
24
+ version_requirements: *70171554944060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70295629357580 !ruby/object:Gem::Requirement
27
+ requirement: &70171554943600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70295629357580
35
+ version_requirements: *70171554943600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &70295629357060 !ruby/object:Gem::Requirement
38
+ requirement: &70171554943180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70295629357060
46
+ version_requirements: *70171554943180
47
47
  description:
48
48
  email:
49
49
  - ananthakumaran@gmail.com