trifle 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/Gemfile.lock +1 -1
  2. data/LICENSE +23 -0
  3. data/README.md +15 -0
  4. data/bin/trifle +37 -0
  5. data/lib/trifle/version.rb +1 -1
  6. metadata +13 -10
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- trifle (0.0.2)
12
+ trifle (0.0.3)
13
13
 
14
14
  GEM
15
15
  remote: http://rubygems.org/
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2012 EmberAds Ltd <team@emberads.com>
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.
23
+
data/README.md CHANGED
@@ -35,6 +35,18 @@ trifle.load filenames: ["file1.csv", "file2.csv"]
35
35
  trifle.load data: preloaded_array
36
36
  ```
37
37
 
38
+ Additionally you can specify your own Redis key to store the Trifle in:
39
+
40
+ ```ruby
41
+ trifle = Trifle.new(Redis.new, key: "foobar")
42
+ ```
43
+
44
+ You can also load the Trifle from the command line:
45
+
46
+ ```
47
+ trifle file1.csv file2.csv
48
+ ```
49
+
38
50
  ### Lookup
39
51
 
40
52
  ```ruby
@@ -53,8 +65,11 @@ trifle.find "192.168.1.1"
53
65
 
54
66
  ## Release notes
55
67
 
68
+ * **0.0.3** Added a binary for loading Trifle from the command line
56
69
  * **0.0.2** Added support for custom Redis key
57
70
  * **0.0.1** First draft
58
71
 
72
+ ## License
59
73
 
74
+ See LICENSE
60
75
 
data/bin/trifle ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+ require "redis"
3
+ require "trifle"
4
+
5
+ if ARGV.count < 1
6
+ puts "Syntax: `trifle options filenames"
7
+ puts "e.g. `trifle --host:127.0.0.1 --port:6380 filename1 filename2"
8
+ puts "Options include the usual Redis options (--scheme, --host, --port, etc)"
9
+ puts "and an extra option to override the `--key`"
10
+ exit(1)
11
+ end
12
+
13
+ redis_config = {}
14
+ trifle_options = {}
15
+ filenames = []
16
+
17
+ ARGV.each do |arg|
18
+ if arg.match(/^--/)
19
+ vals = arg.split(":")
20
+ key = vals.first.gsub("--", "")
21
+ vals.pop
22
+ value = vals.join(":")
23
+
24
+ if key == "key"
25
+ trifle_options[key] = value
26
+ else
27
+ redis_config[key] = value
28
+ end
29
+ else
30
+ filenames << arg
31
+ end
32
+ end
33
+
34
+ redis = Redis.new redis_config
35
+ puts "Loading #{filenames.join(", ")}"
36
+ Trifle.new(redis, trifle_options).load(filenames: filenames)
37
+ puts "Trifle loaded"
@@ -1,3 +1,3 @@
1
1
  class Trifle
2
- VERSION = "0.0.2" unless defined? Trifle::VERSION
2
+ VERSION = "0.0.3" unless defined? Trifle::VERSION
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trifle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70340253404740 !ruby/object:Gem::Requirement
16
+ requirement: &70355541318060 !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: :development
23
23
  prerelease: false
24
- version_requirements: *70340253404740
24
+ version_requirements: *70355541318060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rujitsu
27
- requirement: &70340253404100 !ruby/object:Gem::Requirement
27
+ requirement: &70355541317480 !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: :development
34
34
  prerelease: false
35
- version_requirements: *70340253404100
35
+ version_requirements: *70355541317480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: active_support
38
- requirement: &70340253403320 !ruby/object:Gem::Requirement
38
+ requirement: &70355541316720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70340253403320
46
+ version_requirements: *70355541316720
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fakeredis
49
- requirement: &70340253402820 !ruby/object:Gem::Requirement
49
+ requirement: &70355541303720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,12 +54,13 @@ dependencies:
54
54
  version: 0.3.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70340253402820
57
+ version_requirements: *70355541303720
58
58
  description: Stores the GeoIP databases in Redis and gives it a simple way to lookup
59
59
  IPs and map them to countries
60
60
  email:
61
61
  - cristiano@emberads.com
62
- executables: []
62
+ executables:
63
+ - trifle
63
64
  extensions: []
64
65
  extra_rdoc_files: []
65
66
  files:
@@ -67,8 +68,10 @@ files:
67
68
  - .rspec
68
69
  - Gemfile
69
70
  - Gemfile.lock
71
+ - LICENSE
70
72
  - README.md
71
73
  - Rakefile
74
+ - bin/trifle
72
75
  - lib/trifle.rb
73
76
  - lib/trifle/finder.rb
74
77
  - lib/trifle/initialize_with_redis.rb