hallelujah-cassandra-cql 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +203 -0
  4. data/README.rdoc +71 -0
  5. data/Rakefile +151 -0
  6. data/hallelujah-cassandra-cql.gemspec +33 -0
  7. data/lib/cassandra-cql.rb +49 -0
  8. data/lib/cassandra-cql/0.8.rb +7 -0
  9. data/lib/cassandra-cql/0.8/result.rb +23 -0
  10. data/lib/cassandra-cql/0.8/statement.rb +38 -0
  11. data/lib/cassandra-cql/1.0.rb +7 -0
  12. data/lib/cassandra-cql/1.0/result.rb +6 -0
  13. data/lib/cassandra-cql/1.0/statement.rb +6 -0
  14. data/lib/cassandra-cql/1.1.rb +7 -0
  15. data/lib/cassandra-cql/1.1/result.rb +6 -0
  16. data/lib/cassandra-cql/1.1/statement.rb +6 -0
  17. data/lib/cassandra-cql/database.rb +127 -0
  18. data/lib/cassandra-cql/result.rb +133 -0
  19. data/lib/cassandra-cql/row.rb +54 -0
  20. data/lib/cassandra-cql/schema.rb +108 -0
  21. data/lib/cassandra-cql/statement.rb +116 -0
  22. data/lib/cassandra-cql/types/abstract_type.rb +47 -0
  23. data/lib/cassandra-cql/types/ascii_type.rb +25 -0
  24. data/lib/cassandra-cql/types/boolean_type.rb +25 -0
  25. data/lib/cassandra-cql/types/bytes_type.rb +21 -0
  26. data/lib/cassandra-cql/types/date_type.rb +25 -0
  27. data/lib/cassandra-cql/types/decimal_type.rb +25 -0
  28. data/lib/cassandra-cql/types/double_type.rb +25 -0
  29. data/lib/cassandra-cql/types/float_type.rb +25 -0
  30. data/lib/cassandra-cql/types/integer_type.rb +27 -0
  31. data/lib/cassandra-cql/types/long_type.rb +27 -0
  32. data/lib/cassandra-cql/types/utf8_type.rb +25 -0
  33. data/lib/cassandra-cql/types/uuid_type.rb +27 -0
  34. data/lib/cassandra-cql/utility.rb +37 -0
  35. data/lib/cassandra-cql/uuid.rb +21 -0
  36. data/lib/cassandra-cql/version.rb +19 -0
  37. data/spec/column_family_spec.rb +105 -0
  38. data/spec/comparator_spec.rb +249 -0
  39. data/spec/conf/0.8/cassandra.in.sh +41 -0
  40. data/spec/conf/0.8/cassandra.yaml +61 -0
  41. data/spec/conf/0.8/log4j-server.properties +40 -0
  42. data/spec/conf/0.8/schema.txt +10 -0
  43. data/spec/conf/1.0/cassandra.in.sh +41 -0
  44. data/spec/conf/1.0/cassandra.yaml +416 -0
  45. data/spec/conf/1.0/log4j-server.properties +40 -0
  46. data/spec/conf/1.0/schema.txt +10 -0
  47. data/spec/conf/1.1/cassandra.in.sh +41 -0
  48. data/spec/conf/1.1/cassandra.yaml +560 -0
  49. data/spec/conf/1.1/log4j-server.properties +44 -0
  50. data/spec/conf/1.1/schema.txt +10 -0
  51. data/spec/database_spec.rb +25 -0
  52. data/spec/result_spec.rb +173 -0
  53. data/spec/row_spec.rb +49 -0
  54. data/spec/rowkey_spec.rb +233 -0
  55. data/spec/schema_spec.rb +51 -0
  56. data/spec/spec_helper.rb +30 -0
  57. data/spec/statement_spec.rb +226 -0
  58. data/spec/utility_spec.rb +26 -0
  59. data/spec/uuid_spec.rb +26 -0
  60. data/spec/validation_spec.rb +272 -0
  61. data/vendor/0.8/gen-rb/cassandra.rb +2210 -0
  62. data/vendor/0.8/gen-rb/cassandra_constants.rb +10 -0
  63. data/vendor/0.8/gen-rb/cassandra_types.rb +811 -0
  64. data/vendor/1.0/gen-rb/cassandra.rb +2212 -0
  65. data/vendor/1.0/gen-rb/cassandra_constants.rb +10 -0
  66. data/vendor/1.0/gen-rb/cassandra_types.rb +854 -0
  67. data/vendor/1.1/gen-rb/cassandra.rb +2511 -0
  68. data/vendor/1.1/gen-rb/cassandra_constants.rb +13 -0
  69. data/vendor/1.1/gen-rb/cassandra_types.rb +928 -0
  70. metadata +230 -0
