-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRakefile
More file actions
90 lines (75 loc) · 2.51 KB
/
Copy pathRakefile
File metadata and controls
90 lines (75 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
require 'rubygems'
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "cassandra-model"
gem.summary = %Q{Minimal models for Cassandra.}
gem.description = %Q{Cassandra-model allows you to map ColumnFamily/SuperColumnFamily in Cassandra to Ruby objects. It was designed to be fast and simple.}
gem.email = "tienlx /at/ gmail /dot/ com"
gem.homepage = "http://github.com/tienle/cassandra-model"
gem.authors = ["Tien Le"]
gem.add_development_dependency "shoulda", ">= 0"
gem.add_development_dependency "cassandra", ">= 0"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
rescue LoadError
task :rcov do
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
end
end
task :test => :check_dependencies
task :default => :test
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "cassandra-model #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
CASSANDRA_HOME = ENV["CASSANDRA_HOME"] || "#{ENV["HOME"]}/apache-cassandra"
CASSANDRA_PID = ENV["CASSANDRA_PID"] || "/tmp/cassandra.pid".freeze
cassandra_env = ""
cassandra_env << "CASSANDRA_INCLUDE=#{File.expand_path(Dir.pwd)}/test/config/cassandra.in.sh "
cassandra_env << "CASSANDRA_HOME=#{CASSANDRA_HOME} "
cassandra_env << "CASSANDRA_CONF=#{File.expand_path(Dir.pwd)}/test/config"
namespace :cassandra do
desc "Start cassandra"
task :start do
Dir.chdir(CASSANDRA_HOME) do
sh("env #{cassandra_env} bin/cassandra -f -p #{CASSANDRA_PID}")
end
end
desc "Stop cassandra"
task :stop do
system "kill -9 `cat #{CASSANDRA_PID}`"
end
desc "Restart cassandra"
task :restart => [:stop, :start]
desc "Clear test data"
task :clear_test_data do
unless defined?(CassandraModel)
$: << 'test'
require 'test_helper'
end
CassandraModel::Base.establish_connection('CassandraModel').clear_keyspace!
end
end