cassandra 0.5 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ v0.5.1. Add bin/cassandra_helper script, to build and start the server for you. Improve build error reporting.
3
+
2
4
  v0.5. More API changes. Working temporal comparators.
3
5
 
4
6
  v0.4. Use new comparator API. Namespace Thrift bindings; rename gem and class to Cassandra. Make tokens and limits actually work. Retry UnavailableExceptions.
data/Manifest CHANGED
@@ -1,3 +1,4 @@
1
+ bin/cassandra_helper
1
2
  CHANGELOG
2
3
  conf/cassandra.in.sh
3
4
  conf/log4j.properties
data/README CHANGED
@@ -25,12 +25,14 @@ You need Ruby 1.8 or 1.9. If you have those, just run:
25
25
 
26
26
  sudo gem install cassandra
27
27
 
28
- == Usage
29
-
30
- Cassandra is a rapidly moving target. In order to get a working server, change to the checkout or gem directory, and run:
28
+ Cassandra is a rapidly moving target. In order to get a working server, use the <tt>bin/cassandra_helper</tt> script (requires <tt>git</tt>):
31
29
 
32
- rake cassandra
30
+ cassandra_helper cassandra
31
+
32
+ A server will be installed in <tt>$HOME/cassandra/r$REVISION</tt>, and started in debug mode.
33
33
 
34
+ == Usage
35
+
34
36
  Now, start IRb and require the library:
35
37
 
36
38
  require 'cassandra'
data/Rakefile CHANGED
@@ -1,48 +1,91 @@
1
- require 'echoe'
2
1
 
3
- Echoe.new("cassandra") do |p|
4
- p.author = "Evan Weaver"
5
- p.project = "fauna"
6
- p.summary = "A Ruby client for the Cassandra distributed database."
7
- p.rubygems_version = ">= 0.8"
8
- p.dependencies = ['json', 'thrift']
9
- p.ignore_pattern = /^(data|vendor\/cassandra|cassandra|vendor\/thrift)/
10
- p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
11
- p.url = "http://blog.evanweaver.com/files/doc/fauna/cassandra/"
12
- p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/"
13
- end
2
+ unless ENV['FROM_BIN_CASSANDRA_HELPER']
3
+ require 'rubygems'
4
+ require 'echoe'
14
5
 
15
- desc "Start Cassandra"
16
- task :cassandra => [:checkout, :patch, :build] do
17
- env = "CASSANDRA_INCLUDE=#{Dir.pwd}/conf/cassandra.in.sh" unless ENV["CASSANDRA_INCLUDE"]
18
- exec("env #{env} cassandra/bin/cassandra -f")
6
+ Echoe.new("cassandra") do |p|
7
+ p.author = "Evan Weaver"
8
+ p.project = "fauna"
9
+ p.summary = "A Ruby client for the Cassandra distributed database."
10
+ p.rubygems_version = ">= 0.8"
11
+ p.dependencies = ['thrift', 'rake']
12
+ p.ignore_pattern = /^(data|vendor\/cassandra|cassandra|vendor\/thrift)/
13
+ p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
14
+ p.url = "http://blog.evanweaver.com/files/doc/fauna/cassandra/"
15
+ p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/"
16
+ end
19
17
  end
20
18
 
21
19
  REVISION = "15354b4906fd654d58fe50fd01ebf95b69434ba9"
20
+
22
21
  PATCHES = [
23
22
  "http://issues.apache.org/jira/secure/attachment/12416014/0001-CASSANDRA-356-rename-clean-up-collectColumns-methods.txt",
24
23
  "http://issues.apache.org/jira/secure/attachment/12416073/0002-v3.patch",
25
24
  "http://issues.apache.org/jira/secure/attachment/12416074/357-v2.patch",
26
25
  "http://issues.apache.org/jira/secure/attachment/12416086/357-3.patch"]
