sandra-rails 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sandra-rails/tasks/sandra.rake +18 -3
- data/lib/sandra-rails/version.rb +1 -1
- data/sandra-rails.gemspec +2 -2
- metadata +10 -10
@@ -1,14 +1,29 @@
|
|
1
1
|
namespace :sandra do
|
2
2
|
task :migrate => :environment do
|
3
|
-
sandra_config = YAML::load_file("#{::Rails.root.to_s}/config/sandra.yml")[::Rails.env]
|
3
|
+
sandra_config = YAML::load_file("#{::Rails.root.to_s}/config/sandra.yml")[::Rails.env].symbolize_keys
|
4
4
|
keyspace = sandra_config[:keyspace]
|
5
5
|
store = Cassandra.new(keyspace)
|
6
6
|
cfs = sandra_config[:column_families]
|
7
|
-
|
8
|
-
|
7
|
+
current_cfs = {}
|
8
|
+
store.schema.cf_defs.each do |cfdef|
|
9
|
+
current_cfs[cfdef.name] = cfdef
|
10
|
+
end
|
11
|
+
updated_cfs = current_cfs.keys & cfs.keys
|
12
|
+
deleted_cfs = current_cfs.keys - cfs.keys
|
13
|
+
new_cfs = cfs.keys - current_cfs.keys
|
14
|
+
new_cfs.each do |name, options|
|
15
|
+
options = options.is_a?(Hash) ? options : {}
|
9
16
|
cf_def = CassandraThrift::CfDef.new({:keyspace => keyspace, :name => name}.merge(options))
|
10
17
|
store.add_column_family(cf_def)
|
18
|
+
end
|
19
|
+
# TODO: Update existing column families
|
20
|
+
#updated_cfs.each do |name, options|
|
21
|
+
#options = options.is_a?(Hash) ? options : {}
|
22
|
+
#cf_def = update_cf(current_cfs[name], options)
|
11
23
|
store.update_column_family(cf_def)
|
24
|
+
#end
|
25
|
+
deleted_cfs.each do |name|
|
26
|
+
store.drop_column_family(name)
|
12
27
|
end
|
13
28
|
end
|
14
29
|
end
|
data/lib/sandra-rails/version.rb
CHANGED
data/sandra-rails.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
# specify any dependencies here; for example:
|
22
22
|
s.add_runtime_dependency "sandra"
|
23
|
-
s.add_runtime_dependency "actionpack", ["~> 3.
|
24
|
-
s.add_runtime_dependency "railties", ["~> 3.
|
23
|
+
s.add_runtime_dependency "actionpack", ["~> 3.1.0"]
|
24
|
+
s.add_runtime_dependency "railties", ["~> 3.1.0"]
|
25
25
|
# s.add_runtime_dependency "rest-client"
|
26
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sandra-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-06 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sandra
|
16
|
-
requirement: &
|
16
|
+
requirement: &70208568698540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,29 +21,29 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70208568698540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: actionpack
|
27
|
-
requirement: &
|
27
|
+
requirement: &70208568697860 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.
|
32
|
+
version: 3.1.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70208568697860
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: railties
|
38
|
-
requirement: &
|
38
|
+
requirement: &70208568697200 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 3.
|
43
|
+
version: 3.1.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70208568697200
|
47
47
|
description: Connect Sandra with Rails
|
48
48
|
email:
|
49
49
|
- chuck@teachmetocode.com
|