cassandra_migrations 0.2.6 → 0.2.7

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: c965a29df3ab284126e40f87b121b36ac7265bd8
4
- data.tar.gz: 1f51f693edccafb89757145d09d110e1e80906f1
3
+ metadata.gz: a28e40a6fe9323547d4484bdfb6ace0bf2dee21c
4
+ data.tar.gz: 7a2215ba07262a12038b7bf5cd7c6ac4582db4a9
5
5
  SHA512:
6
- metadata.gz: 46a1436db58fb04065c16cefb5438131b45fe64f129ced77eaeade85844b301f8855d8aabd51acfae5c0b6f388065a8a79ef66a4e5473f4c2a80f23ac0256959
7
- data.tar.gz: 86926b224d24685da9b83ab312754446135f346618e5489d91bf4e3fc63f25f00c6806f1be4043f26b1198bf5b345ed63e3dbfe8114fac8b3a5f69c691775b68
6
+ metadata.gz: 2d795b210e5eefd853eb25ba8b3d8bfce1955aa1645e751e6a98cc995cdc96b6f7be46367ddec6263ed29fb2a94bb55634adf68ffcb49b643bddbad8e2a4ed3e
7
+ data.tar.gz: e602f7cec7715b2d7bc16bdd5390cb1b75fa269d09bd038b0f0ff562a7bb71898e8ab1d273df4cbdc6e56fcf8591dc5436ceb1a4679d33f2104806c7d1254c63
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'cassandra'
3
+ require 'active_support/core_ext/string/strip'
3
4
 
4
5
  module CassandraMigrations
5
6
  module Cassandra
@@ -52,5 +52,11 @@ module CassandraMigrations
52
52
  end
53
53
  end
54
54
 
55
+ class MigrationNamingError < CassandraError
56
+ def initialize(msg)
57
+ super(msg)
58
+ end
59
+ end
60
+
55
61
  end
56
62
  end
@@ -247,6 +247,10 @@ module CassandraMigrations
247
247
  when :compact_storage
248
248
  cql_name
249
249
  else
250
+ #if complex option with nested hash, convert keys and values to proper string value
251
+ if value.is_a?(Hash)
252
+ value = "{#{value.map {|k, v| "'#{k}':'#{v}'"}.join(',')}}"
253
+ end
250
254
  "#{cql_name} = #{value}"
251
255
  end
252
256
  end
@@ -81,11 +81,16 @@ private
81
81
  end
82
82
 
83
83
  def self.get_class_from_migration_name(filename)
84
- filename.match(/[0-9]{14}_(.+)\.rb$/).captures.first.camelize.constantize
84
+ migration_name = filename.match(/[0-9]+_(.+)\.rb$/).captures.first.camelize
85
+ migration_name.constantize
86
+ rescue NameError => e
87
+ raise Errors::MigrationNamingError, "Migration file names must match the class name in the migration—could not find class #{migration_name}."
85
88
  end
86
89
 
87
- def self.get_version_from_migration_name(migration_name)
88
- migration_name.match(/([0-9]{14})_.+\.rb$/).captures.first.to_i
90
+ def self.get_version_from_migration_name(filename)
91
+ filename.match(/\/([0-9]+)_.+\.rb$/).captures.first.to_i
92
+ rescue
93
+ raise Errors::MigrationNamingError, "Migration file names must start with a numeric version prefix."
89
94
  end
90
95
  end
91
96
  end
@@ -1,3 +1,3 @@
1
1
  module CassandraMigrations
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Gubert
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-24 00:00:00.000000000 Z
12
+ date: 2016-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cassandra-driver
@@ -17,7 +17,7 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '2.1'
20
+ version: '3.0'
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.1.1
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - "~>"
29
29
  - !ruby/object:Gem::Version
30
- version: '2.1'
30
+ version: '3.0'
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.1.1
@@ -49,14 +49,14 @@ dependencies:
49
49
  name: rails
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.2'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.2'
62
62
  - !ruby/object:Gem::Dependency