alephant-lookup 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2de5b13682fc9400af295b28c3aacbc41f2c1203
4
+ data.tar.gz: ea8aac19dd9a080ffcc84dc4f81b8ade317a0dc5
5
+ SHA512:
6
+ metadata.gz: f8a73612df87c017cb80d98f9ff8769aff507fc8f7f832d397179b763cb9a621c6edd16e63b7ed77b1553a827a08449a91076dfeeb40de161130d23ec90e3c64
7
+ data.tar.gz: 76be4d525cf258d70d0192917df0353a5a53801b5ffe933c93dd671ab434e2e834916b8136f1c691597b604f2a2fa4977d51c5946298886c5881a1ea328784e4
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /config/*.yaml
2
+ /config/*.yml
3
+ Gemfile.lock
4
+ .rspec
5
+ *.gem
6
+
7
+ /pkg
8
+ /tmp
9
+ /components
10
+
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ jruby-1.7.9
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - "jruby"
4
+ notifications:
5
+ email:
6
+ recipients:
7
+ - kenoir@gmail.com
8
+ on_failure: change
9
+ on_success: never
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in alephant-lookup.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/.+\.rb$})
4
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Robert Kenny
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Alephant::Lookup
2
+
3
+ Lookup a location in S3 using DynamoDB.
4
+
5
+ [![Build
6
+ Status](https://travis-ci.org/BBC-News/alephant-lookup.png)](https://travis-ci.org/BBC-News/alephant-lookup)
7
+
8
+ [![Gem
9
+ Version](https://badge.fury.io/rb/alephant-lookup.png)](http://badge.fury.io/rb/alephant-lookup)
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'alephant-lookup'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install alephant-lookup
24
+
25
+ ## Usage
26
+
27
+ ```rb
28
+ require 'alephant-lookup'
29
+
30
+ lookup = Alephant::Lookup.create('table_name', 'component_id')
31
+
32
+ opts = { :key => :value }
33
+
34
+ location = "s3-bucket/location"
35
+ lookup.write(opts, location)
36
+
37
+ lookup.read(opts)
38
+ # => s3-bucket/location
39
+ ```
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it ( http://github.com/<my-github-username>/alephant-lookup/fork )
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'alephant/lookup/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "alephant-lookup"
8
+ spec.version = Alephant::Lookup::VERSION
9
+ spec.authors = ["Robert Kenny"]
10
+ spec.email = ["kenoir@gmail.com"]
11
+ spec.summary = %q{Lookup a location in S3 using DynamoDB.}
12
+ spec.homepage = "https://github.com/BBC-News/alephant-lookup"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "rspec"
21
+ spec.add_development_dependency "rspec-nc"
22
+ spec.add_development_dependency "guard"
23
+ spec.add_development_dependency "guard-rspec"
24
+ spec.add_development_dependency "pry"
25
+ spec.add_development_dependency "pry-remote"
26
+ spec.add_development_dependency "pry-nav"
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.5"
29
+ spec.add_development_dependency "rake"
30
+ end
@@ -0,0 +1,14 @@
1
+ require "alephant/lookup/version"
2
+ require "alephant/lookup/lookup"
3
+ require "alephant/lookup/lookup_table"
4
+
5
+ module Alephant
6
+ module Lookup
7
+ @@lookup_tables = {}
8
+
9
+ def self.create(table_name, component_id)
10
+ @@lookup_tables[table_name] ||= LookupTable.new('table_name')
11
+ Lookup.new(@@lookup_tables[table_name], component_id)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ module Alephant
2
+ module Lookup
3
+ class Lookup
4
+ attr_reader :component_id
5
+
6
+ def initialize(lookup_table, component_id)
7
+ @lookup_table = lookup_table
8
+ @component_id = component_id
9
+
10
+ @lookup_table.create
11
+ end
12
+
13
+ def read(opts)
14
+ fail
15
+ end
16
+
17
+ def write(opts, location)
18
+ fail
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module Alephant
2
+ module Lookup
3
+ class LookupTable
4
+ def initialize(table_name)
5
+
6
+ end
7
+
8
+ def create
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Alephant
2
+ module Lookup
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe Alephant::Lookup do
4
+ describe '.create(table_name, component_id)' do
5
+ it 'returns a lookup' do
6
+ expect(subject.create(:table_name, :component_id)).to be_a Alephant::Lookup::Lookup
7
+ end
8
+ end
9
+
10
+ describe Alephant::Lookup::Lookup do
11
+ describe '#initialize(table_name)' do
12
+ it 'calls create on lookup_table' do
13
+ table = double()
14
+ table.should_receive(:create)
15
+
16
+ Alephant::Lookup::Lookup.new(table, :component_id)
17
+ end
18
+ end
19
+
20
+ describe '#read(opts)' do
21
+ it 'returns lookup_table.location_for(component_id, opts_hash)' do
22
+ fail
23
+ end
24
+ end
25
+
26
+ describe '#write(opts, location)' do
27
+ it 'calls lookup_table.location_for(component_id, opts_hash, data)' do
28
+ fail
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+
@@ -0,0 +1,5 @@
1
+ $: << File.join(File.dirname(__FILE__),"..", "lib")
2
+
3
+ require 'pry'
4
+ require 'alephant/lookup'
5
+
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alephant-lookup
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Robert Kenny
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
25
+ prerelease: false
26
+ type: :development
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-nc
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ prerelease: false
40
+ type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-rspec
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ prerelease: false
68
+ type: :development
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ prerelease: false
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-remote
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ prerelease: false
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-nav
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ prerelease: false
110
+ type: :development
111
+ - !ruby/object:Gem::Dependency
112
+ name: bundler
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '1.5'
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ~>
121
+ - !ruby/object:Gem::Version
122
+ version: '1.5'
123
+ prerelease: false
124
+ type: :development
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ prerelease: false
138
+ type: :development
139
+ description:
140
+ email:
141
+ - kenoir@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - .gitignore
147
+ - .ruby-version
148
+ - .travis.yml
149
+ - Gemfile
150
+ - Guardfile
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - alephant-lookup.gemspec
155
+ - lib/alephant/lookup.rb
156
+ - lib/alephant/lookup/lookup.rb
157
+ - lib/alephant/lookup/lookup_table.rb
158
+ - lib/alephant/lookup/version.rb
159
+ - spec/lookup_spec.rb
160
+ - spec/spec_helper.rb
161
+ homepage: https://github.com/BBC-News/alephant-lookup
162
+ licenses:
163
+ - MIT
164
+ metadata: {}
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ requirements: []
180
+ rubyforge_project:
181
+ rubygems_version: 2.1.9
182
+ signing_key:
183
+ specification_version: 4
184
+ summary: Lookup a location in S3 using DynamoDB.
185
+ test_files:
186
+ - spec/lookup_spec.rb
187
+ - spec/spec_helper.rb