@@ -0,0 +1,9 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ coverage
5
+ .DS_Store
6
+ .rspec-tm
7
+ doc
8
+ Gemfile.lock
9
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :gemcutter
2
+
3
+ # Specify your gem's dependencies in cassandra-cql.gemspec
4
+ gemspec
@@ -0,0 +1,203 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+
@@ -0,0 +1,71 @@
1
+ =Cassandra
2
+ The Apache Cassandra Project (http://cassandra.apache.org) develops a highly scalable second-generation distributed database, bringing together Dynamo's fully distributed design and Bigtable's ColumnFamily-based data model.
3
+
4
+ =CQL
5
+ Cassandra originally went with a Thrift RPC-based API as a way to provide a common denominator that more idiomatic clients could build upon independently.
6
+ However, this worked poorly in practice: raw Thrift is too low-level to use productively, and keeping pace with new API methods to support (for example) indexes in 0.7 or distributed counters in 0.8 is too much for many maintainers.
7
+
8
+ CQL, the Cassandra Query Language, addresses this by pushing all implementation details to the server; all the client has to know for any operation is how to interpret "resultset" objects.
9
+ So adding a feature like counters just requires teaching the CQL parser to understand "column + N" notation; no client-side changes are necessary.
10
+
11
+ (CQL Specification: https://github.com/apache/cassandra/blob/trunk/doc/cql/CQL.textile)
12
+
13
+ =Quick Start
14
+
15
+ ==Establishing a connection
16
+
17
+ # Defaults to the system keyspace
18
+ db = CassandraCQL::Database.new('127.0.0.1:9160')
19
+
20
+ # Specifying a keyspace
21
+ db = CassandraCQL::Database.new('127.0.0.1:9160', {:keyspace => 'keyspace1'})
22
+
23
+ # Specifying more than one seed node
24
+ db = CassandraCQL::Database.new(['127.0.0.1:9160','127.0.0.2:9160'])
25
+
26
+ ==Creating a Keyspace
27
+
28
+ # Creating a simple keyspace with replication factor 1
29
+ db.execute("CREATE KEYSPACE keyspace1 WITH strategy_class='org.apache.cassandra.locator.SimpleStrategy' AND strategy_options:replication_factor=1")
30
+ db.execute("USE keyspace1")
31
+
32
+ ==Creating a Column Family
33
+
34
+ # Creating a column family with a single validated column
35
+ db.execute("CREATE COLUMNFAMILY users (id varchar PRIMARY KEY, email varchar)")
36
+
37
+ # Create an index on the name
38
+ db.execute("CREATE INDEX users_email_idx ON users (email)")
39
+
40
+ ==Inserting into a Column Family
41
+
42
+ # Insert without bound variables
43
+ db.execute("INSERT INTO users (id, email) VALUES ('kreynolds', 'kelley@insidesystems.net')")
44
+
45
+ # Insert with bound variables
46
+ db.execute("INSERT INTO users (id, email) VALUES (?, ?)", 'kway', 'kevin@insidesystems.net')
47
+
48
+ ==Updating a Column Family
49
+
50
+ # Update
51
+ db.execute("UPDATE users SET email=? WHERE id=?", 'kreynolds@insidesystems.net', 'kreynolds')
52
+
53
+ ==Selecting from a Column Family
54
+
55
+ # Select all
56
+ db.execute("SELECT * FROM users").fetch { |row| puts row.to_hash.inspect }
57
+ {"id"=>"kway", "email"=>"kevin@insidesystems.net"}
58
+ {"id"=>"kreynolds", "email"=>"kreynolds@insidesystems.net"}
59
+
60
+ # Select just one user by id
61
+ db.execute("SELECT * FROM users WHERE id=?", 'kreynolds').fetch { |row| puts row.to_hash.inspect }
62
+ {"id"=>"kreynolds", "email"=>"kreynolds@insidesystems.net"}
63
+
64
+ # Select just one user by indexed column
65
+ db.execute("SELECT * FROM users WHERE email=?", 'kreynolds@insidesystems.net').fetch { |row| puts row.to_hash.inspect }
66
+ {"id"=>"kreynolds", "email"=>"kreynolds@insidesystems.net"}
67
+
68
+ ==Deleting from a Column Family
69
+
70
+ # Delete the swarthy bastard Kevin
71
+ db.execute("DELETE FROM users WHERE id=?", 'kway')
@@ -0,0 +1,151 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake'
5
+ require 'rspec/core'
6
+ require 'rspec/core/rake_task'
7
+
8
+ CassandraBinaries = {
9
+ '0.8' => 'http://archive.apache.org/dist/cassandra/0.8.8/apache-cassandra-0.8.8-bin.tar.gz',
10
+ '1.0' => 'http://archive.apache.org/dist/cassandra/1.0.5/apache-cassandra-1.0.5-bin.tar.gz',
11
+ '1.1' => 'http://archive.apache.org/dist/cassandra/1.1.2/apache-cassandra-1.1.2-bin.tar.gz',
12
+ }
13
+
14
+ CASSANDRA_VERSION = ENV['CASSANDRA_VERSION'] || '1.0'
15
+ CASSANDRA_HOME = ENV['CASSANDRA_HOME'] || File.dirname(__FILE__) + '/tmp'
16
+ CASSANDRA_PIDFILE = ENV['CASSANDRA_PIDFILE'] || "#{CASSANDRA_HOME}/cassandra.pid"
17
+
18
+ RSpec::Core::RakeTask.new(:spec) do |spec|
19
+ spec.pattern = FileList['spec/**/*_spec.rb']
20
+ end
21
+
22
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
23
+ spec.pattern = FileList['spec/**/*_spec.rb']
24
+ # spec.rcov = true
25
+ # spec.rcov_opts = "--exclude 'spec/*'"
26
+ end
27
+
28
+ desc "Download Cassandra and run specs against it"
29
+ task :spec_with_server do
30
+ Rake::Task["cassandra:clean"].invoke
31
+ Rake::Task["cassandra:start"].invoke
32
+ error = nil
33
+ begin
34
+ Rake::Task["spec"].invoke
35
+ rescue
36
+ error = $!
37
+ end
38
+ Rake::Task["cassandra:stop"].invoke
39
+ raise $! if $!
40
+ end
41
+
42
+ task :default => :spec
43
+
44
+ def setup_cassandra_version(version = CASSANDRA_VERSION)
45
+ FileUtils.mkdir_p CASSANDRA_HOME
46
+
47
+ destination_directory = File.join(CASSANDRA_HOME, 'cassandra-' + CASSANDRA_VERSION)
48
+
49
+ unless File.exists?(File.join(destination_directory, 'bin','cassandra'))
50
+ download_source = CassandraBinaries[CASSANDRA_VERSION]
51
+ download_destination = File.join(CASSANDRA_HOME, File.basename(download_source))
52
+ untar_directory = File.join(CASSANDRA_HOME, File.basename(download_source,'-bin.tar.gz'))
53
+
54
+ puts "downloading cassandra"
55
+ sh "curl -L -o #{download_destination} #{download_source}"
56
+
57
+ sh "tar xzf #{download_destination} -C #{CASSANDRA_HOME}"
58
+ sh "mv #{untar_directory} #{destination_directory}"
59
+ end
60
+ end
61
+
62
+ def setup_environment
63
+ env = ""
64
+ if !ENV["CASSANDRA_INCLUDE"]
65
+ env << "CASSANDRA_INCLUDE=#{File.expand_path(Dir.pwd)}/spec/conf/#{CASSANDRA_VERSION}/cassandra.in.sh "
66
+ env << "CASSANDRA_HOME=#{CASSANDRA_HOME}/cassandra-#{CASSANDRA_VERSION} "
67
+ env << "CASSANDRA_CONF=#{File.expand_path(Dir.pwd)}/spec/conf/#{CASSANDRA_VERSION}"
68
+ else
69
+ env << "CASSANDRA_INCLUDE=#{ENV['CASSANDRA_INCLUDE']} "
70
+ env << "CASSANDRA_HOME=#{ENV['CASSANDRA_HOME']} "
71
+ env << "CASSANDRA_CONF=#{ENV['CASSANDRA_CONF']}"
72
+ end
73
+
74
+ env
75
+ end
76
+
77
+ def running?(pid_file = nil)
78
+ pid_file ||= CASSANDRA_PIDFILE
79
+
80
+ if File.exists?(pid_file)
81
+ pid = File.new(pid_file).read.to_i
82
+ begin
83
+ Process.kill(0, pid)
84
+ return true
85
+ rescue
86
+ File.delete(pid_file)
87
+ end
88
+ end
89
+
90
+ false
91
+ end
92
+
93
+ namespace :cassandra do
94
+ desc "Start Cassandra"
95
+ task :start, [:daemonize] => :java do |t, args|
96
+ args.with_defaults(:daemonize => true)
97
+
98
+ setup_cassandra_version
99
+
100
+ env = setup_environment
101
+
102
+ Dir.chdir(File.join(CASSANDRA_HOME, "cassandra-#{CASSANDRA_VERSION}")) do
103
+ sh("env #{env} bin/cassandra #{'-f' unless args.daemonize} -p #{CASSANDRA_PIDFILE}")
104
+ end
105
+ $stdout.puts "Sleeping for 8 seconds to wait for Cassandra to start ..."
106
+ sleep(8)
107
+ end
108
+
109
+ desc "Stop Cassandra"
110
+ task :stop => :java do
111
+ setup_cassandra_version
112
+ env = setup_environment
113
+ sh("kill $(cat #{CASSANDRA_PIDFILE})")
114
+ end
115
+
116
+ desc "Delete all data files in #{CASSANDRA_HOME}"
117
+ task :clean do
118
+ sh("rm -rf #{File.join(CASSANDRA_HOME, "cassandra-#{CASSANDRA_VERSION}", 'data')}")
119
+ end
120
+
121
+ end
122
+
123
+ desc "Start Cassandra"
124
+ task :cassandra => :java do
125
+ begin
126
+ Rake::Task["cassandra:start"].invoke(false)
127
+ rescue RuntimeError => e
128
+ raise e unless e.message =~ /Command failed with status \(130\)/ # handle keyboard interupt errors
129
+ end
130
+ end
131
+
132
+ desc "Run the Cassandra CLI"
133
+ task :cli do
134
+ Dir.chdir(File.join(CASSANDRA_HOME, "cassandra-#{CASSANDRA_VERSION}")) do
135
+ sh("bin/cassandra-cli -host localhost -port 9160")
136
+ end
137
+ end
138
+
139
+ desc "Check Java version"
140
+ task :java do
141
+ unless `java -version 2>&1`.split("\n").first =~ /java version "1.6/ #"
142
+ puts "You need to configure your environment for Java 1.6."
143
+ puts "If you're on OS X, just export the following environment variables:"
144
+ puts ' JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"'
145
+ puts ' PATH="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH"'
146
+ exit(1)
147
+ end
148
+ end
149
+
150
+ require 'yard'
151
+ YARD::Rake::YardocTask.new
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/cassandra-cql/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "hallelujah-cassandra-cql"
6
+ s.version = CassandraCQL::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Kelley Reynolds"]
9
+ s.email = ["kelley@insidesystems.net"]
10
+ s.homepage = "http://code.google.com/a/apache-extras.org/p/cassandra-ruby/"
11
+ s.summary = "CQL Interface to Cassandra"
12
+ s.description = "CQL Interface to Cassandra"
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ s.rubyforge_project = "cassandra-cql"
16
+
17
+ s.add_development_dependency "bundler", ">= 1.0.0"
18
+ if RUBY_VERSION < '1.9'
19
+ s.add_development_dependency "rcov", ">= 0.9.9"
20
+ else
21
+ s.add_development_dependency "simplecov", ">= 0.6.4"
22
+ end
23
+ s.add_development_dependency "rspec", ">= 2.6.0"
24
+ s.add_development_dependency "rake", ">= 0.9.2"
25
+ s.add_development_dependency "yard", ">= 0.7.2"
26
+ s.add_dependency "simple_uuid", ">= 0.2.0"
27
+ s.add_dependency "thrift_client", ">= 0.7.1"
28
+
29
+ s.files = `git ls-files`.split("\n")
30
+ s.test_files = `git ls-files -- {spec}/*`.split("\n")
31
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
32
+ s.require_path = 'lib'
33
+ end