trifle 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/trifle +13 -19
  2. data/lib/trifle/version.rb +1 -1
  3. metadata +9 -9
data/bin/trifle CHANGED
@@ -2,36 +2,30 @@
2
2
  require "redis"
3
3
  require "trifle"
4
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`"
5
+ if ARGV.count < 2
6
+ puts "Syntax: `trifle redis filenames --key=your_key"
7
+ puts "e.g. `trifle redis://127.0.0.1:6379/6 filename1 filename2 --key=my_key"
10
8
  exit(1)
11
9
  end
12
10
 
13
- redis_config = {}
14
- trifle_options = {}
11
+ redis = Redis.new(url: ARGV[0])
12
+ ARGV.shift
13
+
15
14
  filenames = []
15
+ options = {}
16
16
 
17
17
  ARGV.each do |arg|
18
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
19
+ option = arg.split("=")
20
+ key = option[0].gsub("--")
21
+ option.shift
22
+ value = option.join("=")
23
+ options[key] = value
29
24
  else
30
25
  filenames << arg
31
26
  end
32
27
  end
33
28
 
34
- redis = Redis.new redis_config
35
29
  puts "Loading #{filenames.join(", ")}"
36
- Trifle.new(redis, trifle_options).load(filenames: filenames)
30
+ Trifle.new(redis, options).load(filenames: filenames)
37
31
  puts "Trifle loaded"
@@ -1,3 +1,3 @@
1
1
  class Trifle
2
- VERSION = "0.0.3" unless defined? Trifle::VERSION
2
+ VERSION = "0.0.4" 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.3
4
+ version: 0.0.4
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: &70355541318060 !ruby/object:Gem::Requirement
16
+ requirement: &70309726715860 !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: *70355541318060
24
+ version_requirements: *70309726715860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rujitsu
27
- requirement: &70355541317480 !ruby/object:Gem::Requirement
27
+ requirement: &70309726715260 !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: *70355541317480
35
+ version_requirements: *70309726715260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: active_support
38
- requirement: &70355541316720 !ruby/object:Gem::Requirement
38
+ requirement: &70309726714540 !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: *70355541316720
46
+ version_requirements: *70309726714540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fakeredis
49
- requirement: &70355541303720 !ruby/object:Gem::Requirement
49
+ requirement: &70309726713980 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.3.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70355541303720
57
+ version_requirements: *70309726713980
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: