cartomodel 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f8c3d48364cf34824e9eb9dcca3c1d431dfb6f2
4
- data.tar.gz: 6f08009c3c1796322774ef5f6ee5e134c81076b4
3
+ metadata.gz: f3f06c72df282687bac36fc9d398c12a60426647
4
+ data.tar.gz: 3b312d57c2853d967bc0c4875f1058e2ef9cb11f
5
5
  SHA512:
6
- metadata.gz: 418759be6ecb9f4af6d6860cf4af545547729d96e564749dcc026445fc16e8468cbb1c97c457b88791176348a948140310f69fc0feb699579dfb243240bfd5ea
7
- data.tar.gz: ec302cc856f99891adeeb2c07334b10f4116ada966561a31ec9a48e535f7128370fd7b6940fa0014d222774b1400a20e1d9d7fd833a40ffa8a31f279c1ec56d2
6
+ metadata.gz: 98115298ff192d851a6d5de0003a7af187ccfc69f00def427d8996afdab9779ee828a62050243093a4b6358302b2340251211a6d5af8053cae7432ebcf65f928
7
+ data.tar.gz: fb77498a4a1c24149dee862493025ece66b97a7863ff6a6a6cb07e24c29750a42bfa1950acd0726c112fe5f6360339399cc25d210c68d84078e99c5a8903fae6
data/README.md CHANGED
@@ -46,4 +46,11 @@ If CartoDB, for some reason, fails to save your data, you can retry later using
46
46
  rake cartomodel:sync
47
47
  ```
48
48
 
49
+ To use this task, you need to add the following to your Rakefile:
50
+
51
+ ```
52
+ spec = Gem::Specification.find_by_name 'cartomodel'
53
+ load "#{spec.gem_dir}/tasks/sync.rake"
54
+ ```
55
+
49
56
  Currently the task prints no output on progress or success
@@ -19,6 +19,7 @@ module Cartomodel
19
19
  self.sync_state == STATE_UNSYNCED
20
20
 
21
21
  attributes = prepare_attributes
22
+ attributes = custom_cartodb_attributes attributes
22
23
 
23
24
  query = @query_generator.insert(attributes)
24
25
  begin
@@ -37,6 +38,7 @@ module Cartomodel
37
38
  self.sync_state == STATE_UNSYNCED
38
39
 
39
40
  attributes = prepare_attributes
41
+ attributes = custom_cartodb_attributes attributes
40
42
 
41
43
  query = @query_generator.update(attributes, :cartodb_id, self.cartodb_id)
42
44
  begin
@@ -61,7 +63,11 @@ module Cartomodel
61
63
  raise RuntimeError.new('Cartomodel::Synchronizable can only extend ActiveRecord instances')
62
64
  end
63
65
 
64
- unless base.new.attributes.include? 'cartodb_id' and base.new.attributes.include? 'sync_state'
66
+ unless base.table_exists?
67
+ return
68
+ end
69
+
70
+ unless base.column_names.include? 'cartodb_id' and base.column_names.include? 'sync_state'
65
71
  raise RuntimeError.new('Cartomodel::Synchronizable requires \'cartodb_id\' and \'sync_state\' attributes')
66
72
  end
67
73
 
@@ -70,6 +76,10 @@ module Cartomodel
70
76
  base.before_destroy :delete_on_cartodb
71
77
  end
72
78
 
79
+ def custom_cartodb_attributes(attributes)
80
+ attributes
81
+ end
82
+
73
83
  private
74
84
 
75
85
  def prepare_dependencies
@@ -1,3 +1,3 @@
1
1
  module Cartomodel
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartomodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Garcia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-09 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -70,30 +70,30 @@ dependencies:
70
70
  name: activesupport
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 5.0.0.beta3
75
+ version: '5.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 5.0.0.beta3
82
+ version: '5.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: activerecord
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 5.0.0.beta3
89
+ version: '5.0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 5.0.0.beta3
96
+ version: '5.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: arel
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.5.1
161
+ rubygems_version: 2.6.6
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: CartoDB sync for ActiveRecord objects