27
-
26
+
27
+ CASSANDRA_HOME = "#{ENV['HOME']}/cassandra/r#{REVISION[0, 8]}"
28
+
29
+ CASSANDRA_TEST = "#{ENV['HOME']}/cassandra/test"
30
+
31
+ desc "Start Cassandra"
32
+ task :cassandra => [:java, :checkout, :patch, :build] do
33
+ # Construct environment
34
+ env = ""
35
+ if !ENV["CASSANDRA_INCLUDE"]
36
+ env << "CASSANDRA_INCLUDE=#{Dir.pwd}/conf/cassandra.in.sh "
37
+ env << "CASSANDRA_HOME=#{CASSANDRA_HOME} "
38
+ env << "CASSANDRA_CONF=#{File.expand_path(File.dirname(__FILE__))}/conf"
39
+ end
40
+ # Create data dir
41
+ Dir.mkdir(CASSANDRA_TEST) if !File.exist?(CASSANDRA_TEST)
42
+ # Start server
43
+ Dir.chdir(CASSANDRA_TEST) do
44
+ exec("env #{env} #{CASSANDRA_HOME}/bin/cassandra -f")
45
+ end
46
+ end
47
+
48
+ desc "Check Java version"
49
+ task :java do
50
+ unless `java -version 2>&1`.split("\n").first =~ /java version "1.6/ #"
51
+ puts "You need to configure your environment for Java 1.6."
52
+ puts "If you're on OS X, just export the following environment variables:"
53
+ puts ' JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"'
54
+ puts ' PATH="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH"'
55
+ exit(1)
56
+ end
57
+ end
58
+
59
+ desc "Checkout Cassandra from git"
28
60
  task :checkout do
29
- # Like a git submodule, but all in one obvious place
30
- unless File.exist?("cassandra")
31
- system("git clone git://git.apache.org/cassandra.git")
61
+ # Check git version
62
+ unless `git --version 2>&1` =~ /git version 1.6/
63
+ puts "You need to install git 1.6."
64
+ exit(1)
65
+ end
66
+ # Like a git submodule, but all in one more obvious place
67
+ unless File.exist?(CASSANDRA_HOME)
68
+ cmd = "git clone git://git.apache.org/cassandra.git #{CASSANDRA_HOME}"
69
+ if !system(cmd)
70
+ put "Checkout failed. Try:\n #{cmd}"
71
+ exit(1)
72
+ end
32
73
  ENV["RESET"] = "true"
33
74
  end
34
75
  end
35
76
 
77
+ desc "Apply patches to Cassandra checkout; use RESET=1 to force"
36
78
  task :patch do
37
79
  if ENV["RESET"]
38
- Dir.chdir("cassandra") do
80
+ system("rm -rf #{CASSANDRA_TEST}/data")
81
+ Dir.chdir(CASSANDRA_HOME) do
39
82
  system("ant clean && git fetch && git reset #{REVISION} --hard")
40
83
  # Delete untracked files, so that the patchs can apply again
41
84
  Array(`git status`[/Untracked files:(.*)$/m, 1].to_s.split("\n")[3..-1]).each do |file|
42
85
  File.unlink(file.sub(/^.\s+/, "")) rescue nil
43
86
  end
44
87
  # Patch, with a handy commit for each one
45
- PATCHES.each do |url|
88
+ PATCHES.each do |url|
46
89
  raise "#{url} failed" unless system("curl #{url} | patch -p1")
47
90
  system("git commit -a -m 'Applied patch: #{url.inspect}'")
48
91
  end
@@ -50,19 +93,38 @@ task :patch do
50
93
  end
51
94
  end
52
95
 
96
+ desc "Rebuild Cassandra"
53
97
  task :build do
54
- Dir.chdir("cassandra") { system("ant") } unless File.exist?("cassandra/build")
98
+ unless File.exist?("#{CASSANDRA_HOME}/build")
99
+ cmd = "cd #{CASSANDRA_HOME} && ant"
100
+ if !system(cmd)
101
+ puts "Could not build Casssandra. Try:\n #{cmd}"
102
+ exit(1)
103
+ end
104
+ end
55
105
  end
56
106
 
107
+ desc "Clean Cassandra build"
57
108
  task :clean do
58
- Dir.chdir("cassandra") { system("ant clean") }
109
+ if File.exist?(CASSANDRA_HOME)
110
+ Dir.chdir(CASSANDRA_HOME) do
111
+ system("ant clean")
112
+ end
113
+ end
114
+ end
115
+
116
+ namespace :data do
117
+ desc "Reset test data"
118
+ task :reset do
119
+ system("rm -rf #{CASSANDRA_TEST}/data")
120
+ end
59
121
  end
60
122
 
61
- desc "Regenerate thrift bindings for Cassandra"
123
+ # desc "Regenerate thrift bindings for Cassandra" # Dev only
62
124
  task :thrift do
63
125
  system(
64
126
  "cd vendor &&
65
127
  rm -rf gen-rb &&
66
- thrift -gen rb ../cassandra/interface/cassandra.thrift")
128
+ thrift -gen rb #{CASSANDRA_HOME}/interface/cassandra.thrift")
67
129
  end
68
130
 
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'cassandra'
6
+
7
+ gem_path = $LOAD_PATH.last.sub(/lib$/, "")
8
+
9
+ Dir.chdir(gem_path) do
10
+ if !ENV["CASSANDRA_INCLUDE"]
11
+ puts "Set the CASSANDRA_INCLUDE environment variable to use a non-default cassandra.in.sh and friends."
12
+ end
13
+
14
+ ARGV << "-T" if ARGV.empty?
15
+ exec("env FROM_BIN_CASSANDRA_HELPER=1 rake #{ARGV.join(' ')}")
16
+ end
data/cassandra.gemspec CHANGED
@@ -2,16 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cassandra}
5
- s.version = "0.5"
5
+ s.version = "0.5.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver"]
9
9
  s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
10
10
  s.date = %q{2009-08-18}
11
+ s.default_executable = %q{cassandra_helper}
11
12
  s.description = %q{A Ruby client for the Cassandra distributed database.}
12
13
  s.email = %q{}
13
- s.extra_rdoc_files = ["CHANGELOG", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/long.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/safe_client.rb", "lib/cassandra/time.rb", "lib/cassandra/uuid.rb", "lib/cassandra.rb", "LICENSE", "README"]
14
- s.files = ["CHANGELOG", "conf/cassandra.in.sh", "conf/log4j.properties", "conf/storage-conf.xml", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/long.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/safe_client.rb", "lib/cassandra/time.rb", "lib/cassandra/uuid.rb", "lib/cassandra.rb", "LICENSE", "Manifest", "Rakefile", "README", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/test_helper.rb", "vendor/gen-rb/cassandra.rb", "vendor/gen-rb/cassandra_constants.rb", "vendor/gen-rb/cassandra_types.rb", "cassandra.gemspec"]
14
+ s.executables = ["cassandra_helper"]
15
+ s.extra_rdoc_files = ["bin/cassandra_helper", "CHANGELOG", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/long.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/safe_client.rb", "lib/cassandra/time.rb", "lib/cassandra/uuid.rb", "lib/cassandra.rb", "LICENSE", "README"]
16
+ s.files = ["bin/cassandra_helper", "CHANGELOG", "conf/cassandra.in.sh", "conf/log4j.properties", "conf/storage-conf.xml", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/long.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/safe_client.rb", "lib/cassandra/time.rb", "lib/cassandra/uuid.rb", "lib/cassandra.rb", "LICENSE", "Manifest", "Rakefile", "README", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/test_helper.rb", "vendor/gen-rb/cassandra.rb", "vendor/gen-rb/cassandra_constants.rb", "vendor/gen-rb/cassandra_types.rb", "cassandra.gemspec"]
15
17
  s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/cassandra/}
16
18
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cassandra", "--main", "README"]
17
19
  s.require_paths = ["lib"]
@@ -26,14 +28,14 @@ Gem::Specification.new do |s|
26
28
  s.specification_version = 3
27
29
 
28
30
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
29
- s.add_runtime_dependency(%q<json>, [">= 0"])
30
31
  s.add_runtime_dependency(%q<thrift>, [">= 0"])
32
+ s.add_runtime_dependency(%q<rake>, [">= 0"])
31
33
  else
32
- s.add_dependency(%q<json>, [">= 0"])
33
34
  s.add_dependency(%q<thrift>, [">= 0"])
35
+ s.add_dependency(%q<rake>, [">= 0"])
34
36
  end
35
37
  else
36
- s.add_dependency(%q<json>, [">= 0"])
37
38
  s.add_dependency(%q<thrift>, [">= 0"])
39
+ s.add_dependency(%q<rake>, [">= 0"])
38
40
  end
39
41
  end
data/conf/cassandra.in.sh CHANGED
@@ -14,26 +14,22 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
-
18
- cassandra_home=`pwd`/cassandra
19
-
20
17
  # The directory where Cassandra's configs live (required)
21
- CASSANDRA_CONF=`pwd`/conf
18
+ CASSANDRA_CONF=$CASSANDRA_CONF
22
19
 
23
20
  # This can be the path to a jar file, or a directory containing the
24
- # compiled classes. NOTE: This isn't needed by the startup script,
25
- # it's just used here in constructing the classpath.
26
- cassandra_bin=$cassandra_home/build/classes
27
- #cassandra_bin=$cassandra_home/build/cassandra.jar
21
+ # compiled classes.
22
+ cassandra_bin=$CASSANDRA_HOME/build/classes
28
23
 
29
24
  # The java classpath (required)
30
25
  CLASSPATH=$CASSANDRA_CONF:$cassandra_bin
31
26
 
32
- for jar in $cassandra_home/lib/*.jar; do
27
+ for jar in $CASSANDRA_HOME/lib/*.jar; do
33
28
  CLASSPATH=$CLASSPATH:$jar
34
29
  done
35
30
 
36
- echo $cassandra_home
31
+ echo "CASSANDRA_HOME: $CASSANDRA_HOME"
32
+ echo "CASSANDRA_CONF: $CASSANDRA_CONF"
37
33
 
38
34
  # Arguments to pass to the JVM
39
35
  JVM_OPTS=" \
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.5"
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Weaver
@@ -34,7 +34,7 @@ date: 2009-08-18 00:00:00 -04:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
- name: json
37
+ name: thrift
38
38
  type: :runtime
39
39
  version_requirement:
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: "0"
45
45
  version:
46
46
  - !ruby/object:Gem::Dependency
47
- name: thrift
47
+ name: rake
48
48
  type: :runtime
49
49
  version_requirement:
50
50
  version_requirements: !ruby/object:Gem::Requirement
@@ -55,11 +55,12 @@ dependencies:
55
55
  version:
56
56
  description: A Ruby client for the Cassandra distributed database.
57
57
  email: ""
58
- executables: []
59
-
58
+ executables:
59
+ - cassandra_helper
60
60
  extensions: []
61
61
 
62
62
  extra_rdoc_files:
63
+ - bin/cassandra_helper
63
64
  - CHANGELOG
64
65
  - lib/cassandra/array.rb
65
66
  - lib/cassandra/cassandra.rb
@@ -76,6 +77,7 @@ extra_rdoc_files:
76
77
  - LICENSE
77
78
  - README
78
79
  files:
80
+ - bin/cassandra_helper
79
81
  - CHANGELOG
80
82
  - conf/cassandra.in.sh
81
83
  - conf/log4j.properties
metadata.gz.sig CHANGED
Binary file