redis_importer 0.0.7 → 0.0.8

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.
@@ -16,10 +16,9 @@ module RedisImporter
16
16
  def import
17
17
  files.each do |file|
18
18
  begin
19
- convert_to_redis_commands(file) if class_exists?(file.to_class_name)
19
+ convert_to_redis_commands(file) if class_exists?(file.to_class_name.to_sym)
20
20
  rescue NameError
21
- @errors ||= []
22
- @errors << "#{file.name} is not matched by a class #{file.to_class_name} in the system."
21
+ add_errors("#{file.name} is not matched by a class #{file.to_class_name} in the system.")
23
22
  end
24
23
  end
25
24
  pipeline
@@ -29,6 +28,11 @@ module RedisImporter
29
28
 
30
29
  attr_writer :files, :commands
31
30
 
31
+ def add_errors(errors)
32
+ @errors ||= []
33
+ @errors << errors
34
+ end
35
+
32
36
  def class_exists?(c)
33
37
  Module.const_get(c)
34
38
  end
@@ -61,7 +65,12 @@ module RedisImporter
61
65
  if !self.commands.empty?
62
66
  pipeline = RedisPipeline::RedisPipeline.new
63
67
  pipeline.add_commands(self.commands.flatten)
64
- pipeline.execute_commands
68
+ if !pipeline.execute_commands
69
+ add_errors(pipeline.errors)
70
+ false
71
+ else
72
+ true
73
+ end
65
74
  else
66
75
  self.commands
67
76
  end
@@ -1,3 +1,3 @@
1
1
  module RedisImporter
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -16,8 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.version = RedisImporter::VERSION
17
17
 
18
18
  gem.add_development_dependency "rspec"
19
- gem.add_dependency('gem_configurator')
19
+ gem.add_dependency('gem_configurator', '~> 0.0.6')
20
20
  gem.add_dependency('csv_to_object', '~> 0.0.3')
21
- gem.add_dependency('redis_pipeline')
21
+ gem.add_dependency('redis_pipeline','~> 0.0.5')
22
22
  gem.add_dependency('aws-s3', '~> 0.6.3')
23
23
  end
@@ -41,7 +41,7 @@ describe RedisImporter do
41
41
 
42
42
  it "only passes files to csv_to_object that are matched by a class in the system" do
43
43
  @ri.import
44
- @ri.errors.should == ["foo.csv is not matched by a class Foo in the system."]
44
+ @ri.errors.should include "foo.csv is not matched by a class Foo in the system."
45
45
  end
46
46
 
47
47
  it "passes the redis commands to the redis pipeline" do
data/test/lib/person.rb CHANGED
@@ -8,6 +8,6 @@ class Person
8
8
  end
9
9
 
10
10
  def to_redis()
11
- ["hset person:#{self.id} first_name #{self.first_name}", "hset person:#{self.id} last_name #{self.last_name}"]
11
+ ["hset|person:#{self.id}|first_name|#{self.first_name}", "hset|person:#{self.id}|last_name|#{self.last_name}"]
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2012-08-31 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &2152990420 !ruby/object:Gem::Requirement
17
+ requirement: &2164916500 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,21 +22,21 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2152990420
25
+ version_requirements: *2164916500
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: gem_configurator
28
- requirement: &2168473120 !ruby/object:Gem::Requirement
28
+ requirement: &2164916000 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
- - - ! '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.0.6
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2168473120
36
+ version_requirements: *2164916000
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: csv_to_object
39
- requirement: &2168472620 !ruby/object:Gem::Requirement
39
+ requirement: &2164915500 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,21 +44,21 @@ dependencies:
44
44
  version: 0.0.3
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2168472620
47
+ version_requirements: *2164915500
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: redis_pipeline
50
- requirement: &2168472200 !ruby/object:Gem::Requirement
50
+ requirement: &2164915040 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
- - - ! '>='
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: 0.0.5
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2168472200
58
+ version_requirements: *2164915040
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: aws-s3
61
- requirement: &2168471660 !ruby/object:Gem::Requirement
61
+ requirement: &2164914580 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: 0.6.3
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2168471660
69
+ version_requirements: *2164914580
70
70
  description: Creates objects, converts them to Redis commands and executes the redis
71
71
  commands.
72
72
  